sqllogictest
Hex Artifact Content
Not logged in

Artifact 519aa0e9ce4ef9c7208229320a352765339e2d26:


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 2d 20 28 20 2b 20 63 6f 6c 32 20 29  NCT - ( + col2 )
02f0: 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 37 35 20 46   + + col1 * 75 F
0300: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
0310: 31 32 33 37 0d 0a 32 32 39 38 0d 0a 34 33 39 39  1237..2298..4399
0320: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0330: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
0340: 49 4e 43 54 20 28 20 74 61 62 32 2e 63 6f 6c 31  INCT ( tab2.col1
0350: 20 29 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   ) + - col0 FROM
0360: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39   tab2..----..-19
0370: 0d 0a 2d 36 32 0d 0a 32 34 0d 0a 0d 0a 71 75 65  ..-62..24....que
0380: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0390: 4c 45 43 54 20 41 4c 4c 20 31 30 20 2a 20 63 6f  LECT ALL 10 * co
03a0: 6c 30 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l0 - - col1 FROM
03b0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 36   tab0..----..326
03c0: 0d 0a 34 34 37 0d 0a 39 38 31 0d 0a 0d 0a 71 75  ..447..981....qu
03d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
03e0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34  ELECT DISTINCT 4
03f0: 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
0400: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
0410: 0a 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .42....query I r
0420: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
0430: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2d  ISTINCT + col0 -
0440: 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   tab0.col2 * + c
0450: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
0460: 2d 2d 2d 0d 0a 2d 31 30 36 35 0d 0a 2d 36 36 33  ---..-1065..-663
0470: 35 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  5..34....query I
0480: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0490: 20 41 4c 4c 20 34 34 20 46 52 4f 4d 20 74 61 62   ALL 44 FROM tab
04a0: 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
04b0: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
04c0: 68 61 73 68 69 6e 67 20 74 6f 20 61 62 32 62 63  hashing to ab2bc
04d0: 32 62 39 66 38 62 61 61 33 30 30 64 66 37 37 35  2b9f8baa300df775
04e0: 35 65 35 39 38 30 61 33 31 39 64 0d 0a 0d 0a 71  5e5980a319d....q
04f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0500: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
0510: 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63  + ( col1 ) + + c
0520: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
0530: 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32 0d 0a 31  ---..172..182..1
0540: 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  94....query I ro
0550: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
0560: 35 35 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 32  55 * - tab1.col2
0570: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
0580: 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
0590: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
05a0: 20 68 61 73 68 69 6e 67 20 74 6f 20 38 38 34 65   hashing to 884e
05b0: 65 63 32 31 38 62 64 31 33 33 66 34 39 64 61 35  ec218bd133f49da5
05c0: 35 34 62 33 61 36 62 64 34 35 65 36 0d 0a 0d 0a  54b3a6bd45e6....
05d0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
05e0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
05f0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
0600: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
0610: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
0620: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0630: 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2d   - col0 + col0 -
0640: 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20   col2 col2 FROM 
0650: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
0660: 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33  --..-26..-27..-3
0670: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
0680: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
0690: 6f 6c 32 20 2a 20 63 6f 6c 32 20 2d 20 2d 20 63  ol2 * col2 - - c
06a0: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 * + col2 FRO
06b0: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
06c0: 2d 0d 0a 2d 32 39 37 0d 0a 33 34 0d 0a 35 37 34  -..-297..34..574
06d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
06e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
06f0: 49 4e 43 54 20 28 20 2b 20 63 6f 72 30 2e 63 6f  INCT ( + cor0.co
0700: 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l2 ) FROM tab1 A
0710: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34  S cor0..----..54
0720: 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  ..57..96....quer
0730: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0740: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
0750: 20 34 38 20 2b 20 35 20 46 52 4f 4d 20 74 61 62   48 + 5 FROM tab
0760: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  2 cor0..----..-4
0770: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
0780: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
0790: 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 31  TINCT - col1 + 1
07a0: 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
07b0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
07c0: 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..0....query I 
07d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
07e0: 32 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 72 30  21 * col2 + cor0
07f0: 2e 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 30 20 29  .col1 + ( col0 )
0800: 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41   * col1 * col1 A
0810: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
0820: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
0830: 32 33 36 34 36 0d 0a 32 37 32 31 32 33 0d 0a 37  23646..272123..7
0840: 33 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  325....query I r
0850: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
0860: 20 38 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   8 + col2 + col2
0870: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
0880: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 37  r0..----..10..17
0890: 32 0d 0a 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49  2..74....query I
08a0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
08b0: 20 44 49 53 54 49 4e 43 54 20 2d 20 33 36 20 2a   DISTINCT - 36 *
08c0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   + cor0.col2 AS 
08d0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
08e0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
08f0: 2d 2d 0d 0a 2d 31 31 38 38 0d 0a 2d 32 39 35 32  --..-1188..-2952
0900: 0d 0a 2d 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-36....query I
0910: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0920: 20 28 20 63 6f 72 31 2e 63 6f 6c 32 20 29 20 46   ( cor1.col2 ) F
0930: 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
0940: 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  S cor0, tab0 AS 
0950: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
0960: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
0970: 20 37 37 38 36 37 31 38 62 64 38 30 34 32 30 32   7786718bd804202
0980: 32 35 33 37 33 37 38 64 34 30 65 63 38 37 34 37  2537378d40ec8747
0990: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
09a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31  sort..SELECT - 1
09b0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
09c0: 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62 32 20  ab0, tab1, tab2 
09d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
09e0: 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
09f0: 20 74 6f 20 62 62 37 66 37 35 34 61 37 61 30 35   to bb7f754a7a05
0a00: 36 65 36 36 35 31 35 35 65 64 35 32 61 36 33 66  6e665155ed52a63f
0a10: 35 62 63 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5bc0....query I 
0a20: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0a30: 41 4c 4c 20 2d 20 2d 20 31 38 20 46 52 4f 4d 20  ALL - - 18 FROM 
0a40: 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62 31  tab1, tab2, tab1
0a50: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
0a60: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
0a70: 67 20 74 6f 20 39 30 33 61 63 32 32 37 39 33 35  g to 903ac227935
0a80: 63 31 35 33 32 33 30 30 64 62 34 35 61 38 35 33  c1532300db45a853
0a90: 37 63 35 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7c595....onlyif 
0aa0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
0ab0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
0ac0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
0ad0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
0ae0: 61 62 65 6c 2d 31 39 0d 0a 53 45 4c 45 43 54 20  abel-19..SELECT 
0af0: 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ALL - cor0.col1 
0b00: 44 49 56 20 2d 20 31 32 20 63 6f 6c 32 20 46 52  DIV - 12 col2 FR
0b10: 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
0b20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
0b30: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
0b40: 20 32 64 30 32 32 62 38 66 39 63 38 63 35 36 63   2d022b8f9c8c56c
0b50: 33 33 30 38 63 38 39 30 32 65 33 62 31 63 37 33  3308c8902e3b1c73
0b60: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
0b70: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
0b80: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
0b90: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
0ba0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
0bb0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
0bc0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
0bd0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
0be0: 65 6c 2d 31 39 0d 0a 53 45 4c 45 43 54 20 41 4c  el-19..SELECT AL
0bf0: 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20  L - cor0.col1 / 
0c00: 2d 20 31 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74  - 12 col2 FROM t
0c10: 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
0c20: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
0c30: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 64 30  s hashing to 2d0
0c40: 32 32 62 38 66 39 63 38 63 35 36 63 33 33 30 38  22b8f9c8c56c3308
0c50: 63 38 39 30 32 65 33 62 31 63 37 33 36 0d 0a 0d  c8902e3b1c736...
0c60: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0c70: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
0c80: 54 20 2d 20 34 37 20 41 53 20 63 6f 6c 30 20 46  T - 47 AS col0 F
0c90: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
0ca0: 2d 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -47....query I r
0cb0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
0cc0: 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63  ISTINCT col0 * c
0cd0: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
0ce0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32   tab0..----..122
0cf0: 35 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a  5..576..7921....
0d00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0d10: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 32 36  .SELECT ALL + 26
0d20: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
0d30: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 36  b1..----..26..26
0d40: 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..26....query I 
0d50: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0d60: 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 34 37 20  + - col1 * + 47 
0d70: 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
0d80: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
0d90: 35 39 35 36 35 0d 0a 33 38 30 36 35 33 0d 0a 39  59565..380653..9
0da0: 37 30 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7008....query I 
0db0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0dc0: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  + col1 + col0 * 
0dd0: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
0de0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
0df0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32   cor0..----..132
0e00: 32 0d 0a 36 36 32 0d 0a 38 30 31 32 0d 0a 0d 0a  2..662..8012....
0e10: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0e20: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
0e30: 6c 30 20 2a 20 2b 20 31 35 20 46 52 4f 4d 20 74  l0 * + 15 FROM t
0e40: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
0e50: 2d 0d 0a 2d 31 30 35 0d 0a 2d 31 31 37 30 0d 0a  -..-105..-1170..
0e60: 2d 31 31 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  -1185....query I
0e70: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0e80: 20 41 4c 4c 20 2d 20 36 20 41 53 20 63 6f 6c 31   ALL - 6 AS col1
0e90: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
0ea0: 0d 0a 2d 36 0d 0a 2d 36 0d 0a 2d 36 0d 0a 0d 0a  ..-6..-6..-6....
0eb0: 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
0ec0: 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
0ed0: 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52  CT DISTINCT * FR
0ee0: 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74  OM tab0, tab1, t
0ef0: 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
0f00: 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37  0 cor1..----..97
0f10: 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  2 values hashing
0f20: 20 74 6f 20 38 34 32 30 32 30 36 64 36 39 33 32   to 8420206d6932
0f30: 63 34 35 34 66 30 35 61 33 38 64 65 36 33 34 62  c454f05a38de634b
0f40: 33 63 62 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3cb5....onlyif m
0f50: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
0f60: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
0f70: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
0f80: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
0f90: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
0fa0: 2d 32 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  -28..SELECT col1
0fb0: 20 2a 20 43 41 53 54 28 20 2d 20 63 6f 6c 30 20   * CAST( - col0 
0fc0: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
0fd0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
0fe0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
0ff0: 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d  43..-217..-4602.
1000: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1010: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1020: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1030: 74 20 6c 61 62 65 6c 2d 32 38 0d 0a 53 45 4c 45  t label-28..SELE
1040: 43 54 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28  CT col1 * CAST (
1050: 20 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   - col0 AS INTEG
1060: 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ER ) AS col2 FRO
1070: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1080: 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31  ----..-1343..-21
1090: 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72  7..-4602....quer
10a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10b0: 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 39 34 20  ECT col1 * + 94 
10c0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
10d0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
10e0: 0a 38 30 38 34 0d 0a 38 35 35 34 0d 0a 39 31 31  .8084..8554..911
10f0: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1100: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1110: 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63  TINCT - col0 * c
1120: 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 * col2 AS co
1130: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
1140: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32  0..----..-119652
1150: 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35 38 35 39 0d  ..-51034..-5859.
1160: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1170: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1180: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1190: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
11a0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
11b0: 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
11c0: 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56  CT cor0.col1 DIV
11d0: 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
11e0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
11f0: 0a 30 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..4....skipif 
1200: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1210: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1220: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31  rowsort label-31
1230: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1240: 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 2b 20  T cor0.col1 / + 
1250: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1260: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1270: 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .4....skipif pos
1280: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1290: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
12a0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
12b0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
12c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12d0: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
12e0: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f  + cor0.col1 * co
12f0: 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
1300: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1310: 0a 31 31 39 36 35 32 0d 0a 35 31 30 33 34 0d 0a  .119652..51034..
1320: 35 38 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  5859....skipif p
1330: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1340: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1350: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1360: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1370: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1380: 0d 0a 53 45 4c 45 43 54 20 33 39 20 63 6f 6c 31  ..SELECT 39 col1
1390: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
13a0: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
13b0: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
13c0: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
13d0: 74 6f 20 65 64 32 65 62 64 39 64 65 66 33 65 32  to ed2ebd9def3e2
13e0: 63 33 38 61 61 34 36 63 62 33 61 66 36 30 66 65  c38aa46cb3af60fe
13f0: 32 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  229....query I r
1400: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1410: 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d  ISTINCT col2 * -
1420: 20 34 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   4 FROM tab0..--
1430: 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 33 32 38 0d 0a  --..-132..-328..
1440: 2d 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -4....query I ro
1450: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1460: 4c 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72  L + + col0 * cor
1470: 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  0.col0 AS col1 F
1480: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1490: 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 36 0d 0a 36 34  ..----..4096..64
14a0: 30 30 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49  00..9....query I
14b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14c0: 20 2b 20 63 6f 6c 31 20 2a 20 39 37 20 2b 20 63   + col1 * 97 + c
14d0: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
14e0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37   tab1..----..127
14f0: 34 0d 0a 32 35 34 38 0d 0a 39 38 30 0d 0a 0d 0a  4..2548..980....
1500: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1510: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
1520: 63 6f 6c 30 20 2b 20 34 33 20 2a 20 2d 20 63 6f  col0 + 43 * - co
1530: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
1540: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 31  cor0..----..-231
1550: 39 0d 0a 2d 32 33 38 37 0d 0a 2d 34 30 34 38 0d  9..-2387..-4048.
1560: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1570: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1580: 20 63 6f 6c 30 20 2b 20 28 20 2d 20 37 36 20 29   col0 + ( - 76 )
1590: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
15a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a  r0..----..-100..
15b0: 2d 31 31 31 0d 0a 2d 31 36 35 0d 0a 0d 0a 71 75  -111..-165....qu
15c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15d0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 32 35 20 41  ELECT ALL + 25 A
15e0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
15f0: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
1600: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
1610: 61 73 68 69 6e 67 20 74 6f 20 35 32 35 61 35 35  ashing to 525a55
1620: 64 35 65 64 32 32 34 61 36 32 64 61 36 35 64 66  d5ed224a62da65df
1630: 33 36 37 33 31 38 38 31 61 37 0d 0a 0d 0a 71 75  36731881a7....qu
1640: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1650: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1660: 20 63 6f 6c 30 20 2a 20 33 30 20 2b 20 63 6f 6c   col0 * 30 + col
1670: 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  0 * + col0 FROM 
1680: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1690: 0a 36 30 31 36 0d 0a 38 38 30 30 0d 0a 39 39 0d  .6016..8800..99.
16a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16b0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
16c0: 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2d  NCT - - col0 * -
16d0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
16e0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
16f0: 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32  .----..-1343..-2
1700: 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65  17..-4602....que
1710: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1720: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  LECT - col0 * + 
1730: 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63  ( - col1 ) + + c
1740: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1750: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33   cor0..----..113
1760: 36 0d 0a 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a 71  6..132..697....q
1770: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1780: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63  SELECT ALL - + c
1790: 6f 6c 31 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29  ol1 * ( - col2 )
17a0: 20 2b 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f   + col2 * ( - co
17b0: 72 30 2e 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f  r0.col0 ) + - co
17c0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
17d0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 33  cor0..----..-313
17e0: 35 0d 0a 2d 36 35 32 38 0d 0a 31 31 38 38 0d 0a  5..-6528..1188..
17f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1800: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1810: 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  CT - + col2 * co
1820: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
1830: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1840: 2d 2d 0d 0a 2d 32 39 31 36 0d 0a 2d 33 32 34 39  --..-2916..-3249
1850: 0d 0a 2d 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79  ..-9216....query
1860: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1870: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
1880: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 38 34 20 2a  cor0.col2 * 84 *
1890: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
18a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
18b0: 31 30 34 38 33 32 0d 0a 2d 31 31 37 39 33 36 0d  104832..-117936.
18c0: 0a 2d 34 37 38 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  .-47880....onlyi
18d0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
18e0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
18f0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1900: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1910: 20 6c 61 62 65 6c 2d 34 36 0d 0a 53 45 4c 45 43   label-46..SELEC
1920: 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 32 37 20  T + col0 DIV 27 
1930: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1940: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 32  0..----..0..2..2
1950: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1960: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1970: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1980: 72 74 20 6c 61 62 65 6c 2d 34 36 0d 0a 53 45 4c  rt label-46..SEL
1990: 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 32 37 20  ECT + col0 / 27 
19a0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
19b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 32  0..----..0..2..2
19c0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
19d0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
19e0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
19f0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1a00: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a10: 34 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  47..SELECT + col
1a20: 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f  2 DIV + col1 FRO
1a30: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1a40: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
1a50: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1a60: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1a70: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1a80: 6c 61 62 65 6c 2d 34 37 0d 0a 53 45 4c 45 43 54  label-47..SELECT
1a90: 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31   + col2 / + col1
1aa0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1ab0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
1ac0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1ad0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1ae0: 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a  TINCT - - col2 *
1af0: 20 35 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   55 AS col1 FROM
1b00: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
1b10: 0d 0a 31 34 33 30 0d 0a 31 34 38 35 0d 0a 32 30  ..1430..1485..20
1b20: 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
1b30: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1b40: 53 54 49 4e 43 54 20 2d 20 2d 20 36 35 20 2b 20  STINCT - - 65 + 
1b50: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS c
1b60: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
1b70: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39   cor0..----..209
1b80: 33 0d 0a 32 35 34 0d 0a 33 30 36 37 0d 0a 0d 0a  3..254..3067....
1b90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ba0: 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 72 30  .SELECT + ( cor0
1bb0: 2e 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30 20 46  .col1 ) * col0 F
1bc0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1bd0: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31  ..----..1343..21
1be0: 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79  7..4602....query
1bf0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c00: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38 34  CT DISTINCT - 84
1c10: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1c20: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1c30: 0d 0a 2d 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-84....onlyif 
1c40: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1c50: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1c60: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1c70: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1c80: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1c90: 6c 2d 35 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-52..SELECT DIS
1ca0: 54 49 4e 43 54 20 2d 20 2d 20 43 41 53 54 28 20  TINCT - - CAST( 
1cb0: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
1cc0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1cd0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1ce0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
1cf0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1d00: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1d10: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
1d20: 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
1d30: 43 54 20 2d 20 2d 20 43 41 53 54 20 28 20 4e 55  CT - - CAST ( NU
1d40: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
1d50: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1d60: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1d70: 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .NULL....onlyif 
1d80: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1d90: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1da0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1db0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1dc0: 61 62 65 6c 2d 35 33 0d 0a 53 45 4c 45 43 54 20  abel-53..SELECT 
1dd0: 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 35 33 20  + - col1 + + 53 
1de0: 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  DIV + cor0.col0 
1df0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1e00: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1e10: 0a 2d 31 37 0d 0a 2d 32 34 0d 0a 2d 35 39 0d 0a  .-17..-24..-59..
1e20: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1e30: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1e40: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e50: 20 6c 61 62 65 6c 2d 35 33 0d 0a 53 45 4c 45 43   label-53..SELEC
1e60: 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 35  T + - col1 + + 5
1e70: 33 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  3 / + cor0.col0 
1e80: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1e90: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1ea0: 0a 2d 31 37 0d 0a 2d 32 34 0d 0a 2d 35 39 0d 0a  .-17..-24..-59..
1eb0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ec0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1ed0: 2b 20 28 20 2d 20 28 20 63 6f 6c 32 20 29 20 29  + ( - ( col2 ) )
1ee0: 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   * cor0.col2 FRO
1ef0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1f00: 2d 2d 2d 2d 0d 0a 2d 32 39 31 36 0d 0a 2d 33 32  ----..-2916..-32
1f10: 34 39 0d 0a 2d 39 32 31 36 0d 0a 0d 0a 71 75 65  49..-9216....que
1f20: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1f30: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  LECT + col2 + + 
1f40: 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col1 * cor0.col1
1f50: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1f60: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 37 0d 0a 33  r0..----..327..3
1f70: 35 30 37 0d 0a 39 38 38 0d 0a 0d 0a 6f 6e 6c 79  507..988....only
1f80: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1f90: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1fa0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1fb0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1fc0: 74 20 6c 61 62 65 6c 2d 35 36 0d 0a 53 45 4c 45  t label-56..SELE
1fd0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1fe0: 6c 31 20 44 49 56 20 2d 20 63 6f 6c 30 20 63 6f  l1 DIV - col0 co
1ff0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2000: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a  cor0..----..-8..
2010: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
2020: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2030: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2040: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2050: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
2060: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2070: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2080: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2090: 65 6c 2d 35 36 0d 0a 53 45 4c 45 43 54 20 44 49  el-56..SELECT DI
20a0: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2f 20  STINCT + col1 / 
20b0: 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  - col0 col1 FROM
20c0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
20d0: 2d 2d 2d 0d 0a 2d 38 0d 0a 30 0d 0a 0d 0a 71 75  ---..-8..0....qu
20e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20f0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
2100: 20 2a 20 2b 20 35 37 20 46 52 4f 4d 20 74 61 62   * + 57 FROM tab
2110: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2120: 0a 2d 31 37 36 37 0d 0a 2d 33 33 36 33 0d 0a 2d  .-1767..-3363..-
2130: 39 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  969....query I r
2140: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2150: 20 2d 20 63 6f 6c 31 20 2a 20 36 36 20 46 52 4f   - col1 * 66 FRO
2160: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
2170: 2d 0d 0a 2d 31 37 31 36 0d 0a 2d 36 36 30 0d 0a  -..-1716..-660..
2180: 2d 38 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -858....query I 
2190: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21a0: 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + + col2 * - col
21b0: 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
21c0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d  ..----..-1248..-
21d0: 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 73 6b  1404..-570....sk
21e0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
21f0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2200: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2210: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2220: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2230: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2240: 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 63 6f 6c 31  LL - + col1 col1
2250: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
2260: 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d  .----..-17..-31.
2270: 0a 2d 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-59....query I 
2280: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2290: 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20 63  DISTINCT - ( - c
22a0: 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol2 ) AS col0 FR
22b0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
22c0: 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33  .----..26..27..3
22d0: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
22e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74  sort..SELECT + t
22f0: 61 62 30 2e 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c  ab0.col1 - + col
2300: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
2310: 2d 0d 0a 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a  -..53..9..96....
2320: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2330: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
2340: 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f  ol2 + + col1 FRO
2350: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
2360: 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d  -..55..58..85...
2370: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2380: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
2390: 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63   cor0.col1 * - c
23a0: 6f 6c 32 20 2d 20 2d 20 35 36 20 46 52 4f 4d 20  ol2 - - 56 FROM 
23b0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
23c0: 2d 2d 0d 0a 2d 31 31 39 32 0d 0a 2d 31 33 34 38  --..-1192..-1348
23d0: 0d 0a 2d 35 31 34 0d 0a 0d 0a 71 75 65 72 79 20  ..-514....query 
23e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23f0: 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  T col2 * - col0 
2400: 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  + col2 * + col1 
2410: 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
2420: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2430: 0d 0a 32 34 33 32 37 36 0d 0a 36 37 31 37 34 34  ..243276..671744
2440: 0d 0a 39 33 37 34 0d 0a 0d 0a 71 75 65 72 79 20  ..9374....query 
2450: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2460: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
2470: 2a 20 2b 20 63 6f 6c 30 20 2b 20 37 31 20 2a 20  * + col0 + 71 * 
2480: 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  ( - col1 ) FROM 
2490: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
24a0: 2d 2d 0d 0a 2d 31 37 36 38 0d 0a 2d 37 30 0d 0a  --..-1768..-70..
24b0: 31 31 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  117....onlyif my
24c0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
24d0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
24e0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
24f0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2500: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2510: 36 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  67..SELECT ALL -
2520: 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31   - ( + cor0.col1
2530: 20 29 20 2b 20 2d 20 43 41 53 54 28 20 2d 20 63   ) + - CAST( - c
2540: 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol1 AS SIGNED ) 
2550: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
2560: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2570: 31 39 34 0d 0a 32 39 32 34 0d 0a 37 35 35 33 0d  194..2924..7553.
2580: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2590: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
25a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25b0: 74 20 6c 61 62 65 6c 2d 36 37 0d 0a 53 45 4c 45  t label-67..SELE
25c0: 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20 2b 20 63  CT ALL - - ( + c
25d0: 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20 2d 20 43  or0.col1 ) + - C
25e0: 41 53 54 20 28 20 2d 20 63 6f 6c 31 20 41 53 20  AST ( - col1 AS 
25f0: 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 32  INTEGER ) * col2
2600: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2610: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a 32  r0..----..194..2
2620: 39 32 34 0d 0a 37 35 35 33 0d 0a 0d 0a 71 75 65  924..7553....que
2630: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2640: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
2650: 2b 20 63 6f 6c 32 20 29 20 2b 20 2b 20 38 20 41  + col2 ) + + 8 A
2660: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2670: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2680: 34 31 0d 0a 39 0d 0a 39 30 0d 0a 0d 0a 71 75 65  41..9..90....que
2690: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26a0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
26b0: 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e  - col0 * - cor0.
26c0: 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63  col2 + col2 AS c
26d0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
26e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d   cor0..----..36.
26f0: 0a 37 33 38 30 0d 0a 38 32 35 0d 0a 0d 0a 71 75  .7380..825....qu
2700: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2710: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2720: 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   + col1 + + col2
2730: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2740: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2750: 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a  ..28..47..83....
2760: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2770: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2780: 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   + + col1 * - co
2790: 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
27a0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
27b0: 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37  .-100..-169..-67
27c0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
27d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
27e0: 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32   - ( + cor0.col2
27f0: 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
2800: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2810: 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33  --..-26..-27..-3
2820: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2830: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2840: 20 2d 20 31 38 20 46 52 4f 4d 20 74 61 62 30 2c   - 18 FROM tab0,
2850: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2860: 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
2870: 73 68 69 6e 67 20 74 6f 20 30 39 61 66 61 66 65  shing to 09afafe
2880: 63 36 35 37 61 35 65 39 66 30 38 32 62 65 62 36  c657a5e9f082beb6
2890: 61 31 36 65 63 38 35 64 65 0d 0a 0d 0a 71 75 65  a16ec85de....que
28a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28b0: 4c 45 43 54 20 41 4c 4c 20 2d 20 31 20 2a 20 34  LECT ALL - 1 * 4
28c0: 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
28d0: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
28e0: 2d 0d 0a 33 34 34 0d 0a 33 36 34 0d 0a 33 38 38  -..344..364..388
28f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2900: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
2910: 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30  cor0.col1 * col0
2920: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2930: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2940: 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30  ..2064..3395..80
2950: 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
2960: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2970: 4c 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20  L - col2 - col0 
2980: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2990: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
29a0: 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d  21..-176..-57...
29b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29c0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
29d0: 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a   col0 * - col2 *
29e0: 20 63 6f 6c 32 20 2b 20 2b 20 34 38 20 41 53 20   col2 + + 48 AS 
29f0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2a00: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
2a10: 36 30 38 38 0d 0a 2d 35 39 38 33 38 38 0d 0a 31  6088..-598388..1
2a20: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
2a30: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2a40: 20 63 6f 6c 30 20 2a 20 2d 20 33 33 20 41 53 20   col0 * - 33 AS 
2a50: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
2a60: 2d 2d 2d 2d 0d 0a 2d 31 31 35 35 0d 0a 2d 32 39  ----..-1155..-29
2a70: 33 37 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72  37..-792....quer
2a80: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a90: 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20 74 61 62  ECT - col1 - tab
2aa0: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
2ab0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32 0d 0a 2d 31  ..----..-172..-1
2ac0: 38 32 0d 0a 2d 31 39 34 0d 0a 0d 0a 71 75 65 72  82..-194....quer
2ad0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ae0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
2af0: 20 63 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 6c 31   col0 + + ( col1
2b00: 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
2b10: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d  cor0..----..-19.
2b20: 0a 2d 36 32 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72  .-62..24....quer
2b30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b40: 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 39  ECT - col2 + + 9
2b50: 34 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  4 FROM tab1 AS c
2b60: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 33  or0..----..-2..3
2b70: 37 0d 0a 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  7..40....query I
2b80: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b90: 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 63 6f   ALL + col0 + co
2ba0: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
2bb0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d  tab0..----..110.
2bc0: 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65  .132..180....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 2b 20  LECT DISTINCT + 
2bf0: 28 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  ( col2 * - col0 
2c00: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
2c10: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d  ab2..----..-189.
2c20: 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d  .-2028..-3002...
2c30: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c40: 0d 0a 53 45 4c 45 43 54 20 2b 20 35 20 2b 20 63  ..SELECT + 5 + c
2c50: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2c60: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d   cor0..----..12.
2c70: 0a 38 33 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72 79  .83..84....query
2c80: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c90: 43 54 20 31 37 20 2a 20 2b 20 63 6f 6c 30 20 41  CT 17 * + col0 A
2ca0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2cb0: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 33 0d 0a 34 30  ..----..1513..40
2cc0: 38 0d 0a 35 39 35 0d 0a 0d 0a 71 75 65 72 79 20  8..595....query 
2cd0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ce0: 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  T + - cor0.col0 
2cf0: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
2d00: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
2d10: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2d20: 74 6f 20 34 65 63 33 30 34 62 38 63 65 39 33 35  to 4ec304b8ce935
2d30: 66 32 32 32 36 65 37 35 34 38 64 37 32 63 32 62  f2226e7548d72c2b
2d40: 32 66 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  2f0....query I r
2d50: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2d60: 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
2d70: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
2d80: 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
2d90: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a  or0..----..-86..
2da0: 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 6f 6e 6c 79  -91..-97....only
2db0: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2dc0: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
2dd0: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
2de0: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
2df0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2e00: 61 62 65 6c 2d 38 38 0d 0a 53 45 4c 45 43 54 20  abel-88..SELECT 
2e10: 44 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 4e  DISTINCT CAST( N
2e20: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
2e30: 2b 20 39 30 20 2f 20 2d 20 63 6f 72 30 2e 63 6f  + 90 / - cor0.co
2e40: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
2e50: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2e60: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
2e70: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2e80: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2e90: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2ea0: 2d 38 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  -88..SELECT DIST
2eb0: 49 4e 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c  INCT CAST ( NULL
2ec0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
2ed0: 39 30 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  90 / - cor0.col1
2ee0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2ef0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2f00: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
2f10: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f20: 54 20 2d 20 2b 20 31 20 2b 20 63 6f 6c 32 20 46  T - + 1 + col2 F
2f30: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2f40: 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 36 0d 0a  ..----..53..56..
2f50: 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  95....query I ro
2f60: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2f70: 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20  ( - cor0.col0 ) 
2f80: 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52  * col1 + col0 FR
2f90: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2fa0: 0a 2d 2d 2d 2d 0d 0a 32 30 38 38 0d 0a 33 34 33  .----..2088..343
2fb0: 30 0d 0a 38 31 38 38 0d 0a 0d 0a 71 75 65 72 79  0..8188....query
2fc0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2fd0: 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30  CT col0 * - cor0
2fe0: 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2d  .col2 * + col2 -
2ff0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
3000: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34  cor0..----..-114
3010: 30 39 33 0d 0a 2d 35 31 33 34 0d 0a 2d 35 32 37  093..-5134..-527
3020: 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  87....query I ro
3030: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
3040: 53 54 49 4e 43 54 20 2b 20 33 34 20 41 53 20 63  STINCT + 34 AS c
3050: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
3060: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
3070: 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
3080: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
3090: 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f  cor0.col1 + - co
30a0: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
30b0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
30c0: 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d  --..-137..-38..-
30d0: 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
30e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
30f0: 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  + col0 + cor0.co
3100: 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  l0 * col0 * + co
3110: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
3120: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 37  cor0..----..1187
3130: 39 30 0d 0a 34 39 35 31 32 0d 0a 37 32 30 37 32  90..49512..72072
3140: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
3150: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
3160: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63  ol0 + - col2 * c
3170: 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  or0.col2 * - col
3180: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
3190: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36 30 36  or0..----..22606
31a0: 0d 0a 32 34 36 32 37 0d 0a 33 39 39 36 32 0d 0a  ..24627..39962..
31b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31c0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
31d0: 43 54 20 39 37 20 46 52 4f 4d 20 74 61 62 31 2c  CT 97 FROM tab1,
31e0: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
31f0: 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..97....skipif p
3200: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
3210: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
3220: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
3230: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
3240: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3250: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
3260: 54 20 36 30 20 2b 20 2d 20 74 61 62 32 2e 63 6f  T 60 + - tab2.co
3270: 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 30  l1 + + col1 col0
3280: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
3290: 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..60....query I 
32a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32b0: 2d 20 28 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20  - ( + tab2.col2 
32c0: 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ) * col1 FROM ta
32d0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d  b2..----..-1534.
32e0: 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71  .-646..-837....q
32f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3300: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
3310: 2b 20 35 39 20 46 52 4f 4d 20 74 61 62 31 20 41  + 59 FROM tab1 A
3320: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
3330: 33 0d 0a 31 31 36 0d 0a 31 35 35 0d 0a 0d 0a 71  3..116..155....q
3340: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3350: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
3360: 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  9 AS col1 FROM t
3370: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3380: 2d 0d 0a 31 30 0d 0a 34 32 0d 0a 39 31 0d 0a 0d  -..10..42..91...
3390: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
33a0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
33b0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
33c0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
33d0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31  owsort label-101
33e0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
33f0: 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  T - col0 + col1 
3400: 2a 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20 63  * - col0 DIV + c
3410: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
3420: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
3430: 37 0d 0a 2d 33 38 0d 0a 2d 39 36 0d 0a 0d 0a 73  7..-38..-96....s
3440: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
3450: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
3460: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
3470: 62 65 6c 2d 31 30 31 0d 0a 53 45 4c 45 43 54 20  bel-101..SELECT 
3480: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
3490: 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  + col1 * - col0 
34a0: 2f 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  / + col0 FROM ta
34b0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
34c0: 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d 39 36  ..-137..-38..-96
34d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
34f0: 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  INCT + col2 + - 
3500: 36 37 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  67 - - col1 FROM
3510: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
3520: 2d 2d 2d 0d 0a 30 0d 0a 31 33 0d 0a 34 32 0d 0a  ---..0..13..42..
3530: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3540: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
3550: 20 37 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   77 AS col2 FROM
3560: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
3570: 2d 2d 2d 0d 0a 34 31 35 38 0d 0a 34 33 38 39 0d  ---..4158..4389.
3580: 0a 37 33 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .7392....query I
3590: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35a0: 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f   DISTINCT - + co
35b0: 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l1 * col0 AS col
35c0: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
35d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33  or0..----..-1343
35e0: 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d  ..-217..-4602...
35f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3600: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
3610: 63 6f 6c 30 20 2a 20 32 35 20 46 52 4f 4d 20 74  col0 * 25 FROM t
3620: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
3630: 2d 0d 0a 31 37 35 0d 0a 31 39 35 30 0d 0a 31 39  -..175..1950..19
3640: 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  75....query I ro
3650: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
3660: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20  STINCT + col2 + 
3670: 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  ( + cor0.col2 ) 
3680: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
3690: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31 31  0..----..108..11
36a0: 34 0d 0a 31 39 32 0d 0a 0d 0a 73 6b 69 70 69 66  4..192....skipif
36b0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
36c0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
36d0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
36e0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
36f0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
3700: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
3710: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2b  ol2 * + col1 * +
3720: 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20   col2 col0 FROM 
3730: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 38  tab1..----..1198
3740: 30 38 0d 0a 33 32 34 39 30 0d 0a 37 35 38 31 36  08..32490..75816
3750: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3760: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 20 2d 20  ort..SELECT 9 - 
3770: 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab1.col1 FROM t
3780: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  ab1..----..-1..-
3790: 31 37 0d 0a 2d 34 0d 0a 0d 0a 71 75 65 72 79 20  17..-4....query 
37a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37b0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 36  T DISTINCT + + 6
37c0: 37 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  7 FROM tab0 AS c
37d0: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
37e0: 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
37f0: 2d 0d 0a 36 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -..67....onlyif 
3800: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
3810: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
3820: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
3830: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
3840: 61 62 65 6c 2d 31 31 30 0d 0a 53 45 4c 45 43 54  abel-110..SELECT
3850: 20 63 6f 6c 30 20 44 49 56 20 36 33 20 2b 20 38   col0 DIV 63 + 8
3860: 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
3870: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
3880: 0a 32 36 34 0d 0a 36 35 37 0d 0a 38 0d 0a 0d 0a  .264..657..8....
3890: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
38a0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
38b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
38c0: 61 62 65 6c 2d 31 31 30 0d 0a 53 45 4c 45 43 54  abel-110..SELECT
38d0: 20 63 6f 6c 30 20 2f 20 36 33 20 2b 20 38 20 2a   col0 / 63 + 8 *
38e0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
38f0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
3900: 36 34 0d 0a 36 35 37 0d 0a 38 0d 0a 0d 0a 71 75  64..657..8....qu
3910: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3920: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
3930: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b   col0 * + col0 +
3940: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
3950: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
3960: 2d 2d 0d 0a 2d 34 30 33 39 0d 0a 2d 36 33 30 34  --..-4039..-6304
3970: 0d 0a 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..45....skipif p
3980: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
3990: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
39a0: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
39b0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
39c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
39d0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
39e0: 30 20 2b 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c  0 + col0 * ( col
39f0: 32 20 29 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20  2 ) + col2 col2 
3a00: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
3a10: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 39 0d 0a 33 37  0..----..219..37
3a20: 36 39 0d 0a 37 38 35 36 0d 0a 0d 0a 71 75 65 72  69..7856....quer
3a30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3a40: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a  ECT ALL + col0 *
3a50: 20 2b 20 38 39 20 2d 20 63 6f 6c 32 20 2a 20 2d   + 89 - col2 * -
3a60: 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 46   col1 * - col0 F
3a70: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
3a80: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 0d 0a 2d 36  ..----..-280..-6
3a90: 35 36 31 39 37 0d 0a 2d 36 35 39 37 36 0d 0a 0d  56197..-65976...
3aa0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3ab0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
3ac0: 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 * - cor0.col
3ad0: 30 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  0 + + col1 FROM 
3ae0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
3af0: 2d 2d 0d 0a 2d 31 35 38 0d 0a 2d 31 39 36 39 0d  --..-158..-1969.
3b00: 0a 2d 32 39 38 35 0d 0a 0d 0a 71 75 65 72 79 20  .-2985....query 
3b10: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3b20: 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  T - col0 + - col
3b30: 31 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 30 20 2a  1 * + ( - col0 *
3b40: 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 29   - col0 + col2 )
3b50: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
3b60: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 38 32  r0..----..-10682
3b70: 32 0d 0a 2d 32 33 36 33 0d 0a 2d 33 36 30 35 36  2..-2363..-36056
3b80: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
3b90: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
3ba0: 20 63 6f 6c 30 20 2b 20 2d 20 28 20 2d 20 63 6f   col0 + - ( - co
3bb0: 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l2 ) AS col1 FRO
3bc0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
3bd0: 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a  ----..121..176..
3be0: 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
3bf0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
3c00: 4c 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  L + col0 + cor0.
3c10: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
3c20: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
3c30: 0d 0a 31 35 36 0d 0a 31 35 38 0d 0a 0d 0a 71 75  ..156..158....qu
3c40: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3c50: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
3c60: 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a   col0 * - col2 *
3c70: 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab1.col0 FROM 
3c80: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 33  tab1..----..-233
3c90: 34 37 32 0d 0a 2d 34 38 36 0d 0a 2d 36 31 34 34  472..-486..-6144
3ca0: 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
3cb0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
3cc0: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20  STINCT - col1 * 
3cd0: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
3ce0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
3cf0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
3d00: 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d  0..-169..-676...
3d10: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
3d20: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
3d30: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
3d40: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
3d50: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 30  owsort label-120
3d60: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
3d70: 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b  ol0 DIV - col1 +
3d80: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
3d90: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
3da0: 0a 2d 33 0d 0a 2d 37 30 0d 0a 2d 38 36 0d 0a 0d  .-3..-70..-86...
3db0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
3dc0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
3dd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
3de0: 6c 61 62 65 6c 2d 31 32 30 0d 0a 53 45 4c 45 43  label-120..SELEC
3df0: 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2f 20 2d  T ALL + col0 / -
3e00: 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 46   col1 + - col0 F
3e10: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
3e20: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 37 30 0d  ..----..-3..-70.
3e30: 0a 2d 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-86....query I 
3e40: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3e50: 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  ALL + col0 * - c
3e60: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 63  ol0 * + col2 - c
3e70: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
3e80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   cor0..----..-23
3e90: 33 34 38 32 0d 0a 2d 35 31 32 0d 0a 2d 36 31 34  3482..-512..-614
3ea0: 34 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  413....query I r
3eb0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
3ec0: 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 74  ISTINCT col2 * t
3ed0: 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  ab1.col2 AS col2
3ee0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
3ef0: 0d 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32  ..2916..3249..92
3f00: 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
3f10: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
3f20: 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 74 61 62 30  l2 * col2 + tab0
3f30: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52  .col2 AS col0 FR
3f40: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
3f50: 31 32 32 0d 0a 32 0d 0a 36 38 30 36 0d 0a 0d 0a  122..2..6806....
3f60: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3f70: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2d  .SELECT + col0 -
3f80: 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
3f90: 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  2..----..0..0..0
3fa0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3fb0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
3fc0: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52  col0 * - col0 FR
3fd0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
3fe0: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35  .----..-1225..-5
3ff0: 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65  76..-7921....que
4000: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4010: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
4020: 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  l1 * - col1 * co
4030: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
4040: 2d 2d 0d 0a 2d 31 33 35 32 30 0d 0a 2d 32 30 32  --..-13520..-202
4050: 38 0d 0a 2d 36 34 30 30 0d 0a 0d 0a 71 75 65 72  8..-6400....quer
4060: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4070: 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  ECT + col0 * - c
4080: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol0 * + col1 AS 
4090: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
40a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
40b0: 31 38 38 32 35 0d 0a 2d 34 39 35 33 36 0d 0a 2d  18825..-49536..-
40c0: 37 32 30 38 31 31 0d 0a 0d 0a 71 75 65 72 79 20  720811....query 
40d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
40e0: 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  T cor0.col0 * + 
40f0: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col1 * - col1 + 
4100: 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52  col2 + + col0 FR
4110: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
4120: 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37 34 34 37 0d 0a  .----..-177447..
4130: 2d 33 32 39 32 37 39 0d 0a 2d 37 33 36 38 33 38  -329279..-736838
4140: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
4150: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
4160: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
4170: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
4180: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
4190: 31 32 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  129..SELECT + co
41a0: 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56 20  l2 + - col1 DIV 
41b0: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
41c0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
41d0: 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39 35 0d 0a 0d  -..53..56..95...
41e0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
41f0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
4200: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
4210: 6c 61 62 65 6c 2d 31 32 39 0d 0a 53 45 4c 45 43  label-129..SELEC
4220: 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  T + col2 + - col
4230: 31 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  1 / col1 AS col2
4240: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
4250: 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39  .----..53..56..9
4260: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
4270: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
4280: 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  1 * + cor0.col0 
4290: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
42a0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
42b0: 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a  .1040..640..78..
42c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
42d0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
42e0: 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41  l1 * cor0.col0 A
42f0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
4300: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4310: 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39  2064..3395..8099
4320: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4330: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
4340: 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20  + col2 * col2 * 
4350: 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
4360: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4370: 2d 31 0d 0a 2d 33 35 39 33 37 0d 0a 2d 35 35 31  -1..-35937..-551
4380: 33 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  368....onlyif my
4390: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
43a0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
43b0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
43c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
43d0: 65 6c 2d 31 33 33 0d 0a 53 45 4c 45 43 54 20 44  el-133..SELECT D
43e0: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a  ISTINCT + col2 *
43f0: 20 63 6f 6c 32 20 44 49 56 20 2b 20 28 20 63 6f   col2 DIV + ( co
4400: 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  l1 ) FROM tab2 A
4410: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
4420: 0d 0a 32 33 0d 0a 38 34 0d 0a 0d 0a 73 6b 69 70  ..23..84....skip
4430: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
4440: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
4450: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4460: 2d 31 33 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -133..SELECT DIS
4470: 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  TINCT + col2 * c
4480: 6f 6c 32 20 2f 20 2b 20 28 20 63 6f 6c 31 20 29  ol2 / + ( col1 )
4490: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
44a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 32 33  r0..----..11..23
44b0: 0d 0a 38 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..84....skipif p
44c0: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
44d0: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
44e0: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
44f0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
4500: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4510: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
4520: 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63  ol2 * col2 + + c
4530: 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
4540: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
4550: 0d 0a 31 35 32 33 0d 0a 37 33 36 0d 0a 37 35 34  ..1523..736..754
4560: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4570: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
4580: 37 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  70 AS col1 FROM 
4590: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
45a0: 0a 2d 37 30 0d 0a 2d 37 30 0d 0a 2d 37 30 0d 0a  .-70..-70..-70..
45b0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
45c0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
45d0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
45e0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
45f0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
4600: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4610: 43 54 20 2d 20 2b 20 63 6f 6c 32 20 63 6f 6c 31  CT - + col2 col1
4620: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
4630: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d  r0..----..-26..-
4640: 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70 69  27..-38....skipi
4650: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
4660: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
4670: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
4680: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
4690: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
46a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
46b0: 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 63 6f 6c 30  col0 * col1 col0
46c0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
46d0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d  r0..----..-2064.
46e0: 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d  .-3395..-8099...
46f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4700: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
4710: 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 2b  T - ( col0 ) + +
4720: 20 63 6f 6c 30 20 2a 20 35 36 20 46 52 4f 4d 20   col0 * 56 FROM 
4730: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
4740: 0a 31 36 35 0d 0a 33 35 32 30 0d 0a 34 34 30 30  .165..3520..4400
4750: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4760: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39 33  ort..SELECT + 93
4770: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
4780: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 39 33 0d 0a 39 33  b2..----..93..93
4790: 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..93....query I 
47a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
47b0: 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
47c0: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
47d0: 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
47e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d  r0..----..7..78.
47f0: 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .79....query I r
4800: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
4810: 4c 4c 20 35 33 20 46 52 4f 4d 20 74 61 62 32 20  LL 53 FROM tab2 
4820: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
4830: 33 0d 0a 35 33 0d 0a 35 33 0d 0a 0d 0a 6f 6e 6c  3..53..53....onl
4840: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
4850: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
4860: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
4870: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
4880: 72 74 20 6c 61 62 65 6c 2d 31 34 32 0d 0a 53 45  rt label-142..SE
4890: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20  LECT ALL col0 * 
48a0: 63 6f 6c 30 20 2b 20 36 37 20 44 49 56 20 2d 20  col0 + 67 DIV - 
48b0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
48c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30  S cor0..----..40
48d0: 0d 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a  ..6084..6241....
48e0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
48f0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
4900: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4910: 61 62 65 6c 2d 31 34 32 0d 0a 53 45 4c 45 43 54  abel-142..SELECT
4920: 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 30   ALL col0 * col0
4930: 20 2b 20 36 37 20 2f 20 2d 20 63 6f 6c 30 20 46   + 67 / - col0 F
4940: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
4950: 0d 0a 2d 2d 2d 2d 0d 0a 34 30 0d 0a 36 30 38 34  ..----..40..6084
4960: 0d 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20  ..6241....query 
4970: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4980: 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20 63  T ALL col2 * - c
4990: 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 + cor0.col0 
49a0: 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20  + col1 * + col2 
49b0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
49c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 31 34 0d 0a  0..----..-3014..
49d0: 2d 36 33 35 32 0d 0a 31 32 34 35 0d 0a 0d 0a 71  -6352..1245....q
49e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
49f0: 53 45 4c 45 43 54 20 2d 20 32 31 20 46 52 4f 4d  SELECT - 21 FROM
4a00: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
4a10: 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 32 31 0d 0a 2d  ---..-21..-21..-
4a20: 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  21....query I ro
4a30: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
4a40: 2d 20 35 30 20 46 52 4f 4d 20 74 61 62 31 20 41  - 50 FROM tab1 A
4a50: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
4a60: 30 0d 0a 2d 35 30 0d 0a 2d 35 30 0d 0a 0d 0a 73  0..-50..-50....s
4a70: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
4a80: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
4a90: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
4aa0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
4ab0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
4ac0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4ad0: 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  ALL - col1 * - c
4ae0: 6f 6c 32 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20  ol2 + col0 col1 
4af0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
4b00: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 32 0d 0a 37  0..----..1612..7
4b10: 32 35 0d 0a 38 34 34 0d 0a 0d 0a 71 75 65 72 79  25..844....query
4b20: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4b30: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
4b40: 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   - + col0 * - co
4b50: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
4b60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d  cor0..----..196.
4b70: 0a 32 31 30 36 0d 0a 33 30 38 31 0d 0a 0d 0a 71  .2106..3081....q
4b80: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4b90: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
4ba0: 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e  - col1 * - cor0.
4bb0: 63 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 31 20  col2 + ( - col1 
4bc0: 29 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 2d  ) + ( col0 ) * -
4bd0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
4be0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
4bf0: 31 32 32 35 0d 0a 2d 35 35 30 0d 0a 32 31 37 36  1225..-550..2176
4c00: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4c10: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
4c20: 6c 30 20 2d 20 2d 20 32 20 46 52 4f 4d 20 74 61  l0 - - 2 FROM ta
4c30: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  b2 cor0..----..8
4c40: 30 0d 0a 38 31 0d 0a 39 0d 0a 0d 0a 71 75 65 72  0..81..9....quer
4c50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4c60: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63  ECT ALL + cor0.c
4c70: 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 * cor0.col0 
4c80: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
4c90: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
4ca0: 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a 36 31 36 32  ..----..56..6162
4cb0: 0d 0a 36 33 32 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..6320....skipif
4cc0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
4cd0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
4ce0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
4cf0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
4d00: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
4d10: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
4d20: 4e 43 54 20 2d 20 36 36 20 63 6f 6c 30 20 46 52  NCT - 66 col0 FR
4d30: 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
4d40: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 36   cor0..----..-66
4d50: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
4d60: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
4d70: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
4d80: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
4d90: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
4da0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4db0: 4c 45 43 54 20 38 20 63 6f 6c 30 20 46 52 4f 4d  LECT 8 col0 FROM
4dc0: 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72 30   tab2, tab1 cor0
4dd0: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  , tab0 AS cor1..
4de0: 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
4df0: 68 61 73 68 69 6e 67 20 74 6f 20 33 33 30 36 39  hashing to 33069
4e00: 61 64 63 33 63 31 31 34 32 64 33 31 35 31 31 65  adc3c1142d31511e
4e10: 63 38 38 66 63 66 61 34 30 61 66 0d 0a 0d 0a 71  c88fcfa40af....q
4e20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4e30: 53 45 4c 45 43 54 20 2d 20 37 38 20 2d 20 74 61  SELECT - 78 - ta
4e40: 62 30 2e 63 6f 6c 32 20 2a 20 2b 20 74 61 62 30  b0.col2 * + tab0
4e50: 2e 63 6f 6c 30 20 2a 20 2b 20 36 31 20 41 53 20  .col0 * + 61 AS 
4e60: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
4e70: 2d 2d 2d 2d 0d 0a 2d 32 32 31 33 0d 0a 2d 34 34  ----..-2213..-44
4e80: 35 32 35 36 0d 0a 2d 34 38 33 39 30 0d 0a 0d 0a  5256..-48390....
4e90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4ea0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 36 20 2b  .SELECT ALL 86 +
4eb0: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 46   col0 * + col0 F
4ec0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
4ed0: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 0d 0a 36 31 37  ..----..135..617
4ee0: 30 0d 0a 36 33 32 37 0d 0a 0d 0a 71 75 65 72 79  0..6327....query
4ef0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4f00: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20  CT DISTINCT + ( 
4f10: 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20 2d 20  cor0.col1 ) + - 
4f20: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
4f30: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
4f40: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
4f50: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
4f60: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
4f70: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
4f80: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
4f90: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4fa0: 45 43 54 20 28 20 2d 20 28 20 63 6f 6c 30 20 29  ECT ( - ( col0 )
4fb0: 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b   ) * cor0.col1 +
4fc0: 20 2d 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f   - col0 col0 FRO
4fd0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
4fe0: 2d 2d 2d 2d 0d 0a 2d 32 30 38 38 0d 0a 2d 33 34  ----..-2088..-34
4ff0: 33 30 0d 0a 2d 38 31 38 38 0d 0a 0d 0a 71 75 65  30..-8188....que
5000: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5010: 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
5020: 31 20 2a 20 2d 20 37 34 20 46 52 4f 4d 20 74 61  1 * - 74 FROM ta
5030: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
5040: 0d 0a 2d 31 32 35 38 0d 0a 2d 32 32 39 34 0d 0a  ..-1258..-2294..
5050: 2d 34 33 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -4366....query I
5060: 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  IIIIIIIIIII rows
5070: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
5080: 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  * FROM tab2, tab
5090: 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  0 AS cor0, tab1 
50a0: 41 53 20 63 6f 72 31 2c 20 74 61 62 31 20 63 6f  AS cor1, tab1 co
50b0: 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61  r2..----..972 va
50c0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
50d0: 37 38 36 34 61 61 64 61 38 36 62 66 35 62 66 35  7864aada86bf5bf5
50e0: 65 31 36 32 31 63 37 39 30 35 64 65 38 64 63 64  e1621c7905de8dcd
50f0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
5100: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
5110: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
5120: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
5130: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
5140: 31 35 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  159..SELECT DIST
5150: 49 4e 43 54 20 2b 20 36 32 20 44 49 56 20 2d 20  INCT + 62 DIV - 
5160: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 31 35  cor0.col2 + + 15
5170: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
5180: 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
5190: 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
51a0: 0d 0a 2d 34 37 0d 0a 31 34 0d 0a 31 35 0d 0a 0d  ..-47..14..15...
51b0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
51c0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
51d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
51e0: 6c 61 62 65 6c 2d 31 35 39 0d 0a 53 45 4c 45 43  label-159..SELEC
51f0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 36 32 20  T DISTINCT + 62 
5200: 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  / - cor0.col2 + 
5210: 2b 20 31 35 20 46 52 4f 4d 20 74 61 62 30 20 41  + 15 FROM tab0 A
5220: 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
5230: 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  N tab1 AS cor1..
5240: 2d 2d 2d 2d 0d 0a 2d 34 37 0d 0a 31 34 0d 0a 31  ----..-47..14..1
5250: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
5260: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
5270: 20 2d 20 39 32 20 46 52 4f 4d 20 74 61 62 30 2c   - 92 FROM tab0,
5280: 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
5290: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or0..----..27 va
52a0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
52b0: 61 30 65 36 62 37 36 32 32 37 64 38 37 30 64 31  a0e6b76227d870d1
52c0: 30 63 34 64 39 66 34 36 35 34 35 61 37 63 38 33  0c4d9f46545a7c83
52d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
52e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 20 2a 20  ort..SELECT 3 * 
52f0: 38 39 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74  89 - col2 FROM t
5300: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a  ab1..----..171..
5310: 32 31 30 0d 0a 32 31 33 0d 0a 0d 0a 71 75 65 72  210..213....quer
5320: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5330: 45 43 54 20 35 38 20 2d 20 2b 20 39 35 20 2a 20  ECT 58 - + 95 * 
5340: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
5350: 2d 2d 2d 2d 0d 0a 2d 36 30 37 0d 0a 2d 37 33 35  ----..-607..-735
5360: 32 0d 0a 2d 37 34 34 37 0d 0a 0d 0a 73 6b 69 70  2..-7447....skip
5370: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
5380: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
5390: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
53a0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
53b0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
53c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
53d0: 54 49 4e 43 54 20 28 20 2d 20 63 6f 6c 31 20 29  TINCT ( - col1 )
53e0: 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 63   + + tab0.col0 c
53f0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
5400: 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 0d 0a  ---..-2..-62....
5410: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
5420: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
5430: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
5440: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
5450: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
5460: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5470: 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 63 6f   ( + col2 ) * co
5480: 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
5490: 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36  2..----..1444..6
54a0: 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79  76..729....query
54b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
54c0: 43 54 20 2b 20 39 35 20 2b 20 2d 20 63 6f 6c 30  CT + 95 + - col0
54d0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
54e0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
54f0: 0d 0a 31 36 0d 0a 31 37 0d 0a 38 38 0d 0a 0d 0a  ..16..17..88....
5500: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5510: 0a 53 45 4c 45 43 54 20 31 31 20 41 53 20 63 6f  .SELECT 11 AS co
5520: 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
5530: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
5540: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
5550: 6e 67 20 74 6f 20 66 34 64 31 39 39 35 38 34 62  ng to f4d199584b
5560: 34 34 37 33 32 66 31 61 38 39 37 65 36 36 39 31  44732f1a897e6691
5570: 62 34 65 61 30 30 0d 0a 0d 0a 71 75 65 72 79 20  b4ea00....query 
5580: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5590: 54 20 2d 20 2d 20 36 33 20 2a 20 63 6f 6c 32 20  T - - 63 * col2 
55a0: 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  + + col2 AS col0
55b0: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
55c0: 0a 2d 2d 2d 2d 0d 0a 31 36 36 34 0d 0a 31 37 32  .----..1664..172
55d0: 38 0d 0a 32 34 33 32 0d 0a 0d 0a 73 6b 69 70 69  8..2432....skipi
55e0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
55f0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
5600: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
5610: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
5620: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
5630: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 32  ort..SELECT - 32
5640: 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30   + + col1 * cor0
5650: 2e 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20  .col1 col1 FROM 
5660: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
5670: 2d 2d 0d 0a 31 33 37 0d 0a 36 34 34 0d 0a 36 38  --..137..644..68
5680: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
5690: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
56a0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
56b0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
56c0: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
56d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
56e0: 4c 45 43 54 20 28 20 39 31 20 29 20 2b 20 2d 20  LECT ( 91 ) + - 
56f0: 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col0 col1 FROM t
5700: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35 36  ab0..----..2..56
5710: 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..67....query I 
5720: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5730: 44 49 53 54 49 4e 43 54 20 31 30 20 2a 20 63 6f  DISTINCT 10 * co
5740: 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
5750: 2d 2d 0d 0a 37 30 0d 0a 37 38 30 0d 0a 37 39 30  --..70..780..790
5760: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5770: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f  ort..SELECT ( co
5780: 6c 31 20 2a 20 28 20 63 6f 6c 32 20 29 20 29 20  l1 * ( col2 ) ) 
5790: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
57a0: 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30  .1248..1404..570
57b0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
57c0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
57d0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
57e0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
57f0: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
5800: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 32  owsort label-172
5810: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
5820: 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  T + col1 * - col
5830: 30 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  0 - CAST( NULL A
5840: 53 20 44 45 43 49 4d 41 4c 20 29 20 41 53 20 63  S DECIMAL ) AS c
5850: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
5860: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
5870: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
5880: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
5890: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
58a0: 6f 72 74 20 6c 61 62 65 6c 2d 31 37 32 0d 0a 53  ort label-172..S
58b0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
58c0: 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2d   col1 * - col0 -
58d0: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
58e0: 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 32 20 46  REAL ) AS col2 F
58f0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
5900: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
5910: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5920: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
5930: 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32  r0.col2 * + col2
5940: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
5950: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
5960: 0d 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32  ..2916..3249..92
5970: 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
5980: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
5990: 4c 20 2b 20 39 32 20 2d 20 2d 20 63 6f 6c 31 20  L + 92 - - col1 
59a0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
59b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a 31 38  0..----..178..18
59c0: 33 0d 0a 31 38 39 0d 0a 0d 0a 73 6b 69 70 69 66  3..189....skipif
59d0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
59e0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
59f0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
5a00: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
5a10: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
5a20: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 32 20  rt..SELECT + 72 
5a30: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
5a40: 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
5a50: 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  b2 cor1..----..2
5a60: 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
5a70: 20 74 6f 20 39 32 63 63 33 64 35 64 61 61 35 35   to 92cc3d5daa55
5a80: 30 33 30 34 65 39 36 63 31 35 34 32 37 38 37 36  0304e96c15427876
5a90: 39 31 63 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  91c7....query I 
5aa0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5ab0: 41 4c 4c 20 33 34 20 2a 20 63 6f 6c 30 20 41 53  ALL 34 * col0 AS
5ac0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
5ad0: 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 32 31 37 36  .----..102..2176
5ae0: 0d 0a 32 37 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..2720....onlyif
5af0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
5b00: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
5b10: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
5b20: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
5b30: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
5b40: 65 6c 2d 31 37 37 0d 0a 53 45 4c 45 43 54 20 41  el-177..SELECT A
5b50: 4c 4c 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53  LL CAST( NULL AS
5b60: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
5b70: 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30 2c 20  ab0, tab1 cor0, 
5b80: 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
5b90: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
5ba0: 73 68 69 6e 67 20 74 6f 20 31 36 62 65 38 38 36  shing to 16be886
5bb0: 38 61 31 65 36 66 34 65 38 38 35 30 35 30 39 66  8a1e6f4e8850509f
5bc0: 39 33 32 37 61 66 65 39 30 0d 0a 0d 0a 73 6b 69  9327afe90....ski
5bd0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
5be0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
5bf0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
5c00: 6c 2d 31 37 37 0d 0a 53 45 4c 45 43 54 20 41 4c  l-177..SELECT AL
5c10: 4c 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  L CAST ( NULL AS
5c20: 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
5c30: 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30 2c  tab0, tab1 cor0,
5c40: 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
5c50: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
5c60: 61 73 68 69 6e 67 20 74 6f 20 31 36 62 65 38 38  ashing to 16be88
5c70: 36 38 61 31 65 36 66 34 65 38 38 35 30 35 30 39  68a1e6f4e8850509
5c80: 66 39 33 32 37 61 66 65 39 30 0d 0a 0d 0a 71 75  f9327afe90....qu
5c90: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5ca0: 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
5cb0: 31 20 2a 20 2d 20 39 37 20 2a 20 34 36 20 46 52  1 * - 97 * 46 FR
5cc0: 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f  OM tab2, tab1 co
5cd0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
5ce0: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 65  es hashing to 2e
5cf0: 36 38 62 64 61 61 33 62 39 37 63 36 30 35 66 31  68bdaa3b97c605f1
5d00: 64 31 31 38 65 62 31 33 33 39 38 35 31 37 0d 0a  d118eb13398517..
5d10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5d20: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
5d30: 43 54 20 37 36 20 41 53 20 63 6f 6c 31 20 46 52  CT 76 AS col1 FR
5d40: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab0..----..7
5d50: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
5d60: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
5d70: 54 49 4e 43 54 20 39 31 20 41 53 20 63 6f 6c 32  TINCT 91 AS col2
5d80: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
5d90: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 31 0d 0a 0d 0a  r0..----..91....
5da0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5db0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 20  .SELECT ALL + 7 
5dc0: 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  * col0 AS col1 F
5dd0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
5de0: 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 34 34 38 0d  ..----..21..448.
5df0: 0a 35 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .560....query I 
5e00: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5e10: 41 4c 4c 20 32 37 20 2b 20 2b 20 63 6f 6c 30 20  ALL 27 + + col0 
5e20: 2a 20 2d 20 31 20 41 53 20 63 6f 6c 32 20 46 52  * - 1 AS col2 FR
5e30: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
5e40: 2d 2d 0d 0a 2d 33 37 0d 0a 2d 35 33 0d 0a 32 34  --..-37..-53..24
5e50: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5e60: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
5e70: 49 4e 43 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f  INCT ( - cor0.co
5e80: 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 31 20 46 52  l0 ) * - col1 FR
5e90: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
5ea0: 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39  .----..2064..339
5eb0: 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79  5..8099....query
5ec0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5ed0: 43 54 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 31 20  CT + + ( + col1 
5ee0: 29 20 2b 20 2d 20 39 39 20 41 53 20 63 6f 6c 30  ) + - 99 AS col0
5ef0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
5f00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a 2d  r0..----..-13..-
5f10: 32 0d 0a 2d 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  2..-8....onlyif 
5f20: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
5f30: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
5f40: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
5f50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5f60: 61 62 65 6c 2d 31 38 35 0d 0a 53 45 4c 45 43 54  abel-185..SELECT
5f70: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 44 49 56   col2 * col2 DIV
5f80: 20 31 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   12 FROM tab2..-
5f90: 2d 2d 2d 0d 0a 31 32 30 0d 0a 35 36 0d 0a 36 30  ---..120..56..60
5fa0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
5fb0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
5fc0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
5fd0: 72 74 20 6c 61 62 65 6c 2d 31 38 35 0d 0a 53 45  rt label-185..SE
5fe0: 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  LECT col2 * col2
5ff0: 20 2f 20 31 32 20 46 52 4f 4d 20 74 61 62 32 0d   / 12 FROM tab2.
6000: 0a 2d 2d 2d 2d 0d 0a 31 32 30 0d 0a 35 36 0d 0a  .----..120..56..
6010: 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  60....skipif mys
6020: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
6030: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
6040: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
6050: 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 2b 20 63  ol1 + CAST ( + c
6060: 6f 6c 30 20 41 53 20 52 45 41 4c 20 29 20 2a 20  ol0 AS REAL ) * 
6070: 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63  col0 + col0 AS c
6080: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
6090: 2d 2d 2d 0d 0a 31 33 35 37 0d 0a 36 38 36 0d 0a  ---..1357..686..
60a0: 38 31 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8101....query I 
60b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
60c0: 63 6f 6c 31 20 2a 20 2d 20 74 61 62 30 2e 63 6f  col1 * - tab0.co
60d0: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
60e0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33  tab0..----..-283
60f0: 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d  8..-7462..-97...
6100: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
6110: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
6120: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
6130: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
6140: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
6150: 6f 72 74 20 6c 61 62 65 6c 2d 31 38 38 0d 0a 53  ort label-188..S
6160: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
6170: 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 43 41 53   tab1.col1 + CAS
6180: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
6190: 44 20 29 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c  D ) * - tab1.col
61a0: 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
61b0: 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
61c0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
61d0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
61e0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
61f0: 31 38 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  188..SELECT DIST
6200: 49 4e 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 31  INCT - tab1.col1
6210: 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
6220: 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20  S INTEGER ) * - 
6230: 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab1.col1 FROM t
6240: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
6250: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6260: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
6270: 2b 20 2d 20 63 6f 6c 30 20 2a 20 37 20 46 52 4f  + - col0 * 7 FRO
6280: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
6290: 32 0d 0a 2d 35 31 35 0d 0a 2d 35 32 30 0d 0a 0d  2..-515..-520...
62a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
62b0: 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 32 2e  ..SELECT - tab2.
62c0: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  col1 + + col1 + 
62d0: 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63  col2 * col1 AS c
62e0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
62f0: 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a  ---..1534..646..
6300: 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  837....query I r
6310: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
6320: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b  ISTINCT + col0 +
6330: 20 2d 20 63 6f 6c 30 20 2b 20 28 20 74 61 62 32   - col0 + ( tab2
6340: 2e 63 6f 6c 31 20 29 20 2a 20 2b 20 34 34 20 41  .col1 ) * + 44 A
6350: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
6360: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 34 0d 0a 32 35  ..----..1364..25
6370: 39 36 0d 0a 37 34 38 0d 0a 0d 0a 73 6b 69 70 69  96..748....skipi
6380: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
6390: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
63a0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
63b0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
63c0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
63d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
63e0: 2b 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f 6c  + col2 * ( - col
63f0: 32 20 29 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  2 ) + col1 * - c
6400: 6f 6c 30 20 2b 20 35 32 20 2a 20 2d 20 63 6f 6c  ol0 + 52 * - col
6410: 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  2 col2 FROM tab1
6420: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6430: 2d 31 35 32 34 38 0d 0a 2d 35 38 30 32 0d 0a 2d  -15248..-5802..-
6440: 36 38 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6853....query I 
6450: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6460: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
6470: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  * - cor0.col2 + 
6480: 35 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  50 * col1 AS col
6490: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
64a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 37 34  or0..----..-2174
64b0: 0d 0a 33 32 31 31 0d 0a 34 38 34 39 0d 0a 0d 0a  ..3211..4849....
64c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
64d0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
64e0: 20 2b 20 63 6f 6c 31 20 2b 20 37 32 20 2a 20 63   + col1 + 72 * c
64f0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
6500: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 35   cor0..----..535
6510: 0d 0a 35 36 37 35 0d 0a 35 37 30 35 0d 0a 0d 0a  ..5675..5705....
6520: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6530: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
6540: 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   - + col1 + col0
6550: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
6560: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
6570: 0d 0a 2d 32 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d  ..-23..54..67...
6580: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
6590: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
65a0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
65b0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
65c0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
65d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
65e0: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
65f0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
6600: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33  or0..----..24..3
6610: 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..89....query I
6620: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6630: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
6640: 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 36   * cor0.col0 * 6
6650: 38 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  8 FROM tab0 AS c
6660: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 31 36  or0..----..-3916
6670: 38 0d 0a 2d 35 33 38 36 32 38 0d 0a 2d 38 33 33  8..-538628..-833
6680: 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
6690: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
66a0: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 28 20  cor0.col2 * - ( 
66b0: 35 37 20 29 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  57 ) + + col0 * 
66c0: 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
66d0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
66e0: 2d 2d 2d 2d 0d 0a 33 31 35 36 0d 0a 33 38 38 39  ----..3156..3889
66f0: 0d 0a 36 35 31 32 0d 0a 0d 0a 71 75 65 72 79 20  ..6512....query 
6700: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6710: 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  T - col1 * + col
6720: 32 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  2 + - col2 FROM 
6730: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
6740: 2d 2d 0d 0a 2d 32 38 37 31 0d 0a 2d 37 35 34 34  --..-2871..-7544
6750: 0d 0a 2d 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-98....skipif 
6760: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
6770: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
6780: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
6790: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
67a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
67b0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
67c0: 43 54 20 2d 20 35 20 63 6f 6c 30 20 46 52 4f 4d  CT - 5 col0 FROM
67d0: 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
67e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 0d  or0..----..-5...
67f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6800: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
6810: 54 20 2b 20 2b 20 31 33 20 2b 20 2d 20 63 6f 72  T + + 13 + - cor
6820: 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  0.col2 * - col0 
6830: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
6840: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  1 cor0..----..17
6850: 35 0d 0a 33 36 36 31 0d 0a 37 36 39 33 0d 0a 0d  5..3661..7693...
6860: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6870: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
6880: 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  * + col0 + cor0.
6890: 63 6f 6c 30 20 2a 20 28 20 28 20 2d 20 63 6f 6c  col0 * ( ( - col
68a0: 32 20 29 20 29 20 46 52 4f 4d 20 74 61 62 30 20  2 ) ) FROM tab0 
68b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
68c0: 31 32 36 30 0d 0a 2d 31 33 36 38 0d 0a 2d 31 35  1260..-1368..-15
68d0: 32 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  219....query I r
68e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
68f0: 20 28 20 37 35 20 29 20 2a 20 63 6f 6c 32 20 46   ( 75 ) * col2 F
6900: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
6910: 0d 0a 2d 2d 2d 2d 0d 0a 32 34 37 35 0d 0a 36 31  ..----..2475..61
6920: 35 30 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20  50..75....query 
6930: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6940: 54 20 63 6f 6c 32 20 2a 20 37 36 20 2b 20 2d 20  T col2 * 76 + - 
6950: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
6960: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
6970: 39 38 0d 0a 32 30 34 35 0d 0a 32 38 30 39 0d 0a  98..2045..2809..
6980: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
6990: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
69a0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
69b0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
69c0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
69d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
69e0: 43 54 20 41 4c 4c 20 2d 20 2b 20 31 20 2a 20 63  CT ALL - + 1 * c
69f0: 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol1 col0 FROM ta
6a00: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
6a10: 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d  ..-86..-91..-97.
6a20: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
6a30: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
6a40: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
6a50: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
6a60: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
6a70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6a80: 45 43 54 20 41 4c 4c 20 28 20 63 6f 72 30 2e 63  ECT ALL ( cor0.c
6a90: 6f 6c 30 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 ) col1 FROM 
6aa0: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
6ab0: 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 6f 6e  .3..64..80....on
6ac0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
6ad0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
6ae0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
6af0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
6b00: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6b10: 20 6c 61 62 65 6c 2d 32 30 37 0d 0a 53 45 4c 45   label-207..SELE
6b20: 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 28 20 2b  CT ALL + CAST( +
6b30: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 53 49   cor0.col2 AS SI
6b40: 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 30 20  GNED ) + - col0 
6b50: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  * col2 FROM tab1
6b60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6b70: 2d 31 30 38 0d 0a 2d 33 35 39 31 0d 0a 2d 37 35  -108..-3591..-75
6b80: 38 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  84....skipif mys
6b90: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
6ba0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
6bb0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30 37 0d 0a  sort label-207..
6bc0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53  SELECT ALL + CAS
6bd0: 54 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  T ( + cor0.col2 
6be0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d  AS INTEGER ) + -
6bf0: 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f   col0 * col2 FRO
6c00: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
6c10: 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 33 35 39  ----..-108..-359
6c20: 31 0d 0a 2d 37 35 38 34 0d 0a 0d 0a 71 75 65 72  1..-7584....quer
6c30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6c40: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a  ECT ALL - col2 *
6c50: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
6c60: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
6c70: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30  0..----..-1..-10
6c80: 38 39 0d 0a 2d 36 37 32 34 0d 0a 0d 0a 71 75 65  89..-6724....que
6c90: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
6ca0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 36 38  LECT DISTINCT 68
6cb0: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
6cc0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  0 cor0..----..10
6cd0: 31 0d 0a 31 35 30 0d 0a 36 39 0d 0a 0d 0a 6f 6e  1..150..69....on
6ce0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
6cf0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
6d00: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
6d10: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
6d20: 6f 72 74 20 6c 61 62 65 6c 2d 32 31 30 0d 0a 53  ort label-210..S
6d30: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
6d40: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 44   + col2 * col1 D
6d50: 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  IV - cor0.col1 +
6d60: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
6d70: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
6d80: 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a  0..----..53..9..
6d90: 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  96....skipif mys
6da0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
6db0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
6dc0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31 30 0d 0a  sort label-210..
6dd0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
6de0: 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  + + col2 * col1 
6df0: 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  / - cor0.col1 + 
6e00: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
6e10: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
6e20: 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39  ..----..53..9..9
6e30: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
6e40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
6e50: 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 2a 20 36  ol2 ) + col0 * 6
6e60: 37 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  7 * + col2 AS co
6e70: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
6e80: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 39  cor0..----..1269
6e90: 30 0d 0a 31 33 35 39 30 32 0d 0a 32 30 31 31 37  0..135902..20117
6ea0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
6eb0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
6ec0: 54 49 4e 43 54 20 2b 20 39 37 20 46 52 4f 4d 20  TINCT + 97 FROM 
6ed0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
6ee0: 2d 2d 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  --..97....query 
6ef0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6f00: 54 20 2d 20 63 6f 6c 31 20 2b 20 32 33 20 2a 20  T - col1 + 23 * 
6f10: 74 61 62 32 2e 63 6f 6c 32 20 2b 20 74 61 62 32  tab2.col2 + tab2
6f20: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
6f30: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab2..----..5
6f40: 36 35 0d 0a 36 31 37 0d 0a 38 39 35 0d 0a 0d 0a  65..617..895....
6f50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6f60: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
6f70: 6c 30 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 - col0 FROM t
6f80: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 38 0d  ab0..----..-178.
6f90: 0a 2d 34 38 0d 0a 2d 37 30 0d 0a 0d 0a 6f 6e 6c  .-48..-70....onl
6fa0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
6fb0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
6fc0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
6fd0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
6fe0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6ff0: 6c 61 62 65 6c 2d 32 31 35 0d 0a 53 45 4c 45 43  label-215..SELEC
7000: 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 38  T ALL col1 * + 8
7010: 34 20 2d 20 2d 20 28 20 74 61 62 31 2e 63 6f 6c  4 - - ( tab1.col
7020: 30 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  0 + CAST( NULL A
7030: 53 20 53 49 47 4e 45 44 20 29 20 29 20 46 52 4f  S SIGNED ) ) FRO
7040: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab1..----..NU
7050: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
7060: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
7070: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
7080: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7090: 20 6c 61 62 65 6c 2d 32 31 35 0d 0a 53 45 4c 45   label-215..SELE
70a0: 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20  CT ALL col1 * + 
70b0: 38 34 20 2d 20 2d 20 28 20 74 61 62 31 2e 63 6f  84 - - ( tab1.co
70c0: 6c 30 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  l0 + CAST ( NULL
70d0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 29 20   AS INTEGER ) ) 
70e0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
70f0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
7100: 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
7110: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
7120: 54 49 4e 43 54 20 2b 20 36 36 20 2b 20 28 20 63  TINCT + 66 + ( c
7130: 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol1 ) FROM tab0 
7140: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
7150: 35 32 0d 0a 31 35 37 0d 0a 31 36 33 0d 0a 0d 0a  52..157..163....
7160: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
7170: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
7180: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
7190: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
71a0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
71b0: 72 74 20 6c 61 62 65 6c 2d 32 31 37 0d 0a 53 45  rt label-217..SE
71c0: 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 43 41 53  LECT ALL + + CAS
71d0: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
71e0: 44 20 29 20 2a 20 32 35 20 2a 20 2d 20 63 6f 6c  D ) * 25 * - col
71f0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
7200: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
7210: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
7220: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
7230: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
7240: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
7250: 62 65 6c 2d 32 31 37 0d 0a 53 45 4c 45 43 54 20  bel-217..SELECT 
7260: 41 4c 4c 20 2b 20 2b 20 43 41 53 54 20 28 20 4e  ALL + + CAST ( N
7270: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
7280: 20 2a 20 32 35 20 2a 20 2d 20 63 6f 6c 30 20 46   * 25 * - col0 F
7290: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
72a0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
72b0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
72c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
72d0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
72e0: 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63   col1 + + cor0.c
72f0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
7300: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
7310: 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c  ..173..98....onl
7320: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
7330: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
7340: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
7350: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
7360: 72 74 20 6c 61 62 65 6c 2d 32 31 39 0d 0a 53 45  rt label-219..SE
7370: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20  LECT + col0 DIV 
7380: 34 38 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63  48 + + col1 AS c
7390: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
73a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d   cor0..----..86.
73b0: 0a 39 32 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69  .92..97....skipi
73c0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
73d0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
73e0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
73f0: 32 31 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  219..SELECT + co
7400: 6c 30 20 2f 20 34 38 20 2b 20 2b 20 63 6f 6c 31  l0 / 48 + + col1
7410: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
7420: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7430: 0d 0a 38 36 0d 0a 39 32 0d 0a 39 37 0d 0a 0d 0a  ..86..92..97....
7440: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
7450: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
7460: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
7470: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
7480: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 30 0d  wsort label-220.
7490: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
74a0: 20 63 6f 6c 30 20 44 49 56 20 34 39 20 41 53 20   col0 DIV 49 AS 
74b0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
74c0: 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b  ----..0..1....sk
74d0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
74e0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
74f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
7500: 65 6c 2d 32 32 30 0d 0a 53 45 4c 45 43 54 20 44  el-220..SELECT D
7510: 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2f 20 34  ISTINCT col0 / 4
7520: 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  9 AS col2 FROM t
7530: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  ab2..----..0..1.
7540: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7550: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74  rt..SELECT ALL t
7560: 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  ab1.col1 * - col
7570: 32 20 2a 20 28 20 2b 20 63 6f 6c 32 20 29 20 41  2 * ( + col2 ) A
7580: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
7590: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 38 30 38 0d  ..----..-119808.
75a0: 0a 2d 33 32 34 39 30 0d 0a 2d 37 35 38 31 36 0d  .-32490..-75816.
75b0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
75c0: 72 74 0d 0a 53 45 4c 45 43 54 20 33 33 20 2a 20  rt..SELECT 33 * 
75d0: 2b 20 37 34 20 2b 20 74 61 62 30 2e 63 6f 6c 30  + 74 + tab0.col0
75e0: 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
75f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7600: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
7610: 20 74 6f 20 66 66 31 63 62 30 39 31 34 34 63 30   to ff1cb09144c0
7620: 31 33 64 37 32 39 38 65 64 31 32 32 61 35 34 35  13d7298ed122a545
7630: 35 31 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5134....query I 
7640: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7650: 41 4c 4c 20 2d 20 28 20 2d 20 74 61 62 31 2e 63  ALL - ( - tab1.c
7660: 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol2 ) AS col2 FR
7670: 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
7680: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
7690: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
76a0: 20 38 30 63 61 30 61 31 63 63 33 33 37 61 37 37   80ca0a1cc337a77
76b0: 31 34 61 38 39 39 30 61 37 36 34 63 66 64 62 31  14a8990a764cfdb1
76c0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
76d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
76e0: 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 28 20 2d 20   - + col0 * ( - 
76f0: 63 6f 72 30 2e 63 6f 6c 31 20 29 20 41 53 20 63  cor0.col1 ) AS c
7700: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
7710: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36   cor0..----..206
7720: 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d 0a 0d  4..3395..8099...
7730: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7740: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
7750: 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  T + col1 + + col
7760: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
7770: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
7780: 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a 36 32 0d 0a  -..118..34..62..
7790: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
77a0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
77b0: 6c 32 20 2a 20 38 39 20 2b 20 63 6f 6c 31 20 46  l2 * 89 + col1 F
77c0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
77d0: 0d 0a 2d 2d 2d 2d 0d 0a 34 38 33 32 0d 0a 35 30  ..----..4832..50
77e0: 38 33 0d 0a 38 35 35 37 0d 0a 0d 0a 71 75 65 72  83..8557....quer
77f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7800: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b  ECT ALL - col0 +
7810: 20 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   9 AS col1 FROM 
7820: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
7830: 2d 2d 0d 0a 2d 36 39 0d 0a 2d 37 30 0d 0a 32 0d  --..-69..-70..2.
7840: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7850: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
7860: 4e 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  NCT - tab1.col0 
7870: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
7880: 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  1, tab2 AS cor0,
7890: 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
78a0: 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38  ---..-3..-64..-8
78b0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
78c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
78d0: 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d  TINCT - col0 + -
78e0: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41   col0 * + col0 A
78f0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
7900: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7910: 2d 31 32 36 30 0d 0a 2d 36 30 30 0d 0a 2d 38 30  -1260..-600..-80
7920: 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
7930: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
7940: 63 6f 6c 31 20 2a 20 2d 20 28 20 28 20 2b 20 63  col1 * - ( ( + c
7950: 6f 6c 31 20 29 20 29 20 46 52 4f 4d 20 74 61 62  ol1 ) ) FROM tab
7960: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
7970: 0a 2d 32 38 39 0d 0a 2d 33 34 38 31 0d 0a 2d 39  .-289..-3481..-9
7980: 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  61....onlyif mys
7990: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
79a0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
79b0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
79c0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
79d0: 6c 2d 32 33 31 0d 0a 53 45 4c 45 43 54 20 2d 20  l-231..SELECT - 
79e0: 2d 20 63 6f 6c 30 20 2b 20 38 33 20 2a 20 63 6f  - col0 + 83 * co
79f0: 6c 32 20 44 49 56 20 2d 20 63 6f 6c 31 20 46 52  l2 DIV - col1 FR
7a00: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
7a10: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 0d 0a 2d 36 35  .----..-106..-65
7a20: 0d 0a 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..42....skipif m
7a30: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
7a40: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
7a50: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 31  owsort label-231
7a60: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
7a70: 30 20 2b 20 38 33 20 2a 20 63 6f 6c 32 20 2f 20  0 + 83 * col2 / 
7a80: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
7a90: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7aa0: 2d 31 30 36 0d 0a 2d 36 35 0d 0a 34 32 0d 0a 0d  -106..-65..42...
7ab0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7ac0: 0d 0a 53 45 4c 45 43 54 20 39 35 20 2d 20 32 32  ..SELECT 95 - 22
7ad0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
7ae0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 0d 0a 37 33  r0..----..73..73
7af0: 0d 0a 37 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..73....onlyif m
7b00: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
7b10: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
7b20: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
7b30: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
7b40: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
7b50: 2d 32 33 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  -233..SELECT + +
7b60: 20 32 32 20 2a 20 2d 20 37 20 2b 20 63 6f 6c 31   22 * - 7 + col1
7b70: 20 2d 20 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c   - + CAST( + col
7b80: 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  2 AS SIGNED ) * 
7b90: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
7ba0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7bb0: 2d 31 36 32 39 0d 0a 2d 37 38 33 0d 0a 2d 39 36  -1629..-783..-96
7bc0: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
7bd0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
7be0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
7bf0: 6f 72 74 20 6c 61 62 65 6c 2d 32 33 33 0d 0a 53  ort label-233..S
7c00: 45 4c 45 43 54 20 2b 20 2b 20 32 32 20 2a 20 2d  ELECT + + 22 * -
7c10: 20 37 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 43 41   7 + col1 - + CA
7c20: 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 49  ST ( + col2 AS I
7c30: 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c  NTEGER ) * + col
7c40: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
7c50: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 39  or0..----..-1629
7c60: 0d 0a 2d 37 38 33 0d 0a 2d 39 36 30 0d 0a 0d 0a  ..-783..-960....
7c70: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7c80: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
7c90: 20 2b 20 32 30 20 41 53 20 63 6f 6c 30 20 46 52   + 20 AS col0 FR
7ca0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
7cb0: 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 0d 0a 73 6b 69  .----..20....ski
7cc0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
7cd0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
7ce0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
7cf0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
7d00: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
7d10: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
7d20: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20  STINCT - col1 * 
7d30: 2b 20 39 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  + 92 col1 FROM t
7d40: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
7d50: 2d 0d 0a 2d 31 35 36 34 0d 0a 2d 32 38 35 32 0d  -..-1564..-2852.
7d60: 0a 2d 35 34 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-5428....onlyif
7d70: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
7d80: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
7d90: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
7da0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7db0: 6c 61 62 65 6c 2d 32 33 36 0d 0a 53 45 4c 45 43  label-236..SELEC
7dc0: 54 20 41 4c 4c 20 2b 20 2d 20 43 41 53 54 28 20  T ALL + - CAST( 
7dd0: 2b 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  + col2 AS SIGNED
7de0: 20 29 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f   ) DIV - cor0.co
7df0: 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 + col0 FROM t
7e00: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
7e10: 2d 0d 0a 32 31 0d 0a 36 34 0d 0a 38 31 0d 0a 0d  -..21..64..81...
7e20: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
7e30: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
7e40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7e50: 6c 61 62 65 6c 2d 32 33 36 0d 0a 53 45 4c 45 43  label-236..SELEC
7e60: 54 20 41 4c 4c 20 2b 20 2d 20 43 41 53 54 20 28  T ALL + - CAST (
7e70: 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   + col2 AS INTEG
7e80: 45 52 20 29 20 2f 20 2d 20 63 6f 72 30 2e 63 6f  ER ) / - cor0.co
7e90: 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 + col0 FROM t
7ea0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
7eb0: 2d 0d 0a 32 31 0d 0a 36 34 0d 0a 38 31 0d 0a 0d  -..21..64..81...
7ec0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7ed0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
7ee0: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col2 * + col1 + 
7ef0: 2d 20 35 34 20 46 52 4f 4d 20 74 61 62 30 20 41  - 54 FROM tab0 A
7f00: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
7f10: 30 0d 0a 32 38 37 30 0d 0a 37 34 39 39 0d 0a 0d  0..2870..7499...
7f20: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7f30: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 31 35 20  ..SELECT + + 15 
7f40: 2b 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 41  + + ( + col2 ) A
7f50: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
7f60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7f70: 31 36 0d 0a 34 38 0d 0a 39 37 0d 0a 0d 0a 71 75  16..48..97....qu
7f80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7f90: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
7fa0: 20 63 6f 6c 32 20 2b 20 32 34 20 46 52 4f 4d 20   col2 + 24 FROM 
7fb0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 38 0d  tab0..----..-58.
7fc0: 0a 2d 39 0d 0a 32 33 0d 0a 0d 0a 6f 6e 6c 79 69  .-9..23....onlyi
7fd0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
7fe0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
7ff0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
8000: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8010: 20 6c 61 62 65 6c 2d 32 34 30 0d 0a 53 45 4c 45   label-240..SELE
8020: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
8030: 20 44 49 56 20 74 61 62 31 2e 63 6f 6c 32 20 46   DIV tab1.col2 F
8040: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
8050: 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
8060: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
8070: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
8080: 6f 72 74 20 6c 61 62 65 6c 2d 32 34 30 0d 0a 53  ort label-240..S
8090: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
80a0: 6f 6c 32 20 2f 20 74 61 62 31 2e 63 6f 6c 32 20  ol2 / tab1.col2 
80b0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
80c0: 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
80d0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
80e0: 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c  - ( col0 ) + col
80f0: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
8100: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
8110: 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30  -..110..132..180
8120: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
8130: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
8140: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
8150: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
8160: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
8170: 32 34 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  242..SELECT DIST
8180: 49 4e 43 54 20 33 39 20 44 49 56 20 63 6f 72 30  INCT 39 DIV cor0
8190: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
81a0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
81b0: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 0d 0a 0d 0a 73  .----..1..3....s
81c0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
81d0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
81e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
81f0: 62 65 6c 2d 32 34 32 0d 0a 53 45 4c 45 43 54 20  bel-242..SELECT 
8200: 44 49 53 54 49 4e 43 54 20 33 39 20 2f 20 63 6f  DISTINCT 39 / co
8210: 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20  r0.col1 AS col1 
8220: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
8230: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 0d 0a 0d  0..----..1..3...
8240: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8250: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
8260: 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 35 39 20  ol2 + col1 * 59 
8270: 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
8280: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
8290: 0d 0a 2d 31 32 38 33 30 0d 0a 2d 32 37 31 35 34  ..-12830..-27154
82a0: 34 0d 0a 2d 37 39 32 37 35 0d 0a 0d 0a 71 75 65  4..-79275....que
82b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
82c0: 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 63  LECT ALL - ( - c
82d0: 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 30 20 41  ol2 ) + - col0 A
82e0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
82f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8300: 2d 34 31 0d 0a 2d 35 32 0d 0a 32 30 0d 0a 0d 0a  -41..-52..20....
8310: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8320: 0a 53 45 4c 45 43 54 20 2b 20 34 33 20 2a 20 2d  .SELECT + 43 * -
8330: 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
8340: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
8350: 2d 2d 0d 0a 2d 31 33 33 33 0d 0a 2d 32 35 33 37  --..-1333..-2537
8360: 0d 0a 2d 37 33 31 0d 0a 0d 0a 71 75 65 72 79 20  ..-731....query 
8370: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8380: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
8390: 30 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  0 * col2 * + col
83a0: 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  1 + + col2 FROM 
83b0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
83c0: 2d 2d 0d 0a 31 31 39 36 37 38 0d 0a 35 31 30 37  --..119678..5107
83d0: 32 0d 0a 35 38 38 36 0d 0a 0d 0a 71 75 65 72 79  2..5886....query
83e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
83f0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
8400: 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col1 + + cor0.co
8410: 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 * col1 FROM t
8420: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
8430: 2d 0d 0a 31 33 36 30 0d 0a 32 34 38 0d 0a 34 36  -..1360..248..46
8440: 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
8450: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
8460: 31 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  10 FROM tab1 cor
8470: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31  0..----..-10..-1
8480: 30 0d 0a 2d 31 30 0d 0a 0d 0a 71 75 65 72 79 20  0..-10....query 
8490: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
84a0: 54 20 2d 20 2d 20 33 38 20 2a 20 63 6f 6c 32 20  T - - 38 * col2 
84b0: 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  + ( cor0.col0 * 
84c0: 2d 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  - col0 ) FROM ta
84d0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
84e0: 0d 0a 2d 31 39 33 30 0d 0a 2d 32 37 35 32 0d 0a  ..-1930..-2752..
84f0: 32 30 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2043....query I 
8500: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8510: 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30 20 2a 20  col1 - - col0 * 
8520: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
8530: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38  M tab1..----..18
8540: 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d 0a 0d  8..3658..7693...
8550: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
8560: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
8570: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
8580: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
8590: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
85a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
85b0: 54 20 36 38 20 2b 20 2b 20 63 6f 6c 30 20 63 6f  T 68 + + col0 co
85c0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
85d0: 2d 2d 0d 0a 31 33 32 0d 0a 31 34 38 0d 0a 37 31  --..132..148..71
85e0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
85f0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
8600: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
8610: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
8620: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
8630: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 32  owsort label-252
8640: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
8650: 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2d   col2 + col2 * -
8660: 20 43 41 53 54 28 20 2b 20 63 6f 6c 32 20 41 53   CAST( + col2 AS
8670: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
8680: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
8690: 2d 0d 0a 2d 32 39 37 30 0d 0a 2d 33 33 30 36 0d  -..-2970..-3306.
86a0: 0a 2d 39 33 31 32 0d 0a 0d 0a 73 6b 69 70 69 66  .-9312....skipif
86b0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
86c0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
86d0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
86e0: 35 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  52..SELECT ALL +
86f0: 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a   - col2 + col2 *
8700: 20 2d 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 32   - CAST ( + col2
8710: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
8720: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
8730: 0a 2d 2d 2d 2d 0d 0a 2d 32 39 37 30 0d 0a 2d 33  .----..-2970..-3
8740: 33 30 36 0d 0a 2d 39 33 31 32 0d 0a 0d 0a 73 6b  306..-9312....sk
8750: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
8760: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
8770: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
8780: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
8790: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
87a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
87b0: 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30  ISTINCT - - cor0
87c0: 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 63  .col2 * + col1 c
87d0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
87e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a  r0..----..1248..
87f0: 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 6f 6e 6c  1404..570....onl
8800: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
8810: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
8820: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
8830: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
8840: 72 74 20 6c 61 62 65 6c 2d 32 35 34 0d 0a 53 45  rt label-254..SE
8850: 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  LECT + + col2 + 
8860: 36 39 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63  69 DIV col2 AS c
8870: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
8880: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d   cor0..----..55.
8890: 0a 35 38 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69  .58..96....skipi
88a0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
88b0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
88c0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
88d0: 32 35 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  254..SELECT + + 
88e0: 63 6f 6c 32 20 2b 20 36 39 20 2f 20 63 6f 6c 32  col2 + 69 / col2
88f0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
8900: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
8910: 0d 0a 35 35 0d 0a 35 38 0d 0a 39 36 0d 0a 0d 0a  ..55..58..96....
8920: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
8930: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
8940: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
8950: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
8960: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
8970: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8980: 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 34 35   - - col1 + - 45
8990: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
89a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
89b0: 31 39 0d 0a 2d 33 32 0d 0a 2d 33 35 0d 0a 0d 0a  19..-32..-35....
89c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
89d0: 0a 53 45 4c 45 43 54 20 2b 20 38 30 20 2b 20 2d  .SELECT + 80 + -
89e0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
89f0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34  OM tab2..----..4
8a00: 32 0d 0a 35 33 0d 0a 35 34 0d 0a 0d 0a 71 75 65  2..53..54....que
8a10: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
8a20: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  LECT + col2 * co
8a30: 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l2 + col0 FROM t
8a40: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
8a50: 2d 0d 0a 32 39 31 39 0d 0a 33 33 31 33 0d 0a 39  -..2919..3313..9
8a60: 32 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  296....onlyif my
8a70: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
8a80: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
8a90: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
8aa0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
8ab0: 65 6c 2d 32 35 38 0d 0a 53 45 4c 45 43 54 20 2b  el-258..SELECT +
8ac0: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 63   col2 * col2 + c
8ad0: 6f 6c 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol1 DIV cor0.col
8ae0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
8af0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 32 34 0d  or0..----..2924.
8b00: 0a 33 32 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a 73  .3249..9216....s
8b10: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
8b20: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
8b30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
8b40: 62 65 6c 2d 32 35 38 0d 0a 53 45 4c 45 43 54 20  bel-258..SELECT 
8b50: 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20  + col2 * col2 + 
8b60: 63 6f 6c 31 20 2f 20 63 6f 72 30 2e 63 6f 6c 30  col1 / cor0.col0
8b70: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
8b80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 32 34 0d 0a  r0..----..2924..
8b90: 33 32 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a 71 75  3249..9216....qu
8ba0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8bb0: 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 28 20 63  ELECT col2 + ( c
8bc0: 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 31 20 46  ol1 ) * - col1 F
8bd0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
8be0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 36 33 0d 0a 2d  ..----..-7363..-
8bf0: 38 31 39 39 0d 0a 2d 39 34 30 38 0d 0a 0d 0a 71  8199..-9408....q
8c00: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8c10: 53 45 4c 45 43 54 20 41 4c 4c 20 32 20 2a 20 2d  SELECT ALL 2 * -
8c20: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
8c30: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
8c40: 31 37 32 0d 0a 2d 31 38 32 0d 0a 2d 31 39 34 0d  172..-182..-194.
8c50: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8c60: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
8c70: 4e 43 54 20 2b 20 28 20 2b 20 63 6f 6c 32 20 2b  NCT + ( + col2 +
8c80: 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   + col2 ) FROM t
8c90: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a  ab1..----..108..
8ca0: 31 31 34 0d 0a 31 39 32 0d 0a 0d 0a 71 75 65 72  114..192....quer
8cb0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8cc0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62  ECT DISTINCT tab
8cd0: 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  0.col2 AS col0 F
8ce0: 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63  ROM tab0, tab1 c
8cf0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33  or0..----..1..33
8d00: 0d 0a 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..82....onlyif m
8d10: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
8d20: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
8d30: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
8d40: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
8d50: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8d60: 2d 32 36 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -263..SELECT DIS
8d70: 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 43 41 53  TINCT col1 + CAS
8d80: 54 28 20 2d 20 63 6f 6c 32 20 41 53 20 53 49 47  T( - col2 AS SIG
8d90: 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20  NED ) FROM tab0 
8da0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
8db0: 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70  3..9..96....skip
8dc0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
8dd0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
8de0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8df0: 2d 32 36 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -263..SELECT DIS
8e00: 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 43 41 53  TINCT col1 + CAS
8e10: 54 20 28 20 2d 20 63 6f 6c 32 20 41 53 20 49 4e  T ( - col2 AS IN
8e20: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
8e30: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
8e40: 0a 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75  .53..9..96....qu
8e50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8e60: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 34 39  ELECT ALL - + 49
8e70: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
8e80: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
8e90: 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
8ea0: 68 61 73 68 69 6e 67 20 74 6f 20 61 64 66 63 63  hashing to adfcc
8eb0: 62 31 30 63 39 34 36 38 38 32 35 64 39 39 36 31  b10c9468825d9961
8ec0: 65 33 36 31 33 31 34 30 66 38 39 0d 0a 0d 0a 71  e3613140f89....q
8ed0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8ee0: 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 32  SELECT tab2.col2
8ef0: 20 2d 20 37 30 20 46 52 4f 4d 20 74 61 62 32 2c   - 70 FROM tab2,
8f00: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
8f10: 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
8f20: 73 68 69 6e 67 20 74 6f 20 64 37 36 30 30 66 39  shing to d7600f9
8f30: 30 37 63 32 64 35 37 32 61 61 65 63 33 39 34 61  07c2d572aaec394a
8f40: 36 31 65 65 31 63 36 30 62 0d 0a 0d 0a 71 75 65  61ee1c60b....que
8f50: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
8f60: 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  LECT col0 + + co
8f70: 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l2 * - col0 AS c
8f80: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
8f90: 2d 2d 2d 0d 0a 2d 31 38 32 0d 0a 2d 31 39 35 30  ---..-182..-1950
8fa0: 0d 0a 2d 32 39 32 33 0d 0a 0d 0a 71 75 65 72 79  ..-2923....query
8fb0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8fc0: 43 54 20 2b 20 33 32 20 2a 20 63 6f 72 30 2e 63  CT + 32 * cor0.c
8fd0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol0 FROM tab1, t
8fe0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
8ff0: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
9000: 69 6e 67 20 74 6f 20 62 30 32 31 31 32 34 61 36  ing to b021124a6
9010: 37 66 30 33 62 64 36 39 30 62 66 38 35 30 38 39  7f03bd690bf85089
9020: 30 33 39 63 36 35 34 0d 0a 0d 0a 71 75 65 72 79  039c654....query
9030: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9040: 43 54 20 41 4c 4c 20 2b 20 36 39 20 2b 20 2d 20  CT ALL + 69 + - 
9050: 33 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  31 AS col2 FROM 
9060: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 0d 0a  tab0..----..38..
9070: 33 38 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69 66  38..38....skipif
9080: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
9090: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
90a0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
90b0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
90c0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
90d0: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
90e0: 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  * + col2 col2 FR
90f0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
9100: 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a  89..2028..3002..
9110: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
9120: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
9130: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
9140: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
9150: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
9160: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9170: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
9180: 74 61 62 31 2e 63 6f 6c 32 20 29 20 2a 20 63 6f  tab1.col2 ) * co
9190: 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
91a0: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 36 0d 0a  1..----..-2916..
91b0: 2d 33 32 34 39 0d 0a 2d 39 32 31 36 0d 0a 0d 0a  -3249..-9216....
91c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
91d0: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 34 20 2a 20  .SELECT + - 4 * 
91e0: 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20  + col2 + - col2 
91f0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
9200: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 30 0d 0a 2d  0..----..-270..-
9210: 32 38 35 0d 0a 2d 34 38 30 0d 0a 0d 0a 73 6b 69  285..-480....ski
9220: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
9230: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
9240: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
9250: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
9260: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
9270: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
9280: 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  + col0 * - col1 
9290: 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52  + + col0 col2 FR
92a0: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
92b0: 2d 2d 0d 0a 32 30 38 38 0d 0a 33 34 33 30 0d 0a  --..2088..3430..
92c0: 38 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8188....query I 
92d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
92e0: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
92f0: 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 41 53  * - tab1.col2 AS
9300: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
9310: 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38  .----..162..3648
9320: 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20  ..7680....query 
9330: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9340: 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 2b 20 63  T ALL col1 + + c
9350: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
9360: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38   tab2..----..118
9370: 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72  ..34..62....quer
9380: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9390: 45 43 54 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ECT col0 FROM ta
93a0: 62 30 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c  b0 WHERE NOT NUL
93b0: 4c 20 49 4e 20 28 20 63 6f 6c 30 20 29 0d 0a 2d  L IN ( col0 )..-
93c0: 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
93d0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
93e0: 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d  ol2 + + col2 * -
93f0: 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f   tab1.col1 AS co
9400: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
9410: 2d 2d 0d 0a 2d 31 31 35 32 0d 0a 2d 31 33 35 30  --..-1152..-1350
9420: 0d 0a 2d 35 31 33 0d 0a 0d 0a 71 75 65 72 79 20  ..-513....query 
9430: 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
9440: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
9450: 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 28  ROM tab1 WHERE (
9460: 20 4e 55 4c 4c 20 29 20 4e 4f 54 20 49 4e 20 28   NULL ) NOT IN (
9470: 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 29   - col1 + col0 )
9480: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
9490: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
94a0: 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 63  T ALL + col1 + c
94b0: 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 * col0 AS co
94c0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
94d0: 2d 2d 0d 0a 32 30 38 37 0d 0a 32 32 30 0d 0a 33  --..2087..220..3
94e0: 30 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  019....query I r
94f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
9500: 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  LL + col1 * col2
9510: 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + + col0 FROM t
9520: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 32 0d  ab2..----..1612.
9530: 0a 37 32 35 0d 0a 38 34 34 0d 0a 0d 0a 71 75 65  .725..844....que
9540: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9550: 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  LECT col0 * - co
9560: 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  l0 * col1 + - co
9570: 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 * col1 FROM t
9580: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 32  ab0..----..-1282
9590: 33 34 0d 0a 2d 35 36 39 33 32 0d 0a 2d 37 32 39  34..-56932..-729
95a0: 30 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  092....query III
95b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
95c0: 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30   ALL * FROM tab0
95d0: 20 57 48 45 52 45 20 4e 4f 54 20 28 20 4e 55 4c   WHERE NOT ( NUL
95e0: 4c 20 29 20 42 45 54 57 45 45 4e 20 28 20 2b 20  L ) BETWEEN ( + 
95f0: 63 6f 6c 31 20 29 20 41 4e 44 20 4e 55 4c 4c 0d  col1 ) AND NULL.
9600: 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
9610: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9620: 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 63   col2 + col2 * c
9630: 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 + col2 AS co
9640: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
9650: 2d 2d 0d 0a 31 35 38 36 0d 0a 37 32 32 0d 0a 38  --..1586..722..8
9660: 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  91....query I ro
9670: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
9680: 4c 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  L col2 AS col2 F
9690: 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 28  ROM tab1 WHERE (
96a0: 20 4e 55 4c 4c 20 29 20 4e 4f 54 20 42 45 54 57   NULL ) NOT BETW
96b0: 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e 55 4c  EEN NULL AND NUL
96c0: 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  L..----....query
96d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
96e0: 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2d 20 2d 20  CT ALL col1 - - 
96f0: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
9700: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
9710: 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65  7..38..96....que
9720: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9730: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
9740: 63 6f 6c 30 20 2a 20 74 61 62 31 2e 63 6f 6c 30  col0 * tab1.col0
9750: 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + + col1 FROM t
9760: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 38 36  ab1..----..-4086
9770: 0d 0a 2d 36 33 38 37 0d 0a 31 37 0d 0a 0d 0a 71  ..-6387..17....q
9780: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9790: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
97a0: 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20  FROM tab2 WHERE 
97b0: 4e 55 4c 4c 20 42 45 54 57 45 45 4e 20 4e 55 4c  NULL BETWEEN NUL
97c0: 4c 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  L AND NULL..----
97d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
97e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 32  ort..SELECT tab2
97f0: 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46  .col1 * + col2 F
9800: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
9810: 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a  1534..646..837..
9820: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9830: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
9840: 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f  col0 * col1 + co
9850: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
9860: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 36  tab1..----..1136
9870: 0d 0a 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a 71 75  ..132..697....qu
9880: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9890: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d  ELECT - col1 + -
98a0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
98b0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
98c0: 35 35 0d 0a 2d 35 38 0d 0a 2d 38 35 0d 0a 0d 0a  55..-58..-85....
98d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
98e0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
98f0: 20 2d 20 39 30 20 46 52 4f 4d 20 74 61 62 31 20   - 90 FROM tab1 
9900: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 30 0d  cor0..----..-90.
9910: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9920: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
9930: 31 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  1 + col1 * col2 
9940: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
9950: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a 32 39  0..----..194..29
9960: 32 34 0d 0a 37 35 35 33 0d 0a 0d 0a 71 75 65 72  24..7553....quer
9970: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9980: 45 43 54 20 41 4c 4c 20 2d 20 30 20 2b 20 63 6f  ECT ALL - 0 + co
9990: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
99a0: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
99b0: 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71  .86..91..97....q
99c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
99d0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
99e0: 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  - + col0 * + col
99f0: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
9a00: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a  or0..----..-35..
9a10: 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 73  -7298..-792....s
9a20: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
9a30: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
9a40: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
9a50: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
9a60: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
9a70: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9a80: 38 37 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20 46  87 * col1 col2 F
9a90: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
9aa0: 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 39 0d 0a 32 36  ..----..1479..26
9ab0: 39 37 0d 0a 35 31 33 33 0d 0a 0d 0a 6f 6e 6c 79  97..5133....only
9ac0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
9ad0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
9ae0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
9af0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9b00: 74 20 6c 61 62 65 6c 2d 32 39 35 0d 0a 53 45 4c  t label-295..SEL
9b10: 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63  ECT - col0 + + c
9b20: 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56  ol2 + - col2 DIV
9b30: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
9b40: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
9b50: 33 35 0d 0a 2d 38 0d 0a 38 0d 0a 0d 0a 73 6b 69  35..-8..8....ski
9b60: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
9b70: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
9b80: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
9b90: 6c 2d 32 39 35 0d 0a 53 45 4c 45 43 54 20 2d 20  l-295..SELECT - 
9ba0: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  col0 + + col2 + 
9bb0: 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 41 53  - col2 / col2 AS
9bc0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
9bd0: 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 38 0d 0a  .----..-35..-8..
9be0: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
9bf0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
9c00: 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 74 61 62 31   - col0 * - tab1
9c10: 2e 63 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c  .col1 + tab1.col
9c20: 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
9c30: 2d 0d 0a 31 30 34 0d 0a 31 30 35 33 0d 0a 36 35  -..104..1053..65
9c40: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
9c50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
9c60: 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 41 53 20  TINCT - col2 AS 
9c70: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 57  col0 FROM tab2 W
9c80: 48 45 52 45 20 4e 55 4c 4c 20 42 45 54 57 45 45  HERE NULL BETWEE
9c90: 4e 20 28 20 4e 55 4c 4c 20 29 20 41 4e 44 20 4e  N ( NULL ) AND N
9ca0: 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69  ULL..----....ski
9cb0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
9cc0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
9cd0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
9ce0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
9cf0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
9d00: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
9d10: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
9d20: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 63 6f  + col1 + col0 co
9d30: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
9d40: 2d 2d 0d 0a 2d 32 30 34 30 0d 0a 2d 33 33 36 30  --..-2040..-3360
9d50: 0d 0a 2d 38 30 31 30 0d 0a 0d 0a 71 75 65 72 79  ..-8010....query
9d60: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9d70: 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 31  CT DISTINCT tab1
9d80: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20  .col2 FROM tab1 
9d90: 57 48 45 52 45 20 4e 4f 54 20 2b 20 63 6f 6c 32  WHERE NOT + col2
9da0: 20 2a 20 2b 20 63 6f 6c 31 20 3e 20 4e 55 4c 4c   * + col1 > NULL
9db0: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
9dc0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9dd0: 54 20 63 6f 6c 32 20 2b 20 2d 20 74 61 62 30 2e  T col2 + - tab0.
9de0: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col2 * + col0 FR
9df0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
9e00: 33 34 0d 0a 2d 37 32 31 36 0d 0a 2d 37 35 39 0d  34..-7216..-759.
9e10: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9e20: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
9e30: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
9e40: 30 20 57 48 45 52 45 20 4e 4f 54 20 28 20 2d 20  0 WHERE NOT ( - 
9e50: 63 6f 6c 32 20 29 20 4e 4f 54 20 42 45 54 57 45  col2 ) NOT BETWE
9e60: 45 4e 20 28 20 63 6f 6c 30 20 29 20 41 4e 44 20  EN ( col0 ) AND 
9e70: 28 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20  ( + col1 - col2 
9e80: 2f 20 2d 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d  / - col1 )..----
9e90: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
9ea0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
9eb0: 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 72 30 2e 63  r0.col2 - cor0.c
9ec0: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
9ed0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
9ee0: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
9ef0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
9f00: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
9f10: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
9f20: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
9f30: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
9f40: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9f50: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
9f60: 20 2a 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f   * col0 col2 FRO
9f70: 4d 20 74 61 62 30 20 63 6f 72 30 20 57 48 45 52  M tab0 cor0 WHER
9f80: 45 20 28 20 4e 55 4c 4c 20 29 20 3e 3d 20 28 20  E ( NULL ) >= ( 
9f90: 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col1 )..----....
9fa0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9fb0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
9fc0: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63   col2 + + cor0.c
9fd0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
9fe0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
9ff0: 39 30 0d 0a 2d 33 32 33 39 0d 0a 2d 39 32 30 33  90..-3239..-9203
a000: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
a010: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
a020: 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  - col0 * - col2 
a030: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
a040: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  1 cor0..----..16
a050: 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d  2..3648..7680...
a060: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a070: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
a080: 54 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20  T - col0 - col2 
a090: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
a0a0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d  0..----..-121..-
a0b0: 31 37 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72  176..-57....quer
a0c0: 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
a0d0: 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
a0e0: 20 74 61 62 32 20 57 48 45 52 45 20 63 6f 6c 32   tab2 WHERE col2
a0f0: 20 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d   = NULL..----...
a100: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
a110: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
a120: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
a130: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
a140: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 38  owsort label-308
a150: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
a160: 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c  + - col0 DIV col
a170: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
a180: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 34  ab0..----..0..24
a190: 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..88....skipif m
a1a0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
a1b0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
a1c0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 38  owsort label-308
a1d0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
a1e0: 2b 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 32 20  + - col0 / col2 
a1f0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
a200: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 34 0d 0a  0..----..0..24..
a210: 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
a220: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
a230: 53 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 30  STINCT tab1.col0
a240: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
a250: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35  1..----..-16..-5
a260: 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..7....query I 
a270: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a280: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
a290: 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  * col1 + - col1 
a2a0: 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
a2b0: 4e 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 42 45 54  NOT NULL NOT BET
a2c0: 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e 55  WEEN NULL AND NU
a2d0: 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72  LL..----....quer
a2e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a2f0: 45 43 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c  ECT ALL tab0.col
a300: 30 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  0 * - col1 AS co
a310: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
a320: 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35  --..-2064..-3395
a330: 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 6f 6e 6c 79 69  ..-8099....onlyi
a340: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
a350: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
a360: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
a370: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a380: 20 6c 61 62 65 6c 2d 33 31 32 0d 0a 53 45 4c 45   label-312..SELE
a390: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
a3a0: 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   * + col2 + - co
a3b0: 6c 32 20 44 49 56 20 63 6f 6c 31 20 2d 20 63 6f  l2 DIV col1 - co
a3c0: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
a3d0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38  tab2..----..1508
a3e0: 0d 0a 36 30 36 0d 0a 38 31 30 0d 0a 0d 0a 73 6b  ..606..810....sk
a3f0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
a400: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
a410: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
a420: 65 6c 2d 33 31 32 0d 0a 53 45 4c 45 43 54 20 44  el-312..SELECT D
a430: 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b  ISTINCT col1 * +
a440: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2f   col2 + - col2 /
a450: 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 41 53 20   col1 - col2 AS 
a460: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
a470: 2d 2d 2d 2d 0d 0a 31 35 30 38 0d 0a 36 30 36 0d  ----..1508..606.
a480: 0a 38 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 49  .810....query II
a490: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a4a0: 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48  T * FROM tab2 WH
a4b0: 45 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20 63 6f  ERE NULL IN ( co
a4c0: 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 29 0d 0a 2d  l1 * - col2 )..-
a4d0: 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
a4e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
a4f0: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
a500: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
a510: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
a520: 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30  .162..3648..7680
a530: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
a540: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
a550: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
a560: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
a570: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
a580: 33 31 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  315..SELECT col1
a590: 20 44 49 56 20 2d 20 63 6f 6c 32 20 2b 20 63 6f   DIV - col2 + co
a5a0: 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 + col1 FROM t
a5b0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37  ab1..----..29..7
a5c0: 34 0d 0a 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..93....skipif 
a5d0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
a5e0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
a5f0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31  rowsort label-31
a600: 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f  5..SELECT col1 /
a610: 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b   - col2 + col0 +
a620: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
a630: 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39  .----..29..74..9
a640: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
a650: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
a660: 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 37 39   + + col1 * + 79
a670: 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 31 31 20 2a   * + col1 - 11 *
a680: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
a690: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
a6a0: 32 36 34 34 0d 0a 32 37 34 33 35 30 0d 0a 37 35  2644..274350..75
a6b0: 35 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  578....query III
a6c0: 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77  IIIIIIIIIIII row
a6d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46  sort..SELECT * F
a6e0: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41  ROM tab2, tab0 A
a6f0: 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72  S cor0, tab2 cor
a700: 31 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  1, tab0, tab0 AS
a710: 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor2..----..364
a720: 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  5 values hashing
a730: 20 74 6f 20 33 38 38 39 36 64 33 61 34 62 64 39   to 38896d3a4bd9
a740: 35 33 63 63 37 38 66 39 33 64 37 33 61 65 30 36  53cc78f93d73ae06
a750: 34 63 62 64 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  4cbd....onlyif m
a760: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
a770: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
a780: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
a790: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
a7a0: 62 65 6c 2d 33 31 38 0d 0a 53 45 4c 45 43 54 20  bel-318..SELECT 
a7b0: 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 36  ALL + col1 + - 6
a7c0: 35 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20  5 DIV col1 FROM 
a7d0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
a7e0: 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a  --..86..91..97..
a7f0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
a800: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
a810: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a820: 20 6c 61 62 65 6c 2d 33 31 38 0d 0a 53 45 4c 45   label-318..SELE
a830: 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20  CT ALL + col1 + 
a840: 2d 20 36 35 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  - 65 / col1 FROM
a850: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
a860: 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d  ---..86..91..97.
a870: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a880: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
a890: 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d  NCT + + col1 + -
a8a0: 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2d   col0 * col1 + -
a8b0: 20 63 6f 6c 30 20 2a 20 2b 20 32 32 20 2a 20 2b   col0 * + 22 * +
a8c0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
a8d0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
a8e0: 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 31 30 0d 0a 2d  .----..-14710..-
a8f0: 31 37 36 38 0d 0a 2d 32 33 39 30 37 0d 0a 0d 0a  1768..-23907....
a900: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
a910: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
a920: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
a930: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
a940: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 30 0d  wsort label-320.
a950: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
a960: 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20   + + col2 DIV + 
a970: 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  1 + - cor0.col1 
a980: 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  * col1 FROM tab0
a990: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a9a0: 2d 37 33 36 33 0d 0a 2d 38 31 39 39 0d 0a 2d 39  -7363..-8199..-9
a9b0: 34 30 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  408....skipif my
a9c0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
a9d0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
a9e0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 30 0d  wsort label-320.
a9f0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
aa00: 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 31 20   + + col2 / + 1 
aa10: 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  + - cor0.col1 * 
aa20: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
aa30: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
aa40: 33 36 33 0d 0a 2d 38 31 39 39 0d 0a 2d 39 34 30  363..-8199..-940
aa50: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
aa60: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
aa70: 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  or0.col2 AS col1
aa80: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
aa90: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63   AS cor0, tab1 c
aaa0: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
aab0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
aac0: 34 34 66 64 63 64 37 63 64 36 30 33 33 35 32 64  44fdcd7cd603352d
aad0: 34 64 31 32 37 38 31 31 64 31 36 34 63 63 31 65  4d127811d164cc1e
aae0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
aaf0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
ab00: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
ab10: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
ab20: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
ab30: 33 32 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  322..SELECT DIST
ab40: 49 4e 43 54 20 2d 20 63 6f 6c 31 20 44 49 56 20  INCT - col1 DIV 
ab50: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53  + col1 + col1 AS
ab60: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
ab70: 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 39 30 0d 0a 39  .----..85..90..9
ab80: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
ab90: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
aba0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
abb0: 6f 72 74 20 6c 61 62 65 6c 2d 33 32 32 0d 0a 53  ort label-322..S
abc0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
abd0: 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20 2b   col1 / + col1 +
abe0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
abf0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38  OM tab0..----..8
ac00: 35 0d 0a 39 30 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c  5..90..96....onl
ac10: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
ac20: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
ac30: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
ac40: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
ac50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
ac60: 6c 61 62 65 6c 2d 33 32 33 0d 0a 53 45 4c 45 43  label-323..SELEC
ac70: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53  T DISTINCT + CAS
ac80: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
ac90: 44 20 29 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f  D ) + - col1 FRO
aca0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
acb0: 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
acc0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
acd0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
ace0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
acf0: 33 32 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  323..SELECT DIST
ad00: 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55  INCT + CAST ( NU
ad10: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
ad20: 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
ad30: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b1 cor0..----..N
ad40: 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
ad50: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
ad60: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 41   col0 + - col1 A
ad70: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
ad80: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ad90: 2d 32 39 0d 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d  -29..-74..-93...
ada0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
adb0: 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c  ..SELECT - ( col
adc0: 32 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 ) + col1 FROM 
add0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
ade0: 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d  --..53..9..96...
adf0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ae00: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28 20 63  ..SELECT + + ( c
ae10: 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 72 30 2e 63  ol2 ) + - cor0.c
ae20: 6f 6c 32 20 2a 20 2d 20 32 20 46 52 4f 4d 20 74  ol2 * - 2 FROM t
ae30: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
ae40: 2d 0d 0a 31 36 32 0d 0a 31 37 31 0d 0a 32 38 38  -..162..171..288
ae50: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ae60: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
ae70: 49 4e 43 54 20 2b 20 2d 20 28 20 63 6f 6c 31 20  INCT + - ( col1 
ae80: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
ae90: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
aea0: 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39  -..-17..-31..-59
aeb0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
aec0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
aed0: 2b 20 2b 20 35 36 20 2a 20 63 6f 6c 30 20 41 53  + + 56 * col0 AS
aee0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
aef0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
af00: 36 38 0d 0a 33 35 38 34 0d 0a 34 34 38 30 0d 0a  68..3584..4480..
af10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
af20: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
af30: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  CT + col2 * + co
af40: 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  l0 - + col2 * - 
af50: 33 34 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  34 FROM tab2 AS 
af60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 37  cor0..----..1107
af70: 0d 0a 32 39 31 32 0d 0a 34 32 39 34 0d 0a 0d 0a  ..2912..4294....
af80: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
af90: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
afa0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
afb0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
afc0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 30 0d  wsort label-330.
afd0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
afe0: 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30  r0.col2 * + cor0
aff0: 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63  .col2 + col0 * c
b000: 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 31 20 41  ol1 DIV + col1 A
b010: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
b020: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
b030: 2d 31 33 36 35 0d 0a 2d 35 39 38 0d 0a 2d 37 32  -1365..-598..-72
b040: 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
b050: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
b060: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
b070: 6f 72 74 20 6c 61 62 65 6c 2d 33 33 30 0d 0a 53  ort label-330..S
b080: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30  ELECT ALL - cor0
b090: 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63  .col2 * + cor0.c
b0a0: 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol2 + col0 * col
b0b0: 31 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  1 / + col1 AS co
b0c0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
b0d0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36  cor0..----..-136
b0e0: 35 0d 0a 2d 35 39 38 0d 0a 2d 37 32 32 0d 0a 0d  5..-598..-722...
b0f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b100: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74  ..SELECT ALL + t
b110: 61 62 31 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  ab1.col2 * col1 
b120: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
b130: 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31  1..----..1248..1
b140: 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 6f 6e 6c 79  404..570....only
b150: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
b160: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
b170: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
b180: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b190: 74 20 6c 61 62 65 6c 2d 33 33 32 0d 0a 53 45 4c  t label-332..SEL
b1a0: 45 43 54 20 2b 20 63 6f 6c 32 20 44 49 56 20 34  ECT + col2 DIV 4
b1b0: 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  5 AS col0 FROM t
b1c0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
b1d0: 2d 0d 0a 31 0d 0a 31 0d 0a 32 0d 0a 0d 0a 73 6b  -..1..1..2....sk
b1e0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
b1f0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
b200: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b210: 65 6c 2d 33 33 32 0d 0a 53 45 4c 45 43 54 20 2b  el-332..SELECT +
b220: 20 63 6f 6c 32 20 2f 20 34 35 20 41 53 20 63 6f   col2 / 45 AS co
b230: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
b240: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  cor0..----..1..1
b250: 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..2....query I r
b260: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
b270: 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
b280: 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 36  ol2 + col1 * + 6
b290: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
b2a0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
b2b0: 2d 0d 0a 35 32 39 39 0d 0a 35 35 36 30 0d 0a 36  -..5299..5560..6
b2c0: 30 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  013....query I r
b2d0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
b2e0: 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f   tab1.col1 AS co
b2f0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
b300: 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
b310: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
b320: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 37 38  s hashing to c78
b330: 39 30 34 36 39 65 61 62 62 32 63 36 66 63 38 31  90469eabb2c6fc81
b340: 34 35 34 62 33 35 64 32 33 33 33 62 36 0d 0a 0d  454b35d2333b6...
b350: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
b360: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
b370: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
b380: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
b390: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 35  owsort label-335
b3a0: 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c  ..SELECT - ( col
b3b0: 31 20 29 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b  1 ) * - col0 + +
b3c0: 20 31 34 20 44 49 56 20 63 6f 6c 31 20 46 52 4f   14 DIV col1 FRO
b3d0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  M tab0..----..20
b3e0: 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d 0a  64..3395..8099..
b3f0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
b400: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
b410: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b420: 20 6c 61 62 65 6c 2d 33 33 35 0d 0a 53 45 4c 45   label-335..SELE
b430: 43 54 20 2d 20 28 20 63 6f 6c 31 20 29 20 2a 20  CT - ( col1 ) * 
b440: 2d 20 63 6f 6c 30 20 2b 20 2b 20 31 34 20 2f 20  - col0 + + 14 / 
b450: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
b460: 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35  ----..2064..3395
b470: 0d 0a 38 30 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..8099....onlyif
b480: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
b490: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
b4a0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
b4b0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
b4c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b4d0: 65 6c 2d 33 33 36 0d 0a 53 45 4c 45 43 54 20 43  el-336..SELECT C
b4e0: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
b4f0: 4e 45 44 20 29 20 2b 20 63 6f 72 31 2e 63 6f 6c  NED ) + cor1.col
b500: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
b510: 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
b520: 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
b530: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
b540: 20 68 61 73 68 69 6e 67 20 74 6f 20 31 36 62 65   hashing to 16be
b550: 38 38 36 38 61 31 65 36 66 34 65 38 38 35 30 35  8868a1e6f4e88505
b560: 30 39 66 39 33 32 37 61 66 65 39 30 0d 0a 0d 0a  09f9327afe90....
b570: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
b580: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
b590: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
b5a0: 61 62 65 6c 2d 33 33 36 0d 0a 53 45 4c 45 43 54  abel-336..SELECT
b5b0: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
b5c0: 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 72 31  INTEGER ) + cor1
b5d0: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
b5e0: 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53  OM tab0, tab2 AS
b5f0: 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63   cor0, tab0 AS c
b600: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
b610: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
b620: 31 36 62 65 38 38 36 38 61 31 65 36 66 34 65 38  16be8868a1e6f4e8
b630: 38 35 30 35 30 39 66 39 33 32 37 61 66 65 39 30  850509f9327afe90
b640: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
b650: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
b660: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
b670: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
b680: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
b690: 33 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  337..SELECT DIST
b6a0: 49 4e 43 54 20 63 6f 6c 32 20 44 49 56 20 63 6f  INCT col2 DIV co
b6b0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
b6c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
b6d0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
b6e0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
b6f0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
b700: 72 74 20 6c 61 62 65 6c 2d 33 33 37 0d 0a 53 45  rt label-337..SE
b710: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
b720: 6c 32 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l2 / col0 FROM t
b730: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
b740: 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79  -..0..1....query
b750: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
b760: 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  CT + col1 * col1
b770: 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   - + col2 AS col
b780: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
b790: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33 0d 0a 36  or0..----..43..6
b7a0: 32 32 0d 0a 37 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  22..73....onlyif
b7b0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
b7c0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
b7d0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
b7e0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
b7f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b800: 65 6c 2d 33 33 39 0d 0a 53 45 4c 45 43 54 20 41  el-339..SELECT A
b810: 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2d 20 2d 20  LL - - col2 - - 
b820: 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49  CAST( col2 AS SI
b830: 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
b840: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
b850: 31 36 34 0d 0a 32 0d 0a 36 36 0d 0a 0d 0a 73 6b  164..2..66....sk
b860: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
b870: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
b880: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b890: 65 6c 2d 33 33 39 0d 0a 53 45 4c 45 43 54 20 41  el-339..SELECT A
b8a0: 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2d 20 2d 20  LL - - col2 - - 
b8b0: 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49  CAST ( col2 AS I
b8c0: 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
b8d0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
b8e0: 0d 0a 31 36 34 0d 0a 32 0d 0a 36 36 0d 0a 0d 0a  ..164..2..66....
b8f0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
b900: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
b910: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
b920: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
b930: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
b940: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b950: 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   ALL col2 * col1
b960: 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f   - col0 col1 FRO
b970: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
b980: 2d 2d 2d 2d 0d 0a 31 34 35 36 0d 0a 35 36 37 0d  ----..1456..567.
b990: 0a 38 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .830....onlyif m
b9a0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
b9b0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
b9c0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
b9d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
b9e0: 62 65 6c 2d 33 34 31 0d 0a 53 45 4c 45 43 54 20  bel-341..SELECT 
b9f0: 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72  DISTINCT - + cor
ba00: 30 2e 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20  0.col1 DIV col1 
ba10: 2b 20 28 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  + ( - col1 + col
ba20: 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  0 ) FROM tab1 co
ba30: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 35  r0..----..-24..5
ba40: 33 0d 0a 36 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..66....skipif 
ba50: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
ba60: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
ba70: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34  rowsort label-34
ba80: 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
ba90: 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  CT - + cor0.col1
baa0: 20 2f 20 63 6f 6c 31 20 2b 20 28 20 2d 20 63 6f   / col1 + ( - co
bab0: 6c 31 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d  l1 + col0 ) FROM
bac0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
bad0: 0d 0a 2d 32 34 0d 0a 35 33 0d 0a 36 36 0d 0a 0d  ..-24..53..66...
bae0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
baf0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
bb00: 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  T - col0 + - col
bb10: 30 20 2a 20 2d 20 36 35 20 41 53 20 63 6f 6c 30  0 * - 65 AS col0
bb20: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
bb30: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 36 0d 0a  r0..----..1536..
bb40: 32 32 34 30 0d 0a 35 36 39 36 0d 0a 0d 0a 6f 6e  2240..5696....on
bb50: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
bb60: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
bb70: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
bb80: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
bb90: 6f 72 74 20 6c 61 62 65 6c 2d 33 34 33 0d 0a 53  ort label-343..S
bba0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
bbb0: 20 44 49 56 20 2b 20 43 41 53 54 28 20 2d 20 38   DIV + CAST( - 8
bbc0: 36 20 2a 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  6 * col2 AS SIGN
bbd0: 45 44 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ED ) col2 FROM t
bbe0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
bbf0: 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  -..-1..0..0....s
bc00: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
bc10: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
bc20: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
bc30: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
bc40: 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
bc50: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
bc60: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
bc70: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34 33  owsort label-343
bc80: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
bc90: 6f 6c 31 20 2f 20 2b 20 43 41 53 54 20 28 20 2d  ol1 / + CAST ( -
bca0: 20 38 36 20 2a 20 63 6f 6c 32 20 41 53 20 49 4e   86 * col2 AS IN
bcb0: 54 45 47 45 52 20 29 20 63 6f 6c 32 20 46 52 4f  TEGER ) col2 FRO
bcc0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
bcd0: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a  ----..-1..0..0..
bce0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
bcf0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
bd00: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
bd10: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
bd20: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34  rowsort label-34
bd30: 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
bd40: 43 54 20 2d 20 2d 20 63 6f 6c 32 20 44 49 56 20  CT - - col2 DIV 
bd50: 2d 20 35 39 20 46 52 4f 4d 20 74 61 62 32 20 41  - 59 FROM tab2 A
bd60: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
bd70: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
bd80: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
bd90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
bda0: 74 20 6c 61 62 65 6c 2d 33 34 34 0d 0a 53 45 4c  t label-344..SEL
bdb0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
bdc0: 20 63 6f 6c 32 20 2f 20 2d 20 35 39 20 46 52 4f   col2 / - 59 FRO
bdd0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
bde0: 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ----..0....skipi
bdf0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
be00: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
be10: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
be20: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
be30: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
be40: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
be50: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 63 6f  col1 * - col2 co
be60: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
be70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34  cor0..----..-124
be80: 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a  8..-1404..-570..
be90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
bea0: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
beb0: 20 38 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f   82 * col0 AS co
bec0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
bed0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34  cor0..----..2054
bee0: 0d 0a 32 39 36 37 0d 0a 37 33 38 39 0d 0a 0d 0a  ..2967..7389....
bef0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
bf00: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
bf10: 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63  col2 + col1 AS c
bf20: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
bf30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39   cor0..----..109
bf40: 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72  ..67..80....quer
bf50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
bf60: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
bf70: 6f 6c 31 20 2a 20 2b 20 28 20 38 34 20 29 20 41  ol1 * + ( 84 ) A
bf80: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
bf90: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
bfa0: 2d 31 34 32 38 0d 0a 2d 32 36 30 34 0d 0a 2d 34  -1428..-2604..-4
bfb0: 39 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  956....query I r
bfc0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
bfd0: 4c 4c 20 63 6f 6c 31 20 2a 20 28 20 34 35 20 29  LL col1 * ( 45 )
bfe0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
bff0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
c000: 0d 0a 33 38 37 30 0d 0a 34 30 39 35 0d 0a 34 33  ..3870..4095..43
c010: 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  65....query I ro
c020: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
c030: 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 30 20 2b 20  col0 + ( col0 + 
c040: 2d 20 63 6f 6c 30 20 29 20 2a 20 35 38 20 46 52  - col0 ) * 58 FR
c050: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
c060: 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39  --..-7..-78..-79
c070: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c080: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
c090: 6c 31 20 2a 20 32 34 20 41 53 20 63 6f 6c 30 20  l1 * 24 AS col0 
c0a0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
c0b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 36 0d 0a 34  0..----..1416..4
c0c0: 30 38 0d 0a 37 34 34 0d 0a 0d 0a 71 75 65 72 79  08..744....query
c0d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c0e0: 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e  CT ALL - + cor0.
c0f0: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
c100: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
c110: 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36  -..-54..-57..-96
c120: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c130: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
c140: 6c 32 20 2a 20 33 35 20 2d 20 2b 20 35 33 20 41  l2 * 35 - + 53 A
c150: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
c160: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c170: 31 38 33 37 0d 0a 31 39 34 32 0d 0a 33 33 30 37  1837..1942..3307
c180: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
c190: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
c1a0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
c1b0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
c1c0: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
c1d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c1e0: 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
c1f0: 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 31  l0 * + col1 col1
c200: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
c210: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a  r0..----..2064..
c220: 33 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75  3395..8099....qu
c230: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c240: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
c250: 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46   * col0 * col1 F
c260: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
c270: 2d 2d 2d 0d 0a 32 33 34 0d 0a 34 30 39 36 30 0d  ---..234..40960.
c280: 0a 38 33 32 30 30 0d 0a 0d 0a 73 6b 69 70 69 66  .83200....skipif
c290: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
c2a0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
c2b0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
c2c0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
c2d0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
c2e0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
c2f0: 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 63 6f  0.col1 * col2 co
c300: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
c310: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34  cor0..----..1534
c320: 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 6f 6e  ..646..837....on
c330: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
c340: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
c350: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
c360: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
c370: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c380: 20 6c 61 62 65 6c 2d 33 35 37 0d 0a 53 45 4c 45   label-357..SELE
c390: 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54  CT DISTINCT CAST
c3a0: 28 20 2d 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ( - col2 AS SIGN
c3b0: 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ED ) AS col0 FRO
c3c0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
c3d0: 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 73 6b  ..-33..-82....sk
c3e0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
c3f0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
c400: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
c410: 65 6c 2d 33 35 37 0d 0a 53 45 4c 45 43 54 20 44  el-357..SELECT D
c420: 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 2d  ISTINCT CAST ( -
c430: 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
c440: 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
c450: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  tab0..----..-1..
c460: 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72  -33..-82....quer
c470: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c480: 45 43 54 20 36 33 20 2a 20 63 6f 6c 31 20 2a 20  ECT 63 * col1 * 
c490: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
c4a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35  S cor0..----..35
c4b0: 39 31 30 0d 0a 37 38 36 32 34 0d 0a 38 38 34 35  910..78624..8845
c4c0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
c4d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
c4e0: 6f 6c 31 20 2a 20 39 35 20 46 52 4f 4d 20 74 61  ol1 * 95 FROM ta
c4f0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 35 0d 0a  b2..----..1615..
c500: 32 39 34 35 0d 0a 35 36 30 35 0d 0a 0d 0a 71 75  2945..5605....qu
c510: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c520: 45 4c 45 43 54 20 38 37 20 41 53 20 63 6f 6c 32  ELECT 87 AS col2
c530: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
c540: 0d 0a 38 37 0d 0a 38 37 0d 0a 38 37 0d 0a 0d 0a  ..87..87..87....
c550: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c560: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61  .SELECT ALL - ta
c570: 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b1.col1 FROM tab
c580: 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 20  0, tab1 AS cor0 
c590: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c  CROSS JOIN tab1,
c5a0: 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab1 cor1..----
c5b0: 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68  ..81 values hash
c5c0: 69 6e 67 20 74 6f 20 39 36 65 39 65 66 32 39 35  ing to 96e9ef295
c5d0: 30 38 30 35 62 63 61 39 33 61 32 39 35 65 65 65  0805bca93a295eee
c5e0: 61 34 33 65 66 35 62 0d 0a 0d 0a 71 75 65 72 79  a43ef5b....query
c5f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c600: 43 54 20 2b 20 37 37 20 41 53 20 63 6f 6c 30 20  CT + 77 AS col0 
c610: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
c620: 0a 37 37 0d 0a 37 37 0d 0a 37 37 0d 0a 0d 0a 71  .77..77..77....q
c630: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c640: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 39 20  SELECT ALL + 79 
c650: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
c660: 30 0d 0a 2d 2d 2d 2d 0d 0a 37 39 0d 0a 37 39 0d  0..----..79..79.
c670: 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .79....query I r
c680: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
c690: 20 32 34 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   24 FROM tab0, t
c6a0: 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
c6b0: 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20  2 AS cor1, tab0 
c6c0: 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor2..----..81 v
c6d0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
c6e0: 20 61 64 39 65 32 66 65 64 61 31 62 63 33 64 35   ad9e2feda1bc3d5
c6f0: 32 65 31 61 38 33 36 32 37 39 65 30 33 31 61 38  2e1a836279e031a8
c700: 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  b....query I row
c710: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
c720: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 41   col0 + - col0 A
c730: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
c740: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c750: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69  0..0..0....onlyi
c760: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
c770: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
c780: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
c790: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c7a0: 20 6c 61 62 65 6c 2d 33 36 36 0d 0a 53 45 4c 45   label-366..SELE
c7b0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
c7c0: 6c 30 20 44 49 56 20 2d 20 34 35 20 46 52 4f 4d  l0 DIV - 45 FROM
c7d0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab1..----..0..
c7e0: 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
c7f0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
c800: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
c810: 6f 72 74 20 6c 61 62 65 6c 2d 33 36 36 0d 0a 53  ort label-366..S
c820: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
c830: 20 63 6f 6c 30 20 2f 20 2d 20 34 35 20 46 52 4f   col0 / - 45 FRO
c840: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab1..----..0.
c850: 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .1....skipif pos
c860: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
c870: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
c880: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
c890: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
c8a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c8b0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20  SELECT - col2 * 
c8c0: 2d 20 74 61 62 30 2e 63 6f 6c 30 20 63 6f 6c 31  - tab0.col0 col1
c8d0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
c8e0: 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d  ..35..7298..792.
c8f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
c900: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
c910: 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 30 2e 63   col1 + - tab0.c
c920: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
c930: 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d 31 37 33 0d  ---..-119..-173.
c940: 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-98....query I 
c950: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c960: 63 6f 6c 32 20 2b 20 28 20 2b 20 74 61 62 31 2e  col2 + ( + tab1.
c970: 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46  col1 ) AS col0 F
c980: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
c990: 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 6f  109..67..80....o
c9a0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
c9b0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
c9c0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
c9d0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
c9e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c9f0: 74 20 6c 61 62 65 6c 2d 33 37 30 0d 0a 53 45 4c  t label-370..SEL
ca00: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a  ECT ALL + col2 *
ca10: 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20 74 61   ( - col2 ) + ta
ca20: 62 30 2e 63 6f 6c 32 20 2a 20 43 41 53 54 28 20  b0.col2 * CAST( 
ca30: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
ca40: 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + + col1 * + co
ca50: 6c 32 20 2f 20 39 39 20 41 53 20 63 6f 6c 32 20  l2 / 99 AS col2 
ca60: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
ca70: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
ca80: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
ca90: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
caa0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
cab0: 6f 72 74 20 6c 61 62 65 6c 2d 33 37 30 0d 0a 53  ort label-370..S
cac0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
cad0: 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20   * ( - col2 ) + 
cae0: 74 61 62 30 2e 63 6f 6c 32 20 2a 20 43 41 53 54  tab0.col2 * CAST
caf0: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
cb00: 45 52 20 29 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  ER ) + + col1 * 
cb10: 2b 20 63 6f 6c 32 20 2f 20 39 39 20 41 53 20 63  + col2 / 99 AS c
cb20: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
cb30: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
cb40: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
cb50: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
cb60: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b   DISTINCT col1 +
cb70: 20 2d 20 63 6f 6c 31 20 2a 20 32 33 20 46 52 4f   - col1 * 23 FRO
cb80: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
cb90: 2d 0d 0a 2d 31 32 39 38 0d 0a 2d 33 37 34 0d 0a  -..-1298..-374..
cba0: 2d 36 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -682....query I 
cbb0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
cbc0: 2b 20 63 6f 6c 32 20 2a 20 38 39 20 46 52 4f 4d  + col2 * 89 FROM
cbd0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
cbe0: 2d 2d 2d 0d 0a 34 38 30 36 0d 0a 35 30 37 33 0d  ---..4806..5073.
cbf0: 0a 38 35 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .8544....query I
cc00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
cc10: 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f   DISTINCT - + co
cc20: 6c 31 20 2a 20 2b 20 38 35 20 46 52 4f 4d 20 74  l1 * + 85 FROM t
cc30: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
cc40: 2d 0d 0a 2d 31 31 30 35 0d 0a 2d 32 32 31 30 0d  -..-1105..-2210.
cc50: 0a 2d 38 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-850....query I
cc60: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
cc70: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b   col0 * + col0 +
cc80: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
cc90: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
cca0: 32 32 36 0d 0a 36 30 39 0d 0a 38 30 30 33 0d 0a  226..609..8003..
ccb0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ccc0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
ccd0: 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
cce0: 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
ccf0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d  ..----..-7..-78.
cd00: 0a 2d 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-79....onlyif m
cd10: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
cd20: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
cd30: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
cd40: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
cd50: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
cd60: 2d 33 37 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -376..SELECT ALL
cd70: 20 2b 20 43 41 53 54 28 20 2d 20 37 34 20 41 53   + CAST( - 74 AS
cd80: 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
cd90: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
cda0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34 0d 0a  or0..----..-74..
cdb0: 2d 37 34 0d 0a 2d 37 34 0d 0a 0d 0a 73 6b 69 70  -74..-74....skip
cdc0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
cdd0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
cde0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
cdf0: 2d 33 37 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -376..SELECT ALL
ce00: 20 2b 20 43 41 53 54 20 28 20 2d 20 37 34 20 41   + CAST ( - 74 A
ce10: 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
ce20: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
ce30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34   cor0..----..-74
ce40: 0d 0a 2d 37 34 0d 0a 2d 37 34 0d 0a 0d 0a 71 75  ..-74..-74....qu
ce50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ce60: 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20  ELECT cor0.col0 
ce70: 2b 20 2b 20 28 20 63 6f 6c 32 20 29 20 46 52 4f  + + ( col2 ) FRO
ce80: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
ce90: 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35  ----..171..36..5
cea0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
ceb0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 39 20  sort..SELECT 19 
cec0: 2a 20 39 31 20 46 52 4f 4d 20 74 61 62 32 20 41  * 91 FROM tab2 A
ced0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
cee0: 32 39 0d 0a 31 37 32 39 0d 0a 31 37 32 39 0d 0a  29..1729..1729..
cef0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cf00: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
cf10: 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l1 * - col2 * co
cf20: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
cf30: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
cf40: 0a 2d 33 36 34 38 30 0d 0a 2d 34 32 31 32 0d 0a  .-36480..-4212..
cf50: 2d 39 39 38 34 30 0d 0a 0d 0a 71 75 65 72 79 20  -99840....query 
cf60: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
cf70: 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  T col0 + - col2 
cf80: 2b 20 2b 20 37 36 20 41 53 20 63 6f 6c 31 20 46  + + 76 AS col1 F
cf90: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
cfa0: 32 35 0d 0a 36 30 0d 0a 38 33 0d 0a 0d 0a 71 75  25..60..83....qu
cfb0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
cfc0: 45 4c 45 43 54 20 28 20 63 6f 6c 30 20 29 20 2a  ELECT ( col0 ) *
cfd0: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
cfe0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
cff0: 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37  .-162..-3648..-7
d000: 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  680....query I r
d010: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
d020: 20 38 34 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2d   84 * - col1 * -
d030: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
d040: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38  cor0..----..-128
d050: 38 35 36 0d 0a 2d 35 34 32 36 34 0d 0a 2d 37 30  856..-54264..-70
d060: 33 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  308....onlyif my
d070: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
d080: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
d090: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
d0a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
d0b0: 65 6c 2d 33 38 33 0d 0a 53 45 4c 45 43 54 20 2d  el-383..SELECT -
d0c0: 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 30   col0 DIV + col0
d0d0: 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20   + tab0.col0 AS 
d0e0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
d0f0: 2d 2d 2d 2d 0d 0a 32 33 0d 0a 33 34 0d 0a 38 38  ----..23..34..88
d100: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
d110: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
d120: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
d130: 72 74 20 6c 61 62 65 6c 2d 33 38 33 0d 0a 53 45  rt label-383..SE
d140: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2f 20 2b 20  LECT - col0 / + 
d150: 63 6f 6c 30 20 2b 20 74 61 62 30 2e 63 6f 6c 30  col0 + tab0.col0
d160: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
d170: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 33 34  b0..----..23..34
d180: 0d 0a 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..88....onlyif m
d190: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
d1a0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
d1b0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
d1c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
d1d0: 62 65 6c 2d 33 38 34 0d 0a 53 45 4c 45 43 54 20  bel-384..SELECT 
d1e0: 2b 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20  + col2 - + col1 
d1f0: 44 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  DIV - col2 AS co
d200: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
d210: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a  cor0..----..54..
d220: 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  57..96....skipif
d230: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
d240: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
d250: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
d260: 38 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  84..SELECT + col
d270: 32 20 2d 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 63  2 - + col1 / - c
d280: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
d290: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
d2a0: 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d  ---..54..57..96.
d2b0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
d2c0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 38  rt..SELECT + ( 8
d2d0: 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  2 ) AS col1 FROM
d2e0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 32 0d   tab1..----..82.
d2f0: 0a 38 32 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79  .82..82....query
d300: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d310: 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  CT - col2 * + co
d320: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
d330: 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d  --..-1..-1089..-
d340: 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6724....query I 
d350: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
d360: 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  - col2 * - col2 
d370: 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  - - col2 AS col2
d380: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
d390: 0d 0a 31 34 38 32 0d 0a 37 30 32 0d 0a 37 35 36  ..1482..702..756
d3a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d3b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
d3c0: 2b 20 36 37 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  + 67 * + col2 * 
d3d0: 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 41 53  col1 + - col2 AS
d3e0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
d3f0: 0a 2d 2d 2d 2d 0d 0a 33 38 31 33 33 0d 0a 38 33  .----..38133..83
d400: 35 32 30 0d 0a 39 34 30 31 34 0d 0a 0d 0a 71 75  520..94014....qu
d410: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d420: 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
d430: 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
d440: 31 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  1 cor0, tab1 AS 
d450: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
d460: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
d470: 20 34 34 66 64 63 64 37 63 64 36 30 33 33 35 32   44fdcd7cd603352
d480: 64 34 64 31 32 37 38 31 31 64 31 36 34 63 63 31  d4d127811d164cc1
d490: 65 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  e....onlyif mysq
d4a0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
d4b0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
d4c0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
d4d0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
d4e0: 2d 33 39 30 0d 0a 53 45 4c 45 43 54 20 2d 20 32  -390..SELECT - 2
d4f0: 39 20 2a 20 2d 20 63 6f 6c 31 20 44 49 56 20 63  9 * - col1 DIV c
d500: 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol1 col0 FROM ta
d510: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
d520: 0d 0a 32 39 0d 0a 32 39 0d 0a 32 39 0d 0a 0d 0a  ..29..29..29....
d530: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
d540: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
d550: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
d560: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
d570: 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
d580: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
d590: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
d5a0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39  rowsort label-39
d5b0: 30 0d 0a 53 45 4c 45 43 54 20 2d 20 32 39 20 2a  0..SELECT - 29 *
d5c0: 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 63   - col1 / col1 c
d5d0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
d5e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d   cor0..----..29.
d5f0: 0a 32 39 0d 0a 32 39 0d 0a 0d 0a 6f 6e 6c 79 69  .29..29....onlyi
d600: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
d610: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
d620: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
d630: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
d640: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
d650: 62 65 6c 2d 33 39 31 0d 0a 53 45 4c 45 43 54 20  bel-391..SELECT 
d660: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  + + cor0.col1 + 
d670: 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 4e 55 4c  col1 * CAST( NUL
d680: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
d690: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
d6a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
d6b0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
d6c0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
d6d0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
d6e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d6f0: 74 20 6c 61 62 65 6c 2d 33 39 31 0d 0a 53 45 4c  t label-391..SEL
d700: 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ECT + + cor0.col
d710: 31 20 2b 20 63 6f 6c 31 20 2a 20 43 41 53 54 20  1 + col1 * CAST 
d720: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
d730: 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  R ) AS col2 FROM
d740: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
d750: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
d760: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
d770: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
d780: 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31   + ( + cor0.col1
d790: 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d   ) * - col2 FROM
d7a0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
d7b0: 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36  ---..-2838..-746
d7c0: 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20  2..-97....query 
d7d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d7e0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
d7f0: 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  2 * - col2 FROM 
d800: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
d810: 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31  .2916..3249..921
d820: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
d830: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
d840: 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 34 34 20  2 * - col1 + 44 
d850: 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * - col1 FROM ta
d860: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
d870: 0d 0a 2d 31 31 34 36 36 0d 0a 2d 34 33 36 35 0d  ..-11466..-4365.
d880: 0a 2d 36 36 32 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-6622....onlyif
d890: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
d8a0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
d8b0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
d8c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
d8d0: 6c 61 62 65 6c 2d 33 39 35 0d 0a 53 45 4c 45 43  label-395..SELEC
d8e0: 54 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20  T ( cor0.col0 ) 
d8f0: 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  DIV - col0 FROM 
d900: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
d910: 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a  --..-1..-1..-1..
d920: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
d930: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
d940: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d950: 20 6c 61 62 65 6c 2d 33 39 35 0d 0a 53 45 4c 45   label-395..SELE
d960: 43 54 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29  CT ( cor0.col0 )
d970: 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   / - col0 FROM t
d980: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
d990: 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d  -..-1..-1..-1...
d9a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d9b0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
d9c0: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f  - cor0.col2 + co
d9d0: 6c 30 20 2a 20 2d 20 31 37 20 2a 20 63 6f 6c 31  l0 * - 17 * col1
d9e0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
d9f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 36 37  r0..----..-13767
da00: 34 0d 0a 2d 33 35 30 33 35 0d 0a 2d 35 37 36 31  4..-35035..-5761
da10: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
da20: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
da30: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
da40: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
da50: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
da60: 2d 33 39 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -397..SELECT ALL
da70: 20 2d 20 63 6f 6c 31 20 44 49 56 20 33 31 20 46   - col1 DIV 31 F
da80: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
da90: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
daa0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
dab0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
dac0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
dad0: 33 39 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  397..SELECT ALL 
dae0: 2d 20 63 6f 6c 31 20 2f 20 33 31 20 46 52 4f 4d  - col1 / 31 FROM
daf0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab1..----..0..
db00: 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
db10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
db20: 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ALL + cor0.col1 
db30: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
db40: 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  0, tab2 AS cor0.
db50: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
db60: 68 61 73 68 69 6e 67 20 74 6f 20 63 36 31 64 32  hashing to c61d2
db70: 37 61 30 30 32 32 65 36 64 30 32 32 33 37 31 64  7a0022e6d022371d
db80: 63 35 38 38 31 39 61 62 32 37 32 0d 0a 0d 0a 73  c58819ab272....s
db90: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
dba0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
dbb0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
dbc0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
dbd0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
dbe0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
dbf0: 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 63 6f  col0 + - col1 co
dc00: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
dc10: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d  cor0..----..-23.
dc20: 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79  .54..67....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 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  CT + col0 * + co
dc50: 6c 31 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 32 20  l1 + + ( - col2 
dc60: 29 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 38 37 20  ) * - col0 * 87 
dc70: 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + - col2 FROM ta
dc80: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
dc90: 36 36 33 33 0d 0a 31 38 31 30 31 32 0d 0a 32 36  6633..181012..26
dca0: 32 34 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2479....query I 
dcb0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
dcc0: 41 4c 4c 20 2d 20 35 36 20 2a 20 2d 20 63 6f 6c  ALL - 56 * - col
dcd0: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
dce0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
dcf0: 2d 0d 0a 31 34 35 36 0d 0a 35 36 30 0d 0a 37 32  -..1456..560..72
dd00: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
dd10: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
dd20: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
dd30: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
dd40: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
dd50: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30  rowsort label-40
dd60: 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41  2..SELECT ALL 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 2a 20 39 20 2a 20 63 6f 6c 30 20  ED ) * 9 * col0 
dd90: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
dda0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
ddb0: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
ddc0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
ddd0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
dde0: 6f 72 74 20 6c 61 62 65 6c 2d 34 30 32 0d 0a 53  ort label-402..S
ddf0: 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28  ELECT ALL CAST (
de00: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
de10: 20 29 20 2a 20 39 20 2a 20 63 6f 6c 30 20 46 52   ) * 9 * col0 FR
de20: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
de30: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
de40: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
de50: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
de60: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
de70: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
de80: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
de90: 30 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  03..SELECT - col
dea0: 30 20 44 49 56 20 63 6f 6c 31 20 63 6f 6c 32 20  0 DIV col1 col2 
deb0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
dec0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
ded0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
dee0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
def0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
df00: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
df10: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
df20: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
df30: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
df40: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
df50: 6c 2d 34 30 33 0d 0a 53 45 4c 45 43 54 20 2d 20  l-403..SELECT - 
df60: 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 63 6f 6c 32  col0 / col1 col2
df70: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
df80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
df90: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
dfa0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
dfb0: 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 6c 30 20 29  ol0 + + ( col0 )
dfc0: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
dfd0: 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d  .----..128..160.
dfe0: 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .6....query I ro
dff0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
e000: 63 6f 6c 30 20 2d 20 37 33 20 46 52 4f 4d 20 74  col0 - 73 FROM t
e010: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
e020: 2d 0d 0a 2d 33 38 0d 0a 2d 34 39 0d 0a 31 36 0d  -..-38..-49..16.
e030: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e040: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
e050: 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col0 + col1 FROM
e060: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
e070: 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a  ..29..74..93....
e080: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
e090: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
e0a0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
e0b0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
e0c0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 37 0d  wsort label-407.
e0d0: 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
e0e0: 30 20 44 49 56 20 2b 20 63 6f 6c 30 20 2d 20 63  0 DIV + col0 - c
e0f0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
e100: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35   cor0..----..-25
e110: 0d 0a 2d 32 36 0d 0a 2d 33 37 0d 0a 0d 0a 73 6b  ..-26..-37....sk
e120: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
e130: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
e140: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
e150: 65 6c 2d 34 30 37 0d 0a 53 45 4c 45 43 54 20 63  el-407..SELECT c
e160: 6f 72 30 2e 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c  or0.col0 / + col
e170: 30 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 - col2 FROM ta
e180: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
e190: 0d 0a 2d 32 35 0d 0a 2d 32 36 0d 0a 2d 33 37 0d  ..-25..-26..-37.
e1a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e1b0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
e1c0: 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  or0.col0 + + col
e1d0: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
e1e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a  or0..----..-34..
e1f0: 2d 37 0d 0a 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -7..9....onlyif 
e200: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
e210: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
e220: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
e230: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
e240: 61 62 65 6c 2d 34 30 39 0d 0a 53 45 4c 45 43 54  abel-409..SELECT
e250: 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f   ALL - + cor0.co
e260: 6c 30 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f  l0 + ( + cor0.co
e270: 6c 32 20 29 20 44 49 56 20 63 6f 72 30 2e 63 6f  l2 ) DIV cor0.co
e280: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
e290: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
e2a0: 2d 2d 0d 0a 2d 32 33 0d 0a 2d 33 34 0d 0a 2d 38  --..-23..-34..-8
e2b0: 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
e2c0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
e2d0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
e2e0: 6f 72 74 20 6c 61 62 65 6c 2d 34 30 39 0d 0a 53  ort label-409..S
e2f0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
e300: 72 30 2e 63 6f 6c 30 20 2b 20 28 20 2b 20 63 6f  r0.col0 + ( + co
e310: 72 30 2e 63 6f 6c 32 20 29 20 2f 20 63 6f 72 30  r0.col2 ) / cor0
e320: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
e330: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
e340: 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 33 34 0d  .----..-23..-34.
e350: 0a 2d 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-88....query I 
e360: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e370: 2b 20 63 6f 6c 32 20 2a 20 2b 20 37 31 20 41 53  + col2 * + 71 AS
e380: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
e390: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
e3a0: 38 34 36 0d 0a 31 39 31 37 0d 0a 32 36 39 38 0d  846..1917..2698.
e3b0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e3c0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
e3d0: 20 63 6f 6c 31 20 2a 20 2d 20 35 37 20 2d 20 63   col1 * - 57 - c
e3e0: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
e3f0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
e400: 2d 2d 2d 0d 0a 2d 34 39 32 36 0d 0a 2d 35 32 37  ---..-4926..-527
e410: 36 0d 0a 2d 35 35 36 34 0d 0a 0d 0a 71 75 65 72  6..-5564....quer
e420: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e430: 45 43 54 20 2d 20 39 38 20 2a 20 2d 20 63 6f 6c  ECT - 98 * - col
e440: 32 20 2b 20 2d 20 28 20 32 38 20 29 20 2a 20 63  2 + - ( 28 ) * c
e450: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
e460: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   tab0..----..-26
e470: 31 38 0d 0a 35 34 38 38 0d 0a 38 32 36 0d 0a 0d  18..5488..826...
e480: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e490: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
e4a0: 2d 20 28 20 2d 20 37 39 20 29 20 46 52 4f 4d 20  - ( - 79 ) FROM 
e4b0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
e4c0: 2d 2d 0d 0a 31 33 34 33 0d 0a 32 34 34 39 0d 0a  --..1343..2449..
e4d0: 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4661....query I 
e4e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e4f0: 2d 20 2b 20 36 20 2d 20 2d 20 63 6f 6c 31 20 41  - + 6 - - col1 A
e500: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
e510: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d   cor0..----..20.
e520: 0a 34 0d 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .4..7....onlyif 
e530: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
e540: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
e550: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
e560: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
e570: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
e580: 6c 2d 34 31 35 0d 0a 53 45 4c 45 43 54 20 2d 20  l-415..SELECT - 
e590: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
e5a0: 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c 30 20  GNED ) * - col0 
e5b0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
e5c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
e5d0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
e5e0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
e5f0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
e600: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
e610: 6c 2d 34 31 35 0d 0a 53 45 4c 45 43 54 20 2d 20  l-415..SELECT - 
e620: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
e630: 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c  NTEGER ) * - col
e640: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
e650: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
e660: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
e670: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e680: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
e690: 2b 20 2b 20 33 35 20 2a 20 2b 20 63 6f 72 30 2e  + + 35 * + cor0.
e6a0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
e6b0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
e6c0: 35 0d 0a 32 32 34 30 0d 0a 32 38 30 30 0d 0a 0d  5..2240..2800...
e6d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e6e0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 28  ..SELECT ALL ( (
e6f0: 20 63 6f 6c 30 20 29 20 29 20 41 53 20 63 6f 6c   col0 ) ) AS col
e700: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
e710: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33  or0..----..24..3
e720: 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..89....query I
e730: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
e740: 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   ALL - cor0.col2
e750: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
e760: 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
e770: 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  b0 cor1..----..9
e780: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
e790: 74 6f 20 37 62 35 39 33 38 31 32 34 32 35 33 37  to 7b59381242537
e7a0: 39 38 34 32 36 66 62 66 30 39 63 31 38 65 31 66  98426fbf09c18e1f
e7b0: 64 37 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  d75....onlyif my
e7c0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
e7d0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
e7e0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
e7f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
e800: 65 6c 2d 34 31 39 0d 0a 53 45 4c 45 43 54 20 2b  el-419..SELECT +
e810: 20 63 6f 6c 32 20 44 49 56 20 2d 20 32 33 20 46   col2 DIV - 23 F
e820: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
e830: 2d 31 0d 0a 2d 33 0d 0a 30 0d 0a 0d 0a 73 6b 69  -1..-3..0....ski
e840: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
e850: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
e860: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
e870: 6c 2d 34 31 39 0d 0a 53 45 4c 45 43 54 20 2b 20  l-419..SELECT + 
e880: 63 6f 6c 32 20 2f 20 2d 20 32 33 20 46 52 4f 4d  col2 / - 23 FROM
e890: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   tab0..----..-1.
e8a0: 0a 2d 33 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-3..0....onlyif
e8b0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
e8c0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
e8d0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
e8e0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
e8f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
e900: 65 6c 2d 34 32 30 0d 0a 53 45 4c 45 43 54 20 2d  el-420..SELECT -
e910: 20 63 6f 6c 31 20 2b 20 28 20 74 61 62 31 2e 63   col1 + ( tab1.c
e920: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 29 20 2b  ol1 * - col1 ) +
e930: 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
e940: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
e950: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
e960: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
e970: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
e980: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
e990: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
e9a0: 62 65 6c 2d 34 32 30 0d 0a 53 45 4c 45 43 54 20  bel-420..SELECT 
e9b0: 2d 20 63 6f 6c 31 20 2b 20 28 20 74 61 62 31 2e  - col1 + ( tab1.
e9c0: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 29 20  col1 * - col1 ) 
e9d0: 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + - CAST ( NULL 
e9e0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
e9f0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab1..----..NU
ea00: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
ea10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ea20: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
ea30: 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 28 20  CT - col1 * + ( 
ea40: 2b 20 34 31 20 2a 20 2d 20 74 61 62 30 2e 63 6f  + 41 * - tab0.co
ea50: 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  l2 ) FROM tab0..
ea60: 2d 2d 2d 2d 0d 0a 31 31 36 33 35 38 0d 0a 33 30  ----..116358..30
ea70: 35 39 34 32 0d 0a 33 39 37 37 0d 0a 0d 0a 71 75  5942..3977....qu
ea80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ea90: 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 28 20 2d  ELECT col1 * ( -
eaa0: 20 28 20 63 6f 6c 30 20 29 20 29 20 41 53 20 63   ( col0 ) ) AS c
eab0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
eac0: 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39  ---..-2064..-339
ead0: 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72  5..-8099....quer
eae0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
eaf0: 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 33 32 20  ECT - col2 * 32 
eb00: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
eb10: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32 38 0d 0a  1..----..-1728..
eb20: 2d 31 38 32 34 0d 0a 2d 33 30 37 32 0d 0a 0d 0a  -1824..-3072....
eb30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
eb40: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
eb50: 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31   + col0 * - col1
eb60: 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63 6f   * + col0 - + co
eb70: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
eb80: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 32  tab1..----..-262
eb90: 0d 0a 2d 34 31 30 30 37 0d 0a 2d 38 33 32 38 33  ..-41007..-83283
eba0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ebb0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
ebc0: 2d 20 39 38 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  - 98 - col1 FROM
ebd0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   tab1..----..-10
ebe0: 38 0d 0a 2d 31 31 31 0d 0a 2d 31 32 34 0d 0a 0d  8..-111..-124...
ebf0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ec00: 0d 0a 53 45 4c 45 43 54 20 38 38 20 2d 20 2d 20  ..SELECT 88 - - 
ec10: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
ec20: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab2..----..10
ec30: 35 0d 0a 31 31 39 0d 0a 31 34 37 0d 0a 0d 0a 6f  5..119..147....o
ec40: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
ec50: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
ec60: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
ec70: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
ec80: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 32 37 0d 0a  sort label-427..
ec90: 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32 2e  SELECT ALL tab2.
eca0: 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 31 20  col0 DIV + col1 
ecb0: 2b 20 63 6f 6c 32 20 2a 20 2b 20 74 61 62 32 2e  + col2 * + tab2.
ecc0: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
ecd0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35  M tab2..----..15
ece0: 33 35 0d 0a 36 35 30 0d 0a 38 33 37 0d 0a 0d 0a  35..650..837....
ecf0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
ed00: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
ed10: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
ed20: 61 62 65 6c 2d 34 32 37 0d 0a 53 45 4c 45 43 54  abel-427..SELECT
ed30: 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 30 20 2f   ALL tab2.col0 /
ed40: 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a   + col1 + col2 *
ed50: 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20   + tab2.col1 AS 
ed60: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
ed70: 2d 2d 2d 2d 0d 0a 31 35 33 35 0d 0a 36 35 30 0d  ----..1535..650.
ed80: 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .837....query I 
ed90: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
eda0: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20  - cor0.col1 + ( 
edb0: 32 35 20 29 20 46 52 4f 4d 20 74 61 62 31 20 63  25 ) FROM tab1 c
edc0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 31  or0..----..-1..1
edd0: 32 0d 0a 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49  2..15....query I
ede0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
edf0: 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 35 38 20 41   ALL col2 * 58 A
ee00: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
ee10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ee20: 31 35 30 38 0d 0a 31 35 36 36 0d 0a 32 32 30 34  1508..1566..2204
ee30: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ee40: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
ee50: 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  INCT + col2 + co
ee60: 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 36 30  l1 * + col1 * 60
ee70: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
ee80: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 33 37 38 0d  b2..----..17378.
ee90: 0a 32 30 38 38 38 36 0d 0a 35 37 36 38 37 0d 0a  .208886..57687..
eea0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
eeb0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
eec0: 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  CT - col1 + + co
eed0: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
eee0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  tab0..----..0...
eef0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ef00: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
ef10: 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  T + col1 + + col
ef20: 32 20 2a 20 28 20 36 38 20 29 20 2b 20 2b 20 63  2 * ( 68 ) + + c
ef30: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
ef40: 2d 2d 2d 0d 0a 33 37 32 34 0d 0a 33 38 39 36 0d  ---..3724..3896.
ef50: 0a 36 35 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .6554....query I
ef60: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ef70: 20 41 4c 4c 20 37 37 20 2b 20 63 6f 6c 31 20 2a   ALL 77 + col1 *
ef80: 20 33 39 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   39 FROM tab0..-
ef90: 2d 2d 2d 0d 0a 33 34 33 31 0d 0a 33 36 32 36 0d  ---..3431..3626.
efa0: 0a 33 38 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .3860....onlyif 
efb0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
efc0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
efd0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
efe0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
eff0: 61 62 65 6c 2d 34 33 34 0d 0a 53 45 4c 45 43 54  abel-434..SELECT
f000: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 44   col0 + - col2 D
f010: 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  IV col0 AS col2 
f020: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
f030: 0a 2d 31 35 0d 0a 36 34 0d 0a 37 39 0d 0a 0d 0a  .-15..64..79....
f040: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
f050: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
f060: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
f070: 61 62 65 6c 2d 34 33 34 0d 0a 53 45 4c 45 43 54  abel-434..SELECT
f080: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2f   col0 + - col2 /
f090: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
f0a0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
f0b0: 31 35 0d 0a 36 34 0d 0a 37 39 0d 0a 0d 0a 71 75  15..64..79....qu
f0c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f0d0: 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b  ELECT + col0 + +
f0e0: 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 41 53 20   col0 - col1 AS 
f0f0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
f100: 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 31 31 38 0d 0a  ----..-20..118..
f110: 31 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  147....query I r
f120: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
f130: 20 38 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f   82 + - col0 FRO
f140: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  M tab2..----..3.
f150: 0a 34 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20  .4..75....query 
f160: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f170: 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
f180: 32 20 2b 20 32 20 41 53 20 63 6f 6c 31 20 46 52  2 + 2 AS col1 FR
f190: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
f1a0: 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 32 35 0d  .----..-24..-25.
f1b0: 0a 2d 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-36....query I 
f1c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f1d0: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
f1e0: 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 31 20 29 20  col2 + ( col1 ) 
f1f0: 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  * - col0 AS col1
f200: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
f210: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 33 31 0d  r0..----..-2031.
f220: 0a 2d 33 33 39 34 0d 0a 2d 38 30 31 37 0d 0a 0d  .-3394..-8017...
f230: 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
f240: 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
f250: 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
f260: 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b0 AS cor0 CROSS
f270: 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61 62 32   JOIN tab1, tab2
f280: 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32 20 41   AS cor1, tab2 A
f290: 53 20 63 6f 72 32 2c 20 74 61 62 30 20 63 6f 72  S cor2, tab0 cor
f2a0: 33 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61  3..----..3645 va
f2b0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
f2c0: 65 36 30 38 32 65 36 34 34 64 65 62 64 37 34 64  e6082e644debd74d
f2d0: 63 66 31 30 34 32 62 39 31 38 64 37 39 31 39 39  cf1042b918d79199
f2e0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f2f0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
f300: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b   * - cor0.col1 +
f310: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
f320: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
f330: 0a 2d 2d 2d 2d 0d 0a 2d 37 33 37 32 0d 0a 2d 38  .----..-7372..-8
f340: 31 39 32 0d 0a 2d 39 33 37 34 0d 0a 0d 0a 71 75  192..-9374....qu
f350: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f360: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b  ELECT ALL col0 +
f370: 20 2d 20 39 31 20 41 53 20 63 6f 6c 30 20 46 52   - 91 AS col0 FR
f380: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
f390: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31 33 0d  .----..-12..-13.
f3a0: 0a 2d 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-84....query I 
f3b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f3c0: 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
f3d0: 6c 31 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41  l1 - cor0.col0 A
f3e0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
f3f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39   cor0..----..-19
f400: 0d 0a 2d 36 32 0d 0a 32 34 0d 0a 0d 0a 71 75 65  ..-62..24....que
f410: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f420: 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  LECT + + col2 + 
f430: 36 33 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  63 * col1 FROM t
f440: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
f450: 2d 0d 0a 31 31 30 39 0d 0a 31 39 38 30 0d 0a 33  -..1109..1980..3
f460: 37 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  743....query I r
f470: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
f480: 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
f490: 6f 6c 30 20 2d 20 35 34 20 46 52 4f 4d 20 74 61  ol0 - 54 FROM ta
f4a0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
f4b0: 0d 0a 2d 31 31 38 0d 0a 2d 31 33 34 0d 0a 2d 35  ..-118..-134..-5
f4c0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
f4d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
f4e0: 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63  TINCT col1 * - c
f4f0: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
f500: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
f510: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a  r0..----..-100..
f520: 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 71 75  -169..-676....qu
f530: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f540: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
f550: 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31   + ( + cor0.col1
f560: 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
f570: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
f580: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
f590: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
f5a0: 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20   col1 + col0 AS 
f5b0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
f5c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
f5d0: 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71  0..132..180....q
f5e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
f5f0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
f600: 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52  0.col0 * col0 FR
f610: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
f620: 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d  .----..49..6084.
f630: 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .6241....query I
f640: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f650: 20 2d 20 63 6f 6c 32 20 2b 20 34 30 20 46 52 4f   - col2 + 40 FRO
f660: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
f670: 2d 2d 2d 2d 0d 0a 31 33 0d 0a 31 34 0d 0a 32 0d  ----..13..14..2.
f680: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
f690: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
f6a0: 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  NCT - cor0.col0 
f6b0: 2a 20 32 37 20 41 53 20 63 6f 6c 30 20 46 52 4f  * 27 AS col0 FRO
f6c0: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
f6d0: 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 31 30 36 0d 0a  -..-189..-2106..
f6e0: 2d 32 31 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  -2133....skipif 
f6f0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
f700: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
f710: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f720: 2b 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 20  + col2 * - CAST 
f730: 28 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 52  ( cor0.col0 AS R
f740: 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 31 20  EAL ) FROM tab1 
f750: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32  cor0..----..-162
f760: 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a  ..-3648..-7680..
f770: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
f780: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
f790: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
f7a0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
f7b0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
f7c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
f7d0: 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  CT - - cor0.col0
f7e0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
f7f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
f800: 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72  ..78..79....quer
f810: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f820: 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30  ECT ALL - - col0
f830: 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   - + col1 FROM t
f840: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
f850: 2d 32 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 6f  -23..54..67....o
f860: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
f870: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
f880: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
f890: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
f8a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f8b0: 74 20 6c 61 62 65 6c 2d 34 35 34 0d 0a 53 45 4c  t label-454..SEL
f8c0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
f8d0: 6f 6c 32 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c  ol2 * CAST( NULL
f8e0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
f8f0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
f900: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
f910: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
f920: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
f930: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
f940: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35 34 0d 0a  sort label-454..
f950: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
f960: 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20  + col2 * CAST ( 
f970: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
f980: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
f990: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
f9a0: 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  -..NULL....onlyi
f9b0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
f9c0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
f9d0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
f9e0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
f9f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
fa00: 62 65 6c 2d 34 35 35 0d 0a 53 45 4c 45 43 54 20  bel-455..SELECT 
fa10: 41 4c 4c 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53  ALL col1 + - CAS
fa20: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
fa30: 44 20 29 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 72  D ) * col1 * cor
fa40: 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0.col2 FROM tab2
fa50: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
fa60: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
fa70: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
fa80: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
fa90: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
faa0: 72 74 20 6c 61 62 65 6c 2d 34 35 35 0d 0a 53 45  rt label-455..SE
fab0: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20  LECT ALL col1 + 
fac0: 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
fad0: 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c   INTEGER ) * col
fae0: 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  1 * cor0.col2 FR
faf0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
fb00: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
fb10: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
fb20: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
fb30: 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20  CT ALL + + col0 
fb40: 2a 20 33 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f  * 3 + + col1 FRO
fb50: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
fb60: 2d 2d 2d 2d 0d 0a 31 35 38 0d 0a 32 30 32 0d 0a  ----..158..202..
fb70: 33 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  358....query I r
fb80: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
fb90: 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 31 36  LL + + col2 * 16
fba0: 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31   - col0 * + col1
fbb0: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
fbc0: 0a 2d 2d 2d 2d 0d 0a 32 37 32 0d 0a 34 39 36 0d  .----..272..496.
fbd0: 0a 37 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .786....query I 
fbe0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
fbf0: 2d 20 36 38 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 68 AS col1 FRO
fc00: 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
fc10: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
fc20: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
fc30: 35 66 65 62 66 33 38 32 64 33 36 64 36 65 30 31  5febf382d36d6e01
fc40: 39 31 38 38 39 63 34 31 62 39 32 38 37 38 36 66  91889c41b928786f
fc50: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
fc60: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
fc70: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
fc80: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
fc90: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
fca0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
fcb0: 4c 45 43 54 20 34 36 20 2d 20 2d 20 63 6f 6c 31  LECT 46 - - col1
fcc0: 20 2a 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   * col1 col1 FRO
fcd0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34  M tab1..----..14
fce0: 36 0d 0a 32 31 35 0d 0a 37 32 32 0d 0a 0d 0a 71  6..215..722....q
fcf0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
fd00: 53 45 4c 45 43 54 20 35 39 20 2a 20 31 32 20 46  SELECT 59 * 12 F
fd10: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
fd20: 0d 0a 2d 2d 2d 2d 0d 0a 37 30 38 0d 0a 37 30 38  ..----..708..708
fd30: 0d 0a 37 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..708....onlyif 
fd40: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
fd50: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
fd60: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
fd70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
fd80: 61 62 65 6c 2d 34 36 31 0d 0a 53 45 4c 45 43 54  abel-461..SELECT
fd90: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
fda0: 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32   + col0 DIV col2
fdb0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
fdc0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d  r0..----..-54..-
fdd0: 35 36 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69  56..-96....skipi
fde0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
fdf0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
fe00: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
fe10: 34 36 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  461..SELECT DIST
fe20: 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  INCT - col2 + co
fe30: 6c 30 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 / col2 FROM t
fe40: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
fe50: 2d 0d 0a 2d 35 34 0d 0a 2d 35 36 0d 0a 2d 39 36  -..-54..-56..-96
fe60: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
fe70: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
fe80: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
fe90: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
fea0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
feb0: 34 36 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  462..SELECT col0
fec0: 20 44 49 56 20 28 20 2b 20 63 6f 6c 31 20 29 20   DIV ( + col1 ) 
fed0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
fee0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
fef0: 0a 30 0d 0a 36 0d 0a 36 0d 0a 0d 0a 73 6b 69 70  .0..6..6....skip
ff00: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
ff10: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
ff20: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
ff30: 2d 34 36 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -462..SELECT col
ff40: 30 20 2f 20 28 20 2b 20 63 6f 6c 31 20 29 20 41  0 / ( + col1 ) A
ff50: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
ff60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ff70: 30 0d 0a 36 0d 0a 36 0d 0a 0d 0a 73 6b 69 70 69  0..6..6....skipi
ff80: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
ff90: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
ffa0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
ffb0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
ffc0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
ffd0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
ffe0: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 38 36 20 63  cor0.col2 * 86 c
fff0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
10000 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
10010 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  b0 cor1..----..9
10020 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
10030 74 6f 20 34 61 34 32 35 66 64 31 66 65 38 36 35  to 4a425fd1fe865
10040 65 64 66 33 64 35 35 31 64 33 39 39 65 35 35 33  edf3d551d399e553
10050 66 66 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ffe....query I r
10060 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
10070 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 34   cor0.col0 * - 4
10080 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
10090 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 0d  or0..----..-123.
100a0 0a 2d 32 36 32 34 0d 0a 2d 33 32 38 30 0d 0a 0d  .-2624..-3280...
100b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
100c0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
100d0 20 36 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   60 AS col1 FROM
100e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
100f0 2d 2d 2d 0d 0a 36 30 0d 0a 36 30 0d 0a 36 30 0d  ---..60..60..60.
10100 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10110 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
10120 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  NCT cor0.col0 + 
10130 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
10140 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
10150 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a  ----..110..132..
10160 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  180....query I r
10170 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
10180 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63  ol2 * - col2 + c
10190 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
101a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
101b0 35 36 0d 0a 2d 36 36 34 32 0d 0a 30 0d 0a 0d 0a  56..-6642..0....
101c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
101d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 20  .SELECT ALL - 8 
101e0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
101f0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 2d 38 0d  0..----..-8..-8.
10200 0a 2d 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .-8....query I r
10210 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
10220 20 37 34 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f   74 + col2 AS co
10230 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
10240 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 0d  cor0..----..107.
10250 0a 31 35 36 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72  .156..75....quer
10260 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10270 45 43 54 20 41 4c 4c 20 2d 20 35 37 20 2a 20 2b  ECT ALL - 57 * +
10280 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
10290 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
102a0 33 30 37 38 0d 0a 2d 33 32 34 39 0d 0a 2d 35 34  3078..-3249..-54
102b0 37 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  72....onlyif mys
102c0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
102d0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
102e0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
102f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
10300 6c 2d 34 37 31 0d 0a 53 45 4c 45 43 54 20 2b 20  l-471..SELECT + 
10310 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2d 20 2d 20  col2 + col2 - - 
10320 39 38 20 44 49 56 20 33 37 20 46 52 4f 4d 20 74  98 DIV 37 FROM t
10330 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
10340 2d 0d 0a 31 31 30 0d 0a 31 31 36 0d 0a 31 39 34  -..110..116..194
10350 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
10360 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
10370 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
10380 72 74 20 6c 61 62 65 6c 2d 34 37 31 0d 0a 53 45  rt label-471..SE
10390 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  LECT + col2 + co
103a0 6c 32 20 2d 20 2d 20 39 38 20 2f 20 33 37 20 46  l2 - - 98 / 37 F
103b0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
103c0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 31 36  ..----..110..116
103d0 0d 0a 31 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..194....query I
103e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
103f0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
10400 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   * cor0.col2 AS 
10410 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
10420 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
10430 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d  444..-676..-729.
10440 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
10450 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
10460 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
10470 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
10480 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
10490 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
104a0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a  ECT ALL + col1 *
104b0 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f   + col1 col0 FRO
104c0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
104d0 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a  ----..100..169..
104e0 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  676....query I r
104f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
10500 4c 4c 20 2d 20 2b 20 37 32 20 46 52 4f 4d 20 74  LL - + 72 FROM t
10510 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
10520 2d 0d 0a 2d 37 32 0d 0a 2d 37 32 0d 0a 2d 37 32  -..-72..-72..-72
10530 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10540 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
10550 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 31 20 46 52  l2 * col0 * 1 FR
10560 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
10570 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36  .----..-162..-36
10580 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65  48..-7680....que
10590 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
105a0 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20 2d  LECT ALL + - ( -
105b0 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62   col0 ) FROM tab
105c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
105d0 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75  .7..78..79....qu
105e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
105f0 45 4c 45 43 54 20 2b 20 39 37 20 2a 20 2b 20 63  ELECT + 97 * + c
10600 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
10610 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
10620 2d 2d 2d 0d 0a 32 35 32 32 0d 0a 32 36 31 39 0d  ---..2522..2619.
10630 0a 33 36 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .3686....query I
10640 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10650 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 36 33   DISTINCT - + 63
10660 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
10670 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 33 0d 0a 0d  r0..----..-63...
10680 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10690 0d 0a 53 45 4c 45 43 54 20 2d 20 39 20 2a 20 2d  ..SELECT - 9 * -
106a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
106b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
106c0 31 36 0d 0a 33 31 35 0d 0a 38 30 31 0d 0a 0d 0a  16..315..801....
106d0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
106e0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
106f0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
10700 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
10710 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
10720 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10730 20 44 49 53 54 49 4e 43 54 20 2b 20 32 36 20 2a   DISTINCT + 26 *
10740 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
10750 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
10760 2d 2d 0d 0a 31 34 30 34 0d 0a 31 34 38 32 0d 0a  --..1404..1482..
10770 32 34 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2496....query I 
10780 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10790 2b 20 31 37 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 17 AS col1 FRO
107a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
107b0 2d 2d 2d 2d 0d 0a 31 37 0d 0a 31 37 0d 0a 31 37  ----..17..17..17
107c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
107d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
107e0 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  - + col2 * - col
107f0 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  0 + - cor0.col2 
10800 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  + col1 * cor0.co
10810 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
10820 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
10830 2d 2d 0d 0a 33 37 39 0d 0a 34 33 30 37 0d 0a 36  --..379..4307..6
10840 36 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  604....query I r
10850 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
10860 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a  ISTINCT + col2 *
10870 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41   + col1 + col0 A
10880 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
10890 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
108a0 31 33 32 0d 0a 32 38 36 32 0d 0a 37 35 35 31 0d  132..2862..7551.
108b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
108c0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
108d0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b   col0 * - col2 +
108e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
108f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 30  cor0..----..-720
10900 39 0d 0a 2d 37 36 38 0d 0a 30 0d 0a 0d 0a 71 75  9..-768..0....qu
10910 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10920 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b  ELECT - col1 + +
10930 20 63 6f 6c 30 20 2a 20 34 35 20 41 53 20 63 6f   col0 * 45 AS co
10940 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
10950 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 34 0d  cor0..----..284.
10960 0a 33 34 35 31 0d 0a 33 35 33 38 0d 0a 0d 0a 71  .3451..3538....q
10970 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10980 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
10990 30 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 32 37 20  0 + + col0 * 27 
109a0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
109b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
109c0 0a 31 39 36 0d 0a 32 31 38 34 0d 0a 32 32 31 32  .196..2184..2212
109d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
109e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
109f0 49 4e 43 54 20 2d 20 33 37 20 41 53 20 63 6f 6c  INCT - 37 AS col
10a00 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
10a10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 0d 0a  or0..----..-37..
10a20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10a30 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
10a40 20 2a 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32   * col2 - - col2
10a50 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
10a60 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
10a70 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .0..0..0....only
10a80 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
10a90 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
10aa0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
10ab0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10ac0 74 20 6c 61 62 65 6c 2d 34 38 39 0d 0a 53 45 4c  t label-489..SEL
10ad0 45 43 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 63  ECT - col0 DIV c
10ae0 6f 6c 32 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 72  ol2 + col0 - cor
10af0 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
10b00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10b10 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -1..0..0....skip
10b20 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
10b30 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
10b40 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10b50 2d 34 38 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -489..SELECT - c
10b60 6f 6c 30 20 2f 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol0 / col2 + col
10b70 30 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  0 - cor0.col0 FR
10b80 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
10b90 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d  .----..-1..0..0.
10ba0 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
10bb0 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
10bc0 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
10bd0 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
10be0 6f 72 30 2c 20 74 61 62 30 20 63 6f 72 31 2c 20  or0, tab0 cor1, 
10bf0 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab2 AS cor2..--
10c00 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68  --..972 values h
10c10 61 73 68 69 6e 67 20 74 6f 20 34 32 65 36 39 65  ashing to 42e69e
10c20 63 64 61 66 62 33 63 38 31 30 34 36 62 63 35 63  cdafb3c81046bc5c
10c30 62 34 63 39 38 62 31 36 36 36 0d 0a 0d 0a 71 75  b4c98b1666....qu
10c40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10c50 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34  ELECT DISTINCT 4
10c60 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
10c70 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
10c80 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
10c90 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..4....query I r
10ca0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
10cb0 49 53 54 49 4e 43 54 20 2b 20 31 39 20 41 53 20  ISTINCT + 19 AS 
10cc0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20  col2 FROM tab1, 
10cd0 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
10ce0 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
10cf0 0d 0a 31 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..19....onlyif m
10d00 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
10d10 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
10d20 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
10d30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10d40 62 65 6c 2d 34 39 33 0d 0a 53 45 4c 45 43 54 20  bel-493..SELECT 
10d50 2b 20 33 35 20 2b 20 63 6f 6c 30 20 44 49 56 20  + 35 + col0 DIV 
10d60 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
10d70 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 33 36 0d 0a  ..----..35..36..
10d80 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  70....skipif mys
10d90 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
10da0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
10db0 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 33 0d 0a  sort label-493..
10dc0 53 45 4c 45 43 54 20 2b 20 33 35 20 2b 20 63 6f  SELECT + 35 + co
10dd0 6c 30 20 2f 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l0 / + col2 FROM
10de0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d   tab0..----..35.
10df0 0a 33 36 0d 0a 37 30 0d 0a 0d 0a 73 6b 69 70 69  .36..70....skipi
10e00 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
10e10 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
10e20 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
10e30 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
10e40 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
10e50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
10e60 2b 20 32 38 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  + 28 * + col2 + 
10e70 2b 20 63 6f 6c 31 20 2a 20 38 39 20 2a 20 2d 20  + col1 * 89 * - 
10e80 37 35 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  75 col2 FROM tab
10e90 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
10ea0 0a 2d 35 37 33 31 32 36 0d 0a 2d 36 30 35 31 32  .-573126..-60512
10eb0 39 0d 0a 2d 36 34 37 34 34 37 0d 0a 0d 0a 71 75  9..-647447....qu
10ec0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10ed0 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 30 20 29  ELECT - ( col0 )
10ee0 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
10ef0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
10f00 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a  -..-1343..-217..
10f10 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -4602....query I
10f20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10f30 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
10f40 6c 31 20 2a 20 2d 20 37 31 20 2a 20 63 6f 6c 30  l1 * - 71 * col0
10f50 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
10f60 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
10f70 0d 0a 31 34 36 35 34 34 0d 0a 32 34 31 30 34 35  ..146544..241045
10f80 0d 0a 35 37 35 30 32 39 0d 0a 0d 0a 6f 6e 6c 79  ..575029....only
10f90 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
10fa0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
10fb0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
10fc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10fd0 74 20 6c 61 62 65 6c 2d 34 39 37 0d 0a 53 45 4c  t label-497..SEL
10fe0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
10ff0 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 44   ( cor0.col2 ) D
11000 49 56 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30  IV col1 + - cor0
11010 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
11020 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
11030 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39  --..-86..-91..-9
11040 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  7....skipif mysq
11050 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
11060 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
11070 6f 72 74 20 6c 61 62 65 6c 2d 34 39 37 0d 0a 53  ort label-497..S
11080 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
11090 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29   + ( cor0.col2 )
110a0 20 2f 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30   / col1 + - cor0
110b0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
110c0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
110d0 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39  --..-86..-91..-9
110e0 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
110f0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
11100 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
11110 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
11120 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
11130 2d 34 39 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  -498..SELECT DIS
11140 54 49 4e 43 54 20 2b 20 28 20 63 6f 6c 31 20 29  TINCT + ( col1 )
11150 20 44 49 56 20 63 6f 6c 30 20 63 6f 6c 31 20 46   DIV col0 col1 F
11160 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
11170 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 34 0d 0a 0d 0a  ..----..0..4....
11180 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
11190 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
111a0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
111b0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
111c0 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
111d0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
111e0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
111f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39  rowsort label-49
11200 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  8..SELECT DISTIN
11210 43 54 20 2b 20 28 20 63 6f 6c 31 20 29 20 2f 20  CT + ( col1 ) / 
11220 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col0 col1 FROM t
11230 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
11240 2d 0d 0a 30 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79  -..0..4....query
11250 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11260 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 31  CT DISTINCT cor1
11270 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
11280 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
11290 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63   cor0, tab0 AS c
112a0 6f 72 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or1, tab2 AS cor
112b0 32 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d  2..----..24..35.
112c0 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .89....query I r
112d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
112e0 4c 4c 20 2d 20 2d 20 39 32 20 2a 20 2d 20 63 6f  LL - - 92 * - co
112f0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
11300 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
11310 2d 2d 0d 0a 2d 32 33 39 32 0d 0a 2d 32 34 38 34  --..-2392..-2484
11320 0d 0a 2d 33 34 39 36 0d 0a 0d 0a 71 75 65 72 79  ..-3496....query
11330 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11340 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34 35  CT DISTINCT - 45
11350 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11360 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
11370 0d 0a 2d 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-45....query I
11380 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11390 20 63 6f 6c 32 20 2a 20 38 37 20 41 53 20 63 6f   col2 * 87 AS co
113a0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
113b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 31  cor0..----..2871
113c0 0d 0a 37 31 33 34 0d 0a 38 37 0d 0a 0d 0a 71 75  ..7134..87....qu
113d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
113e0 45 4c 45 43 54 20 2d 20 34 38 20 2b 20 63 6f 6c  ELECT - 48 + col
113f0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
11400 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a  or0..----..-41..
11410 33 30 0d 0a 33 31 0d 0a 0d 0a 71 75 65 72 79 20  30..31....query 
11420 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11430 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72  T DISTINCT - cor
11440 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e  0.col0 * - cor0.
11450 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col0 + col2 FROM
11460 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
11470 2d 2d 2d 0d 0a 36 31 31 30 0d 0a 36 32 37 39 0d  ---..6110..6279.
11480 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .76....query I r
11490 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
114a0 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
114b0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
114c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
114d0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53  OSS JOIN tab2 AS
114e0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor1..----..-3.
114f0 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65  .-64..-80....que
11500 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11510 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20  LECT ALL col0 + 
11520 2d 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20 63  - tab1.col0 AS c
11530 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
11540 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
11550 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11560 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 39  .SELECT ALL + 79
11570 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   * col1 * + col1
11580 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
11590 0d 0a 35 38 34 32 38 34 0d 0a 36 35 34 31 39 39  ..584284..654199
115a0 0d 0a 37 34 33 33 31 31 0d 0a 0d 0a 71 75 65 72  ..743311....quer
115b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
115c0 45 43 54 20 41 4c 4c 20 39 39 20 46 52 4f 4d 20  ECT ALL 99 FROM 
115d0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 39 39 0d 0a  tab0..----..99..
115e0 39 39 0d 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20  99..99....query 
115f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11600 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20 63  T DISTINCT ( - c
11610 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 29 20 41  ol0 * - col0 ) A
11620 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
11630 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34  ..----..49..6084
11640 0d 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20  ..6241....query 
11650 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11660 54 20 41 4c 4c 20 2d 20 33 35 20 41 53 20 63 6f  T ALL - 35 AS co
11670 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
11680 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 33  0..----..-35..-3
11690 35 0d 0a 2d 33 35 0d 0a 0d 0a 71 75 65 72 79 20  5..-35....query 
116a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
116b0 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  T - cor0.col2 FR
116c0 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
116d0 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
116e0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
116f0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
11700 34 34 66 64 63 64 37 63 64 36 30 33 33 35 32 64  44fdcd7cd603352d
11710 34 64 31 32 37 38 31 31 64 31 36 34 63 63 31 65  4d127811d164cc1e
11720 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
11730 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
11740 72 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  r1.col2 AS col0 
11750 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
11760 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
11770 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
11780 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
11790 6f 20 36 61 34 33 65 37 66 31 35 31 39 34 61 66  o 6a43e7f15194af
117a0 37 33 66 65 31 63 38 33 33 38 35 65 36 65 62 65  73fe1c83385e6ebe
117b0 62 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  bc....skipif pos
117c0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
117d0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
117e0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
117f0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
11800 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11810 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11820 2d 20 28 20 36 37 20 29 20 63 6f 6c 30 20 46 52  - ( 67 ) col0 FR
11830 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
11840 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  67....query I ro
11850 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
11860 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  + cor0.col2 AS c
11870 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol1 FROM tab0, t
11880 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
11890 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
118a0 20 74 6f 20 38 30 63 61 30 61 31 63 63 33 33 37   to 80ca0a1cc337
118b0 61 37 37 31 34 61 38 39 39 30 61 37 36 34 63 66  a7714a8990a764cf
118c0 64 62 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  db17....query I 
118d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
118e0 2b 20 37 38 20 46 52 4f 4d 20 74 61 62 31 2c 20  + 78 FROM tab1, 
118f0 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
11900 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
11910 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
11920 69 6e 67 20 74 6f 20 64 38 65 35 65 66 34 64 62  ing to d8e5ef4db
11930 33 34 31 39 66 63 32 35 31 65 38 32 63 35 30 62  3419fc251e82c50b
11940 61 30 34 65 30 34 38 0d 0a 0d 0a 71 75 65 72 79  a04e048....query
11950 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11960 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  CT + + col0 + + 
11970 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f 72  ( - col1 ) * cor
11980 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0.col0 FROM tab2
11990 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
119a0 2d 31 32 36 34 0d 0a 2d 32 31 30 0d 0a 2d 34 35  -1264..-210..-45
119b0 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  24....onlyif mys
119c0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
119d0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
119e0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
119f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11a00 6c 2d 35 31 37 0d 0a 53 45 4c 45 43 54 20 41 4c  l-517..SELECT AL
11a10 4c 20 63 6f 6c 30 20 44 49 56 20 2d 20 35 20 41  L col0 DIV - 5 A
11a20 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
11a30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 35 0d  ..----..-1..-15.
11a40 0a 2d 31 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-15....skipif m
11a50 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
11a60 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
11a70 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 37  owsort label-517
11a80 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
11a90 30 20 2f 20 2d 20 35 20 41 53 20 63 6f 6c 30 20  0 / - 5 AS col0 
11aa0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
11ab0 0a 2d 31 0d 0a 2d 31 35 0d 0a 2d 31 35 0d 0a 0d  .-1..-15..-15...
11ac0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11ad0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
11ae0 6f 6c 32 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c  ol2 * - tab2.col
11af0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
11b00 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d  ab2..----..1444.
11b10 0a 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65  .676..729....que
11b20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11b30 4c 45 43 54 20 33 32 20 41 53 20 63 6f 6c 30 20  LECT 32 AS col0 
11b40 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
11b50 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 0d 0a 33 32 0d  0..----..32..32.
11b60 0a 33 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .32....skipif po
11b70 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
11b80 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
11b90 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
11ba0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
11bb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11bc0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
11bd0 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 63 6f   + ( - col1 ) co
11be0 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
11bf0 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d 33 34 38 31 0d  --..-289..-3481.
11c00 0a 2d 39 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-961....onlyif 
11c10 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
11c20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
11c30 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
11c40 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
11c50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11c60 6c 2d 35 32 31 0d 0a 53 45 4c 45 43 54 20 63 6f  l-521..SELECT co
11c70 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 2b 20 63  l1 * + CAST( + c
11c80 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol0 AS SIGNED ) 
11c90 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
11ca0 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32  2..----..1343..2
11cb0 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 73 6b 69 70  17..4602....skip
11cc0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
11cd0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
11ce0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
11cf0 2d 35 32 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -521..SELECT col
11d00 31 20 2a 20 2b 20 43 41 53 54 20 28 20 2b 20 63  1 * + CAST ( + c
11d10 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
11d20 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11d30 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a  b2..----..1343..
11d40 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65  217..4602....que
11d50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11d60 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
11d70 30 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 35 36 20  0 + + col1 - 56 
11d80 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
11d90 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  0 cor0..----..12
11da0 34 0d 0a 35 34 0d 0a 37 36 0d 0a 0d 0a 71 75 65  4..54..76....que
11db0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11dc0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
11dd0 35 34 20 29 20 46 52 4f 4d 20 74 61 62 30 2c 20  54 ) FROM tab0, 
11de0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
11df0 2d 2d 0d 0a 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  --..54....onlyif
11e00 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
11e10 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
11e20 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
11e30 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
11e40 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
11e50 65 6c 2d 35 32 34 0d 0a 53 45 4c 45 43 54 20 44  el-524..SELECT D
11e60 49 53 54 49 4e 43 54 20 2d 20 28 20 74 61 62 32  ISTINCT - ( tab2
11e70 2e 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 31  .col1 ) + + col1
11e80 20 2a 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   * CAST( col1 AS
11e90 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
11ea0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
11eb0 2d 0d 0a 32 37 32 0d 0a 33 34 32 32 0d 0a 39 33  -..272..3422..93
11ec0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
11ed0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
11ee0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
11ef0 6f 72 74 20 6c 61 62 65 6c 2d 35 32 34 0d 0a 53  ort label-524..S
11f00 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
11f10 20 28 20 74 61 62 32 2e 63 6f 6c 31 20 29 20 2b   ( tab2.col1 ) +
11f20 20 2b 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28   + col1 * CAST (
11f30 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52   col1 AS INTEGER
11f40 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
11f50 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32 0d  tab2..----..272.
11f60 0a 33 34 32 32 0d 0a 39 33 30 0d 0a 0d 0a 71 75  .3422..930....qu
11f70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11f80 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b  ELECT ALL col1 +
11f90 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63   ( + col0 ) AS c
11fa0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
11fb0 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d  ---..29..74..93.
11fc0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11fd0 72 74 0d 0a 53 45 4c 45 43 54 20 36 34 20 2a 20  rt..SELECT 64 * 
11fe0 63 6f 6c 30 20 2b 20 2b 20 35 31 20 46 52 4f 4d  col0 + + 51 FROM
11ff0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
12000 2d 2d 2d 0d 0a 34 39 39 0d 0a 35 30 34 33 0d 0a  ---..499..5043..
12010 35 31 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5107....query I 
12020 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12030 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
12040 38 36 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  86 FROM tab1..--
12050 2d 2d 0d 0a 32 35 38 0d 0a 35 35 30 34 0d 0a 36  --..258..5504..6
12060 38 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  880....query I r
12070 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
12080 49 53 54 49 4e 43 54 20 39 36 20 2a 20 63 6f 6c  ISTINCT 96 * col
12090 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
120a0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 32 0d  ab2..----..1632.
120b0 0a 32 39 37 36 0d 0a 35 36 36 34 0d 0a 0d 0a 6f  .2976..5664....o
120c0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
120d0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
120e0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
120f0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
12100 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32 39 0d 0a  sort label-529..
12110 53 45 4c 45 43 54 20 2d 20 34 20 44 49 56 20 63  SELECT - 4 DIV c
12120 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
12130 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
12140 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
12150 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
12160 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
12170 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32 39  owsort label-529
12180 0d 0a 53 45 4c 45 43 54 20 2d 20 34 20 2f 20 63  ..SELECT - 4 / c
12190 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
121a0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
121b0 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
121c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
121d0 41 4c 4c 20 2b 20 39 33 20 2b 20 2d 20 63 6f 6c  ALL + 93 + - col
121e0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
121f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 36  or0..----..55..6
12200 36 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49  6..67....query I
12210 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12220 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a   + col2 * col2 *
12230 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
12240 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 31 38 38 34 0d  0..----..611884.
12250 0a 39 33 36 35 34 0d 0a 39 37 0d 0a 0d 0a 71 75  .93654..97....qu
12260 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12270 45 4c 45 43 54 20 2b 20 34 36 20 2a 20 2d 20 63  ELECT + 46 * - c
12280 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
12290 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   tab2..----..-11
122a0 39 36 0d 0a 2d 31 32 34 32 0d 0a 2d 31 37 34 38  96..-1242..-1748
122b0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
122c0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
122d0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
122e0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
122f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
12300 35 33 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  533..SELECT - + 
12310 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 44 49 56 20  col2 + col1 DIV 
12320 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  ( + cor0.col1 * 
12330 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46 52 4f 4d  cor0.col0 ) FROM
12340 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
12350 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d  ---..-54..-57..-
12360 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  96....skipif mys
12370 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
12380 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
12390 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33 33 0d 0a  sort label-533..
123a0 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
123b0 2b 20 63 6f 6c 31 20 2f 20 28 20 2b 20 63 6f 72  + col1 / ( + cor
123c0 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  0.col1 * cor0.co
123d0 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l0 ) FROM tab1 A
123e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
123f0 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 71  4..-57..-96....q
12400 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12410 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
12420 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
12430 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
12440 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a 34 0d  ---..-21..33..4.
12450 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12460 72 74 0d 0a 53 45 4c 45 43 54 20 34 32 20 2b 20  rt..SELECT 42 + 
12470 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
12480 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32  S cor0..----..52
12490 0d 0a 35 35 0d 0a 36 38 0d 0a 0d 0a 73 6b 69 70  ..55..68....skip
124a0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
124b0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
124c0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
124d0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
124e0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
124f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
12500 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 63 6f 6c  TINCT - col2 col
12510 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
12520 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37  ..----..-54..-57
12530 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-96....skipif 
12540 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
12550 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
12560 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
12570 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
12580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12590 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
125a0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f  cor0.col2 + - co
125b0 6c 32 20 2a 20 28 20 63 6f 6c 32 20 2a 20 2b 20  l2 * ( col2 * + 
125c0 63 6f 6c 32 20 29 20 63 6f 6c 30 20 46 52 4f 4d  col2 ) col0 FROM
125d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
125e0 2d 2d 2d 0d 0a 2d 31 35 37 34 31 30 0d 0a 2d 31  ---..-157410..-1
125f0 38 35 31 33 36 0d 0a 2d 38 38 34 36 34 30 0d 0a  85136..-884640..
12600 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12610 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
12620 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f  + cor0.col2 + co
12630 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 2d 20  l1 * + col2 - - 
12640 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
12650 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
12660 34 30 0d 0a 31 35 31 32 0d 0a 36 38 34 0d 0a 0d  40..1512..684...
12670 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12680 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
12690 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  or0.col0 + col2 
126a0 2b 20 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  + 7 AS col0 FROM
126b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
126c0 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 34 35 0d 0a 32  ---..-34..-45..2
126d0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
126e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
126f0 20 32 38 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c   28 * - cor0.col
12700 30 20 2b 20 2b 20 36 37 20 46 52 4f 4d 20 74 61  0 + + 67 FROM ta
12710 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
12720 0d 0a 32 32 35 31 0d 0a 32 32 37 39 0d 0a 32 36  ..2251..2279..26
12730 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  3....skipif post
12740 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
12750 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
12760 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
12770 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
12780 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12790 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b  ELECT ALL col0 +
127a0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   - cor0.col1 * c
127b0 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
127c0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
127d0 0d 0a 2d 31 31 36 38 0d 0a 2d 31 34 30 31 0d 0a  ..-1168..-1401..
127e0 2d 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -506....query I 
127f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12800 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
12810 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 63 6f  * cor0.col1 - co
12820 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
12830 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
12840 2d 31 34 31 37 0d 0a 2d 32 30 38 30 0d 0a 2d 36  -1417..-2080..-6
12850 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  70....onlyif mys
12860 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
12870 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
12880 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
12890 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
128a0 6c 2d 35 34 33 0d 0a 53 45 4c 45 43 54 20 2b 20  l-543..SELECT + 
128b0 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 44 49 56 20  col1 * col1 DIV 
128c0 33 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  3 FROM tab1..---
128d0 2d 0d 0a 32 32 35 0d 0a 33 33 0d 0a 35 36 0d 0a  -..225..33..56..
128e0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
128f0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
12900 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12910 20 6c 61 62 65 6c 2d 35 34 33 0d 0a 53 45 4c 45   label-543..SELE
12920 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  CT + col1 * col1
12930 20 2f 20 33 20 46 52 4f 4d 20 74 61 62 31 0d 0a   / 3 FROM tab1..
12940 2d 2d 2d 2d 0d 0a 32 32 35 0d 0a 33 33 0d 0a 35  ----..225..33..5
12950 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
12960 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
12970 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  0.col0 AS col1 F
12980 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 2c 20  ROM tab2, tab0, 
12990 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
129a0 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
129b0 6e 67 20 74 6f 20 39 66 63 31 64 63 64 37 36 66  ng to 9fc1dcd76f
129c0 65 61 66 34 33 65 35 63 35 64 63 30 36 30 61 30  eaf43e5c5dc060a0
129d0 32 30 31 34 63 64 0d 0a 0d 0a 6f 6e 6c 79 69 66  2014cd....onlyif
129e0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
129f0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
12a00 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
12a10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
12a20 6c 61 62 65 6c 2d 35 34 35 0d 0a 53 45 4c 45 43  label-545..SELEC
12a30 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
12a40 2a 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c  * col1 DIV - col
12a50 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
12a60 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a  ab2..----..-17..
12a70 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 73 6b 69 70  -31..-59....skip
12a80 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
12a90 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
12aa0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12ab0 2d 35 34 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  -545..SELECT DIS
12ac0 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c  TINCT col0 * col
12ad0 31 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 / - col0 AS co
12ae0 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
12af0 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35  --..-17..-31..-5
12b00 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
12b10 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
12b20 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
12b30 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
12b40 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12b50 2d 35 34 36 0d 0a 53 45 4c 45 43 54 20 2d 20 28  -546..SELECT - (
12b60 20 63 6f 6c 31 20 29 20 44 49 56 20 2d 20 63 6f   col1 ) DIV - co
12b70 6c 30 20 2b 20 2b 20 28 20 2b 20 63 6f 72 30 2e  l0 + + ( + cor0.
12b80 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 32 20 29 20  col0 * ( col2 ) 
12b90 29 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  ) - col2 * cor0.
12ba0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
12bb0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
12bc0 2d 2d 2d 2d 0d 0a 2d 31 36 33 0d 0a 2d 32 30 34  ----..-163..-204
12bd0 33 0d 0a 2d 36 30 0d 0a 0d 0a 73 6b 69 70 69 66  3..-60....skipif
12be0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
12bf0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
12c00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
12c10 34 36 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63  46..SELECT - ( c
12c20 6f 6c 31 20 29 20 2f 20 2d 20 63 6f 6c 30 20 2b  ol1 ) / - col0 +
12c30 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   + ( + cor0.col0
12c40 20 2a 20 28 20 63 6f 6c 32 20 29 20 29 20 2d 20   * ( col2 ) ) - 
12c50 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col2 * cor0.col1
12c60 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
12c70 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
12c80 0d 0a 2d 31 36 33 0d 0a 2d 32 30 34 33 0d 0a 2d  ..-163..-2043..-
12c90 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
12ca0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
12cb0 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col1 + - col0 * 
12cc0 39 39 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  99 FROM tab2 AS 
12cd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 36 32  cor0..----..-662
12ce0 0d 0a 2d 37 36 36 33 0d 0a 2d 37 38 30 34 0d 0a  ..-7663..-7804..
12cf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12d00 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
12d10 6c 30 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f  l0 + col0 - - co
12d20 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  r0.col0 AS col1 
12d30 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12d40 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a  0..----..3..64..
12d50 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
12d60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
12d70 63 6f 6c 30 20 2a 20 39 37 20 2b 20 63 6f 6c 30  col0 * 97 + col0
12d80 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
12d90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 34 0d 0a 36  r0..----..294..6
12da0 32 37 32 0d 0a 37 38 34 30 0d 0a 0d 0a 71 75 65  272..7840....que
12db0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12dc0 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  LECT - cor0.col0
12dd0 20 2a 20 2b 20 37 34 20 2b 20 63 6f 6c 30 20 2a   * + 74 + col0 *
12de0 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
12df0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
12e00 2d 2d 2d 2d 0d 0a 2d 32 35 35 35 0d 0a 2d 39 38  ----..-2555..-98
12e10 34 0d 0a 37 31 32 0d 0a 0d 0a 71 75 65 72 79 20  4..712....query 
12e20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
12e30 54 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  T col0 + cor0.co
12e40 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
12e50 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
12e60 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a  --..29..74..93..
12e70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12e80 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
12e90 34 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  40 FROM tab2, ta
12ea0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b1 cor0..----..9
12eb0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
12ec0 74 6f 20 62 31 65 38 66 66 65 65 66 33 33 34 62  to b1e8ffeef334b
12ed0 34 61 32 62 30 31 62 32 66 39 31 65 36 34 39 63  4a2b01b2f91e649c
12ee0 32 64 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  2d3....query I r
12ef0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
12f00 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2d 20   - col1 * + ( - 
12f10 63 6f 6c 31 20 29 20 2d 20 2d 20 63 6f 72 30 2e  col1 ) - - cor0.
12f20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
12f30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
12f40 37 0d 0a 32 36 35 0d 0a 37 33 30 0d 0a 0d 0a 71  7..265..730....q
12f50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12f60 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
12f70 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  ol2 * + col2 AS 
12f80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
12f90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39  S cor0..----..29
12fa0 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d 0a  16..3249..9216..
12fb0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
12fc0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
12fd0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
12fe0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
12ff0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
13000 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13010 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63  CT cor0.col0 * c
13020 6f 6c 32 20 2b 20 2d 20 38 39 20 2a 20 63 6f 6c  ol2 + - 89 * col
13030 31 20 2d 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20  1 - + col0 col0 
13040 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
13050 2d 2d 2d 2d 0d 0a 2d 36 38 38 36 0d 0a 2d 38 36  ----..-6886..-86
13060 33 33 0d 0a 2d 38 39 30 0d 0a 0d 0a 71 75 65 72  33..-890....quer
13070 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13080 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36  ECT DISTINCT - 6
13090 34 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  4 * - col1 FROM 
130a0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 38  tab2..----..1088
130b0 0d 0a 31 39 38 34 0d 0a 33 37 37 36 0d 0a 0d 0a  ..1984..3776....
130c0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
130d0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
130e0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
130f0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
13100 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 37 0d  wsort label-557.
13110 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
13120 20 2b 20 32 36 20 44 49 56 20 63 6f 6c 32 20 46   + 26 DIV col2 F
13130 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
13140 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38  ..----..3..64..8
13150 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
13160 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
13170 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
13180 6f 72 74 20 6c 61 62 65 6c 2d 35 35 37 0d 0a 53  ort label-557..S
13190 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b  ELECT + col0 + +
131a0 20 32 36 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20   26 / col2 FROM 
131b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
131c0 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d  --..3..64..80...
131d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
131e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
131f0 54 20 2b 20 63 6f 6c 32 20 2a 20 32 38 20 46 52  T + col2 * 28 FR
13200 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
13210 0a 2d 2d 2d 2d 0d 0a 32 32 39 36 0d 0a 32 38 0d  .----..2296..28.
13220 0a 39 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .924....query I 
13230 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13240 41 4c 4c 20 2d 20 28 20 2b 20 38 30 20 29 20 41  ALL - ( + 80 ) A
13250 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
13260 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 30 0d 0a 2d 38 30  ..----..-80..-80
13270 0d 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-80....onlyif 
13280 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
13290 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
132a0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
132b0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
132c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
132d0 6c 2d 35 36 30 0d 0a 53 45 4c 45 43 54 20 2d 20  l-560..SELECT - 
132e0 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
132f0 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20  SIGNED ) + col0 
13300 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 63 6f  * cor0.col0 / co
13310 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
13320 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
13330 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
13340 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
13350 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
13360 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
13370 61 62 65 6c 2d 35 36 30 0d 0a 53 45 4c 45 43 54  abel-560..SELECT
13380 20 2d 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   - - CAST ( NULL
13390 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
133a0 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col0 * cor0.col0
133b0 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
133c0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
133d0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
133e0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
133f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
13400 20 36 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   68 AS col0 FROM
13410 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
13420 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
13430 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  ab2..----..27 va
13440 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
13450 31 30 61 61 32 35 66 31 63 36 62 39 37 35 38 32  10aa25f1c6b97582
13460 63 33 34 35 32 31 61 63 36 34 35 32 65 30 62 34  c34521ac6452e0b4
13470 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13480 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 30  ort..SELECT + 60
13490 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
134a0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 0d 0a 36 30  b0..----..60..60
134b0 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..60....query I 
134c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
134d0 2b 20 36 38 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  + 68 + - col0 * 
134e0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
134f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
13500 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 32 38 0d 0a 2d  ..----..-4028..-
13510 36 33 33 32 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72  6332..59....quer
13520 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13530 45 43 54 20 2d 20 2d 20 34 37 20 41 53 20 63 6f  ECT - - 47 AS co
13540 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
13550 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 37 0d 0a  cor0..----..47..
13560 34 37 0d 0a 34 37 0d 0a 0d 0a 71 75 65 72 79 20  47..47....query 
13570 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13580 54 20 36 37 20 2a 20 2b 20 63 6f 6c 31 20 46 52  T 67 * + col1 FR
13590 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
135a0 0a 2d 2d 2d 2d 0d 0a 31 31 33 39 0d 0a 32 30 37  .----..1139..207
135b0 37 0d 0a 33 39 35 33 0d 0a 0d 0a 71 75 65 72 79  7..3953....query
135c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
135d0 43 54 20 2d 20 2d 20 28 20 63 6f 72 30 2e 63 6f  CT - - ( cor0.co
135e0 6c 30 20 29 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  l0 ) + col0 * co
135f0 6c 31 20 2a 20 2b 20 37 20 46 52 4f 4d 20 74 61  l1 * + 7 FROM ta
13600 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
13610 0d 0a 34 35 34 34 0d 0a 35 34 39 0d 0a 37 33 36  ..4544..549..736
13620 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
13630 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
13640 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  2 + col0 * col0 
13650 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
13660 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 36 0d 0a 36  0..----..1226..6
13670 30 39 0d 0a 38 30 30 33 0d 0a 0d 0a 71 75 65 72  09..8003....quer
13680 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13690 45 43 54 20 2b 20 32 37 20 2a 20 2d 20 63 6f 6c  ECT + 27 * - col
136a0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
136b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 32 32  or0..----..-2322
136c0 0d 0a 2d 32 34 35 37 0d 0a 2d 32 36 31 39 0d 0a  ..-2457..-2619..
136d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
136e0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 20 2a 20  t..SELECT + 8 * 
136f0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
13700 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
13710 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 0d 0a 32 31 36  ..----..208..216
13720 0d 0a 33 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..304....query I
13730 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13740 20 44 49 53 54 49 4e 43 54 20 32 31 20 41 53 20   DISTINCT 21 AS 
13750 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
13760 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61  tab1 AS cor0, ta
13770 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30  b0 AS cor1, tab0
13780 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
13790 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  21....onlyif mys
137a0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
137b0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
137c0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
137d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
137e0 6c 2d 35 37 31 0d 0a 53 45 4c 45 43 54 20 31 32  l-571..SELECT 12
137f0 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74   DIV col1 FROM t
13800 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
13810 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
13820 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
13830 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
13840 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
13850 65 6c 2d 35 37 31 0d 0a 53 45 4c 45 43 54 20 31  el-571..SELECT 1
13860 32 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  2 / col1 FROM ta
13870 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
13880 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c  ..0..0..0....onl
13890 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
138a0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
138b0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
138c0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
138d0 72 74 20 6c 61 62 65 6c 2d 35 37 32 0d 0a 53 45  rt label-572..SE
138e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61  LECT DISTINCT ta
138f0 62 30 2e 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f  b0.col0 DIV - co
13900 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20  r0.col1 AS col1 
13910 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
13920 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
13930 31 0d 0a 2d 32 0d 0a 2d 33 0d 0a 2d 36 0d 0a 2d  1..-2..-3..-6..-
13940 38 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  8..0....skipif m
13950 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
13960 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
13970 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 32  owsort label-572
13980 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
13990 54 20 74 61 62 30 2e 63 6f 6c 30 20 2f 20 2d 20  T tab0.col0 / - 
139a0 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
139b0 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
139c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
139d0 0a 2d 31 0d 0a 2d 32 0d 0a 2d 33 0d 0a 2d 36 0d  .-1..-2..-3..-6.
139e0 0a 2d 38 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-8..0....onlyif
139f0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
13a00 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
13a10 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
13a20 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
13a30 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
13a40 65 6c 2d 35 37 33 0d 0a 53 45 4c 45 43 54 20 41  el-573..SELECT A
13a50 4c 4c 20 2b 20 33 32 20 2f 20 28 20 2b 20 63 6f  LL + 32 / ( + co
13a60 6c 30 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  l0 + CAST( NULL 
13a70 41 53 20 53 49 47 4e 45 44 20 29 20 29 20 46 52  AS SIGNED ) ) FR
13a80 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab2..----..N
13a90 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
13aa0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
13ab0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
13ac0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13ad0 74 20 6c 61 62 65 6c 2d 35 37 33 0d 0a 53 45 4c  t label-573..SEL
13ae0 45 43 54 20 41 4c 4c 20 2b 20 33 32 20 2f 20 28  ECT ALL + 32 / (
13af0 20 2b 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28   + col0 + CAST (
13b00 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
13b10 20 29 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a   ) ) FROM tab2..
13b20 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
13b30 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
13b40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13b50 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20  T + cor0.col1 - 
13b60 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
13b70 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
13b80 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32 0d 0a  ----..-19..-62..
13b90 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  24....query I ro
13ba0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
13bb0 53 54 49 4e 43 54 20 36 38 20 2b 20 63 6f 6c 32  STINCT 68 + col2
13bc0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
13bd0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
13be0 30 31 0d 0a 31 35 30 0d 0a 36 39 0d 0a 0d 0a 71  01..150..69....q
13bf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13c00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
13c10 2d 20 28 20 34 39 20 29 20 2a 20 63 6f 6c 32 20  - ( 49 ) * col2 
13c20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
13c30 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
13c40 0a 2d 32 36 34 36 0d 0a 2d 32 37 39 33 0d 0a 2d  .-2646..-2793..-
13c50 34 37 30 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  4704....onlyif m
13c60 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
13c70 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
13c80 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
13c90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
13ca0 62 65 6c 2d 35 37 37 0d 0a 53 45 4c 45 43 54 20  bel-577..SELECT 
13cb0 2b 20 37 20 44 49 56 20 2b 20 63 6f 6c 31 20 2d  + 7 DIV + col1 -
13cc0 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
13cd0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
13ce0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a  0..----..7..78..
13cf0 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  79....skipif mys
13d00 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
13d10 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
13d20 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 37 0d 0a  sort label-577..
13d30 53 45 4c 45 43 54 20 2b 20 37 20 2f 20 2b 20 63  SELECT + 7 / + c
13d40 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 - - col0 AS 
13d50 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
13d60 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d  S cor0..----..7.
13d70 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79  .78..79....query
13d80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13d90 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20  CT ALL - col1 + 
13da0 2d 20 33 38 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 38 AS col0 FRO
13db0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
13dc0 2d 0d 0a 2d 34 38 0d 0a 2d 35 31 0d 0a 2d 36 34  -..-48..-51..-64
13dd0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
13de0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
13df0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
13e00 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
13e10 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
13e20 35 37 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  579..SELECT ALL 
13e30 37 38 20 44 49 56 20 2d 20 34 36 20 46 52 4f 4d  78 DIV - 46 FROM
13e40 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
13e50 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d  ---..-1..-1..-1.
13e60 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
13e70 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
13e80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13e90 74 20 6c 61 62 65 6c 2d 35 37 39 0d 0a 53 45 4c  t label-579..SEL
13ea0 45 43 54 20 41 4c 4c 20 37 38 20 2f 20 2d 20 34  ECT ALL 78 / - 4
13eb0 36 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  6 FROM tab2 AS c
13ec0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
13ed0 31 0d 0a 2d 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  1..-1....onlyif 
13ee0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
13ef0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
13f00 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
13f10 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
13f20 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
13f30 6c 2d 35 38 30 0d 0a 53 45 4c 45 43 54 20 44 49  l-580..SELECT DI
13f40 53 54 49 4e 43 54 20 2b 20 43 41 53 54 28 20 63  STINCT + CAST( c
13f50 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol2 AS SIGNED ) 
13f60 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + + col2 * - col
13f70 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2 col2 FROM tab2
13f80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13f90 2d 31 34 30 36 0d 0a 2d 36 35 30 0d 0a 2d 37 30  -1406..-650..-70
13fa0 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
13fb0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
13fc0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
13fd0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
13fe0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
13ff0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
14000 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
14010 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
14020 65 6c 2d 35 38 30 0d 0a 53 45 4c 45 43 54 20 44  el-580..SELECT D
14030 49 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28  ISTINCT + CAST (
14040 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
14050 20 29 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20   ) + + col2 * - 
14060 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col2 col2 FROM t
14070 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
14080 2d 0d 0a 2d 31 34 30 36 0d 0a 2d 36 35 30 0d 0a  -..-1406..-650..
14090 2d 37 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -702....query I 
140a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
140b0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
140c0 2a 20 2b 20 36 34 20 46 52 4f 4d 20 74 61 62 32  * + 64 FROM tab2
140d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38   cor0..----..108
140e0 38 0d 0a 31 39 38 34 0d 0a 33 37 37 36 0d 0a 0d  8..1984..3776...
140f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14100 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32  ..SELECT ALL - 2
14110 38 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  8 - + col1 FROM 
14120 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
14130 2d 2d 0d 0a 2d 34 35 0d 0a 2d 35 39 0d 0a 2d 38  --..-45..-59..-8
14140 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
14150 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
14160 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
14170 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
14180 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
14190 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
141a0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20 30  ELECT + col2 - 0
141b0 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46   * + col2 col1 F
141c0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
141d0 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d  ---..26..27..38.
141e0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
141f0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
14200 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
14210 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
14220 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
14230 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14240 45 43 54 20 41 4c 4c 20 28 20 63 6f 72 30 2e 63  ECT ALL ( cor0.c
14250 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 32 20 63  ol1 ) + + col2 c
14260 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
14270 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
14280 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71 75 65  ..173..98....que
14290 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
142a0 4c 45 43 54 20 41 4c 4c 20 33 31 20 2a 20 38 39  LECT ALL 31 * 89
142b0 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t
142c0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
142d0 2d 0d 0a 32 36 36 33 0d 0a 32 37 30 32 0d 0a 32  -..2663..2702..2
142e0 37 30 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  705....onlyif my
142f0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
14300 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
14310 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
14320 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
14330 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
14340 35 38 36 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  586..SELECT CAST
14350 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  ( - cor0.col1 AS
14360 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30   SIGNED ) * col0
14370 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   - cor0.col2 AS 
14380 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
14390 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 36  or0..----..-1136
143a0 0d 0a 2d 31 33 32 0d 0a 2d 36 39 37 0d 0a 0d 0a  ..-132..-697....
143b0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
143c0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
143d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
143e0 61 62 65 6c 2d 35 38 36 0d 0a 53 45 4c 45 43 54  abel-586..SELECT
143f0 20 43 41 53 54 20 28 20 2d 20 63 6f 72 30 2e 63   CAST ( - cor0.c
14400 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
14410 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63   * col0 - cor0.c
14420 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
14430 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
14440 0d 0a 2d 31 31 33 36 0d 0a 2d 31 33 32 0d 0a 2d  ..-1136..-132..-
14450 36 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  697....query I r
14460 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
14470 20 2d 20 33 39 20 46 52 4f 4d 20 74 61 62 30 20   - 39 FROM tab0 
14480 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
14490 39 0d 0a 33 39 0d 0a 33 39 0d 0a 0d 0a 71 75 65  9..39..39....que
144a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
144b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 35 20  LECT DISTINCT 5 
144c0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
144d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
144e0 0a 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .5....onlyif mys
144f0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
14500 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
14510 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
14520 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
14530 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
14540 38 39 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  89..SELECT + CAS
14550 54 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41  T( + cor0.col1 A
14560 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
14570 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l1 FROM tab1, ta
14580 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
14590 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
145a0 6e 67 20 74 6f 20 35 38 35 61 34 31 61 35 32 63  ng to 585a41a52c
145b0 30 63 36 63 30 64 36 39 37 62 35 64 33 39 32 36  0c6c0d697b5d3926
145c0 35 62 37 34 64 63 0d 0a 0d 0a 73 6b 69 70 69 66  5b74dc....skipif
145d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
145e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
145f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
14600 38 39 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  89..SELECT + CAS
14610 54 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  T ( + cor0.col1 
14620 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
14630 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
14640 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
14650 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
14660 68 69 6e 67 20 74 6f 20 35 38 35 61 34 31 61 35  hing to 585a41a5
14670 32 63 30 63 36 63 30 64 36 39 37 62 35 64 33 39  2c0c6c0d697b5d39
14680 32 36 35 62 37 34 64 63 0d 0a 0d 0a 71 75 65 72  265b74dc....quer
14690 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
146a0 45 43 54 20 2d 20 30 20 41 53 20 63 6f 6c 32 20  ECT - 0 AS col2 
146b0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
146c0 41 53 20 63 6f 72 30 2c 20 74 61 62 32 2c 20 74  AS cor0, tab2, t
146d0 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
146e0 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73  -..81 values has
146f0 68 69 6e 67 20 74 6f 20 31 66 31 31 37 66 34 36  hing to 1f117f46
14700 37 66 34 35 64 38 63 36 62 37 35 35 33 65 32 65  7f45d8c6b7553e2e
14710 33 63 38 34 32 39 34 32 0d 0a 0d 0a 73 6b 69 70  3c842942....skip
14720 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
14730 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
14740 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
14750 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
14760 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
14770 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
14780 54 49 4e 43 54 20 30 20 2b 20 39 38 20 2a 20 2d  TINCT 0 + 98 * -
14790 20 74 61 62 30 2e 63 6f 6c 31 20 63 6f 6c 30 20   tab0.col1 col0 
147a0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
147b0 0a 2d 38 34 32 38 0d 0a 2d 38 39 31 38 0d 0a 2d  .-8428..-8918..-
147c0 39 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9506....query I 
147d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
147e0 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c  ( - col1 ) + col
147f0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
14800 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a  or0..----..-33..
14810 2d 34 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20  -4..21....query 
14820 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14830 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32 32 20  T DISTINCT + 22 
14840 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e  + col2 * + cor0.
14850 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
14860 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
14870 36 36 0d 0a 36 39 38 0d 0a 37 35 31 0d 0a 0d 0a  66..698..751....
14880 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14890 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
148a0 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   + - col1 + col0
148b0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
148c0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
148d0 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a 0d  ..-24..19..62...
148e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
148f0 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 35 32 20  ..SELECT - ( 52 
14900 29 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ) * + col2 FROM 
14910 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
14920 0a 2d 31 33 35 32 0d 0a 2d 31 34 30 34 0d 0a 2d  .-1352..-1404..-
14930 31 39 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1976....query I 
14940 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14950 2d 20 2d 20 37 35 20 2b 20 63 6f 72 30 2e 63 6f  - - 75 + cor0.co
14960 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 * col1 AS col
14970 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
14980 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 39 0d  or0..----..1609.
14990 0a 37 32 31 0d 0a 39 31 32 0d 0a 0d 0a 6f 6e 6c  .721..912....onl
149a0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
149b0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
149c0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
149d0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
149e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
149f0 6c 61 62 65 6c 2d 35 39 37 0d 0a 53 45 4c 45 43  label-597..SELEC
14a00 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 43  T DISTINCT - + C
14a10 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
14a20 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20  NED ) FROM tab1 
14a30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
14a40 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
14a50 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
14a60 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
14a70 72 74 20 6c 61 62 65 6c 2d 35 39 37 0d 0a 53 45  rt label-597..SE
14a80 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
14a90 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
14aa0 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
14ab0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
14ac0 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
14ad0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14ae0 20 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   6 AS col1 FROM 
14af0 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
14b00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
14b10 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 64  es hashing to 5d
14b20 31 63 62 39 30 65 64 35 38 66 61 37 35 37 33 38  1cb90ed58fa75738
14b30 39 35 64 32 66 39 35 62 32 31 31 38 32 31 0d 0a  95d2f95b211821..
14b40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14b50 74 0d 0a 53 45 4c 45 43 54 20 35 20 46 52 4f 4d  t..SELECT 5 FROM
14b60 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
14b70 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53  OSS JOIN tab0 AS
14b80 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
14b90 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
14ba0 20 36 30 33 35 36 32 38 36 39 34 62 64 65 61 33   6035628694bdea3
14bb0 36 66 35 38 34 66 33 36 34 39 30 38 38 35 35 31  6f584f3649088551
14bc0 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  d....query I row
14bd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
14be0 20 39 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f   91 * + col0 FRO
14bf0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  M tab1..----..27
14c00 33 0d 0a 35 38 32 34 0d 0a 37 32 38 30 0d 0a 0d  3..5824..7280...
14c10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14c20 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
14c30 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l0 * + cor0.col1
14c40 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
14c50 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b1, tab2 AS cor0
14c60 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
14c70 20 68 61 73 68 69 6e 67 20 74 6f 20 62 63 36 36   hashing to bc66
14c80 39 61 33 63 63 39 36 39 63 37 36 31 39 65 62 63  9a3cc969c7619ebc
14c90 66 66 62 35 34 30 30 62 61 30 62 61 0d 0a 0d 0a  ffb5400ba0ba....
14ca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14cb0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
14cc0 20 35 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   5 FROM tab0 AS 
14cd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 30  cor0..----..-120
14ce0 0d 0a 2d 31 37 35 0d 0a 2d 34 34 35 0d 0a 0d 0a  ..-175..-445....
14cf0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
14d00 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
14d10 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
14d20 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
14d30 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
14d40 72 74 20 6c 61 62 65 6c 2d 36 30 33 0d 0a 53 45  rt label-603..SE
14d50 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
14d60 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  * CAST( NULL AS 
14d70 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
14d80 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
14d90 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
14da0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
14db0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
14dc0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
14dd0 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30 33 0d 0a  sort label-603..
14de0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
14df0 31 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  1 * CAST ( NULL 
14e00 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
14e10 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
14e20 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
14e30 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
14e40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14e50 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  T - cor0.col0 AS
14e60 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c   col0 FROM tab0,
14e70 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
14e80 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
14e90 6e 67 20 74 6f 20 34 65 63 33 30 34 62 38 63 65  ng to 4ec304b8ce
14ea0 39 33 35 66 32 32 32 36 65 37 35 34 38 64 37 32  935f2226e7548d72
14eb0 63 32 62 32 66 30 0d 0a 0d 0a 71 75 65 72 79 20  c2b2f0....query 
14ec0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14ed0 54 20 2d 20 37 30 20 41 53 20 63 6f 6c 30 20 46  T - 70 AS col0 F
14ee0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
14ef0 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a 2d 37 30  ..----..-70..-70
14f00 0d 0a 2d 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-70....onlyif 
14f10 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
14f20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
14f30 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
14f40 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
14f50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
14f60 6c 2d 36 30 36 0d 0a 53 45 4c 45 43 54 20 2b 20  l-606..SELECT + 
14f70 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
14f80 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
14f90 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61 62  , tab0 cor0, tab
14fa0 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
14fb0 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
14fc0 6e 67 20 74 6f 20 31 36 62 65 38 38 36 38 61 31  ng to 16be8868a1
14fd0 65 36 66 34 65 38 38 35 30 35 30 39 66 39 33 32  e6f4e8850509f932
14fe0 37 61 66 65 39 30 0d 0a 0d 0a 73 6b 69 70 69 66  7afe90....skipif
14ff0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
15000 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
15010 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
15020 30 36 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  06..SELECT + CAS
15030 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
15040 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 2c  GER ) FROM tab0,
15050 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61 62 30   tab0 cor0, tab0
15060 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
15070 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
15080 67 20 74 6f 20 31 36 62 65 38 38 36 38 61 31 65  g to 16be8868a1e
15090 36 66 34 65 38 38 35 30 35 30 39 66 39 33 32 37  6f4e8850509f9327
150a0 61 66 65 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49  afe90....query I
150b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
150c0 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 32 20 2a   ALL tab2.col2 *
150d0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
150e0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
150f0 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d  534..646..837...
15100 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15110 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
15120 54 20 63 6f 6c 32 20 2a 20 28 20 34 34 20 29 20  T col2 * ( 44 ) 
15130 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
15140 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 34 0d 0a 31  2..----..1144..1
15150 31 38 38 0d 0a 31 36 37 32 0d 0a 0d 0a 71 75 65  188..1672....que
15160 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15170 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 33 31  LECT + col1 + 31
15180 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
15190 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 0d 0a 34 34  r0..----..41..44
151a0 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..57....query I 
151b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
151c0 41 4c 4c 20 63 6f 6c 31 20 2b 20 2b 20 28 20 63  ALL col1 + + ( c
151d0 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol0 ) FROM tab2 
151e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
151f0 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75  37..38..96....qu
15200 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15210 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
15220 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 41   col0 - - col2 A
15230 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
15240 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15250 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 6f 6e  -34..-7..9....on
15260 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
15270 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
15280 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
15290 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
152a0 6f 72 74 20 6c 61 62 65 6c 2d 36 31 32 0d 0a 53  ort label-612..S
152b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
152c0 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30   + col0 + + col0
152d0 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   DIV + col1 FROM
152e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
152f0 2d 2d 2d 0d 0a 33 0d 0a 37 30 0d 0a 38 36 0d 0a  ---..3..70..86..
15300 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
15310 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
15320 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15330 20 6c 61 62 65 6c 2d 36 31 32 0d 0a 53 45 4c 45   label-612..SELE
15340 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
15350 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2f 20  col0 + + col0 / 
15360 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
15370 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15380 33 0d 0a 37 30 0d 0a 38 36 0d 0a 0d 0a 71 75 65  3..70..86....que
15390 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
153a0 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 28 20  LECT col1 * + ( 
153b0 2b 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c  + col1 ) + + col
153c0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
153d0 2d 0d 0a 37 34 32 39 0d 0a 38 33 36 33 0d 0a 39  -..7429..8363..9
153e0 34 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  410....query I r
153f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
15400 20 63 6f 6c 32 20 2b 20 2b 20 32 32 20 2a 20 28   col2 + + 22 * (
15410 20 63 6f 6c 32 20 2b 20 74 61 62 32 2e 63 6f 6c   col2 + tab2.col
15420 30 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  0 ) FROM tab2..-
15430 2d 2d 2d 0d 0a 32 33 31 34 0d 0a 32 36 31 32 0d  ---..2314..2612.
15440 0a 37 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .775....query I 
15450 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15460 41 4c 4c 20 34 32 20 2d 20 34 37 20 46 52 4f 4d  ALL 42 - 47 FROM
15470 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
15480 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
15490 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
154a0 34 36 36 35 66 62 62 34 37 64 35 62 31 37 64 61  4665fbb47d5b17da
154b0 30 31 31 62 63 61 35 36 37 31 39 35 62 32 31 0d  011bca567195b21.
154c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
154d0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
154e0 20 2b 20 63 6f 6c 31 20 2a 20 32 37 20 2b 20 63   + col1 * 27 + c
154f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
15500 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 39 38 0d  r0..----..-2298.
15510 0a 2d 32 33 36 38 0d 0a 2d 32 35 38 34 0d 0a 0d  .-2368..-2584...
15520 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15530 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
15540 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53  + col2 * col1 AS
15550 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
15560 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
15570 38 31 34 0d 0a 36 32 0d 0a 37 33 37 33 0d 0a 0d  814..62..7373...
15580 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
15590 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
155a0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
155b0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
155c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 38  owsort label-618
155d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
155e0 32 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 36  2 + - col0 DIV 6
155f0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
15600 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 32  or0..----..25..2
15610 37 0d 0a 33 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  7..37....skipif 
15620 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
15630 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
15640 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31  rowsort label-61
15650 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  8..SELECT ALL co
15660 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 36 32  l2 + - col0 / 62
15670 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
15680 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 32 37  r0..----..25..27
15690 0d 0a 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..37....query I 
156a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
156b0 2b 20 63 6f 6c 32 20 2b 20 32 35 20 2a 20 2d 20  + col2 + 25 * - 
156c0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53  col0 * + col2 AS
156d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
156e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
156f0 31 38 32 33 36 38 0d 0a 2d 31 39 37 36 37 0d 0a  182368..-19767..
15700 2d 38 37 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -874....skipif p
15710 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
15720 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
15730 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
15740 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
15750 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15760 0d 0a 53 45 4c 45 43 54 20 34 39 20 63 6f 6c 31  ..SELECT 49 col1
15770 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
15780 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 2c 20   AS cor0, tab0, 
15790 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
157a0 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61  --..81 values ha
157b0 73 68 69 6e 67 20 74 6f 20 65 35 38 37 63 31 32  shing to e587c12
157c0 32 64 65 61 33 39 61 32 34 38 38 66 66 38 38 62  2dea39a2488ff88b
157d0 38 38 34 63 65 61 34 36 32 0d 0a 0d 0a 73 6b 69  884cea462....ski
157e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
157f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
15800 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15810 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 43 41 53  ECT + col1 + CAS
15820 54 20 28 20 31 39 20 41 53 20 52 45 41 4c 20 29  T ( 19 AS REAL )
15830 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
15840 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
15850 0a 32 30 30 0d 0a 32 36 30 0d 0a 35 32 30 0d 0a  .200..260..520..
15860 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15870 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
15880 20 2b 20 2d 20 38 35 20 46 52 4f 4d 20 74 61 62   + - 85 FROM tab
15890 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
158a0 0a 2d 31 31 38 0d 0a 2d 31 36 37 0d 0a 2d 38 36  .-118..-167..-86
158b0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
158c0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
158d0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
158e0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
158f0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
15900 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 33  owsort label-623
15910 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
15920 30 20 2f 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  0 / CAST( NULL A
15930 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
15940 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
15950 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
15960 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
15970 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
15980 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
15990 6f 72 74 20 6c 61 62 65 6c 2d 36 32 33 0d 0a 53  ort label-623..S
159a0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2f  ELECT ALL col0 /
159b0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
159c0 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
159d0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
159e0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
159f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15a00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
15a10 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  + - cor0.col0 + 
15a20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  + ( cor0.col2 ) 
15a30 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
15a40 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37  0..----..-34..-7
15a50 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..9....query I r
15a60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
15a70 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a  ISTINCT + col2 *
15a80 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
15a90 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
15aa0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39  0..----..1..1089
15ab0 0d 0a 36 37 32 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..6724....skipif
15ac0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
15ad0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
15ae0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
15af0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
15b00 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
15b10 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
15b20 4e 43 54 20 2d 20 28 20 38 31 20 29 20 2b 20 2b  NCT - ( 81 ) + +
15b30 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20   col0 col0 FROM 
15b40 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
15b50 2d 2d 0d 0a 2d 31 0d 0a 2d 31 37 0d 0a 2d 37 38  --..-1..-17..-78
15b60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15b70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
15b80 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  + + col0 * cor0.
15b90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
15ba0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 36 0d  or0..----..4096.
15bb0 0a 36 34 30 30 0d 0a 39 0d 0a 0d 0a 6f 6e 6c 79  .6400..9....only
15bc0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
15bd0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
15be0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
15bf0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
15c00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
15c10 61 62 65 6c 2d 36 32 38 0d 0a 53 45 4c 45 43 54  abel-628..SELECT
15c20 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53 54   DISTINCT + CAST
15c30 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
15c40 20 29 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 31   ) * col0 * col1
15c50 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
15c60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
15c70 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
15c80 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
15c90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15ca0 20 6c 61 62 65 6c 2d 36 32 38 0d 0a 53 45 4c 45   label-628..SELE
15cb0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
15cc0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
15cd0 45 47 45 52 20 29 20 2a 20 63 6f 6c 30 20 2a 20  EGER ) * col0 * 
15ce0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
15cf0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
15d00 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  LL....skipif pos
15d10 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
15d20 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
15d30 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
15d40 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
15d50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15d60 53 45 4c 45 43 54 20 35 39 20 63 6f 6c 31 20 46  SELECT 59 col1 F
15d70 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
15d80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
15d90 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
15da0 6f 20 61 39 62 39 39 36 36 64 37 34 39 64 31 62  o a9b9966d749d1b
15db0 32 63 65 35 39 35 35 65 64 31 32 33 39 34 66 39  2ce5955ed12394f9
15dc0 62 63 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  bc....onlyif mys
15dd0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
15de0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
15df0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
15e00 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
15e10 6c 2d 36 33 30 0d 0a 53 45 4c 45 43 54 20 63 6f  l-630..SELECT co
15e20 6c 31 20 44 49 56 20 2d 20 28 20 2d 20 63 6f 6c  l1 DIV - ( - col
15e30 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
15e40 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
15e50 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a  ---..0..0..4....
15e60 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
15e70 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
15e80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
15e90 61 62 65 6c 2d 36 33 30 0d 0a 53 45 4c 45 43 54  abel-630..SELECT
15ea0 20 63 6f 6c 31 20 2f 20 2d 20 28 20 2d 20 63 6f   col1 / - ( - co
15eb0 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l0 ) AS col0 FRO
15ec0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
15ed0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d  ----..0..0..4...
15ee0 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
15ef0 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
15f00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
15f10 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  * FROM tab2, tab
15f20 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  0 AS cor0, tab2 
15f30 63 6f 72 31 2c 20 74 61 62 30 2c 20 74 61 62 31  cor1, tab0, tab1
15f40 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor2..----..364
15f50 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  5 values hashing
15f60 20 74 6f 20 32 39 39 33 37 65 30 66 36 30 34 30   to 29937e0f6040
15f70 35 35 62 37 33 32 34 63 65 30 63 33 35 34 61 35  55b7324ce0c354a5
15f80 65 37 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  e778....skipif p
15f90 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
15fa0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
15fb0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
15fc0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
15fd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15fe0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
15ff0 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  * - col1 col0 FR
16000 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
16010 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d  .----..100..169.
16020 0a 36 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .676....skipif p
16030 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
16040 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
16050 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
16060 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
16070 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16080 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
16090 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 33 36 20  * - col0 + - 36 
160a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
160b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
160c0 0d 0a 37 32 36 32 0d 0a 37 35 36 0d 0a 0d 0a 71  ..7262..756....q
160d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
160e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
160f0 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53  - col2 + col0 AS
16100 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
16110 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
16120 32 30 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 71 75  20..41..52....qu
16130 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16140 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
16150 20 34 37 20 46 52 4f 4d 20 74 61 62 30 20 63 6f   47 FROM tab0 co
16160 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 37 0d 0a 0d 0a  r0..----..47....
16170 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16180 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 35 20 46  .SELECT ALL 45 F
16190 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
161a0 34 35 0d 0a 34 35 0d 0a 34 35 0d 0a 0d 0a 71 75  45..45..45....qu
161b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
161c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
161d0 20 2b 20 31 33 20 2b 20 2b 20 63 6f 6c 32 20 2a   + 13 + + col2 *
161e0 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32   - col2 + + col2
161f0 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
16200 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
16210 0a 2d 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-13....query I 
16220 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16230 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c  DISTINCT - - col
16240 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
16250 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
16260 0d 0a 32 38 39 0d 0a 33 34 38 31 0d 0a 39 36 31  ..289..3481..961
16270 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
16280 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
16290 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
162a0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
162b0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
162c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
162d0 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  LECT col1 * col0
162e0 20 2b 20 32 35 20 63 6f 6c 30 20 46 52 4f 4d 20   + 25 col0 FROM 
162f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
16300 2d 2d 0d 0a 32 30 38 39 0d 0a 33 34 32 30 0d 0a  --..2089..3420..
16310 38 31 32 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  8124....skipif p
16320 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
16330 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
16340 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
16350 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
16360 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16370 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
16380 54 20 2b 20 2d 20 37 20 2b 20 63 6f 72 30 2e 63  T + - 7 + cor0.c
16390 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 37  ol2 * + col2 + 7
163a0 39 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  9 col2 FROM tab2
163b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
163c0 31 35 31 36 0d 0a 37 34 38 0d 0a 38 30 31 0d 0a  1516..748..801..
163d0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
163e0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
163f0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
16400 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
16410 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
16420 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16430 43 54 20 2d 20 36 38 20 63 6f 6c 31 20 46 52 4f  CT - 68 col1 FRO
16440 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
16450 2d 2d 2d 2d 0d 0a 2d 36 38 0d 0a 2d 36 38 0d 0a  ----..-68..-68..
16460 2d 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -68....query I r
16470 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
16480 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b  ISTINCT + col2 +
16490 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
164a0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  0 cor0..----..11
164b0 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71 75  9..173..98....qu
164c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
164d0 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b  ELECT - col1 * +
164e0 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a   col0 + + col1 *
164f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
16500 0a 2d 2d 2d 2d 0d 0a 2d 33 32 39 38 0d 0a 2d 36  .----..-3298..-6
16510 33 37 0d 0a 37 37 34 0d 0a 0d 0a 6f 6e 6c 79 69  37..774....onlyi
16520 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
16530 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
16540 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
16550 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16560 20 6c 61 62 65 6c 2d 36 34 34 0d 0a 53 45 4c 45   label-644..SELE
16570 43 54 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56 20  CT ALL col2 DIV 
16580 28 20 28 20 2d 20 63 6f 6c 31 20 29 20 29 20 2b  ( ( - col1 ) ) +
16590 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2d   cor0.col2 DIV -
165a0 20 31 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   19 AS col0 FROM
165b0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
165c0 0d 0a 2d 31 0d 0a 2d 34 0d 0a 30 0d 0a 0d 0a 73  ..-1..-4..0....s
165d0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
165e0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
165f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
16600 62 65 6c 2d 36 34 34 0d 0a 53 45 4c 45 43 54 20  bel-644..SELECT 
16610 41 4c 4c 20 63 6f 6c 32 20 2f 20 28 20 28 20 2d  ALL col2 / ( ( -
16620 20 63 6f 6c 31 20 29 20 29 20 2b 20 63 6f 72 30   col1 ) ) + cor0
16630 2e 63 6f 6c 32 20 2f 20 2d 20 31 39 20 41 53 20  .col2 / - 19 AS 
16640 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
16650 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
16660 34 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4..0....query I 
16670 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16680 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
16690 2a 20 2d 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c  * - col0 + ( col
166a0 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  0 ) FROM tab2 AS
166b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36   cor0..----..196
166c0 0d 0a 32 31 30 36 0d 0a 33 30 38 31 0d 0a 0d 0a  ..2106..3081....
166d0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
166e0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
166f0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
16700 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
16710 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
16720 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16730 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2d 20   ALL + col2 + - 
16740 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f  cor0.col0 * - co
16750 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l1 col2 FROM tab
16760 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
16770 0a 31 33 38 31 0d 0a 32 34 34 0d 0a 34 36 32 38  .1381..244..4628
16780 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16790 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
167a0 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  + col1 + col0 * 
167b0 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  col1 * + col2 + 
167c0 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
167d0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
167e0 33 33 39 35 0d 0a 36 36 34 31 31 38 0d 0a 36 38  3395..664118..68
167f0 31 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  112....query I r
16800 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
16810 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2d  ISTINCT col2 + -
16820 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
16830 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a  .----..-33..-4..
16840 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  21....query I ro
16850 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
16860 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2d 20  col1 * col0 + - 
16870 38 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  82 * col0 * - co
16880 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
16890 2d 2d 0d 0a 33 38 30 31 0d 0a 34 39 34 32 38 36  --..3801..494286
168a0 0d 0a 35 31 30 34 31 39 0d 0a 0d 0a 73 6b 69 70  ..510419....skip
168b0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
168c0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
168d0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
168e0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
168f0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
16900 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
16910 54 49 4e 43 54 20 2d 20 35 34 20 2b 20 2d 20 63  TINCT - 54 + - c
16920 6f 6c 32 20 2a 20 63 6f 6c 32 20 63 6f 6c 30 20  ol2 * col2 col0 
16930 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
16940 0a 2d 32 39 37 30 0d 0a 2d 33 33 30 33 0d 0a 2d  .-2970..-3303..-
16950 39 32 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9270....query I 
16960 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16970 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20  DISTINCT col2 + 
16980 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col2 + - col1 * 
16990 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
169a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 38 32 0d 0a 2d  ..----..-1482..-
169b0 35 37 30 0d 0a 2d 37 38 33 0d 0a 0d 0a 71 75 65  570..-783....que
169c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
169d0 4c 45 43 54 20 63 6f 6c 30 20 2a 20 74 61 62 30  LECT col0 * tab0
169e0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
169f0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
16a00 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
16a10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16a20 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 33 20  rt..SELECT + 63 
16a30 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
16a40 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33 0d 0a 36 33 0d  0..----..63..63.
16a50 0a 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .63....query I r
16a60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
16a70 20 2b 20 32 31 20 2b 20 63 6f 6c 32 20 2d 20 63   + 21 + col2 - c
16a80 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
16a90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 33 37  r0..----..14..37
16aa0 0d 0a 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..72....query I 
16ab0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16ac0 2d 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c  - ( col1 ) + col
16ad0 30 20 2d 20 2b 20 34 37 20 41 53 20 63 6f 6c 32  0 - + 47 AS col2
16ae0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
16af0 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a 32 30 0d 0a  .----..-70..20..
16b00 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
16b10 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
16b20 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
16b30 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
16b40 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
16b50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16b60 45 4c 45 43 54 20 2b 20 34 38 20 63 6f 6c 32 20  ELECT + 48 col2 
16b70 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
16b80 30 0d 0a 2d 2d 2d 2d 0d 0a 34 38 0d 0a 34 38 0d  0..----..48..48.
16b90 0a 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .48....query I r
16ba0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
16bb0 20 36 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b   62 * - col0 + +
16bc0 20 28 20 38 30 20 29 20 41 53 20 63 6f 6c 31 20   ( 80 ) AS col1 
16bd0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
16be0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 0d 0a 2d  0..----..-106..-
16bf0 33 38 38 38 0d 0a 2d 34 38 38 30 0d 0a 0d 0a 73  3888..-4880....s
16c00 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
16c10 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
16c20 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
16c30 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
16c40 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
16c50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16c60 2d 20 2d 20 63 6f 6c 32 20 2a 20 28 20 2b 20 63  - - col2 * ( + c
16c70 6f 6c 30 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 ) col0 FROM 
16c80 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
16c90 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37  --..162..3648..7
16ca0 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  680....query I r
16cb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
16cc0 20 63 6f 6c 30 20 2b 20 31 31 20 46 52 4f 4d 20   col0 + 11 FROM 
16cd0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
16ce0 2d 2d 0d 0a 2d 36 37 0d 0a 2d 36 38 0d 0a 34 0d  --..-67..-68..4.
16cf0 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
16d00 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
16d10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46  ..SELECT ALL * F
16d20 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
16d30 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72  S cor0, tab2 cor
16d40 31 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  1, tab0, tab0 AS
16d50 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor2..----..364
16d60 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  5 values hashing
16d70 20 74 6f 20 31 37 31 33 61 64 61 66 36 38 37 35   to 1713adaf6875
16d80 39 35 33 32 32 64 38 38 38 64 34 65 65 65 66 64  95322d888d4eeefd
16d90 62 62 63 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  bbc8....query I 
16da0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16db0 2d 20 35 39 20 46 52 4f 4d 20 74 61 62 30 0d 0a  - 59 FROM tab0..
16dc0 2d 2d 2d 2d 0d 0a 2d 35 39 0d 0a 2d 35 39 0d 0a  ----..-59..-59..
16dd0 2d 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -59....query I r
16de0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35  owsort..SELECT 5
16df0 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
16e00 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  2 AS cor0, tab2 
16e10 41 53 20 63 6f 72 31 2c 20 74 61 62 32 2c 20 74  AS cor1, tab2, t
16e20 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab0 AS cor2..---
16e30 2d 0d 0a 32 34 33 20 76 61 6c 75 65 73 20 68 61  -..243 values ha
16e40 73 68 69 6e 67 20 74 6f 20 61 38 32 64 37 61 61  shing to a82d7aa
16e50 36 37 30 36 34 33 33 31 32 35 66 38 30 35 35 38  6706433125f80558
16e60 64 38 37 37 62 38 66 30 37 0d 0a 0d 0a 6f 6e 6c  d877b8f07....onl
16e70 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
16e80 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
16e90 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
16ea0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
16eb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
16ec0 6c 61 62 65 6c 2d 36 36 33 0d 0a 53 45 4c 45 43  label-663..SELEC
16ed0 54 20 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c 32  T + CAST( + col2
16ee0 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
16ef0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
16f00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
16f10 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70  ..27..38....skip
16f20 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
16f30 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
16f40 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16f50 2d 36 36 33 0d 0a 53 45 4c 45 43 54 20 2b 20 43  -663..SELECT + C
16f60 41 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20  AST ( + col2 AS 
16f70 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
16f80 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
16f90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32  or0..----..26..2
16fa0 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49  7..38....query I
16fb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16fc0 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 46   ALL cor0.col1 F
16fd0 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63  ROM tab0, tab1 c
16fe0 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
16ff0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
17000 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 36  es hashing to d6
17010 37 31 61 30 36 34 65 32 64 61 37 30 39 63 61 34  71a064e2da709ca4
17020 63 64 66 65 61 33 31 37 62 38 65 38 39 32 0d 0a  cdfea317b8e892..
17030 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17040 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
17050 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20  - ( cor0.col0 ) 
17060 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
17070 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
17080 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75  .7..78..79....qu
17090 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
170a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 36  ELECT DISTINCT 6
170b0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
170c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 0d  or0..----..61...
170d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
170e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
170f0 54 20 36 31 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  T 61 + col2 + + 
17100 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
17110 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a  or0..----..128..
17120 31 34 31 0d 0a 31 37 30 0d 0a 0d 0a 71 75 65 72  141..170....quer
17130 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17140 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  ECT cor0.col2 * 
17150 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
17160 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
17170 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
17180 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 32 65  s hashing to b2e
17190 35 62 30 32 35 62 31 63 37 32 35 36 36 31 32 34  5b025b1c72566124
171a0 38 62 30 66 32 39 61 61 65 66 39 30 38 0d 0a 0d  8b0f29aaef908...
171b0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
171c0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
171d0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
171e0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
171f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 39  owsort label-669
17200 0d 0a 53 45 4c 45 43 54 20 2d 20 37 20 44 49 56  ..SELECT - 7 DIV
17210 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
17220 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
17230 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
17240 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
17250 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
17260 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
17270 72 74 20 6c 61 62 65 6c 2d 36 36 39 0d 0a 53 45  rt label-669..SE
17280 4c 45 43 54 20 2d 20 37 20 2f 20 2b 20 63 6f 6c  LECT - 7 / + col
17290 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
172a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
172b0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
172c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
172d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34  ELECT DISTINCT 4
172e0 39 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  9 FROM tab2..---
172f0 2d 0d 0a 34 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -..49....onlyif 
17300 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
17310 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
17320 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
17330 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
17340 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
17350 6c 2d 36 37 31 0d 0a 53 45 4c 45 43 54 20 2d 20  l-671..SELECT - 
17360 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20 28 20 63  ( - col2 ) + ( c
17370 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 72  or0.col2 * - cor
17380 30 2e 63 6f 6c 31 20 29 20 2d 20 43 41 53 54 28  0.col1 ) - CAST(
17390 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
173a0 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
173b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
173c0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
173d0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
173e0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
173f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17400 62 65 6c 2d 36 37 31 0d 0a 53 45 4c 45 43 54 20  bel-671..SELECT 
17410 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20 28  - ( - col2 ) + (
17420 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63   cor0.col2 * - c
17430 6f 72 30 2e 63 6f 6c 31 20 29 20 2d 20 43 41 53  or0.col1 ) - CAS
17440 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
17450 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 20  GER ) FROM tab2 
17460 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
17470 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
17480 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17490 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 38 20  rt..SELECT + 48 
174a0 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  + - col0 + cor0.
174b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
174c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 38  S cor0..----..48
174d0 0d 0a 34 38 0d 0a 34 38 0d 0a 0d 0a 71 75 65 72  ..48..48....quer
174e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
174f0 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b  ECT + - col1 * +
17500 20 63 6f 6c 30 20 2b 20 28 20 63 6f 72 30 2e 63   col0 + ( cor0.c
17510 6f 6c 30 20 2a 20 63 6f 6c 31 20 29 20 2b 20 2d  ol0 * col1 ) + -
17520 20 38 33 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20   83 * cor0.col0 
17530 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
17540 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
17550 0a 2d 32 34 39 0d 0a 2d 35 33 31 32 0d 0a 2d 36  .-249..-5312..-6
17560 36 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  640....onlyif my
17570 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
17580 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
17590 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
175a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
175b0 65 6c 2d 36 37 34 0d 0a 53 45 4c 45 43 54 20 2b  el-674..SELECT +
175c0 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31   - ( + cor0.col1
175d0 20 29 20 2b 20 2b 20 39 38 20 2a 20 28 20 2b 20   ) + + 98 * ( + 
175e0 63 6f 72 30 2e 63 6f 6c 32 20 29 20 44 49 56 20  cor0.col2 ) DIV 
175f0 2b 20 33 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 32 AS col0 FRO
17600 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
17610 2d 2d 2d 2d 0d 0a 31 33 39 0d 0a 31 36 34 0d 0a  ----..139..164..
17620 32 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  281....skipif my
17630 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
17640 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
17650 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 34 0d  wsort label-674.
17660 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28 20 2b 20  .SELECT + - ( + 
17670 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20 2b 20  cor0.col1 ) + + 
17680 39 38 20 2a 20 28 20 2b 20 63 6f 72 30 2e 63 6f  98 * ( + cor0.co
17690 6c 32 20 29 20 2f 20 2b 20 33 32 20 41 53 20 63  l2 ) / + 32 AS c
176a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
176b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 39   cor0..----..139
176c0 0d 0a 31 36 34 0d 0a 32 38 31 0d 0a 0d 0a 71 75  ..164..281....qu
176d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
176e0 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20  ELECT cor0.col0 
176f0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
17700 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17710 31 34 0d 0a 31 35 36 0d 0a 31 35 38 0d 0a 0d 0a  14..156..158....
17720 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
17730 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
17740 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
17750 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
17760 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
17770 72 74 20 6c 61 62 65 6c 2d 36 37 36 0d 0a 53 45  rt label-676..SE
17780 4c 45 43 54 20 2b 20 43 41 53 54 28 20 2d 20 63  LECT + CAST( - c
17790 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol2 AS SIGNED ) 
177a0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
177b0 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a  .-26..-27..-38..
177c0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
177d0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
177e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
177f0 20 6c 61 62 65 6c 2d 36 37 36 0d 0a 53 45 4c 45   label-676..SELE
17800 43 54 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f  CT + CAST ( - co
17810 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l2 AS INTEGER ) 
17820 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
17830 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a  .-26..-27..-38..
17840 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
17850 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
17860 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
17870 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
17880 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
17890 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
178a0 43 54 20 41 4c 4c 20 37 38 20 63 6f 6c 30 20 46  CT ALL 78 col0 F
178b0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 2c 20  ROM tab2, tab0, 
178c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
178d0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
178e0 73 68 69 6e 67 20 74 6f 20 64 38 65 35 65 66 34  shing to d8e5ef4
178f0 64 62 33 34 31 39 66 63 32 35 31 65 38 32 63 35  db3419fc251e82c5
17900 30 62 61 30 34 65 30 34 38 0d 0a 0d 0a 71 75 65  0ba04e048....que
17910 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17920 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
17930 28 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 29 20  ( + tab2.col2 ) 
17940 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  * col0 FROM tab2
17950 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32  ..----..189..202
17960 38 0d 0a 33 30 30 32 0d 0a 0d 0a 73 6b 69 70 69  8..3002....skipi
17970 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
17980 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
17990 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
179a0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
179b0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
179c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
179d0 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b 20  + tab1.col0 * + 
179e0 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 30 20  ( col2 ) * col0 
179f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
17a00 2d 2d 2d 2d 0d 0a 32 33 33 34 37 32 0d 0a 34 38  ----..233472..48
17a10 36 0d 0a 36 31 34 34 30 30 0d 0a 0d 0a 71 75 65  6..614400....que
17a20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17a30 4c 45 43 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f  LECT ALL tab0.co
17a40 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
17a50 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62 31  tab0, tab1, tab1
17a60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
17a70 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
17a80 6f 20 37 37 38 36 37 31 38 62 64 38 30 34 32 30  o 7786718bd80420
17a90 32 32 35 33 37 33 37 38 64 34 30 65 63 38 37 34  22537378d40ec874
17aa0 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  75....query I ro
17ab0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
17ac0 28 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  ( + col1 * col0 
17ad0 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
17ae0 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a  -..-1040..-640..
17af0 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -78....query I r
17b00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
17b10 49 53 54 49 4e 43 54 20 36 34 20 2b 20 63 6f 6c  ISTINCT 64 + col
17b20 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
17b30 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
17b40 31 32 38 0d 0a 31 34 34 0d 0a 36 37 0d 0a 0d 0a  128..144..67....
17b50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17b60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
17b70 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col1 + cor0.col
17b80 31 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  1 - col2 AS col1
17b90 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
17ba0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 33 35  r0..----..-4..35
17bb0 0d 0a 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..92....query I 
17bc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17bd0 44 49 53 54 49 4e 43 54 20 34 30 20 2a 20 2b 20  DISTINCT 40 * + 
17be0 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
17bf0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
17c00 2d 0d 0a 31 32 34 30 0d 0a 32 33 36 30 0d 0a 36  -..1240..2360..6
17c10 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
17c20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
17c30 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  l2 + col0 * col2
17c40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
17c50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37 33  r0..----..36..73
17c60 38 30 0d 0a 38 32 35 0d 0a 0d 0a 71 75 65 72 79  80..825....query
17c70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
17c80 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
17c90 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l0 * - col2 * co
17ca0 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41  r0.col2 + col0 A
17cb0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
17cc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17cd0 2d 32 36 31 31 32 0d 0a 2d 35 39 38 33 34 37 0d  -26112..-598347.
17ce0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
17cf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
17d00 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f  STINCT + cor0.co
17d10 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  l0 * + col1 + + 
17d20 28 20 33 39 20 29 20 41 53 20 63 6f 6c 31 20 46  ( 39 ) AS col1 F
17d30 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
17d40 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 33 0d 0a 33 34  ..----..2103..34
17d50 33 34 0d 0a 38 31 33 38 0d 0a 0d 0a 71 75 65 72  34..8138....quer
17d60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17d70 45 43 54 20 35 20 46 52 4f 4d 20 74 61 62 31 2c  ECT 5 FROM tab1,
17d80 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
17d90 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
17da0 73 68 69 6e 67 20 74 6f 20 36 30 33 35 36 32 38  shing to 6035628
17db0 36 39 34 62 64 65 61 33 36 66 35 38 34 66 33 36  694bdea36f584f36
17dc0 34 39 30 38 38 35 35 31 64 0d 0a 0d 0a 73 6b 69  49088551d....ski
17dd0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
17de0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
17df0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
17e00 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
17e10 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..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 33 36 20 63 6f 6c 31 20 46 52 4f 4d 20 74  L 36 col1 FROM t
17e40 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 33  ab0..----..36..3
17e50 36 0d 0a 33 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  6..36....onlyif 
17e60 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
17e70 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
17e80 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
17e90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17ea0 61 62 65 6c 2d 36 39 30 0d 0a 53 45 4c 45 43 54  abel-690..SELECT
17eb0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
17ec0 2e 63 6f 6c 30 20 44 49 56 20 63 6f 72 30 2e 63  .col0 DIV cor0.c
17ed0 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 38 38 20  ol2 + col0 * 88 
17ee0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
17ef0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 34 0d 0a 35 36  0..----..264..56
17f00 33 31 0d 0a 37 30 34 30 0d 0a 0d 0a 73 6b 69 70  31..7040....skip
17f10 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
17f20 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
17f30 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
17f40 2d 36 39 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  -690..SELECT DIS
17f50 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  TINCT - cor0.col
17f60 30 20 2f 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  0 / cor0.col2 + 
17f70 63 6f 6c 30 20 2a 20 38 38 20 46 52 4f 4d 20 74  col0 * 88 FROM t
17f80 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
17f90 2d 0d 0a 32 36 34 0d 0a 35 36 33 31 0d 0a 37 30  -..264..5631..70
17fa0 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  40....query I ro
17fb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
17fc0 4c 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 41 53  L + tab2.col1 AS
17fd0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
17fe0 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
17ff0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 0d 0a 2d  OSS JOIN tab2..-
18000 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
18010 61 73 68 69 6e 67 20 74 6f 20 37 35 39 39 62 34  ashing to 7599b4
18020 38 30 31 32 35 64 65 35 32 31 65 66 65 64 37 31  80125de521efed71
18030 62 35 62 32 34 31 33 63 37 64 0d 0a 0d 0a 71 75  b5b2413c7d....qu
18040 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18050 45 4c 45 43 54 20 2d 20 34 33 20 41 53 20 63 6f  ELECT - 43 AS co
18060 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
18070 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b1, tab2 AS cor0
18080 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
18090 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 66 37  s hashing to 2f7
180a0 32 62 64 39 63 61 62 36 38 63 38 64 38 63 33 38  2bd9cab68c8d8c38
180b0 38 37 34 35 31 30 61 32 39 30 61 33 63 0d 0a 0d  874510a290a3c...
180c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
180d0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
180e0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
180f0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
18100 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 33  owsort label-693
18110 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
18120 44 49 56 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20  DIV + tab0.col1 
18130 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
18140 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .0..0..0....skip
18150 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
18160 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
18170 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
18180 2d 36 39 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -693..SELECT - c
18190 6f 6c 32 20 2f 20 2b 20 74 61 62 30 2e 63 6f 6c  ol2 / + tab0.col
181a0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
181b0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e  -..0..0..0....on
181c0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
181d0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
181e0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
181f0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
18200 6f 72 74 20 6c 61 62 65 6c 2d 36 39 34 0d 0a 53  ort label-694..S
18210 45 4c 45 43 54 20 41 4c 4c 20 34 36 20 44 49 56  ELECT ALL 46 DIV
18220 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20   - tab2.col1 AS 
18230 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
18240 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d  ----..-1..-2..0.
18250 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
18260 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
18270 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18280 74 20 6c 61 62 65 6c 2d 36 39 34 0d 0a 53 45 4c  t label-694..SEL
18290 45 43 54 20 41 4c 4c 20 34 36 20 2f 20 2d 20 74  ECT ALL 46 / - t
182a0 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  ab2.col1 AS col2
182b0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
182c0 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a 71  ..-1..-2..0....q
182d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
182e0 53 45 4c 45 43 54 20 34 39 20 2d 20 63 6f 6c 32  SELECT 49 - col2
182f0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
18300 0d 0a 31 31 0d 0a 32 32 0d 0a 32 33 0d 0a 0d 0a  ..11..22..23....
18310 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18320 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 39 20 41  .SELECT ALL 99 A
18330 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
18340 2c 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  , tab2, tab1 AS 
18350 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f  cor0, tab0 AS co
18360 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  r1..----..81 val
18370 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
18380 38 34 31 61 38 64 38 32 36 31 35 31 62 34 32 32  841a8d826151b422
18390 65 63 64 62 37 31 64 62 30 32 35 30 37 33 39 0d  ecdb71db0250739.
183a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
183b0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
183c0 2a 20 2b 20 37 32 20 46 52 4f 4d 20 74 61 62 31  * + 72 FROM tab1
183d0 0d 0a 2d 2d 2d 2d 0d 0a 31 38 37 32 0d 0a 37 32  ..----..1872..72
183e0 30 0d 0a 39 33 36 0d 0a 0d 0a 71 75 65 72 79 20  0..936....query 
183f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18400 54 20 2b 20 2b 20 33 34 20 2a 20 37 34 20 2a 20  T + + 34 * 74 * 
18410 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
18420 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
18430 2d 0d 0a 32 30 36 33 31 32 0d 0a 32 35 31 36 0d  -..206312..2516.
18440 0a 38 33 30 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  .83028....onlyif
18450 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
18460 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
18470 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
18480 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
18490 6c 61 62 65 6c 2d 36 39 39 0d 0a 53 45 4c 45 43  label-699..SELEC
184a0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
184b0 63 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f  col2 DIV cor0.co
184c0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
184d0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
184e0 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..0....skipif 
184f0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
18500 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
18510 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39  rowsort label-69
18520 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
18530 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 63  CT cor0.col2 / c
18540 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
18550 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
18560 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71  r0..----..0....q
18570 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18580 53 45 4c 45 43 54 20 2d 20 35 32 20 46 52 4f 4d  SELECT - 52 FROM
18590 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62   tab1, tab2, tab
185a0 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  0 AS cor0, tab1 
185b0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor1..----..8
185c0 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
185d0 20 74 6f 20 62 65 65 36 31 32 32 37 39 37 32 61   to bee61227972a
185e0 64 39 61 30 32 37 30 35 61 31 63 64 32 62 39 34  d9a02705a1cd2b94
185f0 35 61 65 65 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  5aee....onlyif m
18600 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
18610 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
18620 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
18630 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
18640 62 65 6c 2d 37 30 31 0d 0a 53 45 4c 45 43 54 20  bel-701..SELECT 
18650 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 2b 20  col2 DIV col1 + 
18660 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab1.col1 FROM t
18670 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 32  ab1..----..15..2
18680 30 0d 0a 32 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  0..28....skipif 
18690 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
186a0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
186b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 30  rowsort label-70
186c0 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f  1..SELECT col2 /
186d0 20 63 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c   col1 + tab1.col
186e0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
186f0 2d 0d 0a 31 35 0d 0a 32 30 0d 0a 32 38 0d 0a 0d  -..15..20..28...
18700 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18710 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
18720 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20 2b 20  + tab2.col1 + + 
18730 74 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  tab2.col2 FROM t
18740 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a  ab2..----..111..
18750 38 35 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20  85..93....query 
18760 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18770 54 20 2d 20 63 6f 6c 30 20 2d 20 36 39 20 41 53  T - col0 - 69 AS
18780 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
18790 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 0d 0a 2d 31 34  .----..-147..-14
187a0 38 0d 0a 2d 37 36 0d 0a 0d 0a 71 75 65 72 79 20  8..-76....query 
187b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
187c0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62  T DISTINCT + tab
187d0 31 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  1.col0 + + col2 
187e0 2a 20 38 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  * 80 FROM tab1..
187f0 2d 2d 2d 2d 0d 0a 34 33 32 33 0d 0a 34 36 32 34  ----..4323..4624
18800 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20  ..7760....query 
18810 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18820 54 20 35 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  T 51 AS col0 FRO
18830 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
18840 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
18850 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
18860 64 38 62 66 30 61 30 35 63 39 63 34 64 32 61 39  d8bf0a05c9c4d2a9
18870 33 38 31 32 64 31 30 36 62 61 61 65 34 37 35 32  3812d106baae4752
18880 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18890 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
188a0 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30  r0.col0 + - col0
188b0 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
188c0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
188d0 2d 0d 0a 2d 31 32 36 34 0d 0a 2d 32 31 30 0d 0a  -..-1264..-210..
188e0 2d 34 35 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -4524....onlyif 
188f0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
18900 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
18910 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
18920 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
18930 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
18940 6c 2d 37 30 37 0d 0a 53 45 4c 45 43 54 20 2d 20  l-707..SELECT - 
18950 43 41 53 54 28 20 2d 20 63 6f 6c 32 20 41 53 20  CAST( - col2 AS 
18960 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
18970 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d  b0..----..1..33.
18980 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .82....skipif my
18990 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
189a0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
189b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 30 37 0d  wsort label-707.
189c0 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28  .SELECT - CAST (
189d0 20 2d 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   - col2 AS INTEG
189e0 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  ER ) FROM tab0..
189f0 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d  ----..1..33..82.
18a00 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
18a10 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
18a20 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
18a30 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
18a40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
18a50 30 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  08..SELECT + - c
18a60 6f 6c 32 20 44 49 56 20 38 31 20 2b 20 2d 20 63  ol2 DIV 81 + - c
18a70 6f 6c 31 20 2a 20 2d 20 31 32 20 46 52 4f 4d 20  ol1 * - 12 FROM 
18a80 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
18a90 2d 2d 0d 0a 32 30 34 0d 0a 33 37 32 0d 0a 37 30  --..204..372..70
18aa0 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
18ab0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
18ac0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
18ad0 6f 72 74 20 6c 61 62 65 6c 2d 37 30 38 0d 0a 53  ort label-708..S
18ae0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2f  ELECT + - col2 /
18af0 20 38 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d   81 + - col1 * -
18b00 20 31 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53   12 FROM tab2 AS
18b10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34   cor0..----..204
18b20 0d 0a 33 37 32 0d 0a 37 30 38 0d 0a 0d 0a 6f 6e  ..372..708....on
18b30 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
18b40 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
18b50 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
18b60 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
18b70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18b80 20 6c 61 62 65 6c 2d 37 30 39 0d 0a 53 45 4c 45   label-709..SELE
18b90 43 54 20 2b 20 2d 20 43 41 53 54 28 20 4e 55 4c  CT + - CAST( NUL
18ba0 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2b  L AS DECIMAL ) +
18bb0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
18bc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
18bd0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
18be0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
18bf0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
18c00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18c10 74 20 6c 61 62 65 6c 2d 37 30 39 0d 0a 53 45 4c  t label-709..SEL
18c20 45 43 54 20 2b 20 2d 20 43 41 53 54 20 28 20 4e  ECT + - CAST ( N
18c30 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2b 20  ULL AS REAL ) + 
18c40 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
18c50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
18c60 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
18c70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18c80 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 39  t..SELECT ALL 49
18c90 20 2a 20 33 20 2a 20 63 6f 6c 32 20 46 52 4f 4d   * 3 * col2 FROM
18ca0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
18cb0 2d 2d 2d 0d 0a 33 38 32 32 0d 0a 33 39 36 39 0d  ---..3822..3969.
18cc0 0a 35 35 38 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .5586....onlyif 
18cd0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
18ce0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
18cf0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
18d00 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
18d10 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
18d20 6c 2d 37 31 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-711..SELECT DI
18d30 53 54 49 4e 43 54 20 2b 20 43 41 53 54 28 20 63  STINCT + CAST( c
18d40 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol0 AS SIGNED ) 
18d50 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  * col1 AS col2 F
18d60 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
18d70 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33  ..----..2064..33
18d80 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 73 6b 69 70  95..8099....skip
18d90 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
18da0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
18db0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
18dc0 2d 37 31 31 0d 0a 53 45 4c 45 43 54 20 44 49 53  -711..SELECT DIS
18dd0 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20 63  TINCT + CAST ( c
18de0 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
18df0 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   * col1 AS col2 
18e00 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
18e10 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33  0..----..2064..3
18e20 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65  395..8099....que
18e30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18e40 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
18e50 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53  * col0 + col0 AS
18e60 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
18e70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
18e80 31 32 30 0d 0a 37 30 34 0d 0a 38 31 0d 0a 0d 0a  120..704..81....
18e90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18ea0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
18eb0 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 41 53 20   col2 - col0 AS 
18ec0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
18ed0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
18ee0 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 71 75 65 72  4..-7..9....quer
18ef0 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
18f00 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
18f10 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 57 48   tab0 AS cor0 WH
18f20 45 52 45 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  ERE - col1 + - c
18f30 6f 6c 30 20 4e 4f 54 20 49 4e 20 28 20 2d 20 63  ol0 NOT IN ( - c
18f40 6f 6c 32 20 2b 20 63 6f 6c 32 20 29 0d 0a 2d 2d  ol2 + col2 )..--
18f50 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
18f60 68 69 6e 67 20 74 6f 20 33 38 61 31 36 37 33 65  hing to 38a1673e
18f70 32 65 30 39 64 36 39 34 63 38 63 65 63 34 35 63  2e09d694c8cec45c
18f80 37 39 37 30 33 34 61 37 0d 0a 0d 0a 6f 6e 6c 79  797034a7....only
18f90 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
18fa0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
18fb0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
18fc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18fd0 74 20 6c 61 62 65 6c 2d 37 31 35 0d 0a 53 45 4c  t label-715..SEL
18fe0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
18ff0 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20  1 DIV - col1 AS 
19000 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
19010 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
19020 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
19030 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
19040 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
19050 72 74 20 6c 61 62 65 6c 2d 37 31 35 0d 0a 53 45  rt label-715..SE
19060 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
19070 6c 31 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63  l1 / - col1 AS c
19080 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
19090 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
190a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
190b0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
190c0 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  * - col1 AS col2
190d0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
190e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d  r0..----..-1343.
190f0 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a  .-217..-4602....
19100 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
19110 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
19120 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
19130 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
19140 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
19150 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19160 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 63   - col0 * col0 c
19170 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
19180 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37 36  ---..-1225..-576
19190 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79  ..-7921....query
191a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
191b0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20  CT ALL + col2 + 
191c0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
191d0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
191e0 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75  55..58..85....qu
191f0 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
19200 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
19210 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45   * FROM tab1 WHE
19220 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 49 4e 20 28  RE NOT NULL IN (
19230 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a   col2 + - col0 *
19240 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   col0 )..----...
19250 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19260 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
19270 54 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20  T - col0 - col0 
19280 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
19290 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 38 0d 0a 2d  0..----..-178..-
192a0 34 38 0d 0a 2d 37 30 0d 0a 0d 0a 71 75 65 72 79  48..-70....query
192b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
192c0 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46  CT col2 * col2 F
192d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
192e0 20 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 31 20   WHERE NOT col1 
192f0 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e  * col2 * - cor0.
19300 63 6f 6c 32 20 42 45 54 57 45 45 4e 20 63 6f 6c  col2 BETWEEN col
19310 32 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  2 AND NULL..----
19320 0d 0a 31 0d 0a 31 30 38 39 0d 0a 36 37 32 34 0d  ..1..1089..6724.
19330 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
19340 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
19350 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   * FROM tab2 AS 
19360 63 6f 72 30 20 57 48 45 52 45 20 4e 55 4c 4c 20  cor0 WHERE NULL 
19370 42 45 54 57 45 45 4e 20 28 20 63 6f 6c 31 20 2d  BETWEEN ( col1 -
19380 20 63 6f 6c 32 20 29 20 41 4e 44 20 28 20 4e 55   col2 ) AND ( NU
19390 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  LL )..----....qu
193a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
193b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
193c0 6f 6c 32 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ol2 - col2 AS co
193d0 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
193e0 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  --..0....query I
193f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19400 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b   DISTINCT col1 +
19410 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
19420 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38  2..----..137..38
19430 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..96....skipif p
19440 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
19450 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
19460 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
19470 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
19480 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19490 0d 0a 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f  ..SELECT tab2.co
194a0 6c 31 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46  l1 + col2 col0 F
194b0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
194c0 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75  55..58..85....qu
194d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
194e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
194f0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 46   col0 * - col1 F
19500 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e  ROM tab2 WHERE N
19510 4f 54 20 4e 55 4c 4c 20 3e 3d 20 2d 20 63 6f 6c  OT NULL >= - col
19520 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 0d  2 * col2 * col2.
19530 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
19540 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19550 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2b   + tab2.col1 * +
19560 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
19570 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
19580 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a  343..217..4602..
19590 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
195a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
195b0 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f  OM tab2 WHERE NO
195c0 54 20 28 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  T ( col0 * - col
195d0 30 20 29 20 42 45 54 57 45 45 4e 20 28 20 4e 55  0 ) BETWEEN ( NU
195e0 4c 4c 20 29 20 41 4e 44 20 28 20 63 6f 6c 30 20  LL ) AND ( col0 
195f0 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69  )..----....skipi
19600 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
19610 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
19620 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
19630 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
19640 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
19650 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
19660 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
19670 61 62 30 20 57 48 45 52 45 20 28 20 4e 55 4c 4c  ab0 WHERE ( NULL
19680 20 29 20 42 45 54 57 45 45 4e 20 2d 20 74 61 62   ) BETWEEN - tab
19690 30 2e 63 6f 6c 31 20 41 4e 44 20 2b 20 63 6f 6c  0.col1 AND + col
196a0 31 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  1 * + col2 + col
196b0 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  0..----....query
196c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
196d0 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2d 20 63  CT tab1.col2 - c
196e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
196f0 2d 2d 2d 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d  ---..28..47..83.
19700 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19710 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
19720 4e 43 54 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20  NCT col0 - col1 
19730 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
19740 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34  1..----..-23..54
19750 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..67....query I 
19760 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19770 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63  ALL + col2 + + c
19780 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
19790 2d 2d 2d 0d 0a 35 32 0d 0a 35 34 0d 0a 37 36 0d  ---..52..54..76.
197a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
197b0 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e  rt..SELECT tab0.
197c0 63 6f 6c 31 20 2b 20 74 61 62 30 2e 63 6f 6c 32  col1 + tab0.col2
197d0 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
197e0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
197f0 2d 0d 0a 2d 37 30 36 0d 0a 2d 37 32 30 37 0d 0a  -..-706..-7207..
19800 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  62....onlyif mys
19810 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
19820 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
19830 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
19840 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
19850 6c 2d 37 33 34 0d 0a 53 45 4c 45 43 54 20 2b 20  l-734..SELECT + 
19860 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30 20  col2 DIV - col0 
19870 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
19880 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a  0..----..-1..0..
19890 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
198a0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
198b0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
198c0 6f 72 74 20 6c 61 62 65 6c 2d 37 33 34 0d 0a 53  ort label-734..S
198d0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2f 20 2d  ELECT + col2 / -
198e0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
198f0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
19900 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  1..0..0....query
19910 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19920 43 54 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  CT + col0 AS col
19930 32 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52  2 FROM tab2 WHER
19940 45 20 4e 4f 54 20 63 6f 6c 30 20 49 4e 20 28 20  E NOT col0 IN ( 
19950 2d 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a  - col2 )..----..
19960 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73 6b 69  7..78..79....ski
19970 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
19980 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
19990 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
199a0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
199b0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
199c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
199d0 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 63 6f 6c 32  col1 * col1 col2
199e0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
199f0 0d 0a 37 33 39 36 0d 0a 38 32 38 31 0d 0a 39 34  ..7396..8281..94
19a00 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  09....query I ro
19a10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
19a20 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63  l0 + - col1 AS c
19a30 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
19a40 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34 0d 0a 36 37  ---..-23..54..67
19a50 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
19a60 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
19a70 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
19a80 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
19a90 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
19aa0 37 33 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  738..SELECT col2
19ab0 20 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31   + col1 DIV col1
19ac0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
19ad0 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37 0d 0a 0d 0a  ..55..58..97....
19ae0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
19af0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
19b00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
19b10 61 62 65 6c 2d 37 33 38 0d 0a 53 45 4c 45 43 54  abel-738..SELECT
19b20 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20 63   col2 + col1 / c
19b30 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
19b40 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37 0d  ---..55..58..97.
19b50 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
19b60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46  sort..SELECT * F
19b70 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 2d  ROM tab2 WHERE -
19b80 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 49   col0 * - col2 I
19b90 4e 20 28 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  N ( - col2 + + c
19ba0 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ol1 )..----....q
19bb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19bc0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
19bd0 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  col0 + col2 + co
19be0 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 * col1 FROM t
19bf0 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20 4e 55  ab1 WHERE NOT NU
19c00 4c 4c 20 4e 4f 54 20 49 4e 20 28 20 63 6f 6c 30  LL NOT IN ( col0
19c10 20 2a 20 2b 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d   * + col0 )..---
19c20 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  -....onlyif mysq
19c30 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
19c40 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
19c50 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
19c60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
19c70 2d 37 34 31 0d 0a 53 45 4c 45 43 54 20 44 49 53  -741..SELECT DIS
19c80 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2d 20 74  TINCT col2 + - t
19c90 61 62 30 2e 63 6f 6c 30 20 44 49 56 20 63 6f 6c  ab0.col0 DIV col
19ca0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
19cb0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 33 32  ab0..----..0..32
19cc0 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..81....skipif m
19cd0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
19ce0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
19cf0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 31  owsort label-741
19d00 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
19d10 54 20 63 6f 6c 32 20 2b 20 2d 20 74 61 62 30 2e  T col2 + - tab0.
19d20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 41 53 20 63  col0 / col0 AS c
19d30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
19d40 2d 2d 2d 0d 0a 30 0d 0a 33 32 0d 0a 38 31 0d 0a  ---..0..32..81..
19d50 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
19d60 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
19d70 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
19d80 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
19d90 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34  rowsort label-74
19da0 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  2..SELECT col1 +
19db0 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f   + col1 DIV - co
19dc0 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l0 + - col0 FROM
19dd0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
19de0 35 39 0d 0a 36 30 0d 0a 0d 0a 73 6b 69 70 69 66  59..60....skipif
19df0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
19e00 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
19e10 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
19e20 34 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  42..SELECT col1 
19e30 2b 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c  + + col1 / - col
19e40 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  0 + - col0 FROM 
19e50 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 35  tab0..----..1..5
19e60 39 0d 0a 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  9..60....onlyif 
19e70 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
19e80 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
19e90 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
19ea0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
19eb0 61 62 65 6c 2d 37 34 33 0d 0a 53 45 4c 45 43 54  abel-743..SELECT
19ec0 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 44 49 56   + tab0.col1 DIV
19ed0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
19ee0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
19ef0 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..1..1....skipif
19f00 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
19f10 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
19f20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
19f30 34 33 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62  43..SELECT + tab
19f40 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 41 53  0.col1 / col1 AS
19f50 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
19f60 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a  .----..1..1..1..
19f70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19f80 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
19f90 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  CT + - cor0.col0
19fa0 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32   + col1 - - col2
19fb0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
19fc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 33 0d  r0..----..29..3.
19fd0 0a 37 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .77....onlyif my
19fe0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
19ff0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1a000 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1a010 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1a020 65 6c 2d 37 34 35 0d 0a 53 45 4c 45 43 54 20 2b  el-745..SELECT +
1a030 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b   col0 * + col2 +
1a040 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f   - col2 DIV - co
1a050 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  r0.col1 AS col0 
1a060 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1a070 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39  0..----..35..729
1a080 38 0d 0a 37 39 32 0d 0a 0d 0a 73 6b 69 70 69 66  8..792....skipif
1a090 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1a0a0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1a0b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1a0c0 34 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  45..SELECT + col
1a0d0 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  0 * + col2 + - c
1a0e0 6f 6c 32 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 / - cor0.col
1a0f0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
1a100 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1a110 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32  -..35..7298..792
1a120 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1a130 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1a140 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1a150 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1a160 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a170 37 34 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  746..SELECT DIST
1a180 49 4e 43 54 20 2d 20 63 6f 6c 30 20 44 49 56 20  INCT - col0 DIV 
1a190 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col0 + + col2 AS
1a1a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
1a1b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1a1c0 0d 0a 33 32 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70  ..32..81....skip
1a1d0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1a1e0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1a1f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1a200 2d 37 34 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  -746..SELECT DIS
1a210 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2f 20 63  TINCT - col0 / c
1a220 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 + + col2 AS 
1a230 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
1a240 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1a250 0a 33 32 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79  .32..81....query
1a260 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a270 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
1a280 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30 20 46 52  col2 - - col0 FR
1a290 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1a2a0 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a  .----..171..36..
1a2b0 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
1a2c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1a2d0 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col2 * cor0.col2
1a2e0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
1a2f0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1a300 0a 2d 32 39 31 33 0d 0a 2d 33 31 38 35 0d 0a 2d  .-2913..-3185..-
1a310 39 31 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9136....query I 
1a320 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a330 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL + cor0.col0 
1a340 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  + - col2 AS col2
1a350 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1a360 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34  r0..----..-9..34
1a370 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..7....query I r
1a380 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1a390 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  LL + col1 * + co
1a3a0 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l1 + - cor0.col2
1a3b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 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 37 33 36 33 0d 0a 38 31 39 39 0d 0a 39 34  ..7363..8199..94
1a3e0 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  08....query I ro
1a3f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1a400 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2d 20  STINCT + col0 - 
1a410 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  - col0 * - col0 
1a420 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  * + col0 AS col1
1a430 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1a440 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d  r0..----..-24..-
1a450 32 36 32 30 38 30 0d 0a 2d 35 31 31 39 32 30 0d  262080..-511920.
1a460 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1a470 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1a480 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ol2 + col2 AS co
1a490 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
1a4a0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31 31  0..----..108..11
1a4b0 34 0d 0a 31 39 32 0d 0a 0d 0a 71 75 65 72 79 20  4..192....query 
1a4c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a4d0 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b  T ALL - col2 * +
1a4e0 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 2d   col1 + col2 * -
1a4f0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
1a500 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1a510 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 31 34  .----..-132..-14
1a520 37 36 30 0d 0a 2d 33 36 33 30 0d 0a 0d 0a 71 75  760..-3630....qu
1a530 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a540 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 30 20  ELECT tab2.col0 
1a550 2a 20 2b 20 63 6f 6c 31 20 2a 20 74 61 62 32 2e  * + col1 * tab2.
1a560 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
1a570 2d 2d 2d 2d 0d 0a 31 30 36 30 39 37 0d 0a 31 35  ----..106097..15
1a580 31 39 0d 0a 33 35 38 39 35 36 0d 0a 0d 0a 71 75  19..358956....qu
1a590 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a5a0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d  ELECT + col2 + -
1a5b0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b   col0 * - col0 +
1a5c0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   + cor0.col1 AS 
1a5d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1a5e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
1a5f0 32 33 0d 0a 36 39 35 0d 0a 38 30 39 34 0d 0a 0d  23..695..8094...
1a600 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
1a610 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a  rt..SELECT ALL *
1a620 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1a630 72 30 20 57 48 45 52 45 20 4e 4f 54 20 2b 20 63  r0 WHERE NOT + c
1a640 6f 6c 32 20 4e 4f 54 20 42 45 54 57 45 45 4e 20  ol2 NOT BETWEEN 
1a650 63 6f 72 30 2e 63 6f 6c 32 20 41 4e 44 20 63 6f  cor0.col2 AND co
1a660 6c 31 20 4f 52 20 4e 55 4c 4c 20 42 45 54 57 45  l1 OR NULL BETWE
1a670 45 4e 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41  EN col0 + col2 A
1a680 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 37  ND NULL..----..7
1a690 0d 0a 33 31 0d 0a 32 37 0d 0a 37 38 0d 0a 35 39  ..31..27..78..59
1a6a0 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 49  ..26....query II
1a6b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a6c0 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 41 53  T * FROM tab2 AS
1a6d0 20 63 6f 72 30 20 57 48 45 52 45 20 4e 55 4c 4c   cor0 WHERE NULL
1a6e0 20 42 45 54 57 45 45 4e 20 28 20 4e 55 4c 4c 20   BETWEEN ( NULL 
1a6f0 29 20 41 4e 44 20 28 20 4e 55 4c 4c 20 29 20 4f  ) AND ( NULL ) O
1a700 52 20 4e 55 4c 4c 20 49 4e 20 28 20 63 6f 6c 30  R NULL IN ( col0
1a710 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79   )..----....only
1a720 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1a730 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1a740 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1a750 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a760 74 20 6c 61 62 65 6c 2d 37 35 38 0d 0a 53 45 4c  t label-758..SEL
1a770 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
1a780 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b 20 2b   col0 + col0 + +
1a790 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 41   col2 DIV col1 A
1a7a0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
1a7b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1a7c0 31 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 73  178..48..70....s
1a7d0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1a7e0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1a7f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1a800 62 65 6c 2d 37 35 38 0d 0a 53 45 4c 45 43 54 20  bel-758..SELECT 
1a810 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c  DISTINCT + + col
1a820 30 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  0 + col0 + + col
1a830 32 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  2 / col1 AS col0
1a840 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1a850 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a 34  r0..----..178..4
1a860 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  8..70....query I
1a870 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a880 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   - + col0 + - co
1a890 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
1a8a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1a8b0 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d  --..-137..-38..-
1a8c0 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  96....skipif pos
1a8d0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1a8e0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1a8f0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1a900 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
1a910 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a920 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72  SELECT ALL - cor
1a930 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  0.col2 col1 FROM
1a940 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1a950 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38  ---..-1..-33..-8
1a960 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1a970 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
1a980 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 + + col2 AS 
1a990 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
1a9a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a  or0..----..121..
1a9b0 31 37 36 0d 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79 69  176..57....onlyi
1a9c0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1a9d0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1a9e0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1a9f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1aa00 20 6c 61 62 65 6c 2d 37 36 32 0d 0a 53 45 4c 45   label-762..SELE
1aa10 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20  CT ALL + col0 + 
1aa20 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20  + col1 DIV col1 
1aa30 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1aa40 31 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 36 35 0d 0a  1..----..4..65..
1aa50 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  81....skipif mys
1aa60 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1aa70 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1aa80 73 6f 72 74 20 6c 61 62 65 6c 2d 37 36 32 0d 0a  sort label-762..
1aa90 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
1aaa0 30 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c  0 + + col1 / col
1aab0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
1aac0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 36 35  ab1..----..4..65
1aad0 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..81....query I 
1aae0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1aaf0 74 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab2.col2 AS col
1ab00 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
1ab10 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32   CROSS JOIN tab2
1ab20 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
1ab30 20 68 61 73 68 69 6e 67 20 74 6f 20 35 39 31 31   hashing to 5911
1ab40 62 61 63 35 31 34 34 31 66 34 66 66 36 34 30 62  bac51441f4ff640b
1ab50 32 61 32 62 37 32 31 65 61 38 65 33 0d 0a 0d 0a  2a2b721ea8e3....
1ab60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ab70 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
1ab80 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a  .col2 + + col2 *
1ab90 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
1aba0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1abb0 0a 2d 32 38 36 32 0d 0a 2d 33 31 39 32 0d 0a 2d  .-2862..-3192..-
1abc0 39 31 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9120....query I 
1abd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1abe0 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f  col2 * col1 * co
1abf0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
1ac00 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 31 38  tab0..----..6118
1ac10 38 34 0d 0a 39 33 36 35 34 0d 0a 39 37 0d 0a 0d  84..93654..97...
1ac20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ac30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1ac40 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d  ol1 + + col1 + -
1ac50 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
1ac60 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
1ac70 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a  54..-57..-96....
1ac80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ac90 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
1aca0 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20   + tab0.col0 AS 
1acb0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
1acc0 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d  ----..-2..-62..-
1acd0 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
1ace0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
1acf0 6c 31 20 2a 20 2b 20 33 37 20 41 53 20 63 6f 6c  l1 * + 37 AS col
1ad00 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1ad10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 38 32 0d  or0..----..3182.
1ad20 0a 33 33 36 37 0d 0a 33 35 38 39 0d 0a 0d 0a 71  .3367..3589....q
1ad30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ad40 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1ad50 2b 20 34 33 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  + 43 + col2 FROM
1ad60 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 39 0d   tab2..----..69.
1ad70 0a 37 30 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79  .70..81....query
1ad80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ad90 43 54 20 2b 20 38 38 20 41 53 20 63 6f 6c 32 20  CT + 88 AS col2 
1ada0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
1adb0 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
1adc0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
1add0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1ade0 6f 20 63 34 36 65 37 63 66 39 62 66 35 31 36 66  o c46e7cf9bf516f
1adf0 64 66 64 65 38 38 35 33 34 33 33 36 61 32 38 31  dfde88534336a281
1ae00 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  77....query I ro
1ae10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1ae20 53 54 49 4e 43 54 20 32 38 20 46 52 4f 4d 20 74  STINCT 28 FROM t
1ae30 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 0d  ab2..----..28...
1ae40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ae50 0d 0a 53 45 4c 45 43 54 20 2d 20 38 30 20 41 53  ..SELECT - 80 AS
1ae60 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c   col2 FROM tab1,
1ae70 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
1ae80 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
1ae90 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
1aea0 68 69 6e 67 20 74 6f 20 32 36 64 62 63 63 39 38  hing to 26dbcc98
1aeb0 64 34 62 34 65 38 36 34 66 66 61 33 31 62 65 36  d4b4e864ffa31be6
1aec0 38 35 61 35 64 66 62 64 0d 0a 0d 0a 71 75 65 72  85a5dfbd....quer
1aed0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1aee0 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  ECT col0 + - col
1aef0 31 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20  1 + + tab0.col0 
1af00 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1af10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 2d 33  0..----..-27..-3
1af20 38 0d 0a 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49  8..87....query I
1af30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1af40 20 44 49 53 54 49 4e 43 54 20 39 31 20 2b 20 2b   DISTINCT 91 + +
1af50 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
1af60 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
1af70 37 37 0d 0a 31 38 32 0d 0a 31 38 38 0d 0a 0d 0a  77..182..188....
1af80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1af90 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 32  .SELECT ( + col2
1afa0 20 29 20 2a 20 34 38 20 46 52 4f 4d 20 74 61 62   ) * 48 FROM tab
1afb0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 34 0d 0a 33  0..----..1584..3
1afc0 39 33 36 0d 0a 34 38 0d 0a 0d 0a 71 75 65 72 79  936..48....query
1afd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1afe0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36 33  CT DISTINCT - 63
1aff0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1b000 0d 0a 2d 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-63....query I
1b010 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  IIIIIIIIIII rows
1b020 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1b030 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31  INCT * FROM tab1
1b040 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
1b050 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 32 20 41  OIN tab2, tab2 A
1b060 53 20 63 6f 72 31 2c 20 74 61 62 30 20 63 6f 72  S cor1, tab0 cor
1b070 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c  2..----..972 val
1b080 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65  ues hashing to e
1b090 34 63 37 34 38 66 32 36 37 65 38 64 32 61 30 65  4c748f267e8d2a0e
1b0a0 36 64 35 36 33 32 38 31 65 31 66 62 39 37 35 0d  6d563281e1fb975.
1b0b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b0c0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
1b0d0 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col1 * cor0.col0
1b0e0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1b0f0 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b1 AS cor0 CROSS
1b100 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f   JOIN tab1 AS co
1b110 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
1b120 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 31  es hashing to 81
1b130 35 66 63 63 64 34 63 33 64 33 37 32 62 32 38 64  5fccd4c3d372b28d
1b140 33 66 33 66 62 31 30 33 30 32 35 37 37 35 0d 0a  3f3fb103025775..
1b150 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b160 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
1b170 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 31 20 41 53  cor0.col1 * 1 AS
1b180 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
1b190 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1b1a0 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a  86..-91..-97....
1b1b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b1c0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
1b1d0 20 34 35 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20   45 * + col2 AS 
1b1e0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1b1f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
1b200 39 32 0d 0a 31 32 30 38 0d 0a 31 36 33 31 0d 0a  92..1208..1631..
1b210 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1b220 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1b230 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1b240 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1b250 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1b260 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 31 0d 0a  sort label-781..
1b270 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
1b280 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
1b290 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 46 52  GNED ) + col0 FR
1b2a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1b2b0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
1b2c0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
1b2d0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1b2e0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1b2f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b300 37 38 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  781..SELECT + co
1b310 6c 30 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c  l0 * CAST ( NULL
1b320 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
1b330 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1b340 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
1b350 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
1b360 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1b370 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1b380 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1b390 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1b3a0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1b3b0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 32 0d 0a  sort label-782..
1b3c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1b3d0 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 43 41 53 54  cor0.col0 + CAST
1b3e0 28 20 2d 20 36 34 20 41 53 20 53 49 47 4e 45 44  ( - 64 AS SIGNED
1b3f0 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
1b400 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1b410 2d 2d 0d 0a 2d 32 39 0d 0a 2d 34 30 0d 0a 32 35  --..-29..-40..25
1b420 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1b430 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1b440 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1b450 72 74 20 6c 61 62 65 6c 2d 37 38 32 0d 0a 53 45  rt label-782..SE
1b460 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1b470 72 30 2e 63 6f 6c 30 20 2b 20 43 41 53 54 20 28  r0.col0 + CAST (
1b480 20 2d 20 36 34 20 41 53 20 49 4e 54 45 47 45 52   - 64 AS INTEGER
1b490 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
1b4a0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1b4b0 2d 2d 0d 0a 2d 32 39 0d 0a 2d 34 30 0d 0a 32 35  --..-29..-40..25
1b4c0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1b4d0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1b4e0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1b4f0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1b500 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b510 37 38 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  783..SELECT DIST
1b520 49 4e 43 54 20 2d 20 63 6f 6c 31 20 44 49 56 20  INCT - col1 DIV 
1b530 32 35 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f  25 + col2 DIV co
1b540 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
1b550 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
1b560 0d 0a 31 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..17....skipif m
1b570 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1b580 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1b590 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 33  owsort label-783
1b5a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1b5b0 54 20 2d 20 63 6f 6c 31 20 2f 20 32 35 20 2b 20  T - col1 / 25 + 
1b5c0 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 46 52 4f 4d  col2 / col0 FROM
1b5d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1b5e0 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 37 0d 0a 0d  ---..0..1..17...
1b5f0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1b600 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1b610 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1b620 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1b630 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 34  owsort label-784
1b640 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1b650 54 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 63  T + col2 DIV + c
1b660 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 + col1 AS co
1b670 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
1b680 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a  cor0..----..87..
1b690 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  91..97....skipif
1b6a0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1b6b0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1b6c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1b6d0 38 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  84..SELECT DISTI
1b6e0 4e 43 54 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63  NCT + col2 / + c
1b6f0 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 + col1 AS co
1b700 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
1b710 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a  cor0..----..87..
1b720 39 31 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  91..97....onlyif
1b730 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1b740 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1b750 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1b760 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1b770 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1b780 65 6c 2d 37 38 35 0d 0a 53 45 4c 45 43 54 20 41  el-785..SELECT A
1b790 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  LL + + col2 + + 
1b7a0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
1b7b0 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20 2a 20  GNED ) * col0 * 
1b7c0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
1b7d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1b7e0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1b7f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1b800 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1b810 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1b820 6c 61 62 65 6c 2d 37 38 35 0d 0a 53 45 4c 45 43  label-785..SELEC
1b830 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2b  T ALL + + col2 +
1b840 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
1b850 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f  S INTEGER ) * co
1b860 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l0 * - col0 FROM
1b870 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1b880 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
1b890 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
1b8a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1b8b0 4c 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  L + + col0 * col
1b8c0 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  1 + col0 AS col1
1b8d0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1b8e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a  r0..----..1120..
1b8f0 37 30 34 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79  704..81....query
1b900 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b910 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
1b920 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 63  col1 + col0 AS c
1b930 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
1b940 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 33 0d 0a 31 37  ---..-25..-3..17
1b950 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b960 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1b970 63 6f 6c 32 20 2b 20 2b 20 74 61 62 30 2e 63 6f  col2 + + tab0.co
1b980 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63  l0 + - col1 AS c
1b990 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
1b9a0 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 36 31 0d 0a 38  ---..-29..-61..8
1b9b0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  0....query III r
1b9c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a  owsort..SELECT *
1b9d0 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
1b9e0 20 4e 4f 54 20 4e 55 4c 4c 20 49 4e 20 28 20 2d   NOT NULL IN ( -
1b9f0 20 74 61 62 32 2e 63 6f 6c 32 20 2d 20 63 6f 6c   tab2.col2 - col
1ba00 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  2 )..----....que
1ba10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ba20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1ba30 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  l1 + + col1 + - 
1ba40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
1ba50 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a 34 30 0d 0a 35  ----..-45..40..5
1ba60 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
1ba70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1ba80 32 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c  2 * + col2 - col
1ba90 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
1baa0 2d 0d 0a 32 38 36 32 0d 0a 33 31 39 32 0d 0a 39  -..2862..3192..9
1bab0 31 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  120....query I r
1bac0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1bad0 49 53 54 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c  ISTINCT tab0.col
1bae0 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  2 * col1 AS col1
1baf0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1bb00 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37  ..2838..7462..97
1bb10 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f  ....query III ro
1bb20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1bb30 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61  STINCT * FROM ta
1bb40 62 31 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c  b1 WHERE NOT NUL
1bb50 4c 20 49 4e 20 28 20 2d 20 63 6f 6c 32 20 2a 20  L IN ( - col2 * 
1bb60 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  - col1 + - col2 
1bb70 2b 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62 31 2e  + col1 * - tab1.
1bb80 63 6f 6c 31 20 2a 20 2b 20 74 61 62 31 2e 63 6f  col1 * + tab1.co
1bb90 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l1 )..----....qu
1bba0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1bbb0 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63  ELECT + col0 * c
1bbc0 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  ol2 * - col2 FRO
1bbd0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab1..----..-2
1bbe0 30 37 39 33 36 0d 0a 2d 37 33 37 32 38 30 0d 0a  07936..-737280..
1bbf0 2d 38 37 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -8748....query I
1bc00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1bc10 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31   - col0 * - col1
1bc20 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
1bc30 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34 0d 0a 34 30  1..----..234..40
1bc40 39 36 30 0d 0a 38 33 32 30 30 0d 0a 0d 0a 71 75  960..83200....qu
1bc50 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
1bc60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
1bc70 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f  OM tab1 WHERE NO
1bc80 54 20 28 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  T ( col2 + col1 
1bc90 29 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41  ) BETWEEN NULL A
1bca0 4e 44 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 30  ND - col2 - col0
1bcb0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
1bcc0 20 68 61 73 68 69 6e 67 20 74 6f 20 38 64 36 36   hashing to 8d66
1bcd0 39 32 65 36 64 34 31 35 30 35 63 33 61 64 34 32  92e6d41505c3ad42
1bce0 64 39 31 39 62 64 39 65 63 64 30 64 0d 0a 0d 0a  d919bd9ecd0d....
1bcf0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1bd00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1bd10 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2b   col1 + - col1 +
1bd20 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a   - col2 * col2 *
1bd30 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
1bd40 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 35 39 33  0..----..1..3593
1bd50 37 0d 0a 35 35 31 33 36 38 0d 0a 0d 0a 71 75 65  7..551368....que
1bd60 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
1bd70 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f  SELECT ALL * FRO
1bd80 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54  M tab0 WHERE NOT
1bd90 20 4e 55 4c 4c 20 42 45 54 57 45 45 4e 20 28 20   NULL BETWEEN ( 
1bda0 2d 20 63 6f 6c 31 20 29 20 41 4e 44 20 63 6f 6c  - col1 ) AND col
1bdb0 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  0..----....query
1bdc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1bdd0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61  CT DISTINCT - ta
1bde0 62 31 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30  b1.col1 + + col0
1bdf0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1be00 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35  b1..----..-23..5
1be10 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49  4..67....query I
1be20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1be30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1be40 57 48 45 52 45 20 28 20 2b 20 63 6f 6c 30 20 29  WHERE ( + col0 )
1be50 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e   BETWEEN NULL AN
1be60 44 20 28 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d  D ( col0 )..----
1be70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1be80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30  ort..SELECT tab0
1be90 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
1bea0 57 48 45 52 45 20 4e 55 4c 4c 20 3e 3d 20 28 20  WHERE NULL >= ( 
1beb0 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col1 )..----....
1bec0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1bed0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d  .SELECT col0 * -
1bee0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b   col1 * - col2 +
1bef0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
1bf00 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 36 0d 0a 36  0..----..3396..6
1bf10 36 34 32 30 30 0d 0a 36 38 31 34 35 0d 0a 0d 0a  64200..68145....
1bf20 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1bf30 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1bf40 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1bf50 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1bf60 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 33 0d  wsort label-803.
1bf70 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
1bf80 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20 2d 20   DIV + col0 + - 
1bf90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
1bfa0 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 33 0d 0a 2d  ----..-2..-63..-
1bfb0 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  79....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 30 33 0d 0a  sort label-803..
1bff0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
1c000 2f 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  / + col0 + - col
1c010 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
1c020 2d 0d 0a 2d 32 0d 0a 2d 36 33 0d 0a 2d 37 39 0d  -..-2..-63..-79.
1c030 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c040 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e  rt..SELECT tab0.
1c050 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 2d 20  col1 * col2 * - 
1c060 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
1c070 2d 2d 2d 2d 0d 0a 2d 32 34 34 30 36 38 0d 0a 2d  ----..-244068..-
1c080 36 37 39 30 34 32 0d 0a 2d 39 34 30 39 0d 0a 0d  679042..-9409...
1c090 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c0a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1c0b0 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  T col2 + col2 * 
1c0c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
1c0d0 2d 2d 2d 2d 0d 0a 31 31 32 32 0d 0a 32 0d 0a 36  ----..1122..2..6
1c0e0 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  806....query III
1c0f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c100 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d   DISTINCT * FROM
1c110 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20   tab2 WHERE NOT 
1c120 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20  - col1 * col2 + 
1c130 2d 20 63 6f 6c 32 20 4e 4f 54 20 42 45 54 57 45  - col2 NOT BETWE
1c140 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 28 20 2d 20  EN NULL AND ( - 
1c150 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col0 )..----....
1c160 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c170 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
1c180 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32   + - col0 * col2
1c190 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1c1a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 36 0d 0a  r0..----..-706..
1c1b0 2d 37 32 30 37 0d 0a 36 32 0d 0a 0d 0a 71 75 65  -7207..62....que
1c1c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c1d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1c1e0 28 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  ( - col2 ) FROM 
1c1f0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1c200 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a  --..26..27..38..
1c210 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c220 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
1c230 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 28 20 63 6f   + - col1 + ( co
1c240 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
1c250 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1c260 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37  ----..86..91..97
1c270 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c280 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1c290 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  - cor0.col1 * - 
1c2a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1c2b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  S cor0..----..28
1c2c0 39 0d 0a 33 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a  9..3481..961....
1c2d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c2e0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 31 36 20 2a  .SELECT + - 16 *
1c2f0 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
1c300 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1c310 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 32  cor0..----..-272
1c320 0d 0a 2d 34 39 36 0d 0a 2d 39 34 34 0d 0a 0d 0a  ..-496..-944....
1c330 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c340 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1c350 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30   + + col1 * cor0
1c360 2e 63 6f 6c 31 20 2b 20 31 37 20 2d 20 63 6f 6c  .col1 + 17 - col
1c370 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
1c380 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1c390 2d 0d 0a 32 38 39 0d 0a 33 34 33 39 0d 0a 39 34  -..289..3439..94
1c3a0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1c3b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1c3c0 54 49 4e 43 54 20 2d 20 35 38 20 41 53 20 63 6f  TINCT - 58 AS co
1c3d0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
1c3e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 38 0d 0a 0d 0a  0..----..-58....
1c3f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c400 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d  .SELECT - col1 -
1c410 20 63 6f 6c 30 20 2a 20 31 33 20 2a 20 63 6f 6c   col0 * 13 * col
1c420 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
1c430 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1c440 2d 32 31 33 32 0d 0a 2d 34 37 34 33 34 0d 0a 2d  -2132..-47434..-
1c450 39 39 38 35 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  99853....skipif 
1c460 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1c470 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1c480 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1c490 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1c4a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c4b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1c4c0 39 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  90 col2 FROM tab
1c4d0 30 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  0, tab2 cor0..--
1c4e0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
1c4f0 68 69 6e 67 20 74 6f 20 39 36 66 37 61 39 30 34  hing to 96f7a904
1c500 32 38 64 62 39 33 66 34 37 32 65 30 64 32 31 39  28db93f472e0d219
1c510 62 61 62 36 34 38 35 33 0d 0a 0d 0a 71 75 65 72  bab64853....quer
1c520 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c530 45 43 54 20 41 4c 4c 20 34 37 20 41 53 20 63 6f  ECT ALL 47 AS co
1c540 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l0 FROM tab1, ta
1c550 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b0 cor0..----..9
1c560 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1c570 74 6f 20 34 66 65 31 39 32 66 32 39 36 37 39 31  to 4fe192f296791
1c580 65 31 65 34 30 65 61 30 30 61 36 38 61 61 38 64  e1e40ea00a68aa8d
1c590 61 62 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ab7....query I r
1c5a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1c5b0 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30  ISTINCT - - cor0
1c5c0 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c  .col0 * cor0.col
1c5d0 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
1c5e0 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32  ..----..189..202
1c5f0 38 0d 0a 33 30 30 32 0d 0a 0d 0a 73 6b 69 70 69  8..3002....skipi
1c600 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1c610 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1c620 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c630 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2a  T ALL + + col2 *
1c640 20 2d 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 32   - CAST ( - col2
1c650 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 52 45 41   * - col1 AS REA
1c660 4c 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  L ) FROM tab0 AS
1c670 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31   cor0..----..-61
1c680 31 38 38 34 0d 0a 2d 39 33 36 35 34 0d 0a 2d 39  1884..-93654..-9
1c690 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
1c6a0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1c6b0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1c6c0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1c6d0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1c6e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c6f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1c700 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c   + cor0.col0 col
1c710 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1c720 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
1c730 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor1..----..
1c740 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a  -3..-64..-80....
1c750 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c760 0a 53 45 4c 45 43 54 20 32 36 20 46 52 4f 4d 20  .SELECT 26 FROM 
1c770 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
1c780 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20  SS JOIN tab0 AS 
1c790 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
1c7a0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1c7b0 32 64 31 63 33 31 32 39 65 64 31 37 66 64 37 32  2d1c3129ed17fd72
1c7c0 31 64 34 38 37 36 62 32 31 63 30 33 35 35 38 34  1d4876b21c035584
1c7d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c7e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1c7f0 2b 20 32 20 2a 20 63 6f 6c 32 20 2a 20 74 61 62  + 2 * col2 * tab
1c800 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  0.col2 AS col0 F
1c810 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1c820 31 33 34 34 38 0d 0a 32 0d 0a 32 31 37 38 0d 0a  13448..2..2178..
1c830 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c840 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
1c850 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f   * + col2 - - co
1c860 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l0 * - col0 AS c
1c870 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
1c880 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 33 39 0d  r0..----..-3239.
1c890 0a 2d 34 30 35 36 0d 0a 31 34 30 0d 0a 0d 0a 73  .-4056..140....s
1c8a0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1c8b0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1c8c0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1c8d0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1c8e0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1c8f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c900 2b 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20  + + col2 - col1 
1c910 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
1c920 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
1c930 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71 75 65  3..-4..21....que
1c940 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c950 4c 45 43 54 20 63 6f 6c 30 20 2d 20 2d 20 35 39  LECT col0 - - 59
1c960 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
1c970 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
1c980 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 32 33  or0..----..-1923
1c990 0d 0a 2d 32 34 0d 0a 2d 34 37 34 39 0d 0a 0d 0a  ..-24..-4749....
1c9a0 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
1c9b0 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
1c9c0 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c 20  CT * FROM tab0, 
1c9d0 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
1c9e0 62 32 20 63 6f 72 31 2c 20 74 61 62 32 20 63 6f  b2 cor1, tab2 co
1c9f0 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61  r2..----..972 va
1ca00 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1ca10 61 34 37 61 39 64 62 30 37 63 37 64 65 34 39 32  a47a9db07c7de492
1ca20 37 63 37 63 32 38 65 66 62 34 63 64 31 33 66 32  7c7c28efb4cd13f2
1ca30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ca40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
1ca50 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2d 20  col1 * col0 + - 
1ca60 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63  col0 + col1 AS c
1ca70 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
1ca80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 0d 0a 35  r0..----..101..5
1ca90 38 36 0d 0a 39 37 33 0d 0a 0d 0a 71 75 65 72 79  86..973....query
1caa0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cab0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32 38  CT DISTINCT + 28
1cac0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1cad0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 0d 0a  b2..----..28....
1cae0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1caf0 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
1cb00 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  0 + cor0.col0 * 
1cb10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1cb20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30  S cor0..----..70
1cb30 0d 0a 37 33 38 37 0d 0a 38 31 36 0d 0a 0d 0a 73  ..7387..816....s
1cb40 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1cb50 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1cb60 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1cb70 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1cb80 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1cb90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1cba0 2d 20 2d 20 32 38 20 63 6f 6c 30 20 46 52 4f 4d  - - 28 col0 FROM
1cbb0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
1cbc0 0d 0a 32 38 0d 0a 32 38 0d 0a 32 38 0d 0a 0d 0a  ..28..28..28....
1cbd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1cbe0 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 72 30  .SELECT + ( cor0
1cbf0 2e 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 30  .col1 ) * - col0
1cc00 20 2b 20 2d 20 32 33 20 2a 20 63 6f 6c 31 20 46   + - 23 * col1 F
1cc10 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1cc20 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 39 0d 0a 2d  ..----..-1339..-
1cc30 36 37 36 0d 0a 2d 38 37 30 0d 0a 0d 0a 71 75 65  676..-870....que
1cc40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1cc50 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  LECT + + col2 + 
1cc60 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20  - col0 + col1 * 
1cc70 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
1cc80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1cc90 0d 0a 2d 2d 2d 2d 0d 0a 37 34 30 35 0d 0a 38 32  ..----..7405..82
1cca0 37 34 0d 0a 39 33 37 35 0d 0a 0d 0a 6f 6e 6c 79  74..9375....only
1ccb0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1ccc0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1ccd0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1cce0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ccf0 74 20 6c 61 62 65 6c 2d 38 33 32 0d 0a 53 45 4c  t label-832..SEL
1cd00 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 32  ECT DISTINCT - 2
1cd10 36 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20  6 DIV col2 FROM 
1cd20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1cd30 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..0....skipif 
1cd40 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1cd50 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1cd60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33  rowsort label-83
1cd70 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
1cd80 43 54 20 2d 20 32 36 20 2f 20 63 6f 6c 32 20 46  CT - 26 / col2 F
1cd90 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1cda0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
1cdb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1cdc0 4c 45 43 54 20 41 4c 4c 20 2b 20 35 36 20 46 52  LECT ALL + 56 FR
1cdd0 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f  OM tab0, tab0 co
1cde0 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
1cdf0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
1ce00 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 35 62  s hashing to b5b
1ce10 61 34 62 34 34 65 33 64 65 61 64 63 65 31 65 64  a4b44e3deadce1ed
1ce20 62 33 30 65 37 36 64 66 36 31 32 30 30 0d 0a 0d  b30e76df61200...
1ce30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ce40 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
1ce50 32 20 2a 20 2d 20 33 32 20 2a 20 63 6f 6c 31 20  2 * - 32 * col1 
1ce60 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1ce70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1ce80 0a 32 30 36 37 32 0d 0a 32 36 37 38 34 0d 0a 34  .20672..26784..4
1ce90 39 30 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9088....query I 
1cea0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ceb0 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + - cor0.col2 * 
1cec0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
1ced0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1cee0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32  ..----..-189..-2
1cef0 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75  028..-3002....qu
1cf00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1cf10 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b  ELECT + col1 + +
1cf20 20 28 20 2b 20 33 20 29 20 2a 20 2d 20 63 6f 6c   ( + 3 ) * - col
1cf30 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1cf40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a  or0..----..-20..
1cf50 2d 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 6f 6e 6c 79  -26..-52....only
1cf60 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1cf70 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1cf80 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1cf90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1cfa0 74 20 6c 61 62 65 6c 2d 38 33 37 0d 0a 53 45 4c  t label-837..SEL
1cfb0 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  ECT + + col0 * c
1cfc0 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 30 20 41  ol0 DIV + col0 A
1cfd0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
1cfe0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a   cor0..----..3..
1cff0 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66  64..80....skipif
1d000 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1d010 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1d020 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1d030 33 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  37..SELECT + + c
1d040 6f 6c 30 20 2a 20 63 6f 6c 30 20 2f 20 2b 20 63  ol0 * col0 / + c
1d050 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
1d060 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
1d070 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71  ..3..64..80....q
1d080 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d090 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20  SELECT col0 * + 
1d0a0 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  ( col1 ) FROM ta
1d0b0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1d0c0 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30  ..1343..217..460
1d0d0 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
1d0e0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1d0f0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1d100 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1d110 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1d120 2d 38 33 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -839..SELECT + c
1d130 6f 6c 30 20 44 49 56 20 2b 20 63 6f 72 30 2e 63  ol0 DIV + cor0.c
1d140 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
1d150 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
1d160 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
1d170 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1d180 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1d190 6f 72 74 20 6c 61 62 65 6c 2d 38 33 39 0d 0a 53  ort label-839..S
1d1a0 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2b  ELECT + col0 / +
1d1b0 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
1d1c0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1d1d0 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .0..0..1....quer
1d1e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d1f0 45 43 54 20 41 4c 4c 20 2d 20 38 36 20 2a 20 63  ECT ALL - 86 * c
1d200 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
1d210 2d 2d 2d 0d 0a 2d 34 36 34 34 0d 0a 2d 34 39 30  ---..-4644..-490
1d220 32 0d 0a 2d 38 32 35 36 0d 0a 0d 0a 71 75 65 72  2..-8256....quer
1d230 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d240 45 43 54 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20  ECT tab2.col0 * 
1d250 2b 20 63 6f 6c 30 20 2a 20 2d 20 33 37 20 2b 20  + col0 * - 37 + 
1d260 2d 20 32 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  - 21 FROM tab2..
1d270 2d 2d 2d 2d 0d 0a 2d 31 38 33 34 0d 0a 2d 32 32  ----..-1834..-22
1d280 35 31 32 39 0d 0a 2d 32 33 30 39 33 38 0d 0a 0d  5129..-230938...
1d290 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d2a0 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e  ..SELECT + tab1.
1d2b0 63 6f 6c 32 20 2a 20 2b 20 37 35 20 2a 20 2d 20  col2 * + 75 * - 
1d2c0 39 38 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 32  98 + - tab1.col2
1d2d0 20 2b 20 2b 20 33 34 20 46 52 4f 4d 20 74 61 62   + + 34 FROM tab
1d2e0 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  1, tab1 AS cor0.
1d2f0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
1d300 68 61 73 68 69 6e 67 20 74 6f 20 35 36 39 65 64  hashing to 569ed
1d310 38 33 37 35 62 30 65 30 35 66 30 31 32 33 64 34  8375b0e05f0123d4
1d320 39 63 34 66 31 30 64 33 37 37 30 0d 0a 0d 0a 71  9c4f10d3770....q
1d330 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d340 53 45 4c 45 43 54 20 41 4c 4c 20 37 20 46 52 4f  SELECT ALL 7 FRO
1d350 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  M tab0, tab1 AS 
1d360 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f  cor0, tab0 AS co
1d370 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
1d380 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
1d390 65 37 32 65 39 65 33 33 64 61 63 61 63 37 35 37  e72e9e33dacac757
1d3a0 66 34 38 64 30 63 65 34 36 30 39 34 36 30 37 0d  f48d0ce46094607.
1d3b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d3c0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
1d3d0 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 31 20 29 20  col2 + ( col1 ) 
1d3e0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
1d3f0 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38  ----..109..67..8
1d400 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1d410 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1d420 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 34 20 46 52   + col2 * + 4 FR
1d430 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1d440 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 33 32 38 0d  .----..132..328.
1d450 0a 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .4....onlyif mys
1d460 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1d470 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1d480 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1d490 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1d4a0 6c 2d 38 34 36 0d 0a 53 45 4c 45 43 54 20 2b 20  l-846..SELECT + 
1d4b0 63 6f 6c 32 20 44 49 56 20 2b 20 28 20 2b 20 63  col2 DIV + ( + c
1d4c0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 29 20 46  ol1 + + col0 ) F
1d4d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1d4e0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
1d4f0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1d500 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1d510 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d520 74 20 6c 61 62 65 6c 2d 38 34 36 0d 0a 53 45 4c  t label-846..SEL
1d530 45 43 54 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 28  ECT + col2 / + (
1d540 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30   + col1 + + col0
1d550 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
1d560 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
1d570 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
1d580 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1d590 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1d5a0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1d5b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1d5c0 65 6c 2d 38 34 37 0d 0a 53 45 4c 45 43 54 20 44  el-847..SELECT D
1d5d0 49 53 54 49 4e 43 54 20 2b 20 2d 20 28 20 2d 20  ISTINCT + - ( - 
1d5e0 63 6f 6c 31 20 29 20 44 49 56 20 2d 20 63 6f 6c  col1 ) DIV - col
1d5f0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
1d600 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1d610 2d 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..-1....skipif 
1d620 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1d630 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1d640 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34  rowsort label-84
1d650 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
1d660 43 54 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 31 20  CT + - ( - col1 
1d670 29 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ) / - col1 AS co
1d680 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1d690 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
1d6a0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1d6b0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1d6c0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1d6d0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1d6e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34  rowsort label-84
1d6f0 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  8..SELECT DISTIN
1d700 43 54 20 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f  CT - col1 DIV co
1d710 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30  r0.col1 + - col0
1d720 20 44 49 56 20 31 33 20 46 52 4f 4d 20 74 61 62   DIV 13 FROM tab
1d730 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1d740 0a 2d 31 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 73  .-1..-5..-7....s
1d750 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1d760 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1d770 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1d780 62 65 6c 2d 38 34 38 0d 0a 53 45 4c 45 43 54 20  bel-848..SELECT 
1d790 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
1d7a0 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20  / cor0.col1 + - 
1d7b0 63 6f 6c 30 20 2f 20 31 33 20 46 52 4f 4d 20 74  col0 / 13 FROM t
1d7c0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1d7d0 2d 0d 0a 2d 31 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d  -..-1..-5..-7...
1d7e0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1d7f0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1d800 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1d810 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1d820 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1d830 6f 72 74 20 6c 61 62 65 6c 2d 38 34 39 0d 0a 53  ort label-849..S
1d840 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 4e 55  ELECT - CAST( NU
1d850 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d  LL AS SIGNED ) -
1d860 20 2b 20 35 32 20 41 53 20 63 6f 6c 30 20 46 52   + 52 AS col0 FR
1d870 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
1d880 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
1d890 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1d8a0 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31   cd7a7901e47c151
1d8b0 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30  55404aff0d216fe0
1d8c0 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  b....skipif mysq
1d8d0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1d8e0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1d8f0 6f 72 74 20 6c 61 62 65 6c 2d 38 34 39 0d 0a 53  ort label-849..S
1d900 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 4e  ELECT - CAST ( N
1d910 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
1d920 20 2d 20 2b 20 35 32 20 41 53 20 63 6f 6c 30 20   - + 52 AS col0 
1d930 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
1d940 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
1d950 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1d960 74 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31  to cd7a7901e47c1
1d970 35 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66  5155404aff0d216f
1d980 65 30 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  e0b....query I r
1d990 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1d9a0 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b 20  LL + - col0 + + 
1d9b0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
1d9c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1d9d0 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d  ----..2..62..62.
1d9e0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1d9f0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1da00 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1da10 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1da20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1da30 35 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  51..SELECT DISTI
1da40 4e 43 54 20 2b 20 36 35 20 2a 20 31 39 20 44 49  NCT + 65 * 19 DI
1da50 56 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  V - col2 col2 FR
1da60 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1da70 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 35 0d 0a 2d 31  .----..-1235..-1
1da80 35 0d 0a 2d 33 37 0d 0a 0d 0a 73 6b 69 70 69 66  5..-37....skipif
1da90 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1daa0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1dab0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1dac0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1dad0 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
1dae0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1daf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1db00 74 20 6c 61 62 65 6c 2d 38 35 31 0d 0a 53 45 4c  t label-851..SEL
1db10 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 36  ECT DISTINCT + 6
1db20 35 20 2a 20 31 39 20 2f 20 2d 20 63 6f 6c 32 20  5 * 19 / - col2 
1db30 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1db40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1db50 32 33 35 0d 0a 2d 31 35 0d 0a 2d 33 37 0d 0a 0d  235..-15..-37...
1db60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1db70 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1db80 54 20 2b 20 36 31 20 2a 20 63 6f 6c 31 20 46 52  T + 61 * col1 FR
1db90 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1dba0 0a 2d 2d 2d 2d 0d 0a 31 30 33 37 0d 0a 31 38 39  .----..1037..189
1dbb0 31 0d 0a 33 35 39 39 0d 0a 0d 0a 71 75 65 72 79  1..3599....query
1dbc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1dbd0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20  CT ALL col2 + - 
1dbe0 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 63 6f  col0 * col0 * co
1dbf0 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  r0.col1 AS col0 
1dc00 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1dc10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 30 0d 0a 2d  0..----..-180..-
1dc20 34 30 39 30 33 0d 0a 2d 38 33 31 30 34 0d 0a 0d  40903..-83104...
1dc30 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1dc40 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1dc50 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1dc60 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1dc70 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1dc80 6f 72 74 20 6c 61 62 65 6c 2d 38 35 34 0d 0a 53  ort label-854..S
1dc90 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1dca0 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b 20 2d 20   ( - col0 ) + - 
1dcb0 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28 20 4e  col2 * - CAST( N
1dcc0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
1dcd0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1dce0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  2 cor0..----..NU
1dcf0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
1dd00 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1dd10 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1dd20 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35 34 0d 0a  sort label-854..
1dd30 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1dd40 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b 20 2d  - ( - col0 ) + -
1dd50 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 20 28   col2 * - CAST (
1dd60 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
1dd70 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
1dd80 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1dd90 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
1dda0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ddb0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
1ddc0 20 2a 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d   * ( col0 ) FROM
1ddd0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1dde0 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39  ---..-2064..-339
1ddf0 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 73 6b 69 70  5..-8099....skip
1de00 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1de10 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1de20 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1de30 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1de40 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1de50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1de60 30 20 2d 20 28 20 63 6f 6c 30 20 29 20 63 6f 6c  0 - ( col0 ) col
1de70 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
1de80 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
1de90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1dea0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 33  ELECT + col2 + 3
1deb0 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  8 AS col0 FROM t
1dec0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 0d 0a  ab1..----..134..
1ded0 39 32 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20  92..95....query 
1dee0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1def0 54 20 2d 20 2d 20 37 34 20 2b 20 63 6f 6c 30 20  T - - 74 + col0 
1df00 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1df10 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1df20 0a 31 35 32 0d 0a 31 35 33 0d 0a 38 31 0d 0a 0d  .152..153..81...
1df30 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1df40 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1df50 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1df60 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1df70 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35 39  owsort label-859
1df80 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 34 32 20  ..SELECT - - 42 
1df90 2b 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  + + col1 + + col
1dfa0 30 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f  0 DIV + col1 FRO
1dfb0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1dfc0 2d 0d 0a 31 32 38 0d 0a 31 33 33 0d 0a 31 33 39  -..128..133..139
1dfd0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1dfe0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1dff0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1e000 72 74 20 6c 61 62 65 6c 2d 38 35 39 0d 0a 53 45  rt label-859..SE
1e010 4c 45 43 54 20 2d 20 2d 20 34 32 20 2b 20 2b 20  LECT - - 42 + + 
1e020 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2f 20  col1 + + col0 / 
1e030 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
1e040 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38   cor0..----..128
1e050 0d 0a 31 33 33 0d 0a 31 33 39 0d 0a 0d 0a 73 6b  ..133..139....sk
1e060 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1e070 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1e080 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1e090 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1e0a0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1e0b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1e0c0 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 2b 20   ( - col2 ) * + 
1e0d0 39 37 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  97 - + cor0.col0
1e0e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1e0f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 37 37  cor0..----..3177
1e100 0d 0a 36 32 0d 0a 37 38 36 35 0d 0a 0d 0a 71 75  ..62..7865....qu
1e110 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e120 45 4c 45 43 54 20 2d 20 36 36 20 46 52 4f 4d 20  ELECT - 66 FROM 
1e130 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1e140 2d 2d 0d 0a 2d 36 36 0d 0a 2d 36 36 0d 0a 2d 36  --..-66..-66..-6
1e150 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
1e160 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
1e170 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  1.col2 FROM tab0
1e180 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20  , tab1 AS cor0, 
1e190 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
1e1a0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
1e1b0 73 68 69 6e 67 20 74 6f 20 34 30 66 64 38 63 63  shing to 40fd8cc
1e1c0 30 64 65 39 32 65 61 36 38 64 37 33 36 33 34 63  0de92ea68d73634c
1e1d0 32 64 38 66 37 35 62 66 35 0d 0a 0d 0a 71 75 65  2d8f75bf5....que
1e1e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e1f0 4c 45 43 54 20 41 4c 4c 20 2b 20 33 30 20 41 53  LECT ALL + 30 AS
1e200 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
1e210 0a 2d 2d 2d 2d 0d 0a 33 30 0d 0a 33 30 0d 0a 33  .----..30..30..3
1e220 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1e230 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35  sort..SELECT - 5
1e240 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
1e250 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1e260 2d 0d 0a 2d 35 30 0d 0a 2d 35 30 0d 0a 2d 35 30  -..-50..-50..-50
1e270 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e280 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
1e290 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col1 + - col1 * 
1e2a0 32 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  27 FROM tab2 AS 
1e2b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 35  cor0..----..-165
1e2c0 32 0d 0a 2d 34 37 36 0d 0a 2d 38 36 38 0d 0a 0d  2..-476..-868...
1e2d0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1e2e0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1e2f0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1e300 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1e310 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1e320 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e330 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c  T ALL col2 * col
1e340 31 20 2b 20 35 36 20 63 6f 6c 30 20 46 52 4f 4d  1 + 56 col0 FROM
1e350 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33   tab0..----..153
1e360 0d 0a 32 38 39 34 0d 0a 37 35 31 38 0d 0a 0d 0a  ..2894..7518....
1e370 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e380 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 31  .SELECT ( + col1
1e390 20 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   ) + + col0 FROM
1e3a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1e3b0 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36  ---..137..38..96
1e3c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e3d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 34 20 2a  ort..SELECT 14 *
1e3e0 20 34 36 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   46 FROM tab2..-
1e3f0 2d 2d 2d 0d 0a 36 34 34 0d 0a 36 34 34 0d 0a 36  ---..644..644..6
1e400 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  44....query I ro
1e410 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1e420 4c 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  L + col0 + col0 
1e430 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1e440 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a 34 38  0..----..178..48
1e450 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..70....query I 
1e460 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e470 2d 20 35 36 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 56 AS col0 FRO
1e480 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
1e490 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
1e4a0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1e4b0 33 64 33 64 61 62 34 30 30 65 65 66 39 33 63 30  3d3dab400eef93c0
1e4c0 39 38 61 63 62 62 62 61 33 66 63 39 62 64 63 36  98acbbba3fc9bdc6
1e4d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1e4e0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1e4f0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1e500 72 74 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20  rt..SELECT CAST 
1e510 28 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29  ( col2 AS REAL )
1e520 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1e530 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37  b2..----..26..27
1e540 0d 0a 33 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..38....onlyif m
1e550 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1e560 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1e570 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1e580 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1e590 62 65 6c 2d 38 37 32 0d 0a 53 45 4c 45 43 54 20  bel-872..SELECT 
1e5a0 32 34 20 2b 20 32 31 20 2a 20 2b 20 63 6f 6c 31  24 + 21 * + col1
1e5b0 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74   DIV col1 FROM t
1e5c0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 34 35 0d 0a 34  ab0..----..45..4
1e5d0 35 0d 0a 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  5..45....skipif 
1e5e0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1e5f0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1e600 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 37  rowsort label-87
1e610 32 0d 0a 53 45 4c 45 43 54 20 32 34 20 2b 20 32  2..SELECT 24 + 2
1e620 31 20 2a 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c  1 * + col1 / col
1e630 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
1e640 2d 0d 0a 34 35 0d 0a 34 35 0d 0a 34 35 0d 0a 0d  -..45..45..45...
1e650 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e660 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1e670 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20  T col2 + col0 * 
1e680 63 6f 6c 30 20 2a 20 2d 20 38 33 20 46 52 4f 4d  col0 * - 83 FROM
1e690 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33   tab1..----..-33
1e6a0 39 39 31 31 0d 0a 2d 35 33 31 31 30 34 0d 0a 2d  9911..-531104..-
1e6b0 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  693....query I r
1e6c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1e6d0 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 2d 20   ( - col0 ) * - 
1e6e0 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 63  col1 + col0 AS c
1e6f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
1e700 2d 2d 2d 0d 0a 32 30 38 38 0d 0a 33 34 33 30 0d  ---..2088..3430.
1e710 0a 38 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .8188....query I
1e720 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e730 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 38 20 46 52   + - col2 * 8 FR
1e740 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1e750 0a 2d 2d 2d 2d 0d 0a 2d 34 33 32 0d 0a 2d 34 35  .----..-432..-45
1e760 36 0d 0a 2d 37 36 38 0d 0a 0d 0a 71 75 65 72 79  6..-768....query
1e770 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e780 43 54 20 41 4c 4c 20 2d 20 2b 20 32 36 20 41 53  CT ALL - + 26 AS
1e790 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1e7a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  cor0..----..-26.
1e7b0 0a 2d 32 36 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65  .-26..-26....que
1e7c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e7d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 38 37  LECT DISTINCT 87
1e7e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1e7f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 0d 0a  r0..----..87....
1e800 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e810 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1e820 20 39 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   97 AS col1 FROM
1e830 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
1e840 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 37 0d 0a 0d  or0..----..97...
1e850 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e860 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
1e870 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  or0.col1 * - col
1e880 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1e890 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34  or0..----..-1534
1e8a0 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a  ..-646..-837....
1e8b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e8c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1e8d0 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   - - col1 + - co
1e8e0 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  l1 * - col0 * co
1e8f0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
1e900 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1e910 0a 32 32 38 34 38 0d 0a 32 37 31 35 37 37 0d 0a  .22848..271577..
1e920 36 37 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6758....query I 
1e930 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e940 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 28 20 2b  DISTINCT - - ( +
1e950 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20 63   cor0.col2 ) * c
1e960 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1e970 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   cor0..----..124
1e980 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a  8..1404..570....
1e990 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e9a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1e9b0 20 2b 20 38 34 20 2a 20 63 6f 6c 31 20 2a 20 2d   + 84 * col1 * -
1e9c0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
1e9d0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1e9e0 0a 2d 2d 2d 2d 0d 0a 2d 36 32 31 32 36 34 0d 0a  .----..-621264..
1e9f0 2d 36 39 35 36 30 34 0d 0a 2d 37 39 30 33 35 36  -695604..-790356
1ea00 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ea10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
1ea20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 41 53  col2 * - col2 AS
1ea30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1ea40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1ea50 34 34 34 0d 0a 36 37 36 0d 0a 37 32 39 0d 0a 0d  444..676..729...
1ea60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ea70 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
1ea80 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  1 + + cor0.col1 
1ea90 2a 20 2b 20 31 33 20 46 52 4f 4d 20 74 61 62 31  * + 13 FROM tab1
1eaa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30   cor0..----..140
1eab0 0d 0a 31 38 32 0d 0a 33 36 34 0d 0a 0d 0a 73 6b  ..182..364....sk
1eac0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1ead0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1eae0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1eaf0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1eb00 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1eb10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1eb20 49 53 54 49 4e 43 54 20 2d 20 2b 20 32 36 20 63  ISTINCT - + 26 c
1eb30 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1eb40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   cor0..----..-26
1eb50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1eb60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1eb70 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  - col1 * - col1 
1eb80 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1eb90 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1eba0 0a 31 30 30 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a  .100..169..676..
1ebb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ebc0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 31  t..SELECT ALL 61
1ebd0 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
1ebe0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1ebf0 2d 0d 0a 2d 31 35 38 36 0d 0a 2d 31 36 34 37 0d  -..-1586..-1647.
1ec00 0a 2d 32 33 31 38 0d 0a 0d 0a 73 6b 69 70 69 66  .-2318....skipif
1ec10 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1ec20 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1ec30 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1ec40 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1ec50 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
1ec60 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1ec70 20 36 35 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20   65 * col1 col2 
1ec80 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1ec90 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 39 30 0d 0a  0..----..-1690..
1eca0 2d 36 35 30 0d 0a 2d 38 34 35 0d 0a 0d 0a 6f 6e  -650..-845....on
1ecb0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1ecc0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1ecd0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1ece0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1ecf0 6f 72 74 20 6c 61 62 65 6c 2d 38 38 39 0d 0a 53  ort label-889..S
1ed00 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1ed10 20 36 35 20 44 49 56 20 63 6f 6c 32 20 41 53 20   65 DIV col2 AS 
1ed20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1ed30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1ed40 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
1ed50 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1ed60 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1ed70 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38 39 0d 0a  sort label-889..
1ed80 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1ed90 2b 20 36 35 20 2f 20 63 6f 6c 32 20 41 53 20 63  + 65 / col2 AS c
1eda0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1edb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
1edc0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
1edd0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1ede0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1edf0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1ee00 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1ee10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ee20 45 4c 45 43 54 20 41 4c 4c 20 2b 20 35 35 20 63  ELECT ALL + 55 c
1ee30 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
1ee40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 35  r0..----..55..55
1ee50 0d 0a 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..55....query I 
1ee60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ee70 44 49 53 54 49 4e 43 54 20 2b 20 39 30 20 2b 20  DISTINCT + 90 + 
1ee80 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
1ee90 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 0d 0a 31 32 31  ..----..107..121
1eea0 0d 0a 31 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..149....query I
1eeb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1eec0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b   DISTINCT col1 +
1eed0 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f   col1 + col0 FRO
1eee0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1eef0 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31 39 36 0d 0a  ----..113..196..
1ef00 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  69....query I ro
1ef10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1ef20 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e  STINCT + - cor0.
1ef30 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 46 52  col2 - + col2 FR
1ef40 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1ef50 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 31 31  .----..-108..-11
1ef60 34 0d 0a 2d 31 39 32 0d 0a 0d 0a 71 75 65 72 79  4..-192....query
1ef70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ef80 43 54 20 41 4c 4c 20 2b 20 36 32 20 2a 20 63 6f  CT ALL + 62 * co
1ef90 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1efa0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33 34 0d  cor0..----..434.
1efb0 0a 34 38 33 36 0d 0a 34 38 39 38 0d 0a 0d 0a 71  .4836..4898....q
1efc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1efd0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
1efe0 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20 63  col1 - col0 AS c
1eff0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
1f000 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 36 0d 0a  r0..----..1456..
1f010 35 36 37 0d 0a 38 33 30 0d 0a 0d 0a 6f 6e 6c 79  567..830....only
1f020 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1f030 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1f040 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1f050 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f060 74 20 6c 61 62 65 6c 2d 38 39 36 0d 0a 53 45 4c  t label-896..SEL
1f070 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  ECT col0 + col2 
1f080 44 49 56 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c  DIV + ( cor0.col
1f090 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
1f0a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1f0b0 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 38 31 0d 0a  ---..7..78..81..
1f0c0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1f0d0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1f0e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f0f0 20 6c 61 62 65 6c 2d 38 39 36 0d 0a 53 45 4c 45   label-896..SELE
1f100 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2f  CT col0 + col2 /
1f110 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29   + ( cor0.col1 )
1f120 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1f130 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1f140 0d 0a 37 0d 0a 37 38 0d 0a 38 31 0d 0a 0d 0a 71  ..7..78..81....q
1f150 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f160 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
1f170 6c 31 20 2b 20 32 33 20 2a 20 33 37 20 41 53 20  l1 + 23 * 37 AS 
1f180 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
1f190 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36  S cor0..----..86
1f1a0 31 0d 0a 38 36 34 0d 0a 38 37 37 0d 0a 0d 0a 71  1..864..877....q
1f1b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f1c0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
1f1d0 2a 20 28 20 2b 20 35 20 29 20 41 53 20 63 6f 6c  * ( + 5 ) AS col
1f1e0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1f1f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 33  or0..----..15..3
1f200 32 30 0d 0a 34 30 30 0d 0a 0d 0a 71 75 65 72 79  20..400....query
1f210 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f220 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20  CT ALL + col2 + 
1f230 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 63  + ( - col2 ) * c
1f240 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
1f250 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   tab0..----..-28
1f260 30 35 0d 0a 2d 37 33 38 30 0d 0a 2d 39 36 0d 0a  05..-7380..-96..
1f270 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f280 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
1f290 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 37 34 20 46   * col0 + - 74 F
1f2a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1f2b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 33 38 0d 0a 2d  ..----..-2138..-
1f2c0 33 34 36 39 0d 0a 2d 38 31 37 33 0d 0a 0d 0a 6f  3469..-8173....o
1f2d0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1f2e0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1f2f0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1f300 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1f310 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f320 74 20 6c 61 62 65 6c 2d 39 30 31 0d 0a 53 45 4c  t label-901..SEL
1f330 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b  ECT ALL col1 * +
1f340 20 43 41 53 54 28 20 2b 20 63 6f 6c 32 20 41 53   CAST( + col2 AS
1f350 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
1f360 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1f370 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d  or0..----..2838.
1f380 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 73 6b 69  .7462..97....ski
1f390 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1f3a0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1f3b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1f3c0 6c 2d 39 30 31 0d 0a 53 45 4c 45 43 54 20 41 4c  l-901..SELECT AL
1f3d0 4c 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20  L col1 * + CAST 
1f3e0 28 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54 45  ( + col2 AS INTE
1f3f0 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52  GER ) AS col0 FR
1f400 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1f410 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36  .----..2838..746
1f420 32 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  2..97....onlyif 
1f430 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1f440 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1f450 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1f460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1f470 61 62 65 6c 2d 39 30 32 0d 0a 53 45 4c 45 43 54  abel-902..SELECT
1f480 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
1f490 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30 20 46 52  l2 DIV + col0 FR
1f4a0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1f4b0 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 0d 0a  .----..-3..0....
1f4c0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1f4d0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1f4e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1f4f0 61 62 65 6c 2d 39 30 32 0d 0a 53 45 4c 45 43 54  abel-902..SELECT
1f500 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
1f510 6c 32 20 2f 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l2 / + col0 FROM
1f520 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1f530 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 0d 0a 71 75  ---..-3..0....qu
1f540 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f550 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1f560 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 39 32 20  ol1 * col2 + 92 
1f570 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1f580 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1f590 0a 31 33 34 30 0d 0a 31 34 39 36 0d 0a 36 36 32  .1340..1496..662
1f5a0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1f5b0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1f5c0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1f5d0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1f5e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1f5f0 39 30 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  904..SELECT col2
1f600 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c   DIV col0 AS col
1f610 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1f620 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
1f630 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
1f640 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1f650 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1f660 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 34 0d 0a  sort label-904..
1f670 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 63 6f  SELECT col2 / co
1f680 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
1f690 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1f6a0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 6f  --..0..0..1....o
1f6b0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1f6c0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1f6d0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1f6e0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1f6f0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 35 0d 0a  sort label-905..
1f700 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63  SELECT ALL - + c
1f710 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  or0.col1 + - col
1f720 30 20 44 49 56 20 2b 20 63 6f 6c 31 20 41 53 20  0 DIV + col1 AS 
1f730 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
1f740 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1f750 36 0d 0a 2d 31 39 0d 0a 2d 32 36 0d 0a 0d 0a 73  6..-19..-26....s
1f760 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1f770 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1f780 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1f790 62 65 6c 2d 39 30 35 0d 0a 53 45 4c 45 43 54 20  bel-905..SELECT 
1f7a0 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ALL - + cor0.col
1f7b0 31 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 63  1 + - col0 / + c
1f7c0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
1f7d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1f7e0 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 31 39 0d 0a 2d  ---..-16..-19..-
1f7f0 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  26....onlyif mys
1f800 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1f810 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1f820 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1f830 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1f840 6c 2d 39 30 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-906..SELECT DI
1f850 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20  STINCT - - col0 
1f860 44 49 56 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b  DIV ( - col0 ) +
1f870 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46   col1 * + col1 F
1f880 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1f890 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 35 0d 0a 38 32  ..----..7395..82
1f8a0 38 30 0d 0a 39 34 30 38 0d 0a 0d 0a 73 6b 69 70  80..9408....skip
1f8b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1f8c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1f8d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1f8e0 2d 39 30 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  -906..SELECT DIS
1f8f0 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2f  TINCT - - col0 /
1f900 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b 20 63 6f   ( - col0 ) + co
1f910 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l1 * + col1 FROM
1f920 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1f930 2d 2d 2d 0d 0a 37 33 39 35 0d 0a 38 32 38 30 0d  ---..7395..8280.
1f940 0a 39 34 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .9408....onlyif 
1f950 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1f960 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1f970 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1f980 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1f990 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1f9a0 6c 2d 39 30 37 0d 0a 53 45 4c 45 43 54 20 2b 20  l-907..SELECT + 
1f9b0 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 32 20 41  col1 * CAST( 2 A
1f9c0 53 20 53 49 47 4e 45 44 20 29 20 2d 20 2b 20 63  S SIGNED ) - + c
1f9d0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
1f9e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1f9f0 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 33 37 0d 0a 2d 37  ---..-2..-37..-7
1fa00 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
1fa10 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1fa20 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1fa30 6f 72 74 20 6c 61 62 65 6c 2d 39 30 37 0d 0a 53  ort label-907..S
1fa40 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 43  ELECT + col1 * C
1fa50 41 53 54 20 28 20 32 20 41 53 20 49 4e 54 45 47  AST ( 2 AS INTEG
1fa60 45 52 20 29 20 2d 20 2b 20 63 6f 6c 32 20 41 53  ER ) - + col2 AS
1fa70 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1fa80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1fa90 32 0d 0a 2d 33 37 0d 0a 2d 37 30 0d 0a 0d 0a 71  2..-37..-70....q
1faa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1fab0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
1fac0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63  ol1 * + col0 + c
1fad0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
1fae0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1faf0 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 30 35 33 0d 0a  ---..104..1053..
1fb00 36 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  650....query I r
1fb10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1fb20 20 63 6f 6c 30 20 2d 20 39 33 20 2a 20 2b 20 63   col0 - 93 * + c
1fb30 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 * col1 AS co
1fb40 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
1fb50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 38 37  cor0..----..-687
1fb60 38 30 34 0d 0a 2d 37 37 30 30 34 34 0d 0a 2d 38  804..-770044..-8
1fb70 37 35 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  75002....query I
1fb80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fb90 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f   ALL - + cor0.co
1fba0 6c 30 20 2a 20 39 35 20 46 52 4f 4d 20 74 61 62  l0 * 95 FROM tab
1fbb0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1fbc0 0a 2d 36 36 35 0d 0a 2d 37 34 31 30 0d 0a 2d 37  .-665..-7410..-7
1fbd0 35 30 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  505....onlyif my
1fbe0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1fbf0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1fc00 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1fc10 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1fc20 65 6c 2d 39 31 31 0d 0a 53 45 4c 45 43 54 20 41  el-911..SELECT A
1fc30 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 28  LL cor0.col2 * (
1fc40 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 29 20 44   col1 + col0 ) D
1fc50 49 56 20 2d 20 33 38 20 46 52 4f 4d 20 74 61 62  IV - 38 FROM tab
1fc60 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1fc70 0a 2d 33 0d 0a 2d 33 38 38 0d 0a 2d 39 35 0d 0a  .-3..-388..-95..
1fc80 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1fc90 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1fca0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1fcb0 20 6c 61 62 65 6c 2d 39 31 31 0d 0a 53 45 4c 45   label-911..SELE
1fcc0 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32  CT ALL cor0.col2
1fcd0 20 2a 20 28 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   * ( col1 + col0
1fce0 20 29 20 2f 20 2d 20 33 38 20 46 52 4f 4d 20 74   ) / - 38 FROM t
1fcf0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1fd00 2d 0d 0a 2d 33 0d 0a 2d 33 38 38 0d 0a 2d 39 35  -..-3..-388..-95
1fd10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1fd20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1fd30 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  + col0 * + col2 
1fd40 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
1fd50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1fd60 31 38 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d  188..3658..7693.
1fd70 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1fd80 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1fd90 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1fda0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1fdb0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
1fdc0 31 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  13..SELECT col2 
1fdd0 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  DIV + col1 + + c
1fde0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1fdf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d   cor0..----..24.
1fe00 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69  .35..89....skipi
1fe10 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1fe20 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1fe30 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1fe40 39 31 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  913..SELECT col2
1fe50 20 2f 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   / + col1 + + co
1fe60 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
1fe70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  cor0..----..24..
1fe80 33 35 0d 0a 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  35..89....onlyif
1fe90 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1fea0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1feb0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1fec0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1fed0 6c 61 62 65 6c 2d 39 31 34 0d 0a 53 45 4c 45 43  label-914..SELEC
1fee0 54 20 63 6f 6c 32 20 44 49 56 20 2d 20 31 37 20  T col2 DIV - 17 
1fef0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1ff00 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1ff10 0a 2d 31 0d 0a 2d 34 0d 0a 30 0d 0a 0d 0a 73 6b  .-1..-4..0....sk
1ff20 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1ff30 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1ff40 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1ff50 65 6c 2d 39 31 34 0d 0a 53 45 4c 45 43 54 20 63  el-914..SELECT c
1ff60 6f 6c 32 20 2f 20 2d 20 31 37 20 41 53 20 63 6f  ol2 / - 17 AS co
1ff70 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
1ff80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
1ff90 2d 34 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -4..0....onlyif 
1ffa0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1ffb0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1ffc0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1ffd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ffe0 61 62 65 6c 2d 39 31 35 0d 0a 53 45 4c 45 43 54  abel-915..SELECT
1fff0 20 41 4c 4c 20 33 38 20 44 49 56 20 2d 20 63 6f   ALL 38 DIV - co
20000 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
20010 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
20020 2d 2d 0d 0a 2d 31 32 0d 0a 30 0d 0a 30 0d 0a 0d  --..-12..0..0...
20030 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
20040 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
20050 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
20060 6c 61 62 65 6c 2d 39 31 35 0d 0a 53 45 4c 45 43  label-915..SELEC
20070 54 20 41 4c 4c 20 33 38 20 2f 20 2d 20 63 6f 6c  T ALL 38 / - col
20080 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
20090 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
200a0 2d 0d 0a 2d 31 32 0d 0a 30 0d 0a 30 0d 0a 0d 0a  -..-12..0..0....
200b0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
200c0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
200d0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
200e0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
200f0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
20100 72 74 20 6c 61 62 65 6c 2d 39 31 36 0d 0a 53 45  rt label-916..SE
20110 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
20120 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
20130 44 45 43 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c  DECIMAL ) AS col
20140 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
20150 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
20160 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
20170 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
20180 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20190 74 20 6c 61 62 65 6c 2d 39 31 36 0d 0a 53 45 4c  t label-916..SEL
201a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
201b0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
201c0 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 30 20 46  REAL ) AS col0 F
201d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
201e0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
201f0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
20200 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
20210 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
20220 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
20230 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
20240 72 74 20 6c 61 62 65 6c 2d 39 31 37 0d 0a 53 45  rt label-917..SE
20250 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20 2b  LECT ALL CAST( +
20260 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20   col1 AS SIGNED 
20270 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
20280 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
20290 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d  -..17..31..59...
202a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
202b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
202c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
202d0 6c 61 62 65 6c 2d 39 31 37 0d 0a 53 45 4c 45 43  label-917..SELEC
202e0 54 20 41 4c 4c 20 43 41 53 54 20 28 20 2b 20 63  T ALL CAST ( + c
202f0 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
20300 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
20310 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
20320 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a  ..17..31..59....
20330 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20340 0a 53 45 4c 45 43 54 20 2b 20 34 37 20 2b 20 2d  .SELECT + 47 + -
20350 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
20360 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
20370 62 32 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  b2 cor0, tab2 AS
20380 20 63 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63   cor1, tab1 AS c
20390 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61  or2..----..81 va
203a0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
203b0 66 38 37 37 37 39 37 31 38 34 33 64 36 63 30 33  f8777971843d6c03
203c0 62 61 63 64 64 38 39 66 31 33 61 34 30 39 62 62  bacdd89f13a409bb
203d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
203e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
203f0 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
20400 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  2, tab2 AS cor0,
20410 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab2 cor1..----
20420 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
20430 69 6e 67 20 74 6f 20 66 39 64 34 62 62 38 36 37  ing to f9d4bb867
20440 37 64 62 37 62 39 38 63 37 65 64 38 39 64 30 36  7db7b98c7ed89d06
20450 65 36 65 38 63 64 36 0d 0a 0d 0a 71 75 65 72 79  e6e8cd6....query
20460 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20470 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
20480 36 33 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  63 ) * col2 FROM
20490 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
204a0 2d 2d 2d 0d 0a 2d 32 30 37 39 0d 0a 2d 35 31 36  ---..-2079..-516
204b0 36 0d 0a 2d 36 33 0d 0a 0d 0a 71 75 65 72 79 20  6..-63....query 
204c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
204d0 54 20 28 20 63 6f 6c 30 20 29 20 2a 20 2d 20 63  T ( col0 ) * - c
204e0 6f 6c 31 20 2a 20 34 39 20 41 53 20 63 6f 6c 32  ol1 * 49 AS col2
204f0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
20500 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 31 33  r0..----..-10113
20510 36 0d 0a 2d 31 36 36 33 35 35 0d 0a 2d 33 39 36  6..-166355..-396
20520 38 35 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  851....onlyif my
20530 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
20540 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
20550 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
20560 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
20570 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
20580 39 32 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  922..SELECT ALL 
20590 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
205a0 44 45 43 49 4d 41 4c 20 29 20 2b 20 2b 20 63 6f  DECIMAL ) + + co
205b0 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  l2 * col0 * + co
205c0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
205d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
205e0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
205f0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
20600 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
20610 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
20620 61 62 65 6c 2d 39 32 32 0d 0a 53 45 4c 45 43 54  abel-922..SELECT
20630 20 41 4c 4c 20 2d 20 43 41 53 54 20 28 20 4e 55   ALL - CAST ( NU
20640 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2b 20 2b  LL AS REAL ) + +
20650 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2b   col2 * col0 * +
20660 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
20670 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
20680 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
20690 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
206a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 35 20  rt..SELECT + 25 
206b0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
206c0 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
206d0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
206e0 68 61 73 68 69 6e 67 20 74 6f 20 35 32 35 61 35  hashing to 525a5
206f0 35 64 35 65 64 32 32 34 61 36 32 64 61 36 35 64  5d5ed224a62da65d
20700 66 33 36 37 33 31 38 38 31 61 37 0d 0a 0d 0a 71  f36731881a7....q
20710 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20720 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f  SELECT col0 * co
20730 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l0 + + col0 FROM
20740 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d   tab1..----..12.
20750 0a 34 31 36 30 0d 0a 36 34 38 30 0d 0a 0d 0a 71  .4160..6480....q
20760 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20770 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
20780 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col1 * - col2 + 
20790 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
207a0 2d 2d 2d 2d 0d 0a 2d 31 34 35 36 0d 0a 2d 35 36  ----..-1456..-56
207b0 37 0d 0a 2d 38 33 30 0d 0a 0d 0a 71 75 65 72 79  7..-830....query
207c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
207d0 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  CT + + col2 * - 
207e0 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col2 + - col1 * 
207f0 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63  col0 * col2 AS c
20800 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
20810 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
20820 30 33 32 38 0d 0a 2d 35 32 34 37 38 0d 0a 2d 36  0328..-52478..-6
20830 35 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  588....skipif po
20840 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
20850 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
20860 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
20870 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
20880 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20890 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
208a0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b   col1 * - col0 +
208b0 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 33 36 20 63   - col1 + + 36 c
208c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
208d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   cor0..----..-21
208e0 31 34 0d 0a 2d 33 34 35 36 0d 0a 2d 38 31 35 34  14..-3456..-8154
208f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20900 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
20910 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f  INCT - + cor0.co
20920 6c 30 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46  l0 - cor0.col2 F
20930 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
20940 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a 2d 33  ..----..-171..-3
20950 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20  6..-57....query 
20960 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
20970 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
20980 6f 6c 31 20 2a 20 39 31 20 2b 20 63 6f 6c 30 20  ol1 * 91 + col0 
20990 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
209a0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
209b0 0a 2d 31 31 30 33 0d 0a 2d 32 33 36 33 0d 0a 2d  .-1103..-2363..-
209c0 38 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  846....query I r
209d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
209e0 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   + col1 + + col2
209f0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
20a00 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
20a10 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a  ..-53..-9..-96..
20a20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20a30 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 35 20 2a  t..SELECT - 75 *
20a40 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
20a50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
20a60 2d 2d 0d 0a 2d 31 38 30 30 0d 0a 2d 32 36 32 35  --..-1800..-2625
20a70 0d 0a 2d 36 36 37 35 0d 0a 0d 0a 71 75 65 72 79  ..-6675....query
20a80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20a90 43 54 20 2d 20 2d 20 31 39 20 41 53 20 63 6f 6c  CT - - 19 AS col
20aa0 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
20ab0 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a 31 39 0d 0a  ..----..19..19..
20ac0 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  19....query I ro
20ad0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
20ae0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20  STINCT + col0 * 
20af0 2b 20 31 35 20 2b 20 63 6f 6c 32 20 41 53 20 63  + 15 + col2 AS c
20b00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
20b10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31   cor0..----..101
20b20 37 0d 0a 31 32 39 36 0d 0a 39 39 0d 0a 0d 0a 71  7..1296..99....q
20b30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20b40 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
20b50 38 34 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f  84 + ( + cor0.co
20b60 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l1 ) FROM tab0 A
20b70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
20b80 30 0d 0a 31 37 35 0d 0a 31 38 31 0d 0a 0d 0a 71  0..175..181....q
20b90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20ba0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
20bb0 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  1 + + col2 FROM 
20bc0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
20bd0 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38  --..119..173..98
20be0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20bf0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
20c00 2b 20 2d 20 28 20 28 20 2d 20 63 6f 72 30 2e 63  + - ( ( - cor0.c
20c10 6f 6c 32 20 29 20 29 20 2a 20 2b 20 35 35 20 2b  ol2 ) ) * + 55 +
20c20 20 2d 20 35 34 20 46 52 4f 4d 20 74 61 62 30 20   - 54 FROM tab0 
20c30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
20c40 0d 0a 31 37 36 31 0d 0a 34 34 35 36 0d 0a 0d 0a  ..1761..4456....
20c50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20c60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
20c70 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  l0 * col0 + col2
20c80 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
20c90 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20ca0 0a 2d 34 34 38 0d 0a 31 32 38 30 0d 0a 31 35 33  .-448..1280..153
20cb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20cc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
20cd0 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30   + - col2 * cor0
20ce0 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
20cf0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
20d00 31 30 35 36 0d 0a 2d 36 36 34 32 0d 0a 30 0d 0a  1056..-6642..0..
20d10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20d20 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
20d30 43 54 20 33 34 20 2b 20 63 6f 6c 31 20 41 53 20  CT 34 + col1 AS 
20d40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
20d50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34  S cor0..----..44
20d60 0d 0a 34 37 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72  ..47..60....quer
20d70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20d80 45 43 54 20 41 4c 4c 20 37 33 20 2b 20 2d 20 63  ECT ALL 73 + - c
20d90 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 * col0 AS co
20da0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
20db0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 36  cor0..----..-116
20dc0 0d 0a 2d 31 39 35 35 0d 0a 2d 32 39 32 39 0d 0a  ..-1955..-2929..
20dd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20de0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
20df0 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b  CT col2 * col1 +
20e00 20 35 38 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   58 FROM tab0..-
20e10 2d 2d 2d 0d 0a 31 35 35 0d 0a 32 38 39 36 0d 0a  ---..155..2896..
20e20 37 35 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7520....query I 
20e30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20e40 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20  DISTINCT col0 + 
20e50 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
20e60 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
20e70 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75  29..74..93....qu
20e80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20e90 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c  ELECT col0 * col
20ea0 31 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20 46 52  1 * tab2.col1 FR
20eb0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab2..----..2
20ec0 32 38 33 31 0d 0a 32 37 31 35 31 38 0d 0a 36 37  2831..271518..67
20ed0 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  27....query I ro
20ee0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
20ef0 63 6f 6c 30 20 2d 20 28 20 2b 20 63 6f 72 30 2e  col0 - ( + cor0.
20f00 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46  col1 ) AS col1 F
20f10 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
20f20 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a  ---..-137..-38..
20f30 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -96....query I r
20f40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
20f50 20 2b 20 35 35 20 2b 20 63 6f 72 30 2e 63 6f 6c   + 55 + cor0.col
20f60 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
20f70 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
20f80 30 31 36 0d 0a 33 34 34 0d 0a 33 35 33 36 0d 0a  016..344..3536..
20f90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20fa0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
20fb0 43 54 20 2d 20 36 32 20 46 52 4f 4d 20 74 61 62  CT - 62 FROM tab
20fc0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  0, tab0 AS cor0.
20fd0 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a 0d 0a 71 75  .----..-62....qu
20fe0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20ff0 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 38  ELECT col0 * + 8
21000 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
21010 0d 0a 32 34 0d 0a 35 31 32 0d 0a 36 34 30 0d 0a  ..24..512..640..
21020 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21030 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61  t..SELECT ALL ta
21040 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b0.col1 FROM tab
21050 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  2, tab0 AS cor0 
21060 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 0d  CROSS JOIN tab0.
21070 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
21080 20 68 61 73 68 69 6e 67 20 74 6f 20 32 64 36 64   hashing to 2d6d
21090 33 30 33 31 64 66 65 39 30 65 30 63 30 32 64 62  3031dfe90e0c02db
210a0 31 33 61 61 36 33 39 39 33 62 66 64 0d 0a 0d 0a  13aa63993bfd....
210b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
210c0 0a 53 45 4c 45 43 54 20 38 37 20 46 52 4f 4d 20  .SELECT 87 FROM 
210d0 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f  tab1, tab2 AS co
210e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
210f0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 61  es hashing to fa
21100 30 63 64 64 38 36 34 38 33 38 34 34 63 64 61 33  0cdd86483844cda3
21110 62 62 38 30 36 65 30 33 32 64 35 63 36 34 0d 0a  bb806e032d5c64..
21120 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
21130 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
21140 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
21150 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
21160 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35  rowsort label-95
21170 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  0..SELECT ALL - 
21180 2d 20 34 32 20 2b 20 2d 20 37 30 20 44 49 56 20  - 42 + - 70 DIV 
21190 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 33 38  + cor0.col1 + 38
211a0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
211b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 0d 0a 37 35  r0..----..73..75
211c0 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..78....skipif m
211d0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
211e0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
211f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35 30  owsort label-950
21200 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
21210 20 34 32 20 2b 20 2d 20 37 30 20 2f 20 2b 20 63   42 + - 70 / + c
21220 6f 72 30 2e 63 6f 6c 31 20 2b 20 33 38 20 46 52  or0.col1 + 38 FR
21230 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
21240 0a 2d 2d 2d 2d 0d 0a 37 33 0d 0a 37 35 0d 0a 37  .----..73..75..7
21250 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
21260 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31  sort..SELECT + 1
21270 34 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  4 FROM tab2, tab
21280 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
21290 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
212a0 67 20 74 6f 20 38 33 65 35 37 37 39 64 32 34 38  g to 83e5779d248
212b0 37 64 31 32 34 39 35 65 37 64 38 31 36 63 37 39  7d12495e7d816c79
212c0 37 32 36 34 66 0d 0a 0d 0a 71 75 65 72 79 20 49  7264f....query I
212d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
212e0 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62 31   DISTINCT + tab1
212f0 2e 63 6f 6c 31 20 2a 20 37 35 20 2a 20 74 61 62  .col1 * 75 * tab
21300 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  1.col0 FROM tab1
21310 0d 0a 2d 2d 2d 2d 0d 0a 34 38 30 30 30 0d 0a 35  ..----..48000..5
21320 38 35 30 0d 0a 37 38 30 30 30 0d 0a 0d 0a 71 75  850..78000....qu
21330 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21340 45 4c 45 43 54 20 37 33 20 2a 20 38 34 20 2b 20  ELECT 73 * 84 + 
21350 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
21360 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 31  M tab2..----..61
21370 35 38 0d 0a 36 31 35 39 0d 0a 36 31 37 30 0d 0a  58..6159..6170..
21380 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21390 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 32 20 46  t..SELECT - 32 F
213a0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63  ROM tab2, tab1 c
213b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
213c0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65  ues hashing to e
213d0 66 38 66 39 33 31 31 39 39 38 33 62 39 36 32 66  f8f93119983b962f
213e0 34 63 38 31 33 38 31 65 62 66 34 62 31 65 36 0d  4c81381ebf4b1e6.
213f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21400 72 74 0d 0a 53 45 4c 45 43 54 20 32 38 20 46 52  rt..SELECT 28 FR
21410 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53  OM tab0, tab2 AS
21420 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
21430 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
21440 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
21450 38 61 33 39 35 38 30 35 38 37 66 32 38 33 31 30  8a39580587f28310
21460 37 32 65 39 33 63 33 31 39 66 66 39 34 62 62 66  72e93c319ff94bbf
21470 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21480 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
21490 2b 20 63 6f 6c 30 20 29 20 2b 20 2b 20 74 61 62  + col0 ) + + tab
214a0 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
214b0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32  ..----..110..132
214c0 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..180....query I
214d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
214e0 20 2d 20 2b 20 35 32 20 2b 20 36 20 41 53 20 63   - + 52 + 6 AS c
214f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
21500 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
21510 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
21520 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
21530 6e 67 20 74 6f 20 34 39 31 61 64 31 66 62 37 39  ng to 491ad1fb79
21540 66 65 63 30 62 35 37 31 35 65 61 35 34 39 34 39  fec0b5715ea54949
21550 64 31 61 61 32 64 0d 0a 0d 0a 71 75 65 72 79 20  d1aa2d....query 
21560 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21570 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  T - col0 * + col
21580 31 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  1 + col2 * - col
21590 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
215a0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 30  ab1..----..-1210
215b0 0d 0a 2d 31 34 38 32 0d 0a 2d 32 32 38 38 0d 0a  ..-1482..-2288..
215c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
215d0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
215e0 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 28 20  CT - col2 + - ( 
215f0 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 41 53  col1 ) * col2 AS
21600 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
21610 0a 2d 2d 2d 2d 0d 0a 2d 32 38 37 31 0d 0a 2d 37  .----..-2871..-7
21620 35 34 34 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72  544..-98....quer
21630 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21640 45 43 54 20 63 6f 6c 32 20 2a 20 74 61 62 30 2e  ECT col2 * tab0.
21650 63 6f 6c 32 20 2b 20 38 33 20 41 53 20 63 6f 6c  col2 + 83 AS col
21660 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
21670 2d 0d 0a 31 31 37 32 0d 0a 36 38 30 37 0d 0a 38  -..1172..6807..8
21680 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
21690 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 32 20  sort..SELECT 62 
216a0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
216b0 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  1, tab0 AS cor0,
216c0 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
216d0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
216e0 61 73 68 69 6e 67 20 74 6f 20 34 39 31 31 62 31  ashing to 4911b1
216f0 34 31 37 61 33 37 39 37 64 32 33 64 64 38 66 33  417a3797d23dd8f3
21700 38 62 36 65 64 30 35 63 31 62 0d 0a 0d 0a 71 75  8b6ed05c1b....qu
21710 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21720 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 74  ELECT - col1 * t
21730 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab2.col0 FROM ta
21740 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d  b2..----..-1343.
21750 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a  .-217..-4602....
21760 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
21770 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
21780 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
21790 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
217a0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
217b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
217c0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 63   - col1 + col0 c
217d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
217e0 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32  ---..-24..19..62
217f0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
21800 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
21810 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
21820 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
21830 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
21840 39 36 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  964..SELECT col2
21850 20 44 49 56 20 35 31 20 46 52 4f 4d 20 74 61 62   DIV 51 FROM tab
21860 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31  0..----..0..0..1
21870 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
21880 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
21890 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
218a0 72 74 20 6c 61 62 65 6c 2d 39 36 34 0d 0a 53 45  rt label-964..SE
218b0 4c 45 43 54 20 63 6f 6c 32 20 2f 20 35 31 20 46  LECT col2 / 51 F
218c0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
218d0 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79  0..0..1....query
218e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
218f0 43 54 20 41 4c 4c 20 2b 20 35 38 20 41 53 20 63  CT ALL + 58 AS c
21900 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
21910 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
21920 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
21930 69 6e 67 20 74 6f 20 65 66 36 65 36 33 61 65 65  ing to ef6e63aee
21940 64 32 35 38 31 61 31 36 38 66 30 37 36 34 36 64  d2581a168f07646d
21950 32 35 38 66 36 36 36 0d 0a 0d 0a 73 6b 69 70 69  258f666....skipi
21960 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
21970 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
21980 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
21990 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
219a0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
219b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
219c0 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  INCT + col0 + + 
219d0 28 20 28 20 2b 20 63 6f 6c 31 20 29 20 29 20 63  ( ( + col1 ) ) c
219e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
219f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33  r0..----..137..3
21a00 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  8..96....query I
21a10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21a20 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
21a30 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  l0 * - col0 + co
21a40 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  l2 * col2 * + co
21a50 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
21a60 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
21a70 2d 2d 0d 0a 2d 31 31 32 38 0d 0a 36 30 33 39 36  --..-1128..60396
21a80 33 0d 0a 39 33 30 37 38 0d 0a 0d 0a 71 75 65 72  3..93078....quer
21a90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21aa0 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 28  ECT + col1 * + (
21ab0 20 2d 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   - col2 ) AS col
21ac0 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
21ad0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d  ..----..-1534..-
21ae0 36 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65  646..-837....que
21af0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21b00 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 72  LECT ALL + + cor
21b10 30 2e 63 6f 6c 30 20 2a 20 2b 20 31 30 20 2d 20  0.col0 * + 10 - 
21b20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
21b30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21b40 2d 32 34 0d 0a 35 38 33 0d 0a 37 30 34 0d 0a 0d  -24..583..704...
21b50 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
21b60 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
21b70 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
21b80 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
21b90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 30  owsort label-970
21ba0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
21bb0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b  ol0 * + col0 * +
21bc0 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 44   col2 + - col2 D
21bd0 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  IV + col1 FROM t
21be0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
21bf0 2d 31 33 32 33 0d 0a 2d 31 35 38 31 38 34 0d 0a  -1323..-158184..
21c00 2d 32 33 37 31 36 30 0d 0a 0d 0a 73 6b 69 70 69  -237160....skipi
21c10 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
21c20 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
21c30 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
21c40 39 37 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  970..SELECT ALL 
21c50 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  - col0 * + col0 
21c60 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  * + col2 + - col
21c70 32 20 2f 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 / + col1 FROM 
21c80 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
21c90 0a 2d 31 33 32 33 0d 0a 2d 31 35 38 31 38 34 0d  .-1323..-158184.
21ca0 0a 2d 32 33 37 31 36 30 0d 0a 0d 0a 71 75 65 72  .-237160....quer
21cb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21cc0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
21cd0 6f 6c 30 20 2a 20 2b 20 28 20 63 6f 72 30 2e 63  ol0 * + ( cor0.c
21ce0 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20 41 53 20  ol0 ) + col0 AS 
21cf0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
21d00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 30  or0..----..-1190
21d10 0d 0a 2d 35 35 32 0d 0a 2d 37 38 33 32 0d 0a 0d  ..-552..-7832...
21d20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21d30 0d 0a 53 45 4c 45 43 54 20 31 34 20 46 52 4f 4d  ..SELECT 14 FROM
21d40 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
21d50 2d 2d 2d 0d 0a 31 34 0d 0a 31 34 0d 0a 31 34 0d  ---..14..14..14.
21d60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21d70 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 34 20  rt..SELECT + 34 
21d80 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
21d90 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34  0 cor0..----..34
21da0 0d 0a 33 34 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72  ..34..34....quer
21db0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21dc0 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT - cor0.col0 
21dd0 2a 20 2d 20 33 37 20 41 53 20 63 6f 6c 30 20 46  * - 37 AS col0 F
21de0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20  ROM tab1, tab0, 
21df0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
21e00 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
21e10 73 68 69 6e 67 20 74 6f 20 65 62 66 30 39 31 62  shing to ebf091b
21e20 33 38 38 63 30 38 34 62 39 61 32 36 35 66 65 38  388c084b9a265fe8
21e30 31 35 63 30 61 66 65 66 37 0d 0a 0d 0a 71 75 65  15c0afef7....que
21e40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21e50 4c 45 43 54 20 2d 20 39 39 20 2a 20 2b 20 74 61  LECT - 99 * + ta
21e60 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  b1.col1 AS col0 
21e70 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
21e80 0a 2d 31 32 38 37 0d 0a 2d 32 35 37 34 0d 0a 2d  .-1287..-2574..-
21e90 39 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  990....query I r
21ea0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
21eb0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a  ISTINCT + col1 *
21ec0 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46   + col1 * col0 F
21ed0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
21ee0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 32 30 0d 0a 32  ..----..13520..2
21ef0 30 32 38 0d 0a 36 34 30 30 0d 0a 0d 0a 71 75 65  028..6400....que
21f00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21f10 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
21f20 2b 20 34 33 20 2a 20 63 6f 6c 32 20 41 53 20 63  + 43 * col2 AS c
21f30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
21f40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
21f50 31 39 0d 0a 2d 33 35 32 36 0d 0a 2d 34 33 0d 0a  19..-3526..-43..
21f60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21f70 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
21f80 43 54 20 2d 20 32 37 20 46 52 4f 4d 20 74 61 62  CT - 27 FROM tab
21f90 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  0, tab2 AS cor0.
21fa0 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 0d 0a 6f 6e  .----..-27....on
21fb0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
21fc0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
21fd0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
21fe0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
21ff0 6f 72 74 20 6c 61 62 65 6c 2d 39 37 39 0d 0a 53  ort label-979..S
22000 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
22010 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 28   cor0.col0 + + (
22020 20 2d 20 63 6f 6c 31 20 29 20 44 49 56 20 2d 20   - col1 ) DIV - 
22030 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
22040 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
22050 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 37 37 0d 0a 2d  ----..-6..-77..-
22060 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  78....skipif mys
22070 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
22080 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
22090 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 39 0d 0a  sort label-979..
220a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
220b0 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20  - cor0.col0 + + 
220c0 28 20 2d 20 63 6f 6c 31 20 29 20 2f 20 2d 20 63  ( - col1 ) / - c
220d0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
220e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
220f0 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 37 37 0d 0a 2d 37  ---..-6..-77..-7
22100 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
22110 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
22120 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
22130 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
22140 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
22150 2d 39 38 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -980..SELECT ALL
22160 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 43 41   + - col0 + + CA
22170 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ST( col2 AS SIGN
22180 45 44 20 29 20 44 49 56 20 63 6f 6c 31 20 41 53  ED ) DIV col1 AS
22190 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
221a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
221b0 37 0d 0a 2d 37 37 0d 0a 2d 37 38 0d 0a 0d 0a 73  7..-77..-78....s
221c0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
221d0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
221e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
221f0 62 65 6c 2d 39 38 30 0d 0a 53 45 4c 45 43 54 20  bel-980..SELECT 
22200 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b  ALL + - col0 + +
22210 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20   CAST ( col2 AS 
22220 49 4e 54 45 47 45 52 20 29 20 2f 20 63 6f 6c 31  INTEGER ) / col1
22230 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
22240 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
22250 0d 0a 2d 37 0d 0a 2d 37 37 0d 0a 2d 37 38 0d 0a  ..-7..-77..-78..
22260 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22270 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
22280 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
22290 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
222a0 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32 0d 0a 31 39  --..172..182..19
222b0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
222c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36  sort..SELECT + 6
222d0 39 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  9 * - col0 AS co
222e0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
222f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 33  cor0..----..-483
22300 0d 0a 2d 35 33 38 32 0d 0a 2d 35 34 35 31 0d 0a  ..-5382..-5451..
22310 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22320 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 20 41 53  t..SELECT + 8 AS
22330 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
22340 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 0d 0a 38  cor0..----..8..8
22350 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..8....query I r
22360 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
22370 20 2b 20 33 33 20 2a 20 37 39 20 41 53 20 63 6f   + 33 * 79 AS co
22380 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
22390 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 30 37  cor0..----..2607
223a0 0d 0a 32 36 30 37 0d 0a 32 36 30 37 0d 0a 0d 0a  ..2607..2607....
223b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
223c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
223d0 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46   - - cor0.col2 F
223e0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41  ROM tab1, tab2 A
223f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
22400 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70  ..27..38....skip
22410 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
22420 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
22430 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
22440 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
22450 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
22460 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
22470 54 49 4e 43 54 20 2d 20 38 32 20 2a 20 2b 20 63  TINCT - 82 * + c
22480 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 31 20 46 52  or0.col0 col1 FR
22490 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
224a0 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
224b0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 36 38  or1..----..-1968
224c0 0d 0a 2d 32 38 37 30 0d 0a 2d 37 32 39 38 0d 0a  ..-2870..-7298..
224d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
224e0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 32  t..SELECT + tab2
224f0 2e 63 6f 6c 31 20 2a 20 28 20 2d 20 63 6f 6c 32  .col1 * ( - col2
22500 20 29 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63   ) * - col2 AS c
22510 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
22520 2d 2d 2d 0d 0a 32 32 35 39 39 0d 0a 32 34 35 34  ---..22599..2454
22530 38 0d 0a 33 39 38 38 34 0d 0a 0d 0a 71 75 65 72  8..39884....quer
22540 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22550 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62  ECT DISTINCT tab
22560 32 2e 63 6f 6c 31 20 2a 20 2b 20 28 20 2d 20 63  2.col1 * + ( - c
22570 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 29 20 46  ol2 * - col1 ) F
22580 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
22590 31 30 39 38 32 0d 0a 32 35 39 34 37 0d 0a 39 30  10982..25947..90
225a0 35 30 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  506....skipif po
225b0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
225c0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
225d0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
225e0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
225f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22600 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
22610 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  2 col2 FROM tab1
22620 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
22630 4f 49 4e 20 74 61 62 30 2c 20 74 61 62 31 20 63  OIN tab0, tab1 c
22640 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
22650 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
22660 37 66 34 61 39 62 66 32 34 64 36 34 38 33 33 37  7f4a9bf24d648337
22670 30 36 64 66 62 64 64 30 62 61 66 34 39 64 37 39  06dfbdd0baf49d79
22680 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22690 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
226a0 49 4e 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c 31  INCT - cor1.col1
226b0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
226c0 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
226d0 6f 72 31 2c 20 74 61 62 31 2c 20 74 61 62 32 20  or1, tab1, tab2 
226e0 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor2..----..-
226f0 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a  10..-13..-26....
22700 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22710 0a 53 45 4c 45 43 54 20 2d 20 2d 20 74 61 62 30  .SELECT - - tab0
22720 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63  .col2 + - cor0.c
22730 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
22740 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62   tab0, tab1, tab
22750 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
22760 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
22770 6e 67 20 74 6f 20 62 61 62 36 30 33 63 31 32 38  ng to bab603c128
22780 34 36 39 63 65 30 66 32 66 35 30 35 35 66 35 39  469ce0f2f5055f59
22790 39 65 37 62 30 36 0d 0a 0d 0a 71 75 65 72 79 20  9e7b06....query 
227a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
227b0 54 20 2d 20 37 31 20 41 53 20 63 6f 6c 31 20 46  T - 71 AS col1 F
227c0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
227d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31 0d 0a 2d 37 31  ..----..-71..-71
227e0 0d 0a 2d 37 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-71....onlyif 
227f0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
22800 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
22810 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
22820 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
22830 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
22840 6c 2d 39 39 33 0d 0a 53 45 4c 45 43 54 20 43 41  l-993..SELECT CA
22850 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
22860 45 44 20 29 20 2a 20 2b 20 63 6f 6c 32 20 41 53  ED ) * + col2 AS
22870 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
22880 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
22890 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
228a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
228b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
228c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
228d0 74 20 6c 61 62 65 6c 2d 39 39 33 0d 0a 53 45 4c  t label-993..SEL
228e0 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  ECT CAST ( NULL 
228f0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b  AS INTEGER ) * +
22900 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
22910 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
22920 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
22930 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  L..NULL....onlyi
22940 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
22950 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
22960 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
22970 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
22980 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22990 62 65 6c 2d 39 39 34 0d 0a 53 45 4c 45 43 54 20  bel-994..SELECT 
229a0 2d 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  - - CAST( NULL A
229b0 53 20 44 45 43 49 4d 41 4c 20 29 20 2a 20 2b 20  S DECIMAL ) * + 
229c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
229d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
229e0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
229f0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
22a00 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
22a10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22a20 20 6c 61 62 65 6c 2d 39 39 34 0d 0a 53 45 4c 45   label-994..SELE
22a30 43 54 20 2d 20 2d 20 43 41 53 54 20 28 20 4e 55  CT - - CAST ( NU
22a40 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2a 20 2b  LL AS REAL ) * +
22a50 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
22a60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
22a70 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
22a80 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
22a90 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
22aa0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
22ab0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
22ac0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
22ad0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22ae0 45 43 54 20 28 20 2d 20 63 6f 6c 31 20 29 20 2b  ECT ( - col1 ) +
22af0 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20   col2 col2 FROM 
22b00 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d  tab2..----..-33.
22b10 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79  .-4..21....query
22b20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22b30 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  CT - cor0.col1 *
22b40 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
22b50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
22b60 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31  --..-7396..-8281
22b70 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79  ..-9409....query
22b80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22b90 43 54 20 2b 20 28 20 63 6f 6c 30 20 29 20 2b 20  CT + ( col0 ) + 
22ba0 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  - col2 FROM tab2
22bb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22bc0 2d 32 30 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 71  -20..41..52....q
22bd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22be0 53 45 4c 45 43 54 20 2d 20 37 20 2a 20 63 6f 72  SELECT - 7 * cor
22bf0 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0.col2 FROM tab1
22c00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22c10 2d 33 37 38 0d 0a 2d 33 39 39 0d 0a 2d 36 37 32  -378..-399..-672
22c20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22c30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
22c40 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  l0 + col0 * + co
22c50 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
22c60 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
22c70 2d 2d 0d 0a 31 31 39 30 0d 0a 35 35 32 0d 0a 37  --..1190..552..7
22c80 38 33 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  832....skipif po
22c90 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
22ca0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
22cb0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
22cc0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
22cd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22ce0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a  .SELECT + col0 *
22cf0 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 32 20   cor0.col1 col2 
22d00 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
22d10 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33  0..----..2064..3
22d20 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65  395..8099....que
22d30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22d40 4c 45 43 54 20 41 4c 4c 20 2d 20 39 31 20 2b 20  LECT ALL - 91 + 
22d50 2b 20 63 6f 6c 30 20 2b 20 39 34 20 46 52 4f 4d  + col0 + 94 FROM
22d60 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
22d70 2d 2d 2d 0d 0a 32 37 0d 0a 33 38 0d 0a 39 32 0d  ---..27..38..92.
22d80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22d90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
22da0 20 34 36 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f   46 - col2 AS co
22db0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
22dc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d  cor0..----..-36.
22dd0 0a 31 33 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72 79  .13..45....query
22de0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22df0 43 54 20 2b 20 34 34 20 2a 20 63 6f 6c 32 20 46  CT + 44 * col2 F
22e00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
22e10 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 34 0d 0a 31 31  ..----..1144..11
22e20 38 38 0d 0a 31 36 37 32 0d 0a 0d 0a 73 6b 69 70  88..1672....skip
22e30 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
22e40 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
22e50 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
22e60 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
22e70 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
22e80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
22e90 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d  TINCT + col2 * -
22ea0 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20   col2 col2 FROM 
22eb0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
22ec0 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d  --..-1..-1089..-
22ed0 36 37 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  6724....onlyif m
22ee0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
22ef0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
22f00 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
22f10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22f20 62 65 6c 2d 31 30 30 35 0d 0a 53 45 4c 45 43 54  bel-1005..SELECT
22f30 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2a 20   ALL - + col1 * 
22f40 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 28 20 2d 20  cor0.col0 + ( - 
22f50 63 6f 6c 30 20 29 20 44 49 56 20 2d 20 63 6f 6c  col0 ) DIV - col
22f60 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
22f70 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
22f80 2d 0d 0a 2d 32 30 36 33 0d 0a 2d 33 33 39 34 0d  -..-2063..-3394.
22f90 0a 2d 38 30 39 38 0d 0a 0d 0a 73 6b 69 70 69 66  .-8098....skipif
22fa0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
22fb0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
22fc0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
22fd0 30 30 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  005..SELECT ALL 
22fe0 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  - + col1 * cor0.
22ff0 63 6f 6c 30 20 2b 20 28 20 2d 20 63 6f 6c 30 20  col0 + ( - col0 
23000 29 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  ) / - col0 AS co
23010 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
23020 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36  cor0..----..-206
23030 33 0d 0a 2d 33 33 39 34 0d 0a 2d 38 30 39 38 0d  3..-3394..-8098.
23040 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23050 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
23060 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or1.col1 FROM ta
23070 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
23080 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
23090 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
230a0 68 61 73 68 69 6e 67 20 74 6f 20 37 35 39 39 62  hashing to 7599b
230b0 34 38 30 31 32 35 64 65 35 32 31 65 66 65 64 37  480125de521efed7
230c0 31 62 35 62 32 34 31 33 63 37 64 0d 0a 0d 0a 73  1b5b2413c7d....s
230d0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
230e0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
230f0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
23100 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
23110 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
23120 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23130 41 4c 4c 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 34  ALL - col1 - - 4
23140 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0 col1 FROM tab1
23150 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 32 37 0d 0a  ..----..14..27..
23160 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
23170 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
23180 4c 20 63 6f 6c 31 20 2a 20 2d 20 35 38 20 2d 20  L col1 * - 58 - 
23190 63 6f 6c 30 20 2a 20 2b 20 74 61 62 32 2e 63 6f  col0 * + tab2.co
231a0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
231b0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 38  tab2..----..-198
231c0 37 0d 0a 2d 33 39 38 38 0d 0a 2d 35 34 35 30 0d  7..-3988..-5450.
231d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
231e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
231f0 20 63 6f 6c 31 20 2b 20 33 33 20 2a 20 2d 20 28   col1 + 33 * - (
23200 20 2b 20 63 6f 6c 32 20 29 20 2d 20 63 6f 6c 31   + col2 ) - col1
23210 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
23220 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 35 39 0d  0..----..-10259.
23230 0a 2d 32 32 37 0d 0a 2d 34 30 31 33 0d 0a 0d 0a  .-227..-4013....
23240 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23250 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
23260 6c 32 20 2d 20 2b 20 31 38 20 41 53 20 63 6f 6c  l2 - + 18 AS col
23270 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
23280 2d 0d 0a 32 30 0d 0a 38 0d 0a 39 0d 0a 0d 0a 71  -..20..8..9....q
23290 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
232a0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
232b0 30 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c  0 + + col2 - col
232c0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
232d0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a  ab0..----..-24..
232e0 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72  -35..-89....quer
232f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23300 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2d  ECT - - col2 + -
23310 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
23320 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
23330 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
23340 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23350 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
23360 32 20 2a 20 2b 20 28 20 63 6f 6c 31 20 2b 20 63  2 * + ( col1 + c
23370 6f 6c 32 20 29 20 2a 20 2b 20 28 20 63 6f 6c 32  ol2 ) * + ( col2
23380 20 2a 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   * col2 ) AS col
23390 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
233a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 30  or0..----..-1240
233b0 37 39 33 31 0d 0a 2d 31 32 35 39 37 31 32 30 0d  7931..-12597120.
233c0 0a 2d 39 36 34 33 36 32 32 34 0d 0a 0d 0a 6f 6e  .-96436224....on
233d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
233e0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
233f0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
23400 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
23410 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31 34 0d 0a  ort label-1014..
23420 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20  SELECT - - col2 
23430 2b 20 2d 20 63 6f 6c 31 20 44 49 56 20 2b 20 63  + - col1 DIV + c
23440 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or0.col0 AS col1
23450 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
23460 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 32 36  r0..----..23..26
23470 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..38....skipif m
23480 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
23490 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
234a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31  owsort label-101
234b0 34 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  4..SELECT - - co
234c0 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 2b 20  l2 + - col1 / + 
234d0 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
234e0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
234f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 32  or0..----..23..2
23500 36 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49  6..38....query I
23510 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23520 20 63 6f 6c 31 20 2b 20 2d 20 31 37 20 41 53 20   col1 + - 17 AS 
23530 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
23540 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d  or0..----..-4..-
23550 37 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7..9....query I 
23560 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23570 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  + col2 + + col0 
23580 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  * + col2 AS col1
23590 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
235a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34 0d 0a  r0..----..2054..
235b0 32 31 36 0d 0a 33 30 34 30 0d 0a 0d 0a 73 6b 69  216..3040....ski
235c0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
235d0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
235e0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
235f0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
23600 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
23610 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
23620 63 6f 6c 31 20 2a 20 31 30 20 63 6f 6c 32 20 46  col1 * 10 col2 F
23630 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
23640 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 33 30  ..----..100..130
23650 0d 0a 32 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..260....onlyif 
23660 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
23670 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
23680 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
23690 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
236a0 61 62 65 6c 2d 31 30 31 38 0d 0a 53 45 4c 45 43  abel-1018..SELEC
236b0 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  T + col1 + col0 
236c0 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  DIV col1 AS col2
236d0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
236e0 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 33 31 0d 0a 36  .----..21..31..6
236f0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
23700 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
23710 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
23720 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31 38 0d 0a  ort label-1018..
23730 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20  SELECT + col1 + 
23740 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 41 53 20 63  col0 / col1 AS c
23750 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
23760 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 33 31  r0..----..21..31
23770 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..60....query I 
23780 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23790 41 4c 4c 20 2d 20 28 20 2d 20 34 37 20 29 20 2a  ALL - ( - 47 ) *
237a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
237b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 32  cor0..----..1222
237c0 0d 0a 34 37 30 0d 0a 36 31 31 0d 0a 0d 0a 73 6b  ..470..611....sk
237d0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
237e0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
237f0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
23800 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
23810 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
23820 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
23830 49 53 54 49 4e 43 54 20 37 31 20 63 6f 6c 30 20  ISTINCT 71 col0 
23840 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
23850 30 0d 0a 2d 2d 2d 2d 0d 0a 37 31 0d 0a 0d 0a 71  0..----..71....q
23860 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23870 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
23880 2b 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e  + - col0 - cor0.
23890 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
238a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
238b0 2d 2d 2d 2d 0d 0a 2d 32 35 33 0d 0a 2d 33 37 0d  ----..-253..-37.
238c0 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-90....query I 
238d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
238e0 39 38 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  98 * - cor0.col1
238f0 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 28 20 63 6f   + + col1 * ( co
23900 6c 30 20 2a 20 63 6f 6c 30 20 29 20 46 52 4f 4d  l0 * col0 ) FROM
23910 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
23920 2d 2d 2d 0d 0a 2d 31 35 31 39 0d 0a 31 30 34 34  ---..-1519..1044
23930 33 31 0d 0a 33 35 33 31 37 34 0d 0a 0d 0a 71 75  31..353174....qu
23940 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23950 45 4c 45 43 54 20 2b 20 31 34 20 2b 20 37 34 20  ELECT + 14 + 74 
23960 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
23970 30 0d 0a 2d 2d 2d 2d 0d 0a 38 38 0d 0a 38 38 0d  0..----..88..88.
23980 0a 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .88....onlyif my
23990 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
239a0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
239b0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
239c0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
239d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
239e0 31 30 32 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  1024..SELECT DIS
239f0 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 39 36  TINCT - CAST( 96
23a00 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
23a10 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
23a20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
23a30 0a 2d 2d 2d 2d 0d 0a 32 33 30 34 0d 0a 33 33 36  .----..2304..336
23a40 30 0d 0a 38 35 34 34 0d 0a 0d 0a 73 6b 69 70 69  0..8544....skipi
23a50 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
23a60 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
23a70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
23a80 31 30 32 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  1024..SELECT DIS
23a90 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 39  TINCT - CAST ( 9
23aa0 36 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  6 AS INTEGER ) *
23ab0 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
23ac0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
23ad0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 30 34 0d 0a 33  0..----..2304..3
23ae0 33 36 30 0d 0a 38 35 34 34 0d 0a 0d 0a 71 75 65  360..8544....que
23af0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23b00 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20  LECT - + col2 * 
23b10 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
23b20 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
23b30 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a  ---..189..2028..
23b40 33 30 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3002....onlyif m
23b50 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
23b60 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
23b70 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
23b80 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
23b90 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
23ba0 2d 31 30 32 36 0d 0a 53 45 4c 45 43 54 20 2d 20  -1026..SELECT - 
23bb0 63 6f 6c 32 20 2a 20 43 41 53 54 28 20 2d 20 63  col2 * CAST( - c
23bc0 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 53 49  ol0 * col2 AS SI
23bd0 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46  GNED ) AS col0 F
23be0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
23bf0 32 36 31 33 36 0d 0a 33 35 0d 0a 35 39 38 34 33  26136..35..59843
23c00 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
23c10 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
23c20 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
23c30 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 36 0d 0a  ort label-1026..
23c40 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20  SELECT - col2 * 
23c50 43 41 53 54 20 28 20 2d 20 63 6f 6c 30 20 2a 20  CAST ( - col0 * 
23c60 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
23c70 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
23c80 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 31 33 36  ab0..----..26136
23c90 0d 0a 33 35 0d 0a 35 39 38 34 33 36 0d 0a 0d 0a  ..35..598436....
23ca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23cb0 0a 53 45 4c 45 43 54 20 35 37 20 46 52 4f 4d 20  .SELECT 57 FROM 
23cc0 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
23cd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
23ce0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36 31  es hashing to 61
23cf0 64 61 37 30 63 36 32 34 61 64 36 30 36 30 34 61  da70c624ad60604a
23d00 36 36 38 66 37 66 38 66 32 39 33 39 32 61 0d 0a  668f7f8f29392a..
23d10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23d20 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
23d30 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  - col2 * cor0.co
23d40 6c 32 20 2a 20 39 35 20 46 52 4f 4d 20 74 61 62  l2 * 95 FROM tab
23d50 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
23d60 0a 2d 31 33 37 31 38 30 0d 0a 2d 36 34 32 32 30  .-137180..-64220
23d70 0d 0a 2d 36 39 32 35 35 0d 0a 0d 0a 71 75 65 72  ..-69255....quer
23d80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23d90 45 43 54 20 34 37 20 41 53 20 63 6f 6c 31 20 46  ECT 47 AS col1 F
23da0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 63  ROM tab1, tab2 c
23db0 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a  or0, tab2 cor1..
23dc0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
23dd0 68 61 73 68 69 6e 67 20 74 6f 20 33 66 39 39 31  hashing to 3f991
23de0 36 33 32 65 39 63 37 63 35 31 34 32 65 31 64 38  632e9c7c5142e1d8
23df0 30 38 35 37 63 64 31 30 61 32 64 0d 0a 0d 0a 71  0857cd10a2d....q
23e00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23e10 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
23e20 30 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 39 32 20  0 + col1 * - 92 
23e30 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
23e40 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 36 0d 0a  0..----..-1276..
23e50 2d 32 33 39 35 0d 0a 2d 39 38 34 0d 0a 0d 0a 71  -2395..-984....q
23e60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23e70 53 45 4c 45 43 54 20 41 4c 4c 20 36 31 20 41 53  SELECT ALL 61 AS
23e80 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c   col0 FROM tab0,
23e90 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
23ea0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
23eb0 73 68 69 6e 67 20 74 6f 20 30 37 31 34 39 39 30  shing to 0714990
23ec0 35 61 37 32 62 64 38 37 35 35 33 33 38 31 66 33  5a72bd87553381f3
23ed0 34 64 31 39 65 64 32 39 30 0d 0a 0d 0a 73 6b 69  4d19ed290....ski
23ee0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
23ef0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
23f00 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
23f10 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
23f20 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
23f30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
23f40 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20  STINCT - col2 + 
23f50 2b 20 32 37 20 63 6f 6c 31 20 46 52 4f 4d 20 74  + 27 col1 FROM t
23f60 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a  ab2..----..-11..
23f70 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..1....query I 
23f80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23f90 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20  DISTINCT col0 + 
23fa0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52  col2 * - col0 FR
23fb0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
23fc0 31 38 32 0d 0a 2d 31 39 35 30 0d 0a 2d 32 39 32  182..-1950..-292
23fd0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
23fe0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
23ff0 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 28 20 2d   tab0.col1 + ( -
24000 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
24010 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a  0..----..53..9..
24020 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
24030 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
24040 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20  STINCT col0 * - 
24050 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col2 + col0 FROM
24060 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32   tab0..----..-72
24070 30 39 0d 0a 2d 37 36 38 0d 0a 30 0d 0a 0d 0a 71  09..-768..0....q
24080 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24090 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
240a0 35 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  5 FROM tab1..---
240b0 2d 0d 0a 32 37 30 0d 0a 32 38 35 0d 0a 34 38 30  -..270..285..480
240c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
240d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
240e0 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 46 52   * ( - col2 ) FR
240f0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
24100 31 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39  1444..-676..-729
24110 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
24120 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
24130 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
24140 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
24150 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
24160 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24170 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
24180 72 30 2e 63 6f 6c 32 20 2a 20 32 34 20 63 6f 6c  r0.col2 * 24 col
24190 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
241a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 32 34 0d 0a  or0..----..624..
241b0 36 34 38 0d 0a 39 31 32 0d 0a 0d 0a 71 75 65 72  648..912....quer
241c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
241d0 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32  ECT ALL + - col2
241e0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
241f0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  1 cor0..----..0.
24200 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
24210 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24220 20 44 49 53 54 49 4e 43 54 20 37 32 20 46 52 4f   DISTINCT 72 FRO
24230 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  M tab0, tab0 AS 
24240 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d  cor0, tab2 cor1.
24250 0a 2d 2d 2d 2d 0d 0a 37 32 0d 0a 0d 0a 71 75 65  .----..72....que
24260 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24270 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
24280 63 6f 6c 32 20 2a 20 2d 20 28 20 2d 20 63 6f 6c  col2 * - ( - col
24290 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  0 ) AS col2 FROM
242a0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
242b0 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d  ---..-35..-7298.
242c0 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-792....query I
242d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
242e0 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   ALL - cor0.col2
242f0 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   * - col0 + - co
24300 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l0 * + cor0.col0
24310 20 2b 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d   + ( col0 ) FROM
24320 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
24330 2d 2d 2d 0d 0a 2d 31 31 35 35 0d 0a 2d 35 33 34  ---..-1155..-534
24340 0d 0a 32 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..240....query I
24350 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24360 20 41 4c 4c 20 2b 20 34 32 20 41 53 20 63 6f 6c   ALL + 42 AS col
24370 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
24380 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
24390 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
243a0 67 20 74 6f 20 36 34 63 32 39 64 62 39 66 31 63  g to 64c29db9f1c
243b0 64 37 65 64 34 64 64 65 62 31 37 33 35 65 33 65  d7ed4ddeb1735e3e
243c0 30 64 34 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49  0d442....query I
243d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
243e0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
243f0 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b   * col2 + col1 +
24400 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
24410 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
24420 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 32 0d 0a 2d 31  .----..-1222..-1
24430 33 35 32 0d 0a 2d 35 35 30 0d 0a 0d 0a 71 75 65  352..-550....que
24440 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24450 4c 45 43 54 20 63 6f 6c 31 20 2d 20 35 32 20 41  LECT col1 - 52 A
24460 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
24470 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 33 39  ..----..-26..-39
24480 0d 0a 2d 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-42....query I
24490 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
244a0 20 41 4c 4c 20 2b 20 33 31 20 41 53 20 63 6f 6c   ALL + 31 AS col
244b0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
244c0 2d 0d 0a 33 31 0d 0a 33 31 0d 0a 33 31 0d 0a 0d  -..31..31..31...
244d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
244e0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74  ..SELECT ALL - t
244f0 61 62 32 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  ab2.col2 * col1 
24500 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
24510 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38  .-1534..-646..-8
24520 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
24530 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
24540 6c 32 20 2a 20 2b 20 36 35 20 2d 20 63 6f 6c 32  l2 * + 65 - col2
24550 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
24560 0d 0a 32 31 31 32 0d 0a 35 32 34 38 0d 0a 36 34  ..2112..5248..64
24570 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24580 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
24590 6c 32 20 2a 20 2d 20 37 37 20 46 52 4f 4d 20 74  l2 * - 77 FROM t
245a0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
245b0 2d 32 35 34 31 0d 0a 2d 36 33 31 34 0d 0a 2d 37  -2541..-6314..-7
245c0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
245d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
245e0 54 49 4e 43 54 20 2d 20 38 33 20 41 53 20 63 6f  TINCT - 83 AS co
245f0 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
24600 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
24610 0d 0a 2d 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-83....skipif 
24620 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
24630 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
24640 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
24650 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
24660 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24670 74 0d 0a 53 45 4c 45 43 54 20 28 20 74 61 62 30  t..SELECT ( tab0
24680 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 29 20 2b  .col2 * col2 ) +
24690 20 35 36 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   56 col2 FROM ta
246a0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 35 0d 0a  b0..----..1145..
246b0 35 37 0d 0a 36 37 38 30 0d 0a 0d 0a 71 75 65 72  57..6780....quer
246c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
246d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
246e0 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 39   cor0.col2 ) + 9
246f0 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  0 * + col2 FROM 
24700 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
24710 2d 2d 0d 0a 32 39 33 37 0d 0a 37 32 39 38 0d 0a  --..2937..7298..
24720 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  89....skipif pos
24730 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
24740 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
24750 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
24760 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
24770 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24780 53 45 4c 45 43 54 20 2b 20 2b 20 28 20 63 6f 6c  SELECT + + ( col
24790 30 20 29 20 2b 20 2b 20 37 38 20 63 6f 6c 31 20  0 ) + + 78 col1 
247a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
247b0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a 31 35  0..----..156..15
247c0 37 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  7..85....query I
247d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
247e0 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
247f0 6c 32 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  l2 - col0 * col2
24800 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
24810 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
24820 0d 0a 2d 33 34 0d 0a 2d 37 32 31 36 0d 0a 2d 37  ..-34..-7216..-7
24830 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  59....skipif pos
24840 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
24850 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
24860 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
24870 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
24880 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24890 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
248a0 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  + col0 * + col0 
248b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
248c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35  S cor0..----..35
248d0 0d 0a 34 31 30 36 0d 0a 36 34 31 33 0d 0a 0d 0a  ..4106..6413....
248e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
248f0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63  .SELECT col1 * c
24900 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29  ol1 + ( + col0 )
24910 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
24920 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 32 30 0d 0a  r0..----..7420..
24930 38 33 37 30 0d 0a 39 34 34 34 0d 0a 0d 0a 71 75  8370..9444....qu
24940 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24950 45 4c 45 43 54 20 2b 20 38 39 20 2d 20 63 6f 6c  ELECT + 89 - col
24960 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
24970 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
24980 2d 0d 0a 31 30 0d 0a 31 31 0d 0a 38 32 0d 0a 0d  -..10..11..82...
24990 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
249a0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
249b0 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  * + col1 + col2 
249c0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
249d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
249e0 0a 2d 31 33 30 35 0d 0a 2d 31 39 30 0d 0a 2d 34  .-1305..-190..-4
249f0 35 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  576....query I r
24a00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
24a10 4c 4c 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2a  LL - tab0.col0 *
24a20 20 63 6f 6c 30 20 2a 20 31 34 20 2b 20 2d 20 63   col0 * 14 + - c
24a30 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
24a40 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   tab0..----..-11
24a50 30 39 37 36 0d 0a 2d 31 37 31 35 31 0d 0a 2d 38  0976..-17151..-8
24a60 30 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  097....query I r
24a70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
24a80 4c 4c 20 63 6f 6c 31 20 2b 20 2b 20 74 61 62 30  LL col1 + + tab0
24a90 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d  .col2 FROM tab0.
24aa0 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d  .----..119..173.
24ab0 0a 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .98....onlyif my
24ac0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
24ad0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
24ae0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
24af0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
24b00 65 6c 2d 31 30 36 31 0d 0a 53 45 4c 45 43 54 20  el-1061..SELECT 
24b10 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d  ALL - + col1 * -
24b20 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 28 20 63   cor0.col0 - ( c
24b30 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 29 20 2a  ol1 + - col2 ) *
24b40 20 31 30 20 44 49 56 20 2b 20 63 6f 6c 31 20 41   10 DIV + col1 A
24b50 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
24b60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24b70 31 31 30 33 0d 0a 36 38 37 0d 0a 38 38 0d 0a 0d  1103..687..88...
24b80 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
24b90 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
24ba0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
24bb0 6c 61 62 65 6c 2d 31 30 36 31 0d 0a 53 45 4c 45  label-1061..SELE
24bc0 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20  CT ALL - + col1 
24bd0 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20  * - cor0.col0 - 
24be0 28 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  ( col1 + - col2 
24bf0 29 20 2a 20 31 30 20 2f 20 2b 20 63 6f 6c 31 20  ) * 10 / + col1 
24c00 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
24c10 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
24c20 0a 31 31 30 33 0d 0a 36 38 37 0d 0a 38 38 0d 0a  .1103..687..88..
24c30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24c40 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
24c50 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 31 37  l1 * + col0 + 17
24c60 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
24c70 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
24c80 32 30 34 37 0d 0a 2d 33 33 37 38 0d 0a 2d 38 30  2047..-3378..-80
24c90 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
24ca0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
24cb0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
24cc0 63 6f 6c 30 20 2a 20 28 20 63 6f 72 30 2e 63 6f  col0 * ( cor0.co
24cd0 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 63  l0 ) FROM tab1 c
24ce0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 34  or0..----..12..4
24cf0 31 36 30 0d 0a 36 34 38 30 0d 0a 0d 0a 71 75 65  160..6480....que
24d00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24d10 4c 45 43 54 20 41 4c 4c 20 2d 20 34 37 20 2a 20  LECT ALL - 47 * 
24d20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f  - cor0.col0 + co
24d30 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
24d40 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
24d50 2d 2d 0d 0a 31 32 31 34 0d 0a 31 37 34 32 0d 0a  --..1214..1742..
24d60 34 32 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4274....query I 
24d70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24d80 44 49 53 54 49 4e 43 54 20 33 20 2b 20 2d 20 63  DISTINCT 3 + - c
24d90 6f 72 30 2e 63 6f 6c 32 20 2b 20 39 36 20 2a 20  or0.col2 + 96 * 
24da0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
24db0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 32  S cor0..----..82
24dc0 32 36 0d 0a 38 36 35 37 0d 0a 39 33 31 34 0d 0a  26..8657..9314..
24dd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24de0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
24df0 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
24e00 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
24e10 2d 31 31 39 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d  -119..-173..-98.
24e20 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
24e30 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
24e40 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
24e50 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
24e60 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
24e70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24e80 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20 63 6f  ECT ALL + ( - co
24e90 6c 30 20 29 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  l0 ) - col1 * + 
24ea0 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 32 20 46  cor0.col2 col2 F
24eb0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
24ec0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 38 0d 0a 2d  ..----..-1328..-
24ed0 31 34 30 37 0d 0a 2d 36 33 34 0d 0a 0d 0a 71 75  1407..-634....qu
24ee0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24ef0 45 4c 45 43 54 20 2b 20 2d 20 34 37 20 2b 20 63  ELECT + - 47 + c
24f00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
24f10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 0d   cor0..----..39.
24f20 0a 34 34 0d 0a 35 30 0d 0a 0d 0a 71 75 65 72 79  .44..50....query
24f30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24f40 43 54 20 2d 20 2b 20 39 38 20 46 52 4f 4d 20 74  CT - + 98 FROM t
24f50 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
24f60 2d 0d 0a 2d 39 38 0d 0a 2d 39 38 0d 0a 2d 39 38  -..-98..-98..-98
24f70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24f80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
24f90 49 4e 43 54 20 2b 20 2b 20 28 20 63 6f 6c 30 20  INCT + + ( col0 
24fa0 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ) * col1 FROM ta
24fb0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
24fc0 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d  ..1040..640..78.
24fd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24fe0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
24ff0 4e 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  NCT col1 + col1 
25000 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
25010 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
25020 0a 32 30 0d 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 73  .20..26..52....s
25030 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
25040 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
25050 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
25060 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
25070 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
25080 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25090 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ALL + col1 * col
250a0 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0 col1 FROM tab1
250b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
250c0 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75  0..640..78....qu
250d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
250e0 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2d 20 63  ELECT + col1 - c
250f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
25100 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d  r0..----..53..9.
25110 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .96....query I r
25120 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
25130 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30 20 41   col0 - + col0 A
25140 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
25150 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25160 2d 31 34 0d 0a 2d 31 35 36 0d 0a 2d 31 35 38 0d  -14..-156..-158.
25170 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25180 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
25190 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  NCT - + cor0.col
251a0 30 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 28 20 2d  0 * col1 + - ( -
251b0 20 33 33 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41   33 ) * + col0 A
251c0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
251d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
251e0 2d 31 32 37 32 0d 0a 2d 32 32 34 30 0d 0a 2d 35  -1272..-2240..-5
251f0 31 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  162....onlyif my
25200 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
25210 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
25220 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
25230 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25240 65 6c 2d 31 30 37 36 0d 0a 53 45 4c 45 43 54 20  el-1076..SELECT 
25250 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col1 * - col1 * 
25260 2b 20 63 6f 6c 32 20 2b 20 2d 20 32 30 20 44 49  + col2 + - 20 DI
25270 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  V - col1 FROM ta
25280 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
25290 0d 0a 2d 31 36 32 32 33 0d 0a 2d 33 36 35 30 34  ..-16223..-36504
252a0 0d 0a 2d 35 36 39 38 0d 0a 0d 0a 73 6b 69 70 69  ..-5698....skipi
252b0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
252c0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
252d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
252e0 31 30 37 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1076..SELECT col
252f0 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  1 * - col1 * + c
25300 6f 6c 32 20 2b 20 2d 20 32 30 20 2f 20 2d 20 63  ol2 + - 20 / - c
25310 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
25320 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
25330 32 32 33 0d 0a 2d 33 36 35 30 34 0d 0a 2d 35 36  223..-36504..-56
25340 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
25350 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
25360 53 54 49 4e 43 54 20 2b 20 32 31 20 2b 20 63 6f  STINCT + 21 + co
25370 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
25380 2d 2d 0d 0a 31 30 30 0d 0a 32 38 0d 0a 39 39 0d  --..100..28..99.
25390 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
253a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
253b0 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  2 * - col1 + + c
253c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
253d0 2d 2d 2d 0d 0a 2d 31 34 35 36 0d 0a 2d 35 36 37  ---..-1456..-567
253e0 0d 0a 2d 38 33 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-830....query 
253f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25400 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37 39 20  T DISTINCT - 79 
25410 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
25420 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f  AS cor0, tab2 co
25430 72 31 2c 20 74 61 62 32 2c 20 74 61 62 31 20 41  r1, tab2, tab1 A
25440 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor2..----..-7
25450 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
25460 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
25470 6f 6c 31 20 29 20 2b 20 38 35 20 2a 20 2b 20 28  ol1 ) + 85 * + (
25480 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
25490 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
254a0 0a 34 36 31 36 0d 0a 34 38 35 35 0d 0a 38 31 37  .4616..4855..817
254b0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
254c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
254d0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63  ol1 * - col2 + c
254e0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
254f0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
25500 0d 0a 2d 32 37 35 32 0d 0a 2d 37 33 37 31 0d 0a  ..-2752..-7371..
25510 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
25520 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
25530 20 28 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d   ( + col0 ) FROM
25540 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
25550 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a  ---..3..64..80..
25560 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25570 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
25580 43 54 20 2d 20 37 32 20 2a 20 2b 20 63 6f 6c 30  CT - 72 * + col0
25590 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
255a0 0d 0a 2d 32 31 36 0d 0a 2d 34 36 30 38 0d 0a 2d  ..-216..-4608..-
255b0 35 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5760....query I 
255c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
255d0 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72  ALL col1 * + cor
255e0 30 2e 63 6f 6c 30 20 2b 20 2d 20 31 35 20 2b 20  0.col0 + - 15 + 
255f0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
25600 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
25610 2d 2d 2d 2d 0d 0a 32 30 38 32 0d 0a 33 33 38 31  ----..2082..3381
25620 0d 0a 38 31 36 36 0d 0a 0d 0a 71 75 65 72 79 20  ..8166....query 
25630 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25640 54 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 36 39 20  T + col2 - - 69 
25650 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
25660 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31 35  0..----..102..15
25670 31 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  1..70....query I
25680 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25690 20 2d 20 63 6f 6c 31 20 2a 20 38 34 20 2b 20 2b   - col1 * 84 + +
256a0 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 63   col2 + col1 * c
256b0 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 * col0 FROM 
256c0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
256d0 0a 31 31 34 37 32 32 0d 0a 33 32 38 32 0d 0a 34  .114722..3282..4
256e0 39 36 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9644....query I 
256f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25700 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 28  ALL + col0 + - (
25710 20 63 6f 6c 30 20 29 20 2d 20 63 6f 6c 30 20 41   col0 ) - col0 A
25720 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
25730 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25740 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d  -24..-35..-89...
25750 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25760 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
25770 54 20 2d 20 63 6f 6c 31 20 2a 20 32 20 2a 20 63  T - col1 * 2 * c
25780 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
25790 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
257a0 31 39 38 0d 0a 2d 34 31 32 38 0d 0a 2d 36 37 39  198..-4128..-679
257b0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
257c0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
257d0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
257e0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
257f0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
25800 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25810 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a  ELECT - + col0 *
25820 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63   col0 + col1 * c
25830 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
25840 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
25850 0d 0a 33 36 30 0d 0a 36 38 32 30 0d 0a 38 31 38  ..360..6820..818
25860 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
25870 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
25880 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c  TINCT col0 + col
25890 31 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  1 + col0 * col2 
258a0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
258b0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 31 0d 0a 33 37  1..----..191..37
258c0 32 32 0d 0a 37 37 37 33 0d 0a 0d 0a 71 75 65 72  22..7773....quer
258d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
258e0 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ECT + + cor0.col
258f0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
25900 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
25910 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65  1..33..82....que
25920 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
25930 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  LECT + - cor0.co
25940 6c 31 20 2d 20 2b 20 28 20 32 37 20 29 20 2a 20  l1 - + ( 27 ) * 
25950 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  - cor0.col1 FROM
25960 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
25970 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 34 34 32 0d 0a  ---..1534..442..
25980 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  806....query I r
25990 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
259a0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a  ISTINCT + col1 *
259b0 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 46   col0 + - col1 F
259c0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
259d0 2d 2d 2d 0d 0a 31 39 37 38 0d 0a 33 32 39 38 0d  ---..1978..3298.
259e0 0a 38 30 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .8008....query I
259f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25a00 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 30 20   DISTINCT - ( 0 
25a10 29 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  ) * - col0 AS co
25a20 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
25a30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  cor0..----..0...
25a40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25a50 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
25a60 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 38 30 20  T - col2 * - 80 
25a70 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
25a80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25a90 32 31 35 38 0d 0a 32 31 36 37 0d 0a 33 31 31 39  2158..2167..3119
25aa0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25ab0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
25ac0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  col0 * - col0 * 
25ad0 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col2 + - cor0.co
25ae0 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l2 * - col0 AS c
25af0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
25b00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 34 0d  r0..----..-1134.
25b10 0a 2d 31 35 36 31 35 36 0d 0a 2d 32 33 34 31 35  .-156156..-23415
25b20 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
25b30 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
25b40 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
25b50 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
25b60 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
25b70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25b80 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
25b90 20 2d 20 32 32 20 2a 20 63 6f 6c 31 20 2b 20 2b   - 22 * col1 + +
25ba0 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f 6c 32   col2 * ( - col2
25bb0 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
25bc0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
25bd0 0a 2d 32 33 34 34 0d 0a 2d 33 30 32 39 0d 0a 2d  .-2344..-3029..-
25be0 38 39 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8930....onlyif m
25bf0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
25c00 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
25c10 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
25c20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25c30 62 65 6c 2d 31 30 39 38 0d 0a 53 45 4c 45 43 54  bel-1098..SELECT
25c40 20 41 4c 4c 20 2b 20 2b 20 38 35 20 44 49 56 20   ALL + + 85 DIV 
25c50 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
25c60 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
25c70 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d  ----..0..1..1...
25c80 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
25c90 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
25ca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
25cb0 6c 61 62 65 6c 2d 31 30 39 38 0d 0a 53 45 4c 45  label-1098..SELE
25cc0 43 54 20 41 4c 4c 20 2b 20 2b 20 38 35 20 2f 20  CT ALL + + 85 / 
25cd0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
25ce0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
25cf0 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d  ----..0..1..1...
25d00 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
25d10 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
25d20 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
25d30 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
25d40 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39  owsort label-109
25d50 39 0d 0a 53 45 4c 45 43 54 20 31 36 20 44 49 56  9..SELECT 16 DIV
25d60 20 2b 20 31 30 20 46 52 4f 4d 20 74 61 62 32 20   + 10 FROM tab2 
25d70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  cor0..----..1..1
25d80 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
25d90 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
25da0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
25db0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39 39  wsort label-1099
25dc0 0d 0a 53 45 4c 45 43 54 20 31 36 20 2f 20 2b 20  ..SELECT 16 / + 
25dd0 31 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  10 FROM tab2 cor
25de0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31  0..----..1..1..1
25df0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25e00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
25e10 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20  - col2 * - col1 
25e20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
25e30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25e40 31 33 34 34 0d 0a 31 34 35 38 0d 0a 36 32 37 0d  1344..1458..627.
25e50 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
25e60 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
25e70 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
25e80 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
25e90 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
25ea0 31 30 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  101..SELECT DIST
25eb0 49 4e 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20  INCT + col0 DIV 
25ec0 2b 20 35 39 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 59 AS col2 FRO
25ed0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
25ee0 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b  ----..0..1....sk
25ef0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
25f00 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
25f10 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25f20 65 6c 2d 31 31 30 31 0d 0a 53 45 4c 45 43 54 20  el-1101..SELECT 
25f30 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
25f40 2f 20 2b 20 35 39 20 41 53 20 63 6f 6c 32 20 46  / + 59 AS col2 F
25f50 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
25f60 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a  ..----..0..1....
25f70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25f80 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63 6f  .SELECT + ( - co
25f90 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 31 20 46 52  l0 ) * - col1 FR
25fa0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
25fb0 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30  .----..1040..640
25fc0 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..78....query I 
25fd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25fe0 2d 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  - - col0 + + col
25ff0 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  2 + + col1 * col
26000 32 20 2a 20 2d 20 33 34 20 41 53 20 63 6f 6c 30  2 * - 34 AS col0
26010 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
26020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 32 35 39  r0..----..-19259
26030 0d 0a 2d 34 32 32 35 36 0d 0a 2d 34 37 36 37 39  ..-42256..-47679
26040 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26050 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
26060 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31   + col0 * + col1
26070 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
26080 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
26090 0a 31 33 39 38 0d 0a 32 37 35 0d 0a 34 36 38 37  .1398..275..4687
260a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
260b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
260c0 2d 20 39 30 20 2a 20 63 6f 6c 30 20 41 53 20 63  - 90 * col0 AS c
260d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
260e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37   cor0..----..-27
260f0 30 0d 0a 2d 35 37 36 30 0d 0a 2d 37 32 30 30 0d  0..-5760..-7200.
26100 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26110 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
26120 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  2 + col0 * col1 
26130 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
26140 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
26150 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 34 0d 0a 31 39  ..----..1384..19
26160 37 0d 0a 34 36 35 34 0d 0a 0d 0a 71 75 65 72 79  7..4654....query
26170 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26180 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  CT + + col0 + + 
26190 38 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  82 AS col2 FROM 
261a0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
261b0 0a 31 30 36 0d 0a 31 31 37 0d 0a 31 37 31 0d 0a  .106..117..171..
261c0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
261d0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
261e0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
261f0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
26200 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
26210 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 38 0d  sort label-1108.
26220 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b  .SELECT col1 * +
26230 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53   CAST( col2 AS S
26240 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 31 20 46  IGNED ) + col1 F
26250 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26260 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a 31 34  ..----..1261..14
26270 33 30 0d 0a 35 38 30 0d 0a 0d 0a 73 6b 69 70 69  30..580....skipi
26280 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
26290 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
262a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
262b0 31 31 30 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1108..SELECT col
262c0 31 20 2a 20 2b 20 43 41 53 54 20 28 20 63 6f 6c  1 * + CAST ( col
262d0 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  2 AS INTEGER ) +
262e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
262f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
26300 32 36 31 0d 0a 31 34 33 30 0d 0a 35 38 30 0d 0a  261..1430..580..
26310 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26320 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
26330 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 32   ( col0 ) + col2
26340 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
26350 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
26360 2d 2d 2d 2d 0d 0a 31 30 37 0d 0a 36 31 36 39 0d  ----..107..6169.
26370 0a 36 32 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .6296....query I
26380 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26390 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2b 20   ALL - + col2 + 
263a0 34 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  47 AS col2 FROM 
263b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
263c0 2d 2d 0d 0a 2d 31 30 0d 0a 2d 34 39 0d 0a 2d 37  --..-10..-49..-7
263d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
263e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
263f0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 28 20  cor0.col2 + + ( 
26400 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e  - col1 * + cor0.
26410 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32  col1 ) FROM tab2
26420 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26430 2d 33 32 37 0d 0a 2d 33 35 30 37 0d 0a 2d 39 38  -327..-3507..-98
26440 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
26450 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
26460 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  2 + cor0.col1 * 
26470 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 41 53  col1 + - col2 AS
26480 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
26490 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d  cor0..----..100.
264a0 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 6f 6e 6c  .169..676....onl
264b0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
264c0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
264d0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
264e0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
264f0 72 74 20 6c 61 62 65 6c 2d 31 31 31 33 0d 0a 53  rt label-1113..S
26500 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 44 49 56  ELECT + col2 DIV
26510 20 2b 20 31 32 20 2b 20 2d 20 28 20 63 6f 6c 31   + 12 + - ( col1
26520 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30   + col1 ) * col0
26530 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
26540 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
26550 0d 0a 2d 31 32 37 36 0d 0a 2d 31 35 32 0d 0a 2d  ..-1276..-152..-
26560 32 30 37 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  2072....skipif m
26570 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
26580 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
26590 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31  owsort label-111
265a0 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  3..SELECT + col2
265b0 20 2f 20 2b 20 31 32 20 2b 20 2d 20 28 20 63 6f   / + 12 + - ( co
265c0 6c 31 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63 6f  l1 + col1 ) * co
265d0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
265e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
265f0 2d 2d 0d 0a 2d 31 32 37 36 0d 0a 2d 31 35 32 0d  --..-1276..-152.
26600 0a 2d 32 30 37 32 0d 0a 0d 0a 71 75 65 72 79 20  .-2072....query 
26610 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26620 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  T - + col0 * - c
26630 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
26640 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
26650 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a  ---..1040..640..
26660 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  78....query I ro
26670 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
26680 4c 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a  L - ( + col1 ) *
26690 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
266a0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
266b0 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38  .----..-7396..-8
266c0 32 38 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 6f 6e  281..-9409....on
266d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
266e0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
266f0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
26700 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
26710 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26720 20 6c 61 62 65 6c 2d 31 31 31 36 0d 0a 53 45 4c   label-1116..SEL
26730 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
26740 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
26750 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 31 20 2b  IGNED ) * col1 +
26760 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   + col1 col1 FRO
26770 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
26780 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
26790 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
267a0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
267b0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
267c0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
267d0 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
267e0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
267f0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
26800 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31 36  wsort label-1116
26810 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
26820 54 20 2d 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  T - + CAST ( NUL
26830 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
26840 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 63   col1 + + col1 c
26850 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
26860 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
26870 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
26880 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
26890 54 49 4e 43 54 20 2d 20 32 32 20 46 52 4f 4d 20  TINCT - 22 FROM 
268a0 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30 2c  tab1, tab1 cor0,
268b0 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
268c0 2d 2d 2d 0d 0a 2d 32 32 0d 0a 0d 0a 71 75 65 72  ---..-22....quer
268d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
268e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
268f0 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  or0.col0 AS col0
26900 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
26910 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26920 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c  3..64..80....onl
26930 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
26940 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
26950 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
26960 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
26970 72 74 20 6c 61 62 65 6c 2d 31 31 31 39 0d 0a 53  rt label-1119..S
26980 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63  ELECT - col1 * c
26990 6f 6c 32 20 2d 20 63 6f 6c 31 20 44 49 56 20 2b  ol2 - col1 DIV +
269a0 20 38 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53   87 FROM tab1 AS
269b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
269c0 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37 30 0d  48..-1404..-570.
269d0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
269e0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
269f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26a00 74 20 6c 61 62 65 6c 2d 31 31 31 39 0d 0a 53 45  t label-1119..SE
26a10 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  LECT - col1 * co
26a20 6c 32 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 38 37  l2 - col1 / + 87
26a30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
26a40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d  r0..----..-1248.
26a50 0a 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a  .-1404..-570....
26a60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26a70 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2d 20 63  .SELECT col1 - c
26a80 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  or0.col0 * cor0.
26a90 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
26aa0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
26ab0 2d 0d 0a 2d 37 30 36 0d 0a 2d 37 32 30 37 0d 0a  -..-706..-7207..
26ac0 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  62....skipif pos
26ad0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
26ae0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
26af0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
26b00 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
26b10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26b20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26b30 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  - ( cor0.col2 ) 
26b40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
26b50 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
26b60 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31  b1 AS cor1, tab1
26b70 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
26b80 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d  -26..-27..-38...
26b90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26ba0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
26bb0 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 32 36 20  - + col1 * + 26 
26bc0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
26bd0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 30 0d 0a 2d  0..----..-250..-
26be0 33 32 35 0d 0a 2d 36 35 30 0d 0a 0d 0a 6f 6e 6c  325..-650....onl
26bf0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
26c00 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
26c10 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
26c20 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
26c30 72 74 20 6c 61 62 65 6c 2d 31 31 32 33 0d 0a 53  rt label-1123..S
26c40 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49 56  ELECT - col1 DIV
26c50 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
26c60 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
26c70 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73  .-1..-1..-1....s
26c80 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
26c90 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
26ca0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
26cb0 62 65 6c 2d 31 31 32 33 0d 0a 53 45 4c 45 43 54  bel-1123..SELECT
26cc0 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31   - col1 / + col1
26cd0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
26ce0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  b0..----..-1..-1
26cf0 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-1....query I 
26d00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26d10 36 34 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  64 * - col2 FROM
26d20 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34   tab1..----..-34
26d30 35 36 0d 0a 2d 33 36 34 38 0d 0a 2d 36 31 34 34  56..-3648..-6144
26d40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26d50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 20 41 53  ort..SELECT 9 AS
26d60 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
26d70 0a 2d 2d 2d 2d 0d 0a 39 0d 0a 39 0d 0a 39 0d 0a  .----..9..9..9..
26d80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26d90 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
26da0 43 54 20 2d 20 28 20 63 6f 6c 31 20 29 20 46 52  CT - ( col1 ) FR
26db0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
26dc0 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a  17..-31..-59....
26dd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26de0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
26df0 63 6f 6c 30 20 29 20 2a 20 34 36 20 2b 20 2d 20  col0 ) * 46 + - 
26e00 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2b 20  col1 * col1 * + 
26e10 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
26e20 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
26e30 2d 2d 2d 2d 0d 0a 2d 31 37 37 31 34 0d 0a 2d 33  ----..-17714..-3
26e40 39 34 34 0d 0a 2d 35 38 37 37 0d 0a 0d 0a 71 75  944..-5877....qu
26e50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26e60 45 4c 45 43 54 20 2d 20 2b 20 32 20 2a 20 2d 20  ELECT - + 2 * - 
26e70 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col1 + col1 FROM
26e80 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
26e90 2d 2d 2d 0d 0a 33 30 0d 0a 33 39 0d 0a 37 38 0d  ---..30..39..78.
26ea0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
26eb0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
26ec0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
26ed0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
26ee0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
26ef0 31 32 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  129..SELECT DIST
26f00 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 44 49  INCT - + col0 DI
26f10 56 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d  V col2 col0 FROM
26f20 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
26f30 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b  ---..-1..0....sk
26f40 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
26f50 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
26f60 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
26f70 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
26f80 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
26f90 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
26fa0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
26fb0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 39  wsort label-1129
26fc0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
26fd0 54 20 2d 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c  T - + col0 / col
26fe0 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  2 col0 FROM tab1
26ff0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27000 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -1..0....skipif 
27010 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
27020 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
27030 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
27040 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
27050 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27060 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
27070 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 63  CT col1 + col0 c
27080 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
27090 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34  r0..----..29..74
270a0 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..93....query I 
270b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
270c0 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL + cor0.col0 
270d0 2a 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 31 20  * col1 - + col1 
270e0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  * col2 AS col0 F
270f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
27100 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 30 0d 0a 33 30  ..----..-620..30
27110 36 38 0d 0a 36 39 37 0d 0a 0d 0a 71 75 65 72 79  68..697....query
27120 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27130 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2d  CT cor0.col1 - -
27140 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
27150 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
27160 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a  --..55..58..85..
27170 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27180 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  t..SELECT col0 +
27190 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41   col2 * + col1 A
271a0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
271b0 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 32 0d 0a 37 32  ..----..1612..72
271c0 35 0d 0a 38 34 34 0d 0a 0d 0a 71 75 65 72 79 20  5..844....query 
271d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
271e0 54 20 63 6f 6c 30 20 2a 20 74 61 62 32 2e 63 6f  T col0 * tab2.co
271f0 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l0 * + col2 FROM
27200 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32   tab2..----..132
27210 33 0d 0a 31 35 38 31 38 34 0d 0a 32 33 37 31 35  3..158184..23715
27220 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
27230 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
27240 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 31 20  TINCT tab1.col1 
27250 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52  - col0 * col2 FR
27260 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
27270 31 33 36 0d 0a 2d 33 36 33 38 0d 0a 2d 37 36 36  136..-3638..-766
27280 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
27290 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
272a0 32 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  2 * col2 * - col
272b0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
272c0 2d 0d 0a 2d 31 31 34 30 37 36 0d 0a 2d 35 31 30  -..-114076..-510
272d0 33 0d 0a 2d 35 32 37 32 38 0d 0a 0d 0a 71 75 65  3..-52728....que
272e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
272f0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
27300 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col0 * + col1 + 
27310 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
27320 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab1..----..-2
27330 34 0d 0a 2d 35 38 33 0d 0a 2d 39 34 34 0d 0a 0d  4..-583..-944...
27340 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27350 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
27360 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20  T col1 + col1 * 
27370 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  + col2 * + col0 
27380 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
27390 0a 31 31 39 37 31 31 0d 0a 35 31 30 35 31 0d 0a  .119711..51051..
273a0 35 38 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5890....query I 
273b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
273c0 74 61 62 30 2e 63 6f 6c 31 20 2b 20 74 61 62 30  tab0.col1 + tab0
273d0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
273e0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
273f0 37 32 0d 0a 31 38 32 0d 0a 31 39 34 0d 0a 0d 0a  72..182..194....
27400 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
27410 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
27420 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
27430 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
27440 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 30  wsort label-1140
27450 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
27460 30 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c  0 + col0 DIV col
27470 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
27480 2d 0d 0a 33 0d 0a 36 35 0d 0a 38 30 0d 0a 0d 0a  -..3..65..80....
27490 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
274a0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
274b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
274c0 61 62 65 6c 2d 31 31 34 30 0d 0a 53 45 4c 45 43  abel-1140..SELEC
274d0 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63 6f 6c  T ALL col0 + col
274e0 30 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 / col2 FROM ta
274f0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 35 0d  b1..----..3..65.
27500 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
27510 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
27520 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63  ol0 * col1 + + c
27530 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
27540 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38   tab0..----..208
27550 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d  8..3430..8188...
27560 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
27570 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
27580 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
27590 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
275a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34  owsort label-114
275b0 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  2..SELECT ALL co
275c0 6c 30 20 44 49 56 20 63 6f 6c 31 20 2b 20 2d 20  l0 DIV col1 + - 
275d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
275e0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d  ----..-1..-33..-
275f0 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  82....skipif mys
27600 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
27610 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
27620 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 32 0d  sort label-1142.
27630 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
27640 20 2f 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32   / col1 + - col2
27650 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
27660 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a  ..-1..-33..-82..
27670 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27680 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
27690 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c   tab0.col1 + col
276a0 30 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20  0 - tab0.col2 * 
276b0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
276c0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab0..----..13
276d0 31 0d 0a 31 37 37 33 0d 0a 38 32 37 0d 0a 0d 0a  1..1773..827....
276e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
276f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
27700 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2d 20 2b 20  col2 * col1 - + 
27710 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
27720 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
27730 38 37 31 0d 0a 2d 37 35 34 34 0d 0a 2d 39 38 0d  871..-7544..-98.
27740 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27750 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
27760 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63  NCT - col0 * + c
27770 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b  ol1 * - col2 + +
27780 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 41   col0 + - col1 A
27790 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
277a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
277b0 36 37 31 0d 0a 35 31 30 39 36 0d 0a 35 38 33 35  671..51096..5835
277c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
277d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
277e0 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 41 53 20 63  col0 - col1 AS c
277f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
27800 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
27810 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65  .-62..-62....que
27820 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27830 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
27840 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f  cor0.col2 * + co
27850 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
27860 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38  cor0..----..2838
27870 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 6f 6e  ..7462..97....on
27880 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
27890 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
278a0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
278b0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
278c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
278d0 20 6c 61 62 65 6c 2d 31 31 34 38 0d 0a 53 45 4c   label-1148..SEL
278e0 45 43 54 20 43 41 53 54 28 20 2d 20 63 6f 6c 30  ECT CAST( - col0
278f0 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47   + + col2 AS SIG
27900 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 0d  NED ) FROM tab1.
27910 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a 35  .----..-7..16..5
27920 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
27930 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
27940 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
27950 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 38 0d 0a  ort label-1148..
27960 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 2d 20  SELECT CAST ( - 
27970 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col0 + + col2 AS
27980 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
27990 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a  tab1..----..-7..
279a0 31 36 0d 0a 35 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  16..51....onlyif
279b0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
279c0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
279d0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
279e0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
279f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
27a00 65 6c 2d 31 31 34 39 0d 0a 53 45 4c 45 43 54 20  el-1149..SELECT 
27a10 41 4c 4c 20 43 41 53 54 28 20 63 6f 6c 31 20 41  ALL CAST( col1 A
27a20 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 74  S SIGNED ) * - t
27a30 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ab2.col1 FROM ta
27a40 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a  b2..----..-289..
27a50 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a 73  -3481..-961....s
27a60 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
27a70 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
27a80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
27a90 62 65 6c 2d 31 31 34 39 0d 0a 53 45 4c 45 43 54  bel-1149..SELECT
27aa0 20 41 4c 4c 20 43 41 53 54 20 28 20 63 6f 6c 31   ALL CAST ( col1
27ab0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
27ac0 2d 20 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d  - tab2.col1 FROM
27ad0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   tab2..----..-28
27ae0 39 0d 0a 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a  9..-3481..-961..
27af0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27b00 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20  t..SELECT + ( + 
27b10 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46  col2 ) AS col0 F
27b20 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
27b30 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 6f 6e 6c  1..33..82....onl
27b40 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
27b50 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
27b60 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
27b70 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
27b80 72 74 20 6c 61 62 65 6c 2d 31 31 35 31 0d 0a 53  rt label-1151..S
27b90 45 4c 45 43 54 20 35 32 20 2a 20 2d 20 63 6f 6c  ELECT 52 * - col
27ba0 30 20 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c  0 - col1 DIV col
27bb0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
27bc0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 35 0d  ab2..----..-365.
27bd0 0a 2d 34 30 35 37 0d 0a 2d 34 31 30 39 0d 0a 0d  .-4057..-4109...
27be0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
27bf0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
27c00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
27c10 6c 61 62 65 6c 2d 31 31 35 31 0d 0a 53 45 4c 45  label-1151..SELE
27c20 43 54 20 35 32 20 2a 20 2d 20 63 6f 6c 30 20 2d  CT 52 * - col0 -
27c30 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 41 53 20   col1 / col1 AS 
27c40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
27c50 2d 2d 2d 2d 0d 0a 2d 33 36 35 0d 0a 2d 34 30 35  ----..-365..-405
27c60 37 0d 0a 2d 34 31 30 39 0d 0a 0d 0a 71 75 65 72  7..-4109....quer
27c70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27c80 45 43 54 20 28 20 28 20 74 61 62 30 2e 63 6f 6c  ECT ( ( tab0.col
27c90 32 20 29 20 29 20 2d 20 63 6f 6c 32 20 46 52 4f  2 ) ) - col2 FRO
27ca0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
27cb0 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .0..0....onlyif 
27cc0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
27cd0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
27ce0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
27cf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
27d00 61 62 65 6c 2d 31 31 35 33 0d 0a 53 45 4c 45 43  abel-1153..SELEC
27d10 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e  T DISTINCT tab0.
27d20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20 41 53  col2 DIV col2 AS
27d30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
27d40 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .----..1....skip
27d50 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
27d60 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
27d70 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
27d80 2d 31 31 35 33 0d 0a 53 45 4c 45 43 54 20 44 49  -1153..SELECT DI
27d90 53 54 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 32  STINCT tab0.col2
27da0 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   / col2 AS col2 
27db0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
27dc0 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
27dd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
27de0 53 54 49 4e 43 54 20 28 20 2b 20 28 20 63 6f 6c  STINCT ( + ( col
27df0 30 20 29 20 2a 20 63 6f 6c 32 20 29 20 41 53 20  0 ) * col2 ) AS 
27e00 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
27e10 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d  ----..162..3648.
27e20 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .7680....query I
27e30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27e40 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d   - cor0.col1 + -
27e50 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
27e60 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
27e70 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32 0d 0a 2d 31 38  .----..-172..-18
27e80 32 0d 0a 2d 31 39 34 0d 0a 0d 0a 71 75 65 72 79  2..-194....query
27e90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27ea0 43 54 20 2b 20 63 6f 6c 32 20 2b 20 33 34 20 46  CT + col2 + 34 F
27eb0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
27ec0 2d 2d 2d 0d 0a 31 33 30 0d 0a 38 38 0d 0a 39 31  ---..130..88..91
27ed0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27ee0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
27ef0 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 41   + + tab0.col0 A
27f00 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
27f10 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32  ..----..110..132
27f20 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..180....query I
27f30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27f40 20 39 36 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20   96 + - col2 AS 
27f50 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
27f60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 38 0d 0a 36  or0..----..58..6
27f70 39 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  9..70....query I
27f80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27f90 20 2b 20 36 20 2a 20 63 6f 6c 32 20 41 53 20 63   + 6 * col2 AS c
27fa0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
27fb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36   cor0..----..156
27fc0 0d 0a 31 36 32 0d 0a 32 32 38 0d 0a 0d 0a 71 75  ..162..228....qu
27fd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27fe0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 34 32 20 2b  ELECT ALL - 42 +
27ff0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   - cor0.col0 * c
28000 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
28010 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
28020 0d 0a 2d 36 31 32 36 0d 0a 2d 36 32 38 33 0d 0a  ..-6126..-6283..
28030 2d 39 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -91....skipif po
28040 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
28050 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
28060 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
28070 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
28080 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28090 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
280a0 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f   + col2 col0 FRO
280b0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
280c0 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37  ----..-1444..-67
280d0 36 0d 0a 2d 37 32 39 0d 0a 0d 0a 71 75 65 72 79  6..-729....query
280e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
280f0 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  CT + col2 + + co
28100 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
28110 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32 0d  0..----..164..2.
28120 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .66....query I r
28130 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
28140 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   - col1 * + col1
28150 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
28160 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
28170 0d 0a 37 33 39 36 0d 0a 38 32 38 31 0d 0a 39 34  ..7396..8281..94
28180 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  09....query I ro
28190 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
281a0 4c 20 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  L 8 AS col1 FROM
281b0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
281c0 0d 0a 38 0d 0a 38 0d 0a 38 0d 0a 0d 0a 71 75 65  ..8..8..8....que
281d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
281e0 4c 45 43 54 20 2b 20 2d 20 39 30 20 41 53 20 63  LECT + - 90 AS c
281f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
28200 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 30   cor0..----..-90
28210 0d 0a 2d 39 30 0d 0a 2d 39 30 0d 0a 0d 0a 71 75  ..-90..-90....qu
28220 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28230 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
28240 20 28 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 29   ( + tab0.col2 )
28250 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
28260 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37  0..----..-35..-7
28270 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65  298..-792....que
28280 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28290 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
282a0 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20  l2 * - col0 + + 
282b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
282c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
282d0 38 32 0d 0a 2d 31 39 35 30 0d 0a 2d 32 39 32 33  82..-1950..-2923
282e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
282f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
28300 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  + col0 + + col1 
28310 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  + - col1 AS col2
28320 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
28330 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39  .----..7..78..79
28340 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28350 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
28360 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46   * col1 + col2 F
28370 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
28380 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34  ..----..1381..24
28390 34 0d 0a 34 36 32 38 0d 0a 0d 0a 71 75 65 72 79  4..4628....query
283a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
283b0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
283c0 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32  cor0.col0 + col2
283d0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
283e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36  r0..----..-7..16
283f0 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..51....query I 
28400 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28410 44 49 53 54 49 4e 43 54 20 2d 20 28 20 63 6f 6c  DISTINCT - ( col
28420 31 20 29 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b  1 ) + - col1 * +
28430 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
28440 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28450 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 31 0d 0a 2d 31  .----..-1261..-1
28460 34 33 30 0d 0a 2d 35 38 30 0d 0a 0d 0a 6f 6e 6c  430..-580....onl
28470 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
28480 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
28490 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
284a0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
284b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
284c0 6c 61 62 65 6c 2d 31 31 37 32 0d 0a 53 45 4c 45  label-1172..SELE
284d0 43 54 20 2d 20 43 41 53 54 28 20 39 31 20 41 53  CT - CAST( 91 AS
284e0 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63 6f   SIGNED ) * + co
284f0 6c 32 20 2b 20 2d 20 37 32 20 41 53 20 63 6f 6c  l2 + - 72 AS col
28500 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
28510 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 33 0d  or0..----..-163.
28520 0a 2d 33 30 37 35 0d 0a 2d 37 35 33 34 0d 0a 0d  .-3075..-7534...
28530 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
28540 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
28550 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
28560 6c 61 62 65 6c 2d 31 31 37 32 0d 0a 53 45 4c 45  label-1172..SELE
28570 43 54 20 2d 20 43 41 53 54 20 28 20 39 31 20 41  CT - CAST ( 91 A
28580 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20  S INTEGER ) * + 
28590 63 6f 6c 32 20 2b 20 2d 20 37 32 20 41 53 20 63  col2 + - 72 AS c
285a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
285b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
285c0 33 0d 0a 2d 33 30 37 35 0d 0a 2d 37 35 33 34 0d  3..-3075..-7534.
285d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
285e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37  rt..SELECT ALL 7
285f0 37 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  7 + col2 FROM ta
28600 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
28610 0d 0a 31 30 33 0d 0a 31 30 34 0d 0a 31 31 35 0d  ..103..104..115.
28620 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28630 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
28640 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  0.col1 + - col1 
28650 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
28660 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
28670 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28680 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
28690 2d 20 28 20 2b 20 38 20 29 20 46 52 4f 4d 20 74  - ( + 8 ) FROM t
286a0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
286b0 2d 0d 0a 2d 38 0d 0a 2d 38 0d 0a 2d 38 0d 0a 0d  -..-8..-8..-8...
286c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
286d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
286e0 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  T col2 * + col1 
286f0 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 33 20 46  + + col1 * + 3 F
28700 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
28710 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 37 0d 0a 31 34  ..----..1287..14
28720 38 32 0d 0a 36 30 30 0d 0a 0d 0a 71 75 65 72 79  82..600....query
28730 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28740 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  CT - + cor0.col0
28750 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   - - col1 FROM t
28760 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
28770 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d 0a  -..2..62..62....
28780 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28790 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
287a0 20 39 39 20 2a 20 28 20 2d 20 63 6f 6c 31 20 29   99 * ( - col1 )
287b0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   + col0 * - col2
287c0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
287d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
287e0 0a 2d 33 32 35 31 0d 0a 2d 34 36 30 36 0d 0a 2d  .-3251..-4606..-
287f0 37 37 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7791....onlyif m
28800 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
28810 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
28820 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
28830 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
28840 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
28850 2d 31 31 37 39 0d 0a 53 45 4c 45 43 54 20 2b 20  -1179..SELECT + 
28860 2d 20 43 41 53 54 28 20 2b 20 34 31 20 41 53 20  - CAST( + 41 AS 
28870 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
28880 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
28890 0d 0a 2d 34 31 0d 0a 2d 34 31 0d 0a 2d 34 31 0d  ..-41..-41..-41.
288a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
288b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
288c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
288d0 74 20 6c 61 62 65 6c 2d 31 31 37 39 0d 0a 53 45  t label-1179..SE
288e0 4c 45 43 54 20 2b 20 2d 20 43 41 53 54 20 28 20  LECT + - CAST ( 
288f0 2b 20 34 31 20 41 53 20 49 4e 54 45 47 45 52 20  + 41 AS INTEGER 
28900 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
28910 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a  or0..----..-41..
28920 2d 34 31 0d 0a 2d 34 31 0d 0a 0d 0a 71 75 65 72  -41..-41....quer
28930 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28940 45 43 54 20 41 4c 4c 20 2b 20 38 38 20 2a 20 2d  ECT ALL + 88 * -
28950 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
28960 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28970 0a 2d 2d 2d 2d 0d 0a 2d 32 36 34 0d 0a 2d 35 36  .----..-264..-56
28980 33 32 0d 0a 2d 37 30 34 30 0d 0a 0d 0a 73 6b 69  32..-7040....ski
28990 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
289a0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
289b0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
289c0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
289d0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
289e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
289f0 4c 20 2b 20 31 20 63 6f 6c 30 20 46 52 4f 4d 20  L + 1 col0 FROM 
28a00 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
28a10 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71  --..1..1..1....q
28a20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28a30 53 45 4c 45 43 54 20 2b 20 36 38 20 2b 20 33 36  SELECT + 68 + 36
28a40 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
28a50 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
28a60 2d 32 32 33 36 0d 0a 2d 32 38 31 32 0d 0a 2d 34  -2236..-2812..-4
28a70 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
28a80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
28a90 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63   ( + col1 ) AS c
28aa0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
28ab0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d   cor0..----..10.
28ac0 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79  .13..26....query
28ad0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28ae0 43 54 20 41 4c 4c 20 2b 20 31 20 2b 20 2d 20 28  CT ALL + 1 + - (
28af0 20 74 61 62 32 2e 63 6f 6c 30 20 29 20 2a 20 63   tab2.col0 ) * c
28b00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
28b10 2d 2d 2d 0d 0a 2d 31 33 34 32 0d 0a 2d 32 31 36  ---..-1342..-216
28b20 0d 0a 2d 34 36 30 31 0d 0a 0d 0a 71 75 65 72 79  ..-4601....query
28b30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28b40 43 54 20 41 4c 4c 20 2d 20 38 33 20 2a 20 2b 20  CT ALL - 83 * + 
28b50 63 6f 6c 32 20 2b 20 74 61 62 32 2e 63 6f 6c 32  col2 + tab2.col2
28b60 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
28b70 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 33 32 0d  b2..----..-2132.
28b80 0a 2d 32 32 31 34 0d 0a 2d 33 31 31 36 0d 0a 0d  .-2214..-3116...
28b90 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
28ba0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
28bb0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
28bc0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
28bd0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38  owsort label-118
28be0 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
28bf0 43 54 20 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20  CT ( - col1 ) + 
28c00 63 6f 6c 31 20 44 49 56 20 2d 20 32 33 20 46 52  col1 DIV - 23 FR
28c10 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
28c20 31 37 0d 0a 2d 33 32 0d 0a 2d 36 31 0d 0a 0d 0a  17..-32..-61....
28c30 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
28c40 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
28c50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28c60 61 62 65 6c 2d 31 31 38 36 0d 0a 53 45 4c 45 43  abel-1186..SELEC
28c70 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20 63  T DISTINCT ( - c
28c80 6f 6c 31 20 29 20 2b 20 63 6f 6c 31 20 2f 20 2d  ol1 ) + col1 / -
28c90 20 32 33 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   23 FROM tab2..-
28ca0 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 32 0d 0a 2d  ---..-17..-32..-
28cb0 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
28cc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
28cd0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col1 + + col1 * 
28ce0 37 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  72 FROM tab0 cor
28cf0 30 0d 0a 2d 2d 2d 2d 0d 0a 36 32 37 38 0d 0a 36  0..----..6278..6
28d00 36 34 33 0d 0a 37 30 38 31 0d 0a 0d 0a 71 75 65  643..7081....que
28d10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28d20 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  LECT - col1 + co
28d30 6c 31 20 2d 20 2d 20 36 33 20 46 52 4f 4d 20 74  l1 - - 63 FROM t
28d40 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
28d50 2d 0d 0a 36 33 0d 0a 36 33 0d 0a 36 33 0d 0a 0d  -..63..63..63...
28d60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28d70 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
28d80 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20  + + tab2.col1 + 
28d90 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
28da0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab2..----..11
28db0 31 0d 0a 38 35 0d 0a 39 33 0d 0a 0d 0a 71 75 65  1..85..93....que
28dc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28dd0 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2b  LECT tab1.col2 +
28de0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
28df0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
28e00 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d  .121..176..57...
28e10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28e20 0d 0a 53 45 4c 45 43 54 20 34 30 20 2a 20 2b 20  ..SELECT 40 * + 
28e30 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 46 52  col0 + + col0 FR
28e40 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab2..----..2
28e50 38 37 0d 0a 33 31 39 38 0d 0a 33 32 33 39 0d 0a  87..3198..3239..
28e60 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
28e70 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
28e80 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
28e90 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
28ea0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
28eb0 39 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  92..SELECT DISTI
28ec0 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  NCT col1 * col2 
28ed0 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  DIV col1 + col0 
28ee0 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + + col2 FROM ta
28ef0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a 31  b2..----..130..1
28f00 35 35 0d 0a 36 31 0d 0a 0d 0a 73 6b 69 70 69 66  55..61....skipif
28f10 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
28f20 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
28f30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
28f40 31 39 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  192..SELECT DIST
28f50 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  INCT col1 * col2
28f60 20 2f 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b   / col1 + col0 +
28f70 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
28f80 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a 31 35  2..----..130..15
28f90 35 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  5..61....query I
28fa0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28fb0 20 2b 20 38 20 41 53 20 63 6f 6c 32 20 46 52 4f   + 8 AS col2 FRO
28fc0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 38 0d  M tab2..----..8.
28fd0 0a 38 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .8..8....query I
28fe0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28ff0 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 63   col2 + col2 + c
29000 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
29010 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34   tab2..----..114
29020 0d 0a 37 38 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72  ..78..81....quer
29030 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29040 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b 20 35 39  ECT ALL + ( + 59
29050 20 29 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 31   ) * - tab1.col1
29060 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46   * col0 + col2 F
29070 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
29080 2d 33 37 37 30 33 0d 0a 2d 34 35 34 38 0d 0a 2d  -37703..-4548..-
29090 36 31 32 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  61264....onlyif 
290a0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
290b0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
290c0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
290d0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
290e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
290f0 6c 2d 31 31 39 36 0d 0a 53 45 4c 45 43 54 20 2b  l-1196..SELECT +
29100 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 43   cor0.col2 + - C
29110 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
29120 4e 45 44 20 29 20 2a 20 63 6f 6c 31 20 41 53 20  NED ) * col1 AS 
29130 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
29140 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
29150 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
29160 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
29170 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
29180 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29190 20 6c 61 62 65 6c 2d 31 31 39 36 0d 0a 53 45 4c   label-1196..SEL
291a0 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
291b0 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + - CAST ( NULL 
291c0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63  AS INTEGER ) * c
291d0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
291e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
291f0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
29200 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
29210 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29220 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
29230 20 2a 20 2b 20 28 20 34 34 20 29 20 41 53 20 63   * + ( 44 ) AS c
29240 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
29250 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37   cor0..----..-37
29260 38 34 0d 0a 2d 34 30 30 34 0d 0a 2d 34 32 36 38  84..-4004..-4268
29270 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
29280 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
29290 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
292a0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
292b0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
292c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39  owsort label-119
292d0 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  8..SELECT ALL co
292e0 72 30 2e 63 6f 6c 30 20 2a 20 34 20 2b 20 2b 20  r0.col0 * 4 + + 
292f0 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f  cor0.col0 * - co
29300 6c 32 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c  l2 + CAST( - col
29310 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 53 49  2 * + col0 AS SI
29320 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
29330 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29340 2d 31 34 32 34 30 0d 0a 2d 31 34 38 38 0d 0a 37  -14240..-1488..7
29350 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
29360 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
29370 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
29380 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 38 0d 0a  ort label-1198..
29390 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e  SELECT ALL cor0.
293a0 63 6f 6c 30 20 2a 20 34 20 2b 20 2b 20 63 6f 72  col0 * 4 + + cor
293b0 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  0.col0 * - col2 
293c0 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20  + CAST ( - col2 
293d0 2a 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45  * + col0 AS INTE
293e0 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20  GER ) FROM tab0 
293f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
29400 31 34 32 34 30 0d 0a 2d 31 34 38 38 0d 0a 37 30  14240..-1488..70
29410 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
29420 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
29430 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
29440 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
29450 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
29460 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29470 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
29480 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
29490 32 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  2, tab0, tab0 AS
294a0 20 63 6f 72 30 20 57 48 45 52 45 20 4e 55 4c 4c   cor0 WHERE NULL
294b0 20 3e 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a   >= NULL..----..
294c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
294d0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
294e0 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2d 20 28 20  CT - - col1 - ( 
294f0 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46  col1 ) AS col0 F
29500 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
29510 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ---..0....onlyif
29520 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
29530 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
29540 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
29550 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
29560 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
29570 65 6c 2d 31 32 30 31 0d 0a 53 45 4c 45 43 54 20  el-1201..SELECT 
29580 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
29590 2b 20 2b 20 43 41 53 54 28 20 2b 20 28 20 2b 20  + + CAST( + ( + 
295a0 63 6f 6c 30 20 29 20 41 53 20 53 49 47 4e 45 44  col0 ) AS SIGNED
295b0 20 29 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 38 20   ) + - col2 * 8 
295c0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
295d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
295e0 0a 2d 31 30 34 0d 0a 2d 31 38 32 0d 0a 2d 31 38  .-104..-182..-18
295f0 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  7....skipif mysq
29600 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
29610 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
29620 6f 72 74 20 6c 61 62 65 6c 2d 31 32 30 31 0d 0a  ort label-1201..
29630 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
29640 2b 20 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54 20  + col2 + + CAST 
29650 28 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 41  ( + ( + col0 ) A
29660 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20  S INTEGER ) + - 
29670 63 6f 6c 32 20 2a 20 38 20 41 53 20 63 6f 6c 32  col2 * 8 AS col2
29680 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
29690 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a  r0..----..-104..
296a0 2d 31 38 32 0d 0a 2d 31 38 37 0d 0a 0d 0a 71 75  -182..-187....qu
296b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
296c0 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a  ELECT - + col0 *
296d0 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53   + ( - col1 ) AS
296e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
296f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
29700 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a  040..640..78....
29710 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29720 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
29730 20 63 6f 6c 30 20 2a 20 74 61 62 31 2e 63 6f 6c   col0 * tab1.col
29740 31 20 2a 20 36 33 20 46 52 4f 4d 20 74 61 62 31  1 * 63 FROM tab1
29750 0d 0a 2d 2d 2d 2d 0d 0a 34 30 32 36 33 0d 0a 34  ..----..40263..4
29760 38 36 30 0d 0a 36 35 34 32 34 0d 0a 0d 0a 71 75  860..65424....qu
29770 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29780 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
29790 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 74  ol0 + col1 * + t
297a0 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  ab1.col2 AS col1
297b0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
297c0 0d 0a 31 33 32 38 0d 0a 31 34 30 37 0d 0a 36 33  ..1328..1407..63
297d0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
297e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37  sort..SELECT - 7
297f0 34 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  4 + col0 FROM ta
29800 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 37 0d 0a 34  b2..----..-67..4
29810 0d 0a 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..5....onlyif my
29820 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
29830 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
29840 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
29850 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
29860 65 6c 2d 31 32 30 36 0d 0a 53 45 4c 45 43 54 20  el-1206..SELECT 
29870 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20  - col0 DIV col1 
29880 2b 20 2d 20 32 39 20 2a 20 38 30 20 2a 20 2b 20  + - 29 * 80 * + 
29890 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
298a0 2d 2d 2d 2d 0d 0a 2d 36 30 33 32 31 0d 0a 2d 36  ----..-60321..-6
298b0 32 36 34 30 0d 0a 2d 38 38 31 36 34 0d 0a 0d 0a  2640..-88164....
298c0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
298d0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
298e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
298f0 61 62 65 6c 2d 31 32 30 36 0d 0a 53 45 4c 45 43  abel-1206..SELEC
29900 54 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20  T - col0 / col1 
29910 2b 20 2d 20 32 39 20 2a 20 38 30 20 2a 20 2b 20  + - 29 * 80 * + 
29920 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
29930 2d 2d 2d 2d 0d 0a 2d 36 30 33 32 31 0d 0a 2d 36  ----..-60321..-6
29940 32 36 34 30 0d 0a 2d 38 38 31 36 34 0d 0a 0d 0a  2640..-88164....
29950 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29960 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d  .SELECT + col2 -
29970 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
29980 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
29990 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d  .119..173..98...
299a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
299b0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
299c0 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  * - col1 + col2 
299d0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
299e0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 35  1..----..-24..-5
299f0 38 33 0d 0a 2d 39 34 34 0d 0a 0d 0a 71 75 65 72  83..-944....quer
29a00 79 20 49 49 49 49 49 49 49 49 49 49 49 49 20 72  y IIIIIIIIIIII r
29a10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
29a20 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74  ISTINCT * FROM t
29a30 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab1 AS cor0 CROS
29a40 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61 62  S JOIN tab0, tab
29a50 30 20 63 6f 72 31 2c 20 74 61 62 32 20 63 6f 72  0 cor1, tab2 cor
29a60 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c  2..----..972 val
29a70 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31  ues hashing to 1
29a80 65 39 64 30 31 39 37 30 61 65 35 30 38 34 38 36  e9d01970ae508486
29a90 64 64 61 62 65 63 39 36 37 62 62 31 37 36 63 0d  ddabec967bb176c.
29aa0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
29ab0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
29ac0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
29ad0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
29ae0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
29af0 32 31 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  210..SELECT ALL 
29b00 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + - cor0.col2 * 
29b10 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  + col0 + cor0.co
29b20 6c 32 20 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f  l2 DIV col1 + co
29b30 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
29b40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d  cor0..----..-34.
29b50 0a 2d 37 32 31 36 0d 0a 2d 37 35 39 0d 0a 0d 0a  .-7216..-759....
29b60 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
29b70 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
29b80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
29b90 61 62 65 6c 2d 31 32 31 30 0d 0a 53 45 4c 45 43  abel-1210..SELEC
29ba0 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63  T ALL + - cor0.c
29bb0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63  ol2 * + col0 + c
29bc0 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f 6c 31 20  or0.col2 / col1 
29bd0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
29be0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29bf0 2d 33 34 0d 0a 2d 37 32 31 36 0d 0a 2d 37 35 39  -34..-7216..-759
29c00 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29c10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
29c20 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  INCT + col1 * + 
29c30 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52  col1 + + col0 FR
29c40 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
29c50 0a 2d 2d 2d 2d 0d 0a 37 34 32 30 0d 0a 38 33 37  .----..7420..837
29c60 30 0d 0a 39 34 34 34 0d 0a 0d 0a 71 75 65 72 79  0..9444....query
29c70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29c80 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 35 35  CT - + col0 + 55
29c90 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
29ca0 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 32 30 0d 0a  .----..-34..20..
29cb0 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
29cc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
29cd0 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20  STINCT col0 * - 
29ce0 63 6f 6c 30 20 2b 20 2b 20 33 32 20 41 53 20 63  col0 + + 32 AS c
29cf0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
29d00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
29d10 0d 0a 2d 36 30 35 32 0d 0a 2d 36 32 30 39 0d 0a  ..-6052..-6209..
29d20 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
29d30 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
29d40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29d50 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
29d60 30 20 2a 20 2d 20 43 41 53 54 20 28 20 2b 20 39  0 * - CAST ( + 9
29d70 33 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 38  3 * - col2 + - 8
29d80 30 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d  0 AS REAL ) FROM
29d90 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 35   tab0..----..605
29da0 35 0d 0a 36 38 35 38 33 34 0d 0a 37 35 35 37 36  5..685834..75576
29db0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29dc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
29dd0 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
29de0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
29df0 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d  162..3648..7680.
29e00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29e10 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
29e20 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 28  NCT + + col1 + (
29e30 20 31 37 20 29 20 46 52 4f 4d 20 74 61 62 30 20   17 ) FROM tab0 
29e40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d  cor0..----..103.
29e50 0a 31 30 38 0d 0a 31 31 34 0d 0a 0d 0a 71 75 65  .108..114....que
29e60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29e70 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
29e80 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  + + col1 * col2 
29e90 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
29ea0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
29eb0 0a 32 38 37 31 0d 0a 37 35 34 34 0d 0a 39 38 0d  .2871..7544..98.
29ec0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
29ed0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
29ee0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
29ef0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
29f00 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
29f10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29f20 45 43 54 20 44 49 53 54 49 4e 43 54 20 37 38 20  ECT DISTINCT 78 
29f30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
29f40 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
29f50 2d 2d 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20  --..78....query 
29f60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29f70 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2d  T ALL - col2 * -
29f80 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   ( col1 ) FROM t
29f90 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d  ab2..----..1534.
29fa0 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65  .646..837....que
29fb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29fc0 4c 45 43 54 20 2b 20 2d 20 34 35 20 2a 20 2b 20  LECT + - 45 * + 
29fd0 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col0 * cor0.col0
29fe0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
29ff0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2a000 0d 0a 2d 32 35 39 32 30 0d 0a 2d 33 35 36 34 34  ..-25920..-35644
2a010 35 0d 0a 2d 35 35 31 32 35 0d 0a 0d 0a 71 75 65  5..-55125....que
2a020 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a030 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
2a040 6c 30 20 2a 20 36 34 20 46 52 4f 4d 20 74 61 62  l0 * 64 FROM tab
2a050 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 0d 0a 34 30  1..----..192..40
2a060 39 36 0d 0a 35 31 32 30 0d 0a 0d 0a 73 6b 69 70  96..5120....skip
2a070 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2a080 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2a090 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2a0a0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2a0b0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2a0c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2a0d0 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   - col1 * - col0
2a0e0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
2a0f0 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39  .----..2064..339
2a100 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79  5..8099....query
2a110 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2a120 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
2a130 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30  cor0.col1 * col0
2a140 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
2a150 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2a160 0a 31 31 38 38 32 35 0d 0a 34 39 35 33 36 0d 0a  .118825..49536..
2a170 37 32 30 38 31 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  720811....onlyif
2a180 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2a190 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2a1a0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2a1b0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2a1c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2a1d0 65 6c 2d 31 32 32 34 0d 0a 53 45 4c 45 43 54 20  el-1224..SELECT 
2a1e0 2d 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 4e  - col1 + CAST( N
2a1f0 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
2a200 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2a210 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
2a220 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
2a230 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2a240 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2a250 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2a260 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2a270 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
2a280 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2a290 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2a2a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2a2b0 32 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  24..SELECT - col
2a2c0 31 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  1 + CAST ( NULL 
2a2d0 41 53 20 52 45 41 4c 20 29 20 63 6f 6c 32 20 46  AS REAL ) col2 F
2a2e0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
2a2f0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
2a300 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
2a310 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a320 20 2d 20 63 6f 6c 30 20 2b 20 28 20 2d 20 63 6f   - col0 + ( - co
2a330 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l2 ) FROM tab1 A
2a340 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2a350 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d  21..-176..-57...
2a360 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a370 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 33  ..SELECT ALL ( 3
2a380 34 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  4 ) AS col1 FROM
2a390 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2a3a0 2d 2d 2d 0d 0a 33 34 0d 0a 33 34 0d 0a 33 34 0d  ---..34..34..34.
2a3b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a3c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2a3d0 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  NCT - cor0.col0 
2a3e0 2a 20 36 36 20 2b 20 2d 20 63 6f 6c 30 20 41 53  * 66 + - col0 AS
2a3f0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2a400 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2a410 31 36 30 38 0d 0a 2d 32 33 34 35 0d 0a 2d 35 39  1608..-2345..-59
2a420 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  63....query I ro
2a430 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2a440 53 54 49 4e 43 54 20 2d 20 32 32 20 41 53 20 63  STINCT - 22 AS c
2a450 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2a460 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32   cor0..----..-22
2a470 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2a480 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2a490 28 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  ( + col2 ) AS co
2a4a0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2a4b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a  cor0..----..54..
2a4c0 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  57..96....query 
2a4d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a4e0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
2a4f0 2b 20 2d 20 33 30 20 2a 20 63 6f 6c 32 20 46 52  + - 30 * col2 FR
2a500 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2a510 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 33 0d 0a 2d 37  .----..-1123..-7
2a520 32 31 0d 0a 2d 37 37 39 0d 0a 0d 0a 71 75 65 72  21..-779....quer
2a530 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a540 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  ECT cor0.col2 FR
2a550 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 20  OM tab1 AS cor0 
2a560 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20  CROSS JOIN tab0 
2a570 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
2a580 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2a590 74 6f 20 38 30 63 61 30 61 31 63 63 33 33 37 61  to 80ca0a1cc337a
2a5a0 37 37 31 34 61 38 39 39 30 61 37 36 34 63 66 64  7714a8990a764cfd
2a5b0 62 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  b17....query I r
2a5c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34  owsort..SELECT 4
2a5d0 37 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  7 FROM tab0, tab
2a5e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2a5f0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
2a600 67 20 74 6f 20 34 66 65 31 39 32 66 32 39 36 37  g to 4fe192f2967
2a610 39 31 65 31 65 34 30 65 61 30 30 61 36 38 61 61  91e1e40ea00a68aa
2a620 38 64 61 62 37 0d 0a 0d 0a 71 75 65 72 79 20 49  8dab7....query I
2a630 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a640 20 41 4c 4c 20 2d 20 39 33 20 41 53 20 63 6f 6c   ALL - 93 AS col
2a650 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
2a660 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 33 0d 0a 2d 39 33  ..----..-93..-93
2a670 0d 0a 2d 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-93....onlyif 
2a680 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2a690 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2a6a0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2a6b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2a6c0 61 62 65 6c 2d 31 32 33 34 0d 0a 53 45 4c 45 43  abel-1234..SELEC
2a6d0 54 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56 20 2b  T ALL col2 DIV +
2a6e0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
2a6f0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab0..----..0
2a700 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..1....skipif
2a710 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2a720 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2a730 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2a740 32 33 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  234..SELECT ALL 
2a750 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 30 20 41 53  col2 / + col0 AS
2a760 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
2a770 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a  .----..0..0..1..
2a780 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a790 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
2a7a0 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 34 30  l2 * col2 + + 40
2a7b0 20 2a 20 28 20 63 6f 6c 30 20 29 20 2a 20 28 20   * ( col0 ) * ( 
2a7c0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52  + cor0.col1 ) FR
2a7d0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2a7e0 0a 2d 2d 2d 2d 0d 0a 31 38 34 37 35 36 0d 0a 35  .----..184756..5
2a7f0 35 31 36 34 0d 0a 39 34 30 39 0d 0a 0d 0a 6f 6e  5164..9409....on
2a800 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2a810 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2a820 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2a830 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2a840 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 36 0d 0a  ort label-1236..
2a850 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2a860 2b 20 31 35 20 44 49 56 20 63 6f 72 30 2e 63 6f  + 15 DIV cor0.co
2a870 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2a880 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
2a890 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2a8a0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2a8b0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2a8c0 72 74 20 6c 61 62 65 6c 2d 31 32 33 36 0d 0a 53  rt label-1236..S
2a8d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2a8e0 20 31 35 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20   15 / cor0.col1 
2a8f0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2a900 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d  0..----..0..1...
2a910 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a920 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2a930 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  T + + col2 * + c
2a940 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol0 * + col1 AS 
2a950 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2a960 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
2a970 39 36 35 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35  9652..51034..585
2a980 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2a990 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
2a9a0 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20  0.col1 * col1 * 
2a9b0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
2a9c0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2a9d0 2d 2d 2d 2d 0d 0a 31 30 39 38 32 0d 0a 32 35 39  ----..10982..259
2a9e0 34 37 0d 0a 39 30 35 30 36 0d 0a 0d 0a 6f 6e 6c  47..90506....onl
2a9f0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2aa00 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2aa10 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2aa20 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2aa30 72 74 20 6c 61 62 65 6c 2d 31 32 33 39 0d 0a 53  rt label-1239..S
2aa40 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2aa50 20 28 20 63 6f 6c 31 20 29 20 44 49 56 20 36 33   ( col1 ) DIV 63
2aa60 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2aa70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a  r0..----..-1....
2aa80 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2aa90 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2aaa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2aab0 61 62 65 6c 2d 31 32 33 39 0d 0a 53 45 4c 45 43  abel-1239..SELEC
2aac0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 63  T DISTINCT - ( c
2aad0 6f 6c 31 20 29 20 2f 20 36 33 20 46 52 4f 4d 20  ol1 ) / 63 FROM 
2aae0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2aaf0 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20  --..-1....query 
2ab00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ab10 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b  T ALL - + col1 +
2ab20 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 46   col2 * + col2 F
2ab30 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2ab40 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 30 0d 0a 33 32  ..----..2890..32
2ab50 33 39 0d 0a 39 32 30 33 0d 0a 0d 0a 71 75 65 72  39..9203....quer
2ab60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ab70 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20  ECT cor0.col2 - 
2ab80 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
2ab90 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
2aba0 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39  ---..-53..-9..-9
2abb0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
2abc0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2abd0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2abe0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2abf0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2ac00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ac10 45 4c 45 43 54 20 2d 20 2d 20 38 32 20 2a 20 63  ELECT - - 82 * c
2ac20 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
2ac30 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2ac40 0d 0a 32 31 33 32 0d 0a 32 32 31 34 0d 0a 33 31  ..2132..2214..31
2ac50 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
2ac60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2ac70 4c 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  L + - col1 + + c
2ac80 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
2ac90 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2aca0 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32  ---..-24..19..62
2acb0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2acc0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2acd0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2ace0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2acf0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2ad00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34  owsort label-124
2ad10 34 0d 0a 53 45 4c 45 43 54 20 36 37 20 2a 20 2b  4..SELECT 67 * +
2ad20 20 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f 6c 31   col1 + + ( col1
2ad30 20 29 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d 20   ) * + col1 * - 
2ad40 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45  CAST( NULL AS DE
2ad50 43 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c 31 20  CIMAL ) AS col1 
2ad60 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2ad70 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
2ad80 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
2ad90 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2ada0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2adb0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2adc0 6c 2d 31 32 34 34 0d 0a 53 45 4c 45 43 54 20 36  l-1244..SELECT 6
2add0 37 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 28  7 * + col1 + + (
2ade0 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 31   col1 ) * + col1
2adf0 20 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   * - CAST ( NULL
2ae00 20 41 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f   AS REAL ) AS co
2ae10 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2ae20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
2ae30 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
2ae40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ae50 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 39  .SELECT ALL - 89
2ae60 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
2ae70 0a 2d 2d 2d 2d 0d 0a 2d 38 39 0d 0a 2d 38 39 0d  .----..-89..-89.
2ae80 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-89....query I 
2ae90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2aea0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20  + col1 * col0 * 
2aeb0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2aec0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
2aed0 39 36 35 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35  9652..51034..585
2aee0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2aef0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34  sort..SELECT + 4
2af00 30 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 39 32 20  0 + col0 * + 92 
2af10 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2af20 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2af30 0a 36 38 34 0d 0a 37 32 31 36 0d 0a 37 33 30 38  .684..7216..7308
2af40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2af50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2af60 2d 20 2b 20 32 36 20 46 52 4f 4d 20 74 61 62 32  - + 26 FROM tab2
2af70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2af80 2d 32 36 0d 0a 2d 32 36 0d 0a 2d 32 36 0d 0a 0d  -26..-26..-26...
2af90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2afa0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
2afb0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52  col0 * + col2 FR
2afc0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2afd0 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36  .----..-162..-36
2afe0 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65  48..-7680....que
2aff0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2b000 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
2b010 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30  r0.col1 + + col0
2b020 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 31 20 2a 20   * - ( - col1 * 
2b030 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 29 20 46 52  col0 + col0 ) FR
2b040 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2b050 2d 2d 0d 0a 31 35 30 31 0d 0a 33 35 32 39 33 31  --..1501..352931
2b060 0d 0a 39 39 38 37 33 0d 0a 0d 0a 71 75 65 72 79  ..99873....query
2b070 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b080 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a  CT col1 * col1 *
2b090 20 37 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   71 AS col1 FROM
2b0a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2b0b0 2d 2d 2d 0d 0a 32 30 35 31 39 0d 0a 32 34 37 31  ---..20519..2471
2b0c0 35 31 0d 0a 36 38 32 33 31 0d 0a 0d 0a 71 75 65  51..68231....que
2b0d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2b0e0 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  LECT + + col2 + 
2b0f0 38 34 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  84 * + col2 AS c
2b100 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
2b110 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 31   cor0..----..221
2b120 30 0d 0a 32 32 39 35 0d 0a 33 32 33 30 0d 0a 0d  0..2295..3230...
2b130 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b140 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
2b150 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 28   col2 + col0 * (
2b160 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
2b170 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2b180 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 32 30  0..----..162..20
2b190 30 32 0d 0a 32 39 36 34 0d 0a 0d 0a 71 75 65 72  02..2964....quer
2b1a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b1b0 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  ECT + col0 + - c
2b1c0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
2b1d0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
2b1e0 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 71  ..-9..34..7....q
2b1f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b200 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 36 38 20  SELECT ALL + 68 
2b210 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2b220 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c  2, tab1 AS cor0,
2b230 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab2 cor1..----
2b240 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
2b250 69 6e 67 20 74 6f 20 31 30 61 61 32 35 66 31 63  ing to 10aa25f1c
2b260 36 62 39 37 35 38 32 63 33 34 35 32 31 61 63 36  6b97582c34521ac6
2b270 34 35 32 65 30 62 34 0d 0a 0d 0a 71 75 65 72 79  452e0b4....query
2b280 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b290 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
2b2a0 20 2a 20 2d 20 28 20 28 20 63 6f 6c 30 20 29 20   * - ( ( col0 ) 
2b2b0 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
2b2c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34  or0..----..-2064
2b2d0 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a  ..-3395..-8099..
2b2e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b2f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  t..SELECT - cor0
2b300 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c  .col0 * cor0.col
2b310 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2b320 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
2b330 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36  -162..-3648..-76
2b340 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
2b350 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2b360 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  L + cor0.col0 AS
2b370 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
2b380 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2b390 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
2b3a0 73 68 69 6e 67 20 74 6f 20 64 64 31 38 62 39 33  shing to dd18b93
2b3b0 32 36 33 61 36 63 64 34 32 35 66 63 37 63 63 38  263a6cd425fc7cc8
2b3c0 34 64 39 31 33 37 38 37 30 0d 0a 0d 0a 6f 6e 6c  4d9137870....onl
2b3d0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2b3e0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2b3f0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2b400 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2b410 72 74 20 6c 61 62 65 6c 2d 31 32 35 39 0d 0a 53  rt label-1259..S
2b420 45 4c 45 43 54 20 38 30 20 44 49 56 20 2b 20 63  ELECT 80 DIV + c
2b430 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
2b440 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 34 0d 0a 0d 0a  ---..1..2..4....
2b450 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2b460 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2b470 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2b480 61 62 65 6c 2d 31 32 35 39 0d 0a 53 45 4c 45 43  abel-1259..SELEC
2b490 54 20 38 30 20 2f 20 2b 20 63 6f 6c 31 20 46 52  T 80 / + col1 FR
2b4a0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
2b4b0 0d 0a 32 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20  ..2..4....query 
2b4c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b4d0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 36 32 20  T DISTINCT + 62 
2b4e0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2b4f0 32 0d 0a 2d 2d 2d 2d 0d 0a 36 32 0d 0a 0d 0a 71  2..----..62....q
2b500 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
2b510 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b520 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  T * FROM tab2, t
2b530 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
2b540 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
2b550 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65  .----..972 value
2b560 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 65 36  s hashing to 5e6
2b570 35 35 62 31 32 38 37 37 37 31 38 36 38 61 38 66  55b1287771868a8f
2b580 38 36 38 35 37 34 61 39 34 64 37 34 39 0d 0a 0d  868574a94d749...
2b590 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b5a0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72  ..SELECT + + cor
2b5b0 30 2e 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 46 52  0.col1 - col2 FR
2b5c0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2b5d0 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39 36  .----..53..9..96
2b5e0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2b5f0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2b600 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2b610 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2b620 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2b630 31 32 36 33 0d 0a 53 45 4c 45 43 54 20 2b 20 31  1263..SELECT + 1
2b640 35 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 34  5 + - col2 DIV 4
2b650 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  7 AS col0 FROM t
2b660 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2b670 2d 0d 0a 31 34 0d 0a 31 35 0d 0a 31 35 0d 0a 0d  -..14..15..15...
2b680 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2b690 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2b6a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2b6b0 6c 61 62 65 6c 2d 31 32 36 33 0d 0a 53 45 4c 45  label-1263..SELE
2b6c0 43 54 20 2b 20 31 35 20 2b 20 2d 20 63 6f 6c 32  CT + 15 + - col2
2b6d0 20 2f 20 34 37 20 41 53 20 63 6f 6c 30 20 46 52   / 47 AS col0 FR
2b6e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2b6f0 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 0d 0a 31  .----..14..15..1
2b700 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
2b710 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74  sort..SELECT + t
2b720 61 62 31 2e 63 6f 6c 31 20 2d 20 33 30 20 2a 20  ab1.col1 - 30 * 
2b730 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  - cor0.col2 FROM
2b740 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
2b750 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
2b760 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32  ues hashing to 2
2b770 61 64 35 66 38 30 65 36 39 33 38 66 31 34 34 61  ad5f80e6938f144a
2b780 39 63 33 36 37 66 30 61 32 36 34 65 34 39 62 0d  9c367f0a264e49b.
2b790 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b7a0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62  rt..SELECT - tab
2b7b0 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  0.col2 * - col0 
2b7c0 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52  + col0 + col2 FR
2b7d0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab0..----..7
2b7e0 31 0d 0a 37 34 36 39 0d 0a 38 34 39 0d 0a 0d 0a  1..7469..849....
2b7f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b800 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2b810 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  l1 * col0 + - co
2b820 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
2b830 2d 2d 0d 0a 32 34 0d 0a 35 38 33 0d 0a 39 34 34  --..24..583..944
2b840 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
2b850 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
2b860 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
2b870 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b0 AS cor0 CROSS
2b880 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 30   JOIN tab2, tab0
2b890 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63   cor1, tab0 AS c
2b8a0 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76  or2..----..972 v
2b8b0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2b8c0 20 64 35 32 32 62 35 32 62 36 37 62 32 30 38 38   d522b52b67b2088
2b8d0 38 64 33 35 34 34 64 32 35 63 62 39 38 66 32 33  8d3544d25cb98f23
2b8e0 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
2b8f0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2b900 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2b910 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2b920 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2b930 2d 31 32 36 38 0d 0a 53 45 4c 45 43 54 20 44 49  -1268..SELECT DI
2b940 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 44 49  STINCT - col0 DI
2b950 56 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20  V col2 - + col1 
2b960 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
2b970 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2b980 0d 0a 2d 31 33 32 0d 0a 2d 32 38 33 38 0d 0a 2d  ..-132..-2838..-
2b990 37 34 36 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7463....skipif m
2b9a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2b9b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2b9c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 36  owsort label-126
2b9d0 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  8..SELECT DISTIN
2b9e0 43 54 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 32  CT - col0 / col2
2b9f0 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   - + col1 * + co
2ba00 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2ba10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32  cor0..----..-132
2ba20 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 33 0d 0a  ..-2838..-7463..
2ba30 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2ba40 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2ba50 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2ba60 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2ba70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2ba80 36 39 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  69..SELECT + + c
2ba90 6f 6c 30 20 44 49 56 20 2d 20 38 39 20 2b 20 2d  ol0 DIV - 89 + -
2baa0 20 38 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 46   81 DIV - col1 F
2bab0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2bac0 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 0d 0a 38 0d  ..----..3..6..8.
2bad0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2bae0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2baf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2bb00 74 20 6c 61 62 65 6c 2d 31 32 36 39 0d 0a 53 45  t label-1269..SE
2bb10 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2f 20  LECT + + col0 / 
2bb20 2d 20 38 39 20 2b 20 2d 20 38 31 20 2f 20 2d 20  - 89 + - 81 / - 
2bb30 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
2bb40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  S cor0..----..3.
2bb50 0a 36 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .6..8....query I
2bb60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2bb70 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 31 32   ALL + col1 * 12
2bb80 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2bb90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 0d 0a 33  r0..----..204..3
2bba0 37 32 0d 0a 37 30 38 0d 0a 0d 0a 71 75 65 72 79  72..708....query
2bbb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2bbc0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
2bbd0 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 34 38   + - col0 * - 48
2bbe0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2bbf0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 38 0d 0a  r0..----..1238..
2bc00 31 37 37 37 0d 0a 34 33 36 33 0d 0a 0d 0a 73 6b  1777..4363....sk
2bc10 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2bc20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2bc30 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2bc40 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2bc50 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2bc60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2bc70 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 38 38 20   cor0.col1 + 88 
2bc80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
2bc90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
2bca0 35 0d 0a 31 31 39 0d 0a 31 34 37 0d 0a 0d 0a 73  5..119..147....s
2bcb0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2bcc0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2bcd0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2bce0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2bcf0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2bd00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2bd10 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 35 34 20  ALL + col0 * 54 
2bd20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
2bd30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a  or0..----..162..
2bd40 33 34 35 36 0d 0a 34 33 32 30 0d 0a 0d 0a 71 75  3456..4320....qu
2bd50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2bd60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2bd70 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b   col0 * + col1 +
2bd80 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30   - col1 * + col0
2bd90 20 2b 20 2b 20 34 36 20 46 52 4f 4d 20 74 61 62   + + 46 FROM tab
2bda0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2bdb0 0a 2d 31 31 30 0d 0a 2d 31 32 33 34 0d 0a 2d 32  .-110..-1234..-2
2bdc0 30 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  034....query I r
2bdd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2bde0 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 37 33 20 2b  LL + col0 * 73 +
2bdf0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
2be00 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2be10 0a 32 34 35 0d 0a 34 36 38 32 0d 0a 35 38 35 33  .245..4682..5853
2be20 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2be30 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2be40 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2be50 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2be60 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2be70 31 32 37 36 0d 0a 53 45 4c 45 43 54 20 2b 20 34  1276..SELECT + 4
2be80 38 20 44 49 56 20 2b 20 63 6f 6c 31 20 2d 20 63  8 DIV + col1 - c
2be90 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
2bea0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   tab2..----..-26
2beb0 0d 0a 2d 32 36 0d 0a 2d 33 36 0d 0a 0d 0a 73 6b  ..-26..-36....sk
2bec0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2bed0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2bee0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2bef0 65 6c 2d 31 32 37 36 0d 0a 53 45 4c 45 43 54 20  el-1276..SELECT 
2bf00 2b 20 34 38 20 2f 20 2b 20 63 6f 6c 31 20 2d 20  + 48 / + col1 - 
2bf10 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
2bf20 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
2bf30 36 0d 0a 2d 32 36 0d 0a 2d 33 36 0d 0a 0d 0a 71  6..-26..-36....q
2bf40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2bf50 53 45 4c 45 43 54 20 2b 20 39 31 20 2a 20 2b 20  SELECT + 91 * + 
2bf60 35 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  5 + - col0 FROM 
2bf70 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2bf80 0a 33 37 35 0d 0a 33 39 31 0d 0a 34 35 32 0d 0a  .375..391..452..
2bf90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2bfa0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 35 20 2a  t..SELECT - 55 *
2bfb0 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
2bfc0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2bfd0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 30 35 0d 0a  0..----..-1705..
2bfe0 2d 33 32 34 35 0d 0a 2d 39 33 35 0d 0a 0d 0a 73  -3245..-935....s
2bff0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2c000 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2c010 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2c020 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2c030 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2c040 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c050 2d 20 2b 20 31 33 20 63 6f 6c 32 20 46 52 4f 4d  - + 13 col2 FROM
2c060 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2c070 2d 2d 2d 0d 0a 2d 31 33 0d 0a 2d 31 33 0d 0a 2d  ---..-13..-13..-
2c080 31 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  13....onlyif mys
2c090 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2c0a0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2c0b0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2c0c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2c0d0 6c 2d 31 32 38 30 0d 0a 53 45 4c 45 43 54 20 2b  l-1280..SELECT +
2c0e0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56   - cor0.col0 DIV
2c0f0 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 32 20   cor0.col2 col2 
2c100 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2c110 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 35  0..----..-1..-35
2c120 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..0....skipif po
2c130 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2c140 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2c150 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2c160 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2c170 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2c180 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2c190 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2c1a0 61 62 65 6c 2d 31 32 38 30 0d 0a 53 45 4c 45 43  abel-1280..SELEC
2c1b0 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  T + - cor0.col0 
2c1c0 2f 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 32  / cor0.col2 col2
2c1d0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2c1e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33  r0..----..-1..-3
2c1f0 35 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5..0....query I 
2c200 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c210 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col2 + + cor0.co
2c220 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 * col2 FROM t
2c230 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2c240 2d 0d 0a 32 31 36 0d 0a 33 37 30 35 0d 0a 37 37  -..216..3705..77
2c250 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
2c260 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2c270 53 54 49 4e 43 54 20 2d 20 33 34 20 41 53 20 63  STINCT - 34 AS c
2c280 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2c290 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34   cor0..----..-34
2c2a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c2b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
2c2c0 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53  col2 * + col1 AS
2c2d0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2c2e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2c2f0 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37  1248..-1404..-57
2c300 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2c310 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35  sort..SELECT - 5
2c320 31 20 2a 20 2d 20 33 31 20 46 52 4f 4d 20 74 61  1 * - 31 FROM ta
2c330 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
2c340 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
2c350 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
2c360 68 61 73 68 69 6e 67 20 74 6f 20 63 36 65 39 32  hashing to c6e92
2c370 30 30 61 36 61 33 63 65 38 33 64 32 36 33 33 30  00a6a3ce83d26330
2c380 65 32 38 34 38 65 61 35 35 30 36 0d 0a 0d 0a 6f  e2848ea5506....o
2c390 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2c3a0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2c3b0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2c3c0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2c3d0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 35 0d  sort label-1285.
2c3e0 0a 53 45 4c 45 43 54 20 2b 20 32 33 20 44 49 56  .SELECT + 23 DIV
2c3f0 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
2c400 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2c410 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  .-1..0..0....ski
2c420 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2c430 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2c440 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2c450 6c 2d 31 32 38 35 0d 0a 53 45 4c 45 43 54 20 2b  l-1285..SELECT +
2c460 20 32 33 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f   23 / - col1 FRO
2c470 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2c480 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a  ----..-1..0..0..
2c490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c4a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2c4b0 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  CT - col1 * - co
2c4c0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
2c4d0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2c4e0 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34  --..1343..217..4
2c4f0 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  602....query I r
2c500 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2c510 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  LL - col2 * - co
2c520 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l1 * col2 AS col
2c530 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
2c540 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 35 39 39  or0..----..22599
2c550 0d 0a 32 34 35 34 38 0d 0a 33 39 38 38 34 0d 0a  ..24548..39884..
2c560 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c570 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2c580 43 54 20 31 38 20 2a 20 63 6f 6c 32 20 46 52 4f  CT 18 * col2 FRO
2c590 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2c5a0 2d 2d 2d 2d 0d 0a 31 30 32 36 0d 0a 31 37 32 38  ----..1026..1728
2c5b0 0d 0a 39 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..972....query I
2c5c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c5d0 20 2b 20 2d 20 36 34 20 2a 20 2b 20 63 6f 6c 31   + - 64 * + col1
2c5e0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2c5f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 30 34 0d  r0..----..-5504.
2c600 0a 2d 35 38 32 34 0d 0a 2d 36 32 30 38 0d 0a 0d  .-5824..-6208...
2c610 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c620 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
2c630 32 20 2b 20 63 6f 6c 32 20 2a 20 33 33 20 2a 20  2 + col2 * 33 * 
2c640 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  - cor0.col0 FROM
2c650 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
2c660 0d 0a 2d 36 32 36 34 0d 0a 2d 36 36 39 35 30 0d  ..-6264..-66950.
2c670 0a 2d 39 39 31 30 34 0d 0a 0d 0a 71 75 65 72 79  .-99104....query
2c680 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c690 43 54 20 41 4c 4c 20 2b 20 31 37 20 2b 20 63 6f  CT ALL + 17 + co
2c6a0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2c6b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a  cor0..----..18..
2c6c0 35 30 0d 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20  50..99....query 
2c6d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c6e0 54 20 41 4c 4c 20 2b 20 38 36 20 2a 20 63 6f 72  T ALL + 86 * cor
2c6f0 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0.col2 FROM tab2
2c700 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c710 32 32 33 36 0d 0a 32 33 32 32 0d 0a 33 32 36 38  2236..2322..3268
2c720 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c730 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2c740 49 4e 43 54 20 2d 20 38 38 20 2b 20 63 6f 6c 32  INCT - 88 + col2
2c750 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2c760 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d  r0..----..-55..-
2c770 36 0d 0a 2d 38 37 0d 0a 0d 0a 71 75 65 72 79 20  6..-87....query 
2c780 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c790 54 20 2d 20 36 37 20 41 53 20 63 6f 6c 32 20 46  T - 67 AS col2 F
2c7a0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2c7b0 2d 36 37 0d 0a 2d 36 37 0d 0a 2d 36 37 0d 0a 0d  -67..-67..-67...
2c7c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c7d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2c7e0 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20  T col1 + col2 * 
2c7f0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
2c800 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2c810 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 37 0d 0a 32 32  ..----..2087..22
2c820 30 0d 0a 33 30 31 39 0d 0a 0d 0a 73 6b 69 70 69  0..3019....skipi
2c830 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2c840 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2c850 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2c860 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2c870 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2c880 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2c890 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  INCT - col2 * co
2c8a0 6c 31 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46  l1 + col1 col2 F
2c8b0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
2c8c0 2d 2d 2d 0d 0a 2d 32 37 35 32 0d 0a 2d 37 33 37  ---..-2752..-737
2c8d0 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..0....query I 
2c8e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c8f0 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20  - col2 + col0 * 
2c900 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
2c910 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2c920 2d 2d 2d 2d 0d 0a 32 32 0d 0a 36 30 35 38 0d 0a  ----..22..6058..
2c930 36 32 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6203....query I 
2c940 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c950 41 4c 4c 20 2d 20 38 33 20 2a 20 63 6f 6c 32 20  ALL - 83 * col2 
2c960 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
2c970 2d 2d 2d 2d 0d 0a 2d 34 34 38 32 0d 0a 2d 34 37  ----..-4482..-47
2c980 33 31 0d 0a 2d 37 39 36 38 0d 0a 0d 0a 71 75 65  31..-7968....que
2c990 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c9a0 4c 45 43 54 20 2b 20 35 33 20 41 53 20 63 6f 6c  LECT + 53 AS col
2c9b0 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
2c9c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2c9d0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
2c9e0 67 20 74 6f 20 66 65 64 65 36 30 33 33 64 65 65  g to fede6033dee
2c9f0 33 34 36 64 62 64 32 37 32 30 38 35 63 30 35 37  346dbd272085c057
2ca00 32 34 66 64 61 0d 0a 0d 0a 71 75 65 72 79 20 49  24fda....query I
2ca10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ca20 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b   DISTINCT col0 +
2ca30 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f   col0 * col1 FRO
2ca40 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2ca50 2d 2d 2d 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d  ----..1422..224.
2ca60 0a 34 36 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .4680....skipif 
2ca70 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2ca80 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2ca90 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2caa0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2cab0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cac0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 30 20 63  t..SELECT + 50 c
2cad0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
2cae0 2d 2d 2d 0d 0a 35 30 0d 0a 35 30 0d 0a 35 30 0d  ---..50..50..50.
2caf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2cb00 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2cb10 20 39 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f   90 + col0 AS co
2cb20 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2cb30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 0d  cor0..----..114.
2cb40 0a 31 32 35 0d 0a 31 37 39 0d 0a 0d 0a 71 75 65  .125..179....que
2cb50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2cb60 4c 45 43 54 20 2b 20 28 20 2d 20 38 31 20 29 20  LECT + ( - 81 ) 
2cb70 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
2cb80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
2cb90 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2cba0 74 6f 20 32 30 35 62 33 66 66 32 64 37 62 31 38  to 205b3ff2d7b18
2cbb0 31 37 63 39 38 64 37 39 38 30 62 38 63 31 37 65  17c98d7980b8c17e
2cbc0 36 63 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  6c1....query I r
2cbd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2cbe0 49 53 54 49 4e 43 54 20 2d 20 38 36 20 41 53 20  ISTINCT - 86 AS 
2cbf0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2cc00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
2cc10 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2cc20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2cc30 6f 6c 31 20 2a 20 2d 20 32 37 20 46 52 4f 4d 20  ol1 * - 27 FROM 
2cc40 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39  tab2..----..-159
2cc50 33 0d 0a 2d 34 35 39 0d 0a 2d 38 33 37 0d 0a 0d  3..-459..-837...
2cc60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2cc70 0d 0a 53 45 4c 45 43 54 20 31 36 20 41 53 20 63  ..SELECT 16 AS c
2cc80 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2cc90 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
2cca0 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
2ccb0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
2ccc0 73 68 69 6e 67 20 74 6f 20 33 66 64 62 30 38 65  shing to 3fdb08e
2ccd0 63 32 65 33 64 34 62 36 34 32 64 64 34 35 39 34  c2e3d4b642dd4594
2cce0 37 37 38 63 63 61 38 62 33 0d 0a 0d 0a 6f 6e 6c  778cca8b3....onl
2ccf0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2cd00 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2cd10 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2cd20 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2cd30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2cd40 6c 61 62 65 6c 2d 31 33 30 37 0d 0a 53 45 4c 45  label-1307..SELE
2cd50 43 54 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53  CT CAST( col0 AS
2cd60 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 32   SIGNED ) + col2
2cd70 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
2cd80 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2cd90 0a 31 39 36 0d 0a 32 31 30 36 0d 0a 33 30 38 31  .196..2106..3081
2cda0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2cdb0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2cdc0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2cdd0 72 74 20 6c 61 62 65 6c 2d 31 33 30 37 0d 0a 53  rt label-1307..S
2cde0 45 4c 45 43 54 20 43 41 53 54 20 28 20 63 6f 6c  ELECT CAST ( col
2cdf0 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  0 AS INTEGER ) +
2ce00 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20   col2 * col0 AS 
2ce10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
2ce20 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a 32 31 30 36 0d  ----..196..2106.
2ce30 0a 33 30 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .3081....query I
2ce40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ce50 20 44 49 53 54 49 4e 43 54 20 2b 20 31 20 41 53   DISTINCT + 1 AS
2ce60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
2ce70 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .----..1....quer
2ce80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ce90 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 28 20 63  ECT col2 * + ( c
2cea0 6f 6c 32 20 2a 20 63 6f 6c 30 20 29 20 2d 20 2b  ol2 * col0 ) - +
2ceb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
2cec0 0a 2d 2d 2d 2d 0d 0a 32 30 37 39 32 36 0d 0a 37  .----..207926..7
2ced0 33 37 32 36 37 0d 0a 38 37 32 32 0d 0a 0d 0a 71  37267..8722....q
2cee0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2cef0 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 30 20  SELECT + ( col0 
2cf00 29 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 36  ) + + col1 * - 6
2cf10 33 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  3 FROM tab2..---
2cf20 2d 0d 0a 2d 31 39 34 36 0d 0a 2d 33 36 33 39 0d  -..-1946..-3639.
2cf30 0a 2d 39 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-992....query I
2cf40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2cf50 20 2b 20 35 39 20 2a 20 63 6f 6c 31 20 41 53 20   + 59 * col1 AS 
2cf60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
2cf70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
2cf80 30 33 0d 0a 31 38 32 39 0d 0a 33 34 38 31 0d 0a  03..1829..3481..
2cf90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cfa0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2cfb0 63 6f 6c 30 20 2a 20 2b 20 37 32 20 41 53 20 63  col0 * + 72 AS c
2cfc0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2cfd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36   cor0..----..216
2cfe0 0d 0a 34 36 30 38 0d 0a 35 37 36 30 0d 0a 0d 0a  ..4608..5760....
2cff0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d000 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
2d010 20 34 35 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f   45 * + col0 FRO
2d020 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
2d030 2d 0d 0a 31 33 35 30 39 30 0d 0a 38 35 30 35 0d  -..135090..8505.
2d040 0a 39 31 32 36 30 0d 0a 0d 0a 71 75 65 72 79 20  .91260....query 
2d050 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d060 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  T - col0 + col1 
2d070 2a 20 2d 20 31 36 20 2a 20 63 6f 6c 32 20 46 52  * - 16 * col2 FR
2d080 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
2d090 31 31 39 34 38 31 0d 0a 2d 31 35 38 37 0d 0a 2d  119481..-1587..-
2d0a0 34 35 34 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49  45432....query I
2d0b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d0c0 20 37 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   73 AS col0 FROM
2d0d0 20 74 61 62 32 2c 20 74 61 62 32 20 63 6f 72 30   tab2, tab2 cor0
2d0e0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
2d0f0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
2d100 68 61 73 68 69 6e 67 20 74 6f 20 33 39 33 33 61  hashing to 3933a
2d110 39 30 36 64 31 37 61 38 32 30 63 63 66 39 35 34  906d17a820ccf954
2d120 36 37 65 32 32 30 36 64 66 38 66 0d 0a 0d 0a 6f  67e2206df8f....o
2d130 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2d140 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2d150 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2d160 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2d170 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d180 74 20 6c 61 62 65 6c 2d 31 33 31 36 0d 0a 53 45  t label-1316..SE
2d190 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
2d1a0 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  * CAST( NULL AS 
2d1b0 53 49 47 4e 45 44 20 29 20 2d 20 2b 20 28 20 2b  SIGNED ) - + ( +
2d1c0 20 63 6f 6c 32 20 29 20 63 6f 6c 30 20 46 52 4f   col2 ) col0 FRO
2d1d0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2d1e0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
2d1f0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
2d200 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2d210 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2d220 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2d230 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2d240 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
2d250 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2d260 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d270 74 20 6c 61 62 65 6c 2d 31 33 31 36 0d 0a 53 45  t label-1316..SE
2d280 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
2d290 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  * CAST ( NULL AS
2d2a0 20 49 4e 54 45 47 45 52 20 29 20 2d 20 2b 20 28   INTEGER ) - + (
2d2b0 20 2b 20 63 6f 6c 32 20 29 20 63 6f 6c 30 20 46   + col2 ) col0 F
2d2c0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2d2d0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
2d2e0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
2d2f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d300 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
2d310 20 63 6f 6c 30 20 2b 20 2d 20 35 33 20 46 52 4f   col0 + - 53 FRO
2d320 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2d330 2d 2d 2d 2d 0d 0a 2d 35 30 0d 0a 31 31 0d 0a 32  ----..-50..11..2
2d340 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
2d350 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2d360 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2d370 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2d380 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d390 2d 31 33 31 38 0d 0a 53 45 4c 45 43 54 20 41 4c  -1318..SELECT AL
2d3a0 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 28 20 37  L + col2 + + ( 7
2d3b0 32 20 29 20 44 49 56 20 63 6f 6c 32 20 2d 20 63  2 ) DIV col2 - c
2d3c0 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 * col1 FROM 
2d3d0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2d3e0 2d 2d 0d 0a 2d 37 33 36 31 0d 0a 2d 38 31 39 39  --..-7361..-8199
2d3f0 0d 0a 2d 39 33 33 36 0d 0a 0d 0a 73 6b 69 70 69  ..-9336....skipi
2d400 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2d410 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2d420 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2d430 31 33 31 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1318..SELECT ALL
2d440 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 28 20 37 32   + col2 + + ( 72
2d450 20 29 20 2f 20 63 6f 6c 32 20 2d 20 63 6f 6c 31   ) / col2 - col1
2d460 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
2d470 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2d480 0a 2d 37 33 36 31 0d 0a 2d 38 31 39 39 0d 0a 2d  .-7361..-8199..-
2d490 39 33 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9336....query I 
2d4a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d4b0 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  ALL - col1 * - c
2d4c0 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 * col1 FROM 
2d4d0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2d4e0 2d 2d 0d 0a 31 37 37 35 30 34 0d 0a 33 32 39 33  --..177504..3293
2d4f0 31 35 0d 0a 37 33 37 30 30 39 0d 0a 0d 0a 71 75  15..737009....qu
2d500 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d510 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
2d520 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 * col0 FROM ta
2d530 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  b2 cor0..----..4
2d540 39 0d 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d  9..6084..6241...
2d550 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d560 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2d570 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  T + col1 + col1 
2d580 2b 20 2d 20 28 20 63 6f 6c 30 20 29 20 41 53 20  + - ( col0 ) AS 
2d590 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
2d5a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 0d 0a  or0..----..-44..
2d5b0 2d 35 34 0d 0a 34 39 0d 0a 0d 0a 71 75 65 72 79  -54..49....query
2d5c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d5d0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
2d5e0 6c 30 20 2d 20 2b 20 28 20 2d 20 63 6f 6c 30 20  l0 - + ( - col0 
2d5f0 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
2d600 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2d610 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a  -..128..160..6..
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 32 38 20 2b  t..SELECT + 28 +
2d640 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
2d650 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 0d  cor0..----..124.
2d660 0a 38 32 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79  .82..85....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 44 49 53 54 49 4e 43 54 20 2b 20 35 33  CT DISTINCT + 53
2d690 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2d6a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 0d 0a  r0..----..53....
2d6b0 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
2d6c0 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
2d6d0 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61  CT ALL * FROM ta
2d6e0 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b2, tab2 AS cor0
2d6f0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20  , tab1 AS cor1, 
2d700 74 61 62 32 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  tab2 cor2..----.
2d710 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68  .972 values hash
2d720 69 6e 67 20 74 6f 20 63 61 66 36 61 64 62 39 39  ing to caf6adb99
2d730 33 36 35 31 30 32 30 38 66 35 39 34 35 61 37 65  36510208f5945a7e
2d740 35 63 37 36 66 31 34 0d 0a 0d 0a 71 75 65 72 79  5c76f14....query
2d750 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d760 43 54 20 41 4c 4c 20 2d 20 35 39 20 2a 20 63 6f  CT ALL - 59 * co
2d770 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
2d780 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2d790 2d 2d 0d 0a 2d 31 34 31 36 0d 0a 2d 32 30 36 35  --..-1416..-2065
2d7a0 0d 0a 2d 35 32 35 31 0d 0a 0d 0a 71 75 65 72 79  ..-5251....query
2d7b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d7c0 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  CT + col1 * + co
2d7d0 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  r0.col2 AS col0 
2d7e0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2d7f0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31  0..----..1248..1
2d800 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 73 6b 69 70  404..570....skip
2d810 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2d820 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2d830 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2d840 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2d850 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2d860 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2d870 20 31 35 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   15 col1 FROM ta
2d880 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
2d890 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
2d8a0 20 68 61 73 68 69 6e 67 20 74 6f 20 64 31 64 32   hashing to d1d2
2d8b0 38 30 64 33 38 62 66 39 63 32 64 35 64 35 65 63  80d38bf9c2d5d5ec
2d8c0 39 30 64 64 34 33 61 65 61 66 66 64 0d 0a 0d 0a  90dd43aeaffd....
2d8d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d8e0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2d8f0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 36   + cor0.col2 + 6
2d900 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
2d910 32 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  2 cor0, tab2 AS 
2d920 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a  cor1..----..86..
2d930 38 37 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  87..98....query 
2d940 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d950 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
2d960 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  + - col0 AS col1
2d970 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2d980 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71  r0..----..0....q
2d990 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
2d9a0 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
2d9b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20  LECT DISTINCT * 
2d9c0 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
2d9d0 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
2d9e0 20 63 6f 72 31 2c 20 74 61 62 31 2c 20 74 61 62   cor1, tab1, tab
2d9f0 31 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36  1 cor2..----..36
2da00 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  45 values hashin
2da10 67 20 74 6f 20 34 34 35 34 35 61 36 32 39 37 61  g to 44545a6297a
2da20 61 32 39 62 62 37 33 30 66 66 62 39 30 37 63 31  a29bb730ffb907c1
2da30 33 62 63 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49  3bc58....query I
2da40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2da50 20 2d 20 63 6f 6c 30 20 2a 20 74 61 62 31 2e 63   - col0 * tab1.c
2da60 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 31 20 2a  ol0 * ( - col1 *
2da70 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   + col1 ) AS col
2da80 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
2da90 2d 0d 0a 31 30 38 31 36 30 30 0d 0a 34 30 39 36  -..1081600..4096
2daa0 30 30 0d 0a 36 30 38 34 0d 0a 0d 0a 71 75 65 72  00..6084....quer
2dab0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2dac0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2dad0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 36  ol2 * + col0 * 6
2dae0 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  6 AS col1 FROM t
2daf0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 39 32  ab1..----..10692
2db00 0d 0a 32 34 30 37 36 38 0d 0a 35 30 36 38 38 30  ..240768..506880
2db10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2db20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2db30 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 32 20 41  INCT tab0.col2 A
2db40 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
2db50 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
2db60 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d  ----..1..33..82.
2db70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2db80 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2db90 4e 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20  NCT - tab2.col2 
2dba0 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
2dbb0 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f  cor0, tab1 AS co
2dbc0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d  r1..----..-26..-
2dbd0 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79  27..-38....query
2dbe0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2dbf0 43 54 20 41 4c 4c 20 2b 20 2d 20 35 39 20 46 52  CT ALL + - 59 FR
2dc00 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2dc10 0a 2d 2d 2d 2d 0d 0a 2d 35 39 0d 0a 2d 35 39 0d  .----..-59..-59.
2dc20 0a 2d 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-59....query I 
2dc30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2dc40 41 4c 4c 20 2b 20 38 38 20 2a 20 2d 20 63 6f 6c  ALL + 88 * - col
2dc50 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
2dc60 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2dc70 2d 0d 0a 2d 31 34 39 36 0d 0a 2d 32 37 32 38 0d  -..-1496..-2728.
2dc80 0a 2d 35 31 39 32 0d 0a 0d 0a 71 75 65 72 79 20  .-5192....query 
2dc90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2dca0 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  T - col1 * + col
2dcb0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
2dcc0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
2dcd0 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36  -1343..-217..-46
2dce0 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  02....skipif pos
2dcf0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2dd00 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2dd10 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2dd20 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2dd30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2dd40 53 45 4c 45 43 54 20 2b 20 34 31 20 2a 20 63 6f  SELECT + 41 * co
2dd50 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
2dd60 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2dd70 0a 31 33 35 33 0d 0a 33 33 36 32 0d 0a 34 31 0d  .1353..3362..41.
2dd80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2dd90 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2dda0 4e 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  NCT col2 * + cor
2ddb0 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  0.col1 AS col0 F
2ddc0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
2ddd0 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d  ---..2838..7462.
2dde0 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .97....query I r
2ddf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32  owsort..SELECT 2
2de00 36 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  6 * col1 FROM ta
2de10 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2de20 0d 0a 31 35 33 34 0d 0a 34 34 32 0d 0a 38 30 36  ..1534..442..806
2de30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2de40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2de50 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 2d  + ( - col2 ) * -
2de60 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c   col2 + cor0.col
2de70 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
2de80 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2de90 2d 0d 0a 31 31 32 32 0d 0a 32 0d 0a 36 38 30 36  -..1122..2..6806
2dea0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2deb0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2dec0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2ded0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2dee0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2def0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34  owsort label-134
2df00 33 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  3..SELECT cor0.c
2df10 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c  ol0 * CAST( NULL
2df20 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
2df30 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
2df40 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2df50 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
2df60 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
2df70 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2df80 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2df90 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2dfa0 34 33 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  43..SELECT cor0.
2dfb0 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 4e 55  col0 * CAST ( NU
2dfc0 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
2dfd0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  * col2 AS col0 F
2dfe0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2dff0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
2e000 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
2e010 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e020 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  ECT col2 + + col
2e030 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 * + col1 FROM 
2e040 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30  tab2..----..1560
2e050 0d 0a 36 38 34 0d 0a 38 36 34 0d 0a 0d 0a 6f 6e  ..684..864....on
2e060 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2e070 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2e080 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2e090 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2e0a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e0b0 20 6c 61 62 65 6c 2d 31 33 34 35 0d 0a 53 45 4c   label-1345..SEL
2e0c0 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30  ECT ALL + - col0
2e0d0 20 2b 20 2d 20 43 41 53 54 28 20 2d 20 63 6f 6c   + - CAST( - col
2e0e0 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  0 AS SIGNED ) FR
2e0f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2e100 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
2e110 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2e120 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2e130 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e140 20 6c 61 62 65 6c 2d 31 33 34 35 0d 0a 53 45 4c   label-1345..SEL
2e150 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30  ECT ALL + - col0
2e160 20 2b 20 2d 20 43 41 53 54 20 28 20 2d 20 63 6f   + - CAST ( - co
2e170 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
2e180 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2e190 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
2e1a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2e1b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
2e1c0 6c 30 20 2b 20 2d 20 28 20 28 20 63 6f 6c 32 20  l0 + - ( ( col2 
2e1d0 29 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ) ) AS col0 FROM
2e1e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2e1f0 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d 0a  ---..-9..34..7..
2e200 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2e210 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2e220 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2e230 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2e240 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2e250 34 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  47..SELECT DISTI
2e260 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56  NCT + - col2 DIV
2e270 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
2e280 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  1 cor0..----..0.
2e290 0a 31 0d 0a 31 38 0d 0a 0d 0a 73 6b 69 70 69 66  .1..18....skipif
2e2a0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2e2b0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2e2c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2e2d0 33 34 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  347..SELECT DIST
2e2e0 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2f 20  INCT + - col2 / 
2e2f0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
2e300 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2e310 31 0d 0a 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49  1..18....query I
2e320 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e330 20 63 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 30   col2 + ( - col0
2e340 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 29   + + cor0.col2 )
2e350 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2e360 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 34  r0..----..-33..4
2e370 32 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  2..75....query I
2e380 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e390 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
2e3a0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46   col2 * + col0 F
2e3b0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
2e3c0 31 31 34 30 37 36 0d 0a 35 31 30 33 0d 0a 35 32  114076..5103..52
2e3d0 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  728....query I r
2e3e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2e3f0 20 2b 20 36 35 20 46 52 4f 4d 20 74 61 62 32 2c   + 65 FROM tab2,
2e400 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
2e410 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2e420 6e 67 20 74 6f 20 37 34 34 35 33 31 35 37 35 63  ng to 744531575c
2e430 31 62 36 34 36 31 65 64 32 39 31 36 64 34 39 34  1b6461ed2916d494
2e440 30 65 34 64 32 33 0d 0a 0d 0a 71 75 65 72 79 20  0e4d23....query 
2e450 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e460 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  T - cor0.col0 * 
2e470 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
2e480 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol1 FROM tab2, t
2e490 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2e4a0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
2e4b0 69 6e 67 20 74 6f 20 39 62 32 33 65 35 65 37 34  ing to 9b23e5e74
2e4c0 65 66 33 34 30 35 61 34 64 62 66 30 35 63 63 65  ef3405a4dbf05cce
2e4d0 62 31 38 63 38 61 38 0d 0a 0d 0a 71 75 65 72 79  b18c8a8....query
2e4e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e4f0 43 54 20 2d 20 39 33 20 2a 20 2b 20 63 6f 6c 31  CT - 93 * + col1
2e500 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2e510 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 31 0d  r0..----..-1581.
2e520 0a 2d 32 38 38 33 0d 0a 2d 35 34 38 37 0d 0a 0d  .-2883..-5487...
2e530 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e540 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2e550 54 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d  T tab0.col1 FROM
2e560 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
2e570 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31 0d 0a  or0, tab1 cor1..
2e580 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37  ----..86..91..97
2e590 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2e5a0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2e5b0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2e5c0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2e5d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2e5e0 31 33 35 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  1354..SELECT DIS
2e5f0 54 49 4e 43 54 20 38 32 20 44 49 56 20 63 6f 72  TINCT 82 DIV cor
2e600 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  1.col1 AS col1 F
2e610 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 63  ROM tab0, tab0 c
2e620 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31 0d 0a  or0, tab1 cor1..
2e630 2d 2d 2d 2d 0d 0a 33 0d 0a 36 0d 0a 38 0d 0a 0d  ----..3..6..8...
2e640 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2e650 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2e660 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2e670 6c 61 62 65 6c 2d 31 33 35 34 0d 0a 53 45 4c 45  label-1354..SELE
2e680 43 54 20 44 49 53 54 49 4e 43 54 20 38 32 20 2f  CT DISTINCT 82 /
2e690 20 63 6f 72 31 2e 63 6f 6c 31 20 41 53 20 63 6f   cor1.col1 AS co
2e6a0 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
2e6b0 62 30 20 63 6f 72 30 2c 20 74 61 62 31 20 63 6f  b0 cor0, tab1 co
2e6c0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 0d 0a  r1..----..3..6..
2e6d0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2e6e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2e6f0 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 28  TINCT + col1 * (
2e700 20 74 61 62 31 2e 63 6f 6c 31 20 29 20 46 52 4f   tab1.col1 ) FRO
2e710 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
2e720 30 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 6f  0..169..676....o
2e730 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2e740 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2e750 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2e760 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2e770 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e780 74 20 6c 61 62 65 6c 2d 31 33 35 36 0d 0a 53 45  t label-1356..SE
2e790 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c  LECT ALL - + col
2e7a0 32 20 2b 20 2d 20 43 41 53 54 28 20 63 6f 6c 31  2 + - CAST( col1
2e7b0 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 53 49 47   * - col1 AS SIG
2e7c0 4e 45 44 20 29 20 2b 20 2b 20 63 6f 72 30 2e 63  NED ) + + cor0.c
2e7d0 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 * col0 FROM 
2e7e0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2e7f0 2d 2d 0d 0a 31 31 32 33 0d 0a 33 32 35 33 0d 0a  --..1123..3253..
2e800 35 34 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  5483....skipif m
2e810 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2e820 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2e830 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35  owsort label-135
2e840 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  6..SELECT ALL - 
2e850 2b 20 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54 20  + col2 + - CAST 
2e860 28 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  ( col1 * - col1 
2e870 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b  AS INTEGER ) + +
2e880 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c   cor0.col2 * col
2e890 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
2e8a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 33 0d  or0..----..1123.
2e8b0 0a 33 32 35 33 0d 0a 35 34 38 33 0d 0a 0d 0a 71  .3253..5483....q
2e8c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e8d0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20  SELECT col2 * + 
2e8e0 38 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  84 AS col0 FROM 
2e8f0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 35 33 36  tab1..----..4536
2e900 0d 0a 34 37 38 38 0d 0a 38 30 36 34 0d 0a 0d 0a  ..4788..8064....
2e910 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2e920 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2e930 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2e940 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2e950 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35 38  wsort label-1358
2e960 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
2e970 44 49 56 20 2b 20 36 30 20 46 52 4f 4d 20 74 61  DIV + 60 FROM ta
2e980 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b1..----..0..0..
2e990 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
2e9a0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2e9b0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2e9c0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35 38 0d 0a  ort label-1358..
2e9d0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2f 20  SELECT + col2 / 
2e9e0 2b 20 36 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  + 60 FROM tab1..
2e9f0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d  ----..0..0..1...
2ea00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ea10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32  ..SELECT ALL - 2
2ea20 35 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  5 * col0 + - col
2ea30 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2ea40 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 39 32  ab2..----..-1992
2ea50 0d 0a 2d 32 30 30 39 0d 0a 2d 32 30 36 0d 0a 0d  ..-2009..-206...
2ea60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ea70 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
2ea80 2a 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20  * - col0 - col0 
2ea90 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2eaa0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 30 0d 0a 33  0..----..2040..3
2eab0 33 36 30 0d 0a 38 30 31 30 0d 0a 0d 0a 71 75 65  360..8010....que
2eac0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ead0 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  LECT + col1 * co
2eae0 6c 31 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l1 - - col1 FROM
2eaf0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
2eb00 0d 0a 31 31 30 0d 0a 31 38 32 0d 0a 37 30 32 0d  ..110..182..702.
2eb10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2eb20 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2eb30 4e 43 54 20 2d 20 37 36 20 41 53 20 63 6f 6c 30  NCT - 76 AS col0
2eb40 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
2eb50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2eb60 2d 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -76....onlyif my
2eb70 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2eb80 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2eb90 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2eba0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2ebb0 65 6c 2d 31 33 36 33 0d 0a 53 45 4c 45 43 54 20  el-1363..SELECT 
2ebc0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
2ebd0 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 44 49 56  + ( + col0 ) DIV
2ebe0 20 2d 20 36 32 20 63 6f 6c 30 20 46 52 4f 4d 20   - 62 col0 FROM 
2ebf0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33  tab0..----..1..3
2ec00 33 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..81....skipif 
2ec10 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2ec20 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2ec30 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2ec40 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2ec50 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2ec60 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2ec70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ec80 20 6c 61 62 65 6c 2d 31 33 36 33 0d 0a 53 45 4c   label-1363..SEL
2ec90 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2eca0 6f 6c 32 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29  ol2 + ( + col0 )
2ecb0 20 2f 20 2d 20 36 32 20 63 6f 6c 30 20 46 52 4f   / - 62 col0 FRO
2ecc0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab0..----..1.
2ecd0 0a 33 33 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79  .33..81....query
2ece0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ecf0 43 54 20 2d 20 34 20 2b 20 74 61 62 30 2e 63 6f  CT - 4 + tab0.co
2ed00 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l1 * col0 AS col
2ed10 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2ed20 2d 0d 0a 32 30 36 30 0d 0a 33 33 39 31 0d 0a 38  -..2060..3391..8
2ed30 30 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  095....query I r
2ed40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2ed50 4c 4c 20 39 36 20 2b 20 63 6f 6c 31 20 2a 20 74  LL 96 + col1 * t
2ed60 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ab2.col1 FROM ta
2ed70 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 37 0d 0a  b2..----..1057..
2ed80 33 35 37 37 0d 0a 33 38 35 0d 0a 0d 0a 6f 6e 6c  3577..385....onl
2ed90 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2eda0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2edb0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2edc0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2edd0 72 74 20 6c 61 62 65 6c 2d 31 33 36 36 0d 0a 53  rt label-1366..S
2ede0 45 4c 45 43 54 20 28 20 2b 20 74 61 62 30 2e 63  ELECT ( + tab0.c
2edf0 6f 6c 31 20 29 20 44 49 56 20 63 6f 6c 31 20 46  ol1 ) DIV col1 F
2ee00 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2ee10 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69  1..1..1....skipi
2ee20 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2ee30 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2ee40 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2ee50 31 33 36 36 0d 0a 53 45 4c 45 43 54 20 28 20 2b  1366..SELECT ( +
2ee60 20 74 61 62 30 2e 63 6f 6c 31 20 29 20 2f 20 63   tab0.col1 ) / c
2ee70 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
2ee80 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a  ---..1..1..1....
2ee90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2eea0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
2eeb0 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
2eec0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2eed0 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d  0..----..55..58.
2eee0 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .85....query I r
2eef0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2ef00 4c 4c 20 2b 20 38 36 20 41 53 20 63 6f 6c 31 20  LL + 86 AS col1 
2ef10 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2ef20 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 38 36 0d  0..----..86..86.
2ef30 0a 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .86....query I r
2ef40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2ef50 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
2ef60 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63   + cor0.col2 * c
2ef70 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
2ef80 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2ef90 2d 2d 2d 0d 0a 33 34 0d 0a 37 32 31 36 0d 0a 37  ---..34..7216..7
2efa0 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  59....query I ro
2efb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2efc0 4c 20 2b 20 2d 20 37 20 2b 20 2d 20 63 6f 72 30  L + - 7 + - cor0
2efd0 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20  .col2 FROM tab1 
2efe0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2eff0 31 30 33 0d 0a 2d 36 31 0d 0a 2d 36 34 0d 0a 0d  103..-61..-64...
2f000 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f010 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
2f020 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  + + cor0.col0 AS
2f030 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
2f040 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2f050 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a 0d 0a 71 75  24..19..62....qu
2f060 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f070 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2f080 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b   col1 * - col0 +
2f090 20 33 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53   32 FROM tab2 AS
2f0a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
2f0b0 31 31 0d 0a 2d 31 38 35 0d 0a 2d 34 35 37 30 0d  11..-185..-4570.
2f0c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f0d0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2f0e0 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2d 20 2b   col2 * col2 - +
2f0f0 20 63 6f 6c 31 20 2a 20 39 33 20 46 52 4f 4d 20   col1 * 93 FROM 
2f100 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2f110 2d 2d 0d 0a 2d 33 30 32 35 0d 0a 2d 33 36 31 32  --..-3025..-3612
2f120 0d 0a 2d 36 31 36 33 0d 0a 0d 0a 71 75 65 72 79  ..-6163....query
2f130 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f140 43 54 20 2b 20 2b 20 35 33 20 2b 20 63 6f 6c 31  CT + + 53 + col1
2f150 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2f160 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  b1 cor0..----..6
2f170 33 0d 0a 36 36 0d 0a 37 39 0d 0a 0d 0a 71 75 65  3..66..79....que
2f180 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f190 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2f1a0 33 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  3 * col0 FROM ta
2f1b0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2f1c0 0d 0a 2d 31 30 35 0d 0a 2d 32 36 37 0d 0a 2d 37  ..-105..-267..-7
2f1d0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2f1e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2f1f0 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  or0.col0 + - col
2f200 30 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  0 * col0 * col0 
2f210 2b 20 63 6f 6c 31 20 2a 20 2b 20 31 20 46 52 4f  + col1 * + 1 FRO
2f220 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2f230 2d 2d 2d 2d 0d 0a 2d 32 36 32 30 37 30 0d 0a 2d  ----..-262070..-
2f240 35 31 31 39 30 37 0d 0a 32 0d 0a 0d 0a 71 75 65  511907..2....que
2f250 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f260 4c 45 43 54 20 2d 20 28 20 63 6f 72 30 2e 63 6f  LECT - ( cor0.co
2f270 6c 30 20 29 20 2b 20 63 6f 6c 31 20 41 53 20 63  l0 ) + col1 AS c
2f280 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2f290 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   cor0..----..-54
2f2a0 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 6f 6e 6c  ..-67..23....onl
2f2b0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2f2c0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2f2d0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2f2e0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2f2f0 72 74 20 6c 61 62 65 6c 2d 31 33 37 38 0d 0a 53  rt label-1378..S
2f300 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
2f310 20 2b 20 2b 20 36 38 20 44 49 56 20 2d 20 63 6f   + + 68 DIV - co
2f320 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
2f330 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2f340 2d 2d 0d 0a 2d 38 38 0d 0a 2d 39 31 0d 0a 2d 39  --..-88..-91..-9
2f350 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
2f360 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2f370 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2f380 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 38 0d 0a  ort label-1378..
2f390 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
2f3a0 31 20 2b 20 2b 20 36 38 20 2f 20 2d 20 63 6f 6c  1 + + 68 / - col
2f3b0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
2f3c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2f3d0 2d 0d 0a 2d 38 38 0d 0a 2d 39 31 0d 0a 2d 39 38  -..-88..-91..-98
2f3e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2f3f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2f400 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  INCT + col0 * + 
2f410 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col0 * - col1 + 
2f420 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
2f430 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2f440 2d 2d 2d 2d 0d 0a 2d 31 31 38 37 39 30 0d 0a 2d  ----..-118790..-
2f450 34 39 35 31 32 0d 0a 2d 37 32 30 37 32 32 0d 0a  49512..-720722..
2f460 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f470 74 0d 0a 53 45 4c 45 43 54 20 37 34 20 2a 20 2d  t..SELECT 74 * -
2f480 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
2f490 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
2f4a0 2d 2d 0d 0a 2d 36 33 36 34 0d 0a 2d 36 37 33 34  --..-6364..-6734
2f4b0 0d 0a 2d 37 31 37 38 0d 0a 0d 0a 71 75 65 72 79  ..-7178....query
2f4c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f4d0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
2f4e0 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31  r0.col2 * + col1
2f4f0 20 2b 20 63 6f 6c 30 20 2d 20 32 32 20 46 52 4f   + col0 - 22 FRO
2f500 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2f510 2d 2d 2d 2d 0d 0a 2d 32 38 33 36 0d 0a 2d 37 33  ----..-2836..-73
2f520 39 35 0d 0a 2d 38 34 0d 0a 0d 0a 71 75 65 72 79  95..-84....query
2f530 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f540 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
2f550 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l1 * col1 + + co
2f560 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
2f570 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2f580 0a 31 35 37 0d 0a 32 36 35 0d 0a 37 33 30 0d 0a  .157..265..730..
2f590 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f5a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2f5b0 63 6f 6c 30 20 2a 20 33 33 20 2a 20 2b 20 63 6f  col0 * 33 * + co
2f5c0 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
2f5d0 2d 2d 0d 0a 31 35 31 38 36 36 0d 0a 34 34 33 31  --..151866..4431
2f5e0 39 0d 0a 37 31 36 31 0d 0a 0d 0a 6f 6e 6c 79 69  9..7161....onlyi
2f5f0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
2f600 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
2f610 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
2f620 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
2f630 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f640 62 65 6c 2d 31 33 38 34 0d 0a 53 45 4c 45 43 54  bel-1384..SELECT
2f650 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
2f660 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
2f670 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
2f680 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
2f690 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2f6a0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2f6b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2f6c0 6c 61 62 65 6c 2d 31 33 38 34 0d 0a 53 45 4c 45  label-1384..SELE
2f6d0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
2f6e0 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   * CAST ( NULL A
2f6f0 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
2f700 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab0..----..NUL
2f710 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
2f720 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
2f730 30 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20  0 + tab0.col1 * 
2f740 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 41 53  col1 - - col2 AS
2f750 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
2f760 0a 2d 2d 2d 2d 0d 0a 37 34 35 33 0d 0a 38 34 35  .----..7453..845
2f770 32 0d 0a 39 34 34 35 0d 0a 0d 0a 71 75 65 72 79  2..9445....query
2f780 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f790 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 37 31  CT + col1 * + 71
2f7a0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2f7b0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38 34 36 0d 0a  b1..----..1846..
2f7c0 37 31 30 0d 0a 39 32 33 0d 0a 0d 0a 6f 6e 6c 79  710..923....only
2f7d0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2f7e0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
2f7f0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
2f800 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
2f810 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2f820 61 62 65 6c 2d 31 33 38 37 0d 0a 53 45 4c 45 43  abel-1387..SELEC
2f830 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T + CAST( NULL A
2f840 53 20 53 49 47 4e 45 44 20 29 20 2a 20 39 35 20  S SIGNED ) * 95 
2f850 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2f860 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  2..----..NULL..N
2f870 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
2f880 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2f890 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2f8a0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2f8b0 6c 2d 31 33 38 37 0d 0a 53 45 4c 45 43 54 20 2b  l-1387..SELECT +
2f8c0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
2f8d0 49 4e 54 45 47 45 52 20 29 20 2a 20 39 35 20 41  INTEGER ) * 95 A
2f8e0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2f8f0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
2f900 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  LL..NULL....only
2f910 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2f920 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
2f930 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
2f940 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
2f950 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2f960 61 62 65 6c 2d 31 33 38 38 0d 0a 53 45 4c 45 43  abel-1388..SELEC
2f970 54 20 43 41 53 54 28 20 2b 20 28 20 2b 20 63 6f  T CAST( + ( + co
2f980 72 30 2e 63 6f 6c 32 20 29 20 41 53 20 53 49 47  r0.col2 ) AS SIG
2f990 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20  NED ) FROM tab1 
2f9a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
2f9b0 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69  4..57..96....ski
2f9c0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2f9d0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2f9e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2f9f0 6c 2d 31 33 38 38 0d 0a 53 45 4c 45 43 54 20 43  l-1388..SELECT C
2fa00 41 53 54 20 28 20 2b 20 28 20 2b 20 63 6f 72 30  AST ( + ( + cor0
2fa10 2e 63 6f 6c 32 20 29 20 41 53 20 49 4e 54 45 47  .col2 ) AS INTEG
2fa20 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  ER ) FROM tab1 A
2fa30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34  S cor0..----..54
2fa40 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  ..57..96....quer
2fa50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2fa60 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2fa70 6f 6c 31 20 2d 20 39 39 20 41 53 20 63 6f 6c 32  ol1 - 99 AS col2
2fa80 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2fa90 0d 0a 2d 34 30 0d 0a 2d 36 38 0d 0a 2d 38 32 0d  ..-40..-68..-82.
2faa0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2fab0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 31  rt..SELECT + + 1
2fac0 33 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  3 + + col1 FROM 
2fad0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2fae0 2d 2d 0d 0a 32 33 0d 0a 32 36 0d 0a 33 39 0d 0a  --..23..26..39..
2faf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fb00 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
2fb10 6f 6c 32 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a  ol2 + ( col2 ) *
2fb20 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
2fb30 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36  0 cor0..----..36
2fb40 0d 0a 37 33 38 30 0d 0a 38 32 35 0d 0a 0d 0a 6f  ..7380..825....o
2fb50 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2fb60 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2fb70 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2fb80 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2fb90 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39 32 0d  sort label-1392.
2fba0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44  .SELECT + col0 D
2fbb0 49 56 20 39 32 20 2d 20 63 6f 6c 32 20 41 53 20  IV 92 - col2 AS 
2fbc0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
2fbd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2fbe0 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 73 6b  ..-33..-82....sk
2fbf0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2fc00 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2fc10 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2fc20 65 6c 2d 31 33 39 32 0d 0a 53 45 4c 45 43 54 20  el-1392..SELECT 
2fc30 2b 20 63 6f 6c 30 20 2f 20 39 32 20 2d 20 63 6f  + col0 / 92 - co
2fc40 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
2fc50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2fc60 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32  --..-1..-33..-82
2fc70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2fc80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2fc90 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  INCT + col0 * + 
2fca0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
2fcb0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab0..----..12
2fcc0 32 35 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d  25..576..7921...
2fcd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fce0 0d 0a 53 45 4c 45 43 54 20 2b 20 31 20 2a 20 63  ..SELECT + 1 * c
2fcf0 6f 6c 32 20 2b 20 31 38 20 2a 20 63 6f 6c 32 20  ol2 + 18 * col2 
2fd00 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2fd10 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 34 0d 0a 35 31  0..----..494..51
2fd20 33 0d 0a 37 32 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  3..722....onlyif
2fd30 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2fd40 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2fd50 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2fd60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2fd70 6c 61 62 65 6c 2d 31 33 39 35 0d 0a 53 45 4c 45  label-1395..SELE
2fd80 43 54 20 2d 20 63 6f 6c 31 20 2b 20 39 34 20 44  CT - col1 + 94 D
2fd90 49 56 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  IV + col0 AS col
2fda0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
2fdb0 2d 0d 0a 2d 31 36 0d 0a 2d 31 38 0d 0a 2d 35 38  -..-16..-18..-58
2fdc0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2fdd0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2fde0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2fdf0 72 74 20 6c 61 62 65 6c 2d 31 33 39 35 0d 0a 53  rt label-1395..S
2fe00 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 39  ELECT - col1 + 9
2fe10 34 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  4 / + col0 AS co
2fe20 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
2fe30 2d 2d 0d 0a 2d 31 36 0d 0a 2d 31 38 0d 0a 2d 35  --..-16..-18..-5
2fe40 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2fe50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33  sort..SELECT - 3
2fe60 39 20 2b 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20  9 + - cor1.col1 
2fe70 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
2fe80 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  AS cor0, tab2 AS
2fe90 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
2fea0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2feb0 6f 20 37 33 65 36 38 65 32 33 32 31 61 32 34 35  o 73e68e2321a245
2fec0 39 30 36 33 30 39 35 64 64 34 36 64 63 37 62 31  9063095dd46dc7b1
2fed0 62 65 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  be....onlyif mys
2fee0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2fef0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2ff00 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2ff10 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2ff20 6c 2d 31 33 39 37 0d 0a 53 45 4c 45 43 54 20 38  l-1397..SELECT 8
2ff30 39 20 44 49 56 20 32 36 20 46 52 4f 4d 20 74 61  9 DIV 26 FROM ta
2ff40 62 31 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  b1, tab1 cor0..-
2ff50 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
2ff60 73 68 69 6e 67 20 74 6f 20 33 63 66 31 65 33 37  shing to 3cf1e37
2ff70 37 61 39 34 33 35 38 39 38 39 37 62 38 64 34 33  7a943589897b8d43
2ff80 31 61 38 33 34 66 31 62 61 0d 0a 0d 0a 73 6b 69  1a834f1ba....ski
2ff90 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2ffa0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2ffb0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2ffc0 6c 2d 31 33 39 37 0d 0a 53 45 4c 45 43 54 20 38  l-1397..SELECT 8
2ffd0 39 20 2f 20 32 36 20 46 52 4f 4d 20 74 61 62 31  9 / 26 FROM tab1
2ffe0 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab1 cor0..---
2fff0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
30000 69 6e 67 20 74 6f 20 33 63 66 31 65 33 37 37 61  ing to 3cf1e377a
30010 39 34 33 35 38 39 38 39 37 62 38 64 34 33 31 61  943589897b8d431a
30020 38 33 34 66 31 62 61 0d 0a 0d 0a 71 75 65 72 79  834f1ba....query
30030 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30040 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
30050 20 2a 20 2d 20 33 35 20 41 53 20 63 6f 6c 32 20   * - 35 AS col2 
30060 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
30070 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 30 0d 0a 2d  0..----..-350..-
30080 34 35 35 0d 0a 2d 39 31 30 0d 0a 0d 0a 71 75 65  455..-910....que
30090 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
300a0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
300b0 2b 20 2d 20 28 20 2b 20 32 37 20 29 20 41 53 20  + - ( + 27 ) AS 
300c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
300d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
300e0 31 36 0d 0a 2d 35 31 0d 0a 2d 36 32 0d 0a 0d 0a  16..-51..-62....
300f0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
30100 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
30110 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
30120 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
30130 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30 30  wsort label-1400
30140 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
30150 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72  2 * + col2 * cor
30160 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b 20  0.col1 + col0 + 
30170 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c  + col2 DIV + col
30180 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
30190 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
301a0 2d 0d 0a 32 32 36 30 39 0d 0a 32 34 36 32 37 0d  -..22609..24627.
301b0 0a 33 39 39 36 32 0d 0a 0d 0a 73 6b 69 70 69 66  .39962....skipif
301c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
301d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
301e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
301f0 34 30 30 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  400..SELECT + + 
30200 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  col2 * + col2 * 
30210 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30  cor0.col1 + col0
30220 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f   + + col2 / + co
30230 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
30240 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
30250 2d 2d 0d 0a 32 32 36 30 39 0d 0a 32 34 36 32 37  --..22609..24627
30260 0d 0a 33 39 39 36 32 0d 0a 0d 0a 73 6b 69 70 69  ..39962....skipi
30270 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
30280 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
30290 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
302a0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
302b0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
302c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
302d0 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  INCT - col0 * - 
302e0 36 34 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  64 col0 FROM tab
302f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
30300 0a 31 35 33 36 0d 0a 32 32 34 30 0d 0a 35 36 39  .1536..2240..569
30310 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
30320 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
30330 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
30340 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
30350 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
30360 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
30370 30 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  02..SELECT - + c
30380 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 43 41 53  or0.col0 * + CAS
30390 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
303a0 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  D ) FROM tab1 AS
303b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
303c0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
303d0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
303e0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
303f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
30400 6c 61 62 65 6c 2d 31 34 30 32 0d 0a 53 45 4c 45  label-1402..SELE
30410 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  CT - + cor0.col0
30420 20 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c   * + CAST ( NULL
30430 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
30440 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
30450 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
30460 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
30470 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30480 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  CT - + col2 + + 
30490 63 6f 6c 31 20 2a 20 28 20 2d 20 63 6f 6c 32 20  col1 * ( - col2 
304a0 29 20 2a 20 2d 20 28 20 2d 20 38 32 20 29 20 46  ) * - ( - 82 ) F
304b0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
304c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 32 37 34 39 0d  ..----..-232749.
304d0 0a 2d 36 31 31 39 36 36 0d 0a 2d 37 39 35 35 0d  .-611966..-7955.
304e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
304f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
30500 20 63 6f 6c 32 20 2a 20 37 37 20 46 52 4f 4d 20   col2 * 77 FROM 
30510 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
30520 2d 2d 0d 0a 2d 32 30 30 32 0d 0a 2d 32 30 37 39  --..-2002..-2079
30530 0d 0a 2d 32 39 32 36 0d 0a 0d 0a 71 75 65 72 79  ..-2926....query
30540 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30550 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  CT - - col1 * co
30560 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 * col2 FROM t
30570 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
30580 32 32 35 39 39 0d 0a 32 34 35 34 38 0d 0a 33 39  22599..24548..39
30590 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  884....query I r
305a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
305b0 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63   cor0.col1 * + c
305c0 6f 6c 30 20 2b 20 2b 20 34 38 20 41 53 20 63 6f  ol0 + + 48 AS co
305d0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
305e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39  cor0..----..-129
305f0 35 0d 0a 2d 31 36 39 0d 0a 2d 34 35 35 34 0d 0a  5..-169..-4554..
30600 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30610 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
30620 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   * - col0 * + co
30630 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  r0.col0 AS col2 
30640 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
30650 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 32 35 0d  0..----..118825.
30660 0a 34 39 35 33 36 0d 0a 37 32 30 38 31 31 0d 0a  .49536..720811..
30670 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30680 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
30690 2b 20 31 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 11 AS col2 FRO
306a0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
306b0 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 31 31 0d 0a  ----..-11..-11..
306c0 2d 31 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -11....skipif po
306d0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
306e0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
306f0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
30700 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
30710 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30720 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
30730 20 2b 20 28 20 39 20 29 20 63 6f 6c 32 20 46 52   + ( 9 ) col2 FR
30740 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
30750 2d 2d 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49  --..9....query I
30760 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30770 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
30780 6c 31 20 2a 20 32 35 20 46 52 4f 4d 20 74 61 62  l1 * 25 FROM tab
30790 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  0 cor0..----..21
307a0 35 30 0d 0a 32 32 37 35 0d 0a 32 34 32 35 0d 0a  50..2275..2425..
307b0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
307c0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
307d0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
307e0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
307f0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
30800 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30810 43 54 20 28 20 63 6f 6c 30 20 29 20 2a 20 63 6f  CT ( col0 ) * co
30820 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 32  l1 + + col1 col2
30830 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
30840 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a  r0..----..1360..
30850 32 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 6f 6e 6c  248..4661....onl
30860 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
30870 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
30880 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
30890 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
308a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
308b0 6c 61 62 65 6c 2d 31 34 31 32 0d 0a 53 45 4c 45  label-1412..SELE
308c0 43 54 20 41 4c 4c 20 43 41 53 54 28 20 4e 55 4c  CT ALL CAST( NUL
308d0 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
308e0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c   col2 FROM tab2,
308f0 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
30900 61 62 31 20 63 6f 72 31 2c 20 74 61 62 30 20 41  ab1 cor1, tab0 A
30910 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor2..----..81
30920 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
30930 74 6f 20 63 62 33 33 63 33 30 64 36 66 35 32 62  to cb33c30d6f52b
30940 62 62 32 34 33 33 38 61 32 39 33 63 37 34 30 66  bb24338a293c740f
30950 32 39 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  29c....skipif my
30960 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
30970 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
30980 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 32  wsort label-1412
30990 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53  ..SELECT ALL CAS
309a0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
309b0 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52  GER ) AS col2 FR
309c0 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
309d0 20 63 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31   cor0, tab1 cor1
309e0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a  , tab0 AS cor2..
309f0 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20  ----..81 values 
30a00 68 61 73 68 69 6e 67 20 74 6f 20 63 62 33 33 63  hashing to cb33c
30a10 33 30 64 36 66 35 32 62 62 62 32 34 33 33 38 61  30d6f52bbb24338a
30a20 32 39 33 63 37 34 30 66 32 39 63 0d 0a 0d 0a 71  293c740f29c....q
30a30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30a40 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
30a50 30 2e 63 6f 6c 31 20 2b 20 2d 20 34 36 20 46 52  0.col1 + - 46 FR
30a60 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
30a70 0a 2d 2d 2d 2d 0d 0a 34 30 0d 0a 34 35 0d 0a 35  .----..40..45..5
30a80 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
30a90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
30aa0 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b   + tab2.col2 * +
30ab0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
30ac0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
30ad0 34 34 34 0d 0a 36 37 36 0d 0a 37 32 39 0d 0a 0d  444..676..729...
30ae0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30af0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
30b00 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  T + cor0.col1 + 
30b10 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f  cor0.col2 + + co
30b20 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
30b30 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
30b40 2d 2d 0d 0a 31 33 34 0d 0a 31 36 33 0d 0a 36 35  --..134..163..65
30b50 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
30b60 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
30b70 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
30b80 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
30b90 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
30ba0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31  owsort label-141
30bb0 36 0d 0a 53 45 4c 45 43 54 20 2d 20 38 39 20 2a  6..SELECT - 89 *
30bc0 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 2b 20   col1 + CAST( + 
30bd0 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 41 53  col2 + + col0 AS
30be0 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
30bf0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
30c00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 36  or0..----..-1396
30c10 0d 0a 2d 32 37 32 35 0d 0a 2d 35 31 34 37 0d 0a  ..-2725..-5147..
30c20 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
30c30 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
30c40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30c50 20 6c 61 62 65 6c 2d 31 34 31 36 0d 0a 53 45 4c   label-1416..SEL
30c60 45 43 54 20 2d 20 38 39 20 2a 20 63 6f 6c 31 20  ECT - 89 * col1 
30c70 2b 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 32 20  + CAST ( + col2 
30c80 2b 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45  + + col0 AS INTE
30c90 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52  GER ) AS col0 FR
30ca0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
30cb0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 36 0d 0a 2d 32  .----..-1396..-2
30cc0 37 32 35 0d 0a 2d 35 31 34 37 0d 0a 0d 0a 73 6b  725..-5147....sk
30cd0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
30ce0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
30cf0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
30d00 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
30d10 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
30d20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
30d30 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30  ISTINCT + - cor0
30d40 2e 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20  .col0 col0 FROM 
30d50 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
30d60 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39  --..-7..-78..-79
30d70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30d80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
30d90 31 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  12 FROM tab0, ta
30da0 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b1 AS cor0, tab1
30db0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
30dc0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
30dd0 67 20 74 6f 20 37 30 32 34 37 38 63 35 33 63 61  g to 702478c53ca
30de0 66 32 66 37 65 62 62 39 66 66 66 39 36 64 38 30  f2f7ebb9fff96d80
30df0 30 66 35 61 36 0d 0a 0d 0a 71 75 65 72 79 20 49  0f5a6....query I
30e00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 20 72  IIIIIIIIIIIIII r
30e10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
30e20 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20  LL * FROM tab2, 
30e30 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
30e40 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31  b2 AS cor1, tab1
30e50 2c 20 74 61 62 30 20 63 6f 72 32 0d 0a 2d 2d 2d  , tab0 cor2..---
30e60 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68  -..3645 values h
30e70 61 73 68 69 6e 67 20 74 6f 20 36 61 36 33 30 38  ashing to 6a6308
30e80 35 65 38 63 61 62 36 66 39 37 35 39 31 66 64 30  5e8cab6f97591fd0
30e90 61 36 62 36 66 66 66 66 30 37 0d 0a 0d 0a 71 75  a6b6ffff07....qu
30ea0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30eb0 45 4c 45 43 54 20 41 4c 4c 20 39 36 20 41 53 20  ELECT ALL 96 AS 
30ec0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
30ed0 2d 2d 2d 2d 0d 0a 39 36 0d 0a 39 36 0d 0a 39 36  ----..96..96..96
30ee0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30ef0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
30f00 2b 20 63 6f 6c 31 20 2a 20 34 37 20 46 52 4f 4d  + col1 * 47 FROM
30f10 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
30f20 2d 2d 2d 0d 0a 31 34 35 37 0d 0a 32 37 37 33 0d  ---..1457..2773.
30f30 0a 37 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .799....query I 
30f40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30f50 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  - - col0 * col1 
30f60 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + + col2 FROM ta
30f70 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
30f80 0d 0a 31 31 33 36 0d 0a 31 33 32 0d 0a 36 39 37  ..1136..132..697
30f90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30fa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
30fb0 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  INCT col1 * + co
30fc0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
30fd0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
30fe0 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a  --..2064..3395..
30ff0 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
31000 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31010 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  + col0 + cor0.co
31020 6c 30 20 2b 20 34 34 20 41 53 20 63 6f 6c 30 20  l0 + 44 AS col0 
31030 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
31040 2d 2d 2d 2d 0d 0a 32 30 30 0d 0a 32 30 32 0d 0a  ----..200..202..
31050 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
31060 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
31070 62 32 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a  b2.col1 + col1 *
31080 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
31090 32 0d 0a 2d 2d 2d 2d 0d 0a 33 30 36 0d 0a 33 35  2..----..306..35
310a0 34 30 0d 0a 39 39 32 0d 0a 0d 0a 71 75 65 72 79  40..992....query
310b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
310c0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
310d0 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  l1 + - col0 * + 
310e0 34 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  46 AS col0 FROM 
310f0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31  tab0..----..-101
31100 38 0d 0a 2d 31 35 31 33 0d 0a 2d 34 30 30 33 0d  8..-1513..-4003.
31110 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
31120 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
31130 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
31140 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
31150 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
31160 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32 37  wsort label-1427
31170 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
31180 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62  T - col1 * - tab
31190 32 2e 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 2d  2.col1 + CAST( -
311a0 20 35 30 20 41 53 20 53 49 47 4e 45 44 20 29 20   50 AS SIGNED ) 
311b0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  * col2 AS col0 F
311c0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
311d0 2d 31 36 31 31 0d 0a 2d 33 38 39 0d 0a 32 31 38  -1611..-389..218
311e0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
311f0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
31200 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
31210 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32 37 0d 0a  ort label-1427..
31220 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31230 2d 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62 32 2e  - col1 * - tab2.
31240 63 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 2d 20  col1 + CAST ( - 
31250 35 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  50 AS INTEGER ) 
31260 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  * col2 AS col0 F
31270 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
31280 2d 31 36 31 31 0d 0a 2d 33 38 39 0d 0a 32 31 38  -1611..-389..218
31290 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
312a0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
312b0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
312c0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
312d0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
312e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
312f0 32 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  28..SELECT DISTI
31300 4e 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  NCT + CAST( NULL
31310 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63   AS SIGNED ) + c
31320 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
31330 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab2..----..NUL
31340 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
31350 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
31360 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
31370 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32 38 0d 0a  ort label-1428..
31380 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31390 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
313a0 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c   INTEGER ) + col
313b0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
313c0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab2..----..NULL.
313d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
313e0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 36  rt..SELECT + - 6
313f0 38 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  8 FROM tab1 AS c
31400 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 38 0d 0a  or0..----..-68..
31410 2d 36 38 0d 0a 2d 36 38 0d 0a 0d 0a 6f 6e 6c 79  -68..-68....only
31420 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
31430 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
31440 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
31450 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
31460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
31470 61 62 65 6c 2d 31 34 33 30 0d 0a 53 45 4c 45 43  abel-1430..SELEC
31480 54 20 43 41 53 54 28 20 2d 20 63 6f 6c 31 20 41  T CAST( - col1 A
31490 53 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 32 20  S SIGNED ) col2 
314a0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
314b0 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a  .-10..-13..-26..
314c0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
314d0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
314e0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
314f0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
31500 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
31510 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
31520 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
31530 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
31540 31 34 33 30 0d 0a 53 45 4c 45 43 54 20 43 41 53  1430..SELECT CAS
31550 54 20 28 20 2d 20 63 6f 6c 31 20 41 53 20 49 4e  T ( - col1 AS IN
31560 54 45 47 45 52 20 29 20 63 6f 6c 32 20 46 52 4f  TEGER ) col2 FRO
31570 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
31580 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 6f  0..-13..-26....o
31590 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
315a0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
315b0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
315c0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
315d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
315e0 74 20 6c 61 62 65 6c 2d 31 34 33 31 0d 0a 53 45  t label-1431..SE
315f0 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20  LECT CAST( NULL 
31600 41 53 20 53 49 47 4e 45 44 20 29 20 2f 20 2b 20  AS SIGNED ) / + 
31610 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  col2 + col1 + - 
31620 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col0 * col0 FROM
31630 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab0..----..NUL
31640 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
31650 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
31660 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
31670 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
31680 6c 61 62 65 6c 2d 31 34 33 31 0d 0a 53 45 4c 45  label-1431..SELE
31690 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  CT CAST ( NULL A
316a0 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2b 20  S INTEGER ) / + 
316b0 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  col2 + col1 + - 
316c0 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col0 * col0 FROM
316d0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab0..----..NUL
316e0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
316f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31700 0d 0a 53 45 4c 45 43 54 20 2d 20 36 39 20 2a 20  ..SELECT - 69 * 
31710 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
31720 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
31730 32 37 37 0d 0a 2d 35 36 35 38 0d 0a 2d 36 39 0d  277..-5658..-69.
31740 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31750 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
31760 4e 43 54 20 2d 20 2b 20 38 20 2b 20 36 34 20 41  NCT - + 8 + 64 A
31770 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
31780 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d   cor0..----..56.
31790 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
317a0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33  rt..SELECT ALL 3
317b0 37 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20 41 53  7 * tab0.col2 AS
317c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c   col0 FROM tab1,
317d0 20 74 61 62 30 20 63 6f 72 30 20 43 52 4f 53 53   tab0 cor0 CROSS
317e0 20 4a 4f 49 4e 20 74 61 62 30 0d 0a 2d 2d 2d 2d   JOIN tab0..----
317f0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
31800 69 6e 67 20 74 6f 20 63 31 32 38 65 30 38 63 37  ing to c128e08c7
31810 66 65 61 61 38 65 39 32 63 66 33 39 33 32 31 34  feaa8e92cf393214
31820 64 63 65 30 63 33 30 0d 0a 0d 0a 71 75 65 72 79  dce0c30....query
31830 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31840 43 54 20 2d 20 2b 20 39 39 20 41 53 20 63 6f 6c  CT - + 99 AS col
31850 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
31860 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 39 0d 0a  or0..----..-99..
31870 2d 39 39 0d 0a 2d 39 39 0d 0a 0d 0a 73 6b 69 70  -99..-99....skip
31880 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
31890 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
318a0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
318b0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
318c0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
318d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
318e0 54 49 4e 43 54 20 39 32 20 2a 20 2b 20 63 6f 6c  TINCT 92 * + col
318f0 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  2 - - cor0.col1 
31900 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
31910 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  S cor0..----..24
31920 35 31 0d 0a 32 35 31 35 0d 0a 33 35 31 33 0d 0a  51..2515..3513..
31930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31940 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
31950 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63  CT cor0.col0 * c
31960 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
31970 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
31980 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30  ..2064..3395..80
31990 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
319a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
319b0 4c 20 2d 20 32 31 20 41 53 20 63 6f 6c 31 20 46  L - 21 AS col1 F
319c0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
319d0 2d 32 31 0d 0a 2d 32 31 0d 0a 2d 32 31 0d 0a 0d  -21..-21..-21...
319e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
319f0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 34 20  ..SELECT ALL 94 
31a00 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
31a10 30 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  0, tab1, tab0 AS
31a20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
31a30 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
31a40 6f 20 61 34 64 32 33 39 36 32 36 63 66 30 35 34  o a4d239626cf054
31a50 36 61 63 31 62 32 66 35 37 62 62 38 34 30 37 30  6ac1b2f57bb84070
31a60 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  89....query I ro
31a70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
31a80 53 54 49 4e 43 54 20 2b 20 35 37 20 2a 20 2b 20  STINCT + 57 * + 
31a90 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
31aa0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
31ab0 2d 0d 0a 31 37 31 0d 0a 33 36 34 38 0d 0a 34 35  -..171..3648..45
31ac0 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
31ad0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
31ae0 4c 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  L + col1 + col0 
31af0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
31b00 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
31b10 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71  .29..74..93....q
31b20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31b30 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
31b40 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  + col2 + - col0 
31b50 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
31b60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a 2d 37  0..----..-70..-7
31b70 33 38 37 0d 0a 2d 38 31 36 0d 0a 0d 0a 6f 6e 6c  387..-816....onl
31b80 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
31b90 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
31ba0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
31bb0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
31bc0 72 74 20 6c 61 62 65 6c 2d 31 34 34 33 0d 0a 53  rt label-1443..S
31bd0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
31be0 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 32   col0 DIV - col2
31bf0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
31c00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  r0..----..0..1..
31c10 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
31c20 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
31c30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31c40 20 6c 61 62 65 6c 2d 31 34 34 33 0d 0a 53 45 4c   label-1443..SEL
31c50 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
31c60 6f 6c 30 20 2f 20 2d 20 63 6f 6c 32 20 46 52 4f  ol0 / - col2 FRO
31c70 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
31c80 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75  ----..0..1....qu
31c90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31ca0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
31cb0 20 2b 20 38 31 20 41 53 20 63 6f 6c 32 20 46 52   + 81 AS col2 FR
31cc0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
31cd0 0a 2d 2d 2d 2d 0d 0a 38 31 0d 0a 0d 0a 6f 6e 6c  .----..81....onl
31ce0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
31cf0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
31d00 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
31d10 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
31d20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
31d30 6c 61 62 65 6c 2d 31 34 34 35 0d 0a 53 45 4c 45  label-1445..SELE
31d40 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
31d50 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col2 + - col1 * 
31d60 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
31d70 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46  GNED ) AS col1 F
31d80 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
31d90 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
31da0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
31db0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
31dc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
31dd0 61 62 65 6c 2d 31 34 34 35 0d 0a 53 45 4c 45 43  abel-1445..SELEC
31de0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
31df0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 43  ol2 + - col1 * C
31e00 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
31e10 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20  TEGER ) AS col1 
31e20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
31e30 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
31e40 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
31e50 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
31e60 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
31e70 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
31e80 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34  owsort label-144
31e90 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  6..SELECT ALL + 
31ea0 37 32 20 44 49 56 20 31 37 20 41 53 20 63 6f 6c  72 DIV 17 AS col
31eb0 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
31ec0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
31ed0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
31ee0 67 20 74 6f 20 36 66 65 63 39 36 35 62 36 30 62  g to 6fec965b60b
31ef0 39 38 38 35 63 34 61 66 37 33 65 38 35 34 32 32  9885c4af73e85422
31f00 63 66 64 39 62 0d 0a 0d 0a 73 6b 69 70 69 66 20  cfd9b....skipif 
31f10 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
31f20 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
31f30 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
31f40 34 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  46..SELECT ALL +
31f50 20 37 32 20 2f 20 31 37 20 41 53 20 63 6f 6c 31   72 / 17 AS col1
31f60 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
31f70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31f80 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
31f90 20 74 6f 20 36 66 65 63 39 36 35 62 36 30 62 39   to 6fec965b60b9
31fa0 38 38 35 63 34 61 66 37 33 65 38 35 34 32 32 63  885c4af73e85422c
31fb0 66 64 39 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20  fd9b....query I 
31fc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31fd0 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20  DISTINCT col1 + 
31fe0 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20  - ( - col1 ) AS 
31ff0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
32000 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32 0d 0a  ----..172..182..
32010 31 39 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  194....skipif po
32020 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
32030 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
32040 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
32050 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
32060 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32070 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32  .SELECT ALL tab2
32080 2e 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20  .col0 col1 FROM 
32090 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
320a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
320b0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 35  es hashing to 95
320c0 62 39 36 63 61 31 64 62 65 32 65 33 39 61 30 66  b96ca1dbe2e39a0f
320d0 61 37 38 66 35 30 64 33 37 34 66 35 31 61 0d 0a  a78f50d374f51a..
320e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
320f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 30  t..SELECT - tab0
32100 2e 63 6f 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63  .col1 * + tab0.c
32110 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
32120 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   tab0..----..-20
32130 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39  64..-3395..-8099
32140 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32150 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
32160 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 74 61  col0 * col0 + ta
32170 62 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a  b0.col0 + col2 *
32180 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 31   + tab0.col1 * 1
32190 37 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  7 FROM tab0..---
321a0 2d 0d 0a 31 33 34 38 36 34 0d 0a 32 39 30 39 0d  -..134864..2909.
321b0 0a 34 38 38 34 36 0d 0a 0d 0a 71 75 65 72 79 20  .48846....query 
321c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
321d0 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20 63  T ALL col2 + - c
321e0 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol2 * col1 AS co
321f0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
32200 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30  cor0..----..-280
32210 35 0d 0a 2d 37 33 38 30 0d 0a 2d 39 36 0d 0a 0d  5..-7380..-96...
32220 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32230 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
32240 2b 20 2d 20 38 38 20 2a 20 2b 20 63 6f 6c 30 20  + - 88 * + col0 
32250 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
32260 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32270 2d 32 39 33 0d 0a 2d 35 37 30 36 0d 0a 2d 37 31  -293..-5706..-71
32280 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  33....skipif mys
32290 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
322a0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
322b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
322c0 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  2 + + col2 * - c
322d0 6f 6c 32 20 2d 20 63 6f 6c 32 20 2a 20 28 20 2d  ol2 - col2 * ( -
322e0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63   cor0.col1 + - c
322f0 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20 28 20 63  ol1 * + CAST ( c
32300 6f 6c 30 20 41 53 20 52 45 41 4c 20 29 20 29 20  ol0 AS REAL ) ) 
32310 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
32320 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 35 34 0d 0a 33  0..----..2754..3
32330 33 38 35 38 0d 0a 39 31 39 36 38 0d 0a 0d 0a 73  3858..91968....s
32340 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
32350 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
32360 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
32370 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
32380 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
32390 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
323a0 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 63 6f  - col1 + col2 co
323b0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
323c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34  0..----..-33..-4
323d0 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..21....query I 
323e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
323f0 2d 20 2d 20 63 6f 6c 32 20 2b 20 31 34 20 2d 20  - - col2 + 14 - 
32400 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
32410 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32420 31 36 0d 0a 31 37 38 0d 0a 38 30 0d 0a 0d 0a 71  16..178..80....q
32430 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32440 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
32450 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 34 30 20  - - col2 * + 40 
32460 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
32470 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
32480 0a 31 30 34 30 0d 0a 31 30 38 30 0d 0a 31 35 32  .1040..1080..152
32490 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
324a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
324b0 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32   - - col1 * col2
324c0 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
324d0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
324e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d  or0..----..1261.
324f0 0a 31 34 33 30 0d 0a 35 38 30 0d 0a 0d 0a 73 6b  .1430..580....sk
32500 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
32510 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
32520 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
32530 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
32540 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
32550 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
32560 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 31  LL + + col1 col1
32570 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
32580 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31  r0..----..17..31
32590 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..59....query I 
325a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
325b0 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c  ( - col1 ) * col
325c0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
325d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
325e0 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d  -..-2064..-3395.
325f0 0a 2d 38 30 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-8099....onlyif
32600 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
32610 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
32620 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
32630 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32640 6c 61 62 65 6c 2d 31 34 36 30 0d 0a 53 45 4c 45  label-1460..SELE
32650 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
32660 39 34 20 44 49 56 20 2d 20 28 20 2b 20 63 6f 6c  94 DIV - ( + col
32670 32 20 2b 20 33 32 20 29 20 41 53 20 63 6f 6c 30  2 + 32 ) AS col0
32680 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
32690 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32  r0..----..-1..-2
326a0 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
326b0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
326c0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
326d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 30  wsort label-1460
326e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
326f0 54 20 2d 20 2d 20 39 34 20 2f 20 2d 20 28 20 2b  T - - 94 / - ( +
32700 20 63 6f 6c 32 20 2b 20 33 32 20 29 20 41 53 20   col2 + 32 ) AS 
32710 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
32720 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
32730 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  ..-2..0....query
32740 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32750 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20 37 20 29  CT ALL + - ( 7 )
32760 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41   + + cor0.col2 A
32770 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
32780 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d   cor0..----..-6.
32790 0a 32 36 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79  .26..75....query
327a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
327b0 43 54 20 41 4c 4c 20 39 32 20 2a 20 2d 20 63 6f  CT ALL 92 * - co
327c0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
327d0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
327e0 2d 2d 0d 0a 2d 37 39 31 32 0d 0a 2d 38 33 37 32  --..-7912..-8372
327f0 0d 0a 2d 38 39 32 34 0d 0a 0d 0a 71 75 65 72 79  ..-8924....query
32800 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32810 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  CT + + cor0.col1
32820 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30   * + col2 + cor0
32830 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
32840 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
32850 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36 32  .----..132..2862
32860 0d 0a 37 35 35 31 0d 0a 0d 0a 71 75 65 72 79 20  ..7551....query 
32870 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32880 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63  T ALL - + cor0.c
32890 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  ol0 * - col1 FRO
328a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
328b0 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35  ----..2064..3395
328c0 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20  ..8099....query 
328d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
328e0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
328f0 32 20 2a 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c  2 * col1 - - col
32900 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
32910 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 35  or0..----..-2805
32920 0d 0a 2d 37 33 38 30 0d 0a 2d 39 36 0d 0a 0d 0a  ..-7380..-96....
32930 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32940 0a 53 45 4c 45 43 54 20 2b 20 28 20 35 30 20 29  .SELECT + ( 50 )
32950 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
32960 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 30 0d 0a 35 30  r0..----..50..50
32970 0d 0a 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..50....query I 
32980 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32990 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2d  ALL + + col0 + -
329a0 20 32 38 20 2a 20 63 6f 6c 32 20 2d 20 2d 20 33   28 * col2 - - 3
329b0 33 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29  3 * + ( - col2 )
329c0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
329d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 38 0d  r0..----..-1508.
329e0 0a 2d 31 36 34 30 0d 0a 2d 32 32 33 39 0d 0a 0d  .-1640..-2239...
329f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32a00 0d 0a 53 45 4c 45 43 54 20 35 39 20 2b 20 32 38  ..SELECT 59 + 28
32a10 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
32a20 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
32a30 0d 0a 38 37 0d 0a 38 37 0d 0a 38 37 0d 0a 0d 0a  ..87..87..87....
32a40 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
32a50 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
32a60 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
32a70 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
32a80 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 39  wsort label-1469
32a90 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
32aa0 20 63 6f 6c 30 20 44 49 56 20 33 38 20 46 52 4f   col0 DIV 38 FRO
32ab0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
32ac0 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 32 0d 0a 0d  ----..0..1..2...
32ad0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
32ae0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
32af0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32b00 6c 61 62 65 6c 2d 31 34 36 39 0d 0a 53 45 4c 45  label-1469..SELE
32b10 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20  CT ALL + + col0 
32b20 2f 20 33 38 20 46 52 4f 4d 20 74 61 62 31 20 41  / 38 FROM tab1 A
32b30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
32b40 0a 31 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .1..2....query I
32b50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32b60 20 2b 20 2d 20 37 20 2b 20 63 6f 6c 31 20 2a 20   + - 7 + col1 * 
32b70 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
32b80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32b90 31 36 32 0d 0a 36 36 39 0d 0a 39 33 0d 0a 0d 0a  162..669..93....
32ba0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32bb0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
32bc0 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 38 32   - + col1 + + 82
32bd0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
32be0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d  r0..----..-15..-
32bf0 34 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49  4..-9....query I
32c00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32c10 20 41 4c 4c 20 2d 20 28 20 2d 20 63 6f 6c 32 20   ALL - ( - col2 
32c20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
32c30 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
32c40 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 6f 6e 6c  1..33..82....onl
32c50 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
32c60 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
32c70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
32c80 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
32c90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32ca0 6c 61 62 65 6c 2d 31 34 37 33 0d 0a 53 45 4c 45  label-1473..SELE
32cb0 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2d 20  CT ALL col0 + - 
32cc0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
32cd0 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
32ce0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
32cf0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
32d00 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
32d10 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
32d20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
32d30 2d 31 34 37 33 0d 0a 53 45 4c 45 43 54 20 41 4c  -1473..SELECT AL
32d40 4c 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 20  L col0 + - CAST 
32d50 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
32d60 52 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  R ) FROM tab0..-
32d70 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
32d80 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .NULL....onlyif 
32d90 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
32da0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
32db0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
32dc0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
32dd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
32de0 6c 2d 31 34 37 34 0d 0a 53 45 4c 45 43 54 20 44  l-1474..SELECT D
32df0 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2d  ISTINCT col2 + -
32e00 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
32e10 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
32e20 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  1..----..NULL...
32e30 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
32e40 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
32e50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32e60 6c 61 62 65 6c 2d 31 34 37 34 0d 0a 53 45 4c 45  label-1474..SELE
32e70 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
32e80 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   + - CAST ( NULL
32e90 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
32ea0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
32eb0 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ULL....onlyif my
32ec0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
32ed0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
32ee0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
32ef0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
32f00 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
32f10 31 34 37 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1475..SELECT ALL
32f20 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54   - col0 + - CAST
32f30 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
32f40 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d   ) FROM tab1..--
32f50 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
32f60 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
32f70 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
32f80 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
32f90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37  owsort label-147
32fa0 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  5..SELECT ALL - 
32fb0 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 20 28 20  col0 + - CAST ( 
32fc0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
32fd0 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
32fe0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
32ff0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
33000 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
33010 4c 4c 20 2b 20 34 38 20 41 53 20 63 6f 6c 32 20  LL + 48 AS col2 
33020 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
33030 2d 2d 2d 2d 0d 0a 34 38 0d 0a 34 38 0d 0a 34 38  ----..48..48..48
33040 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
33050 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
33060 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
33070 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
33080 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
33090 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
330a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
330b0 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63  ( + col1 ) + - c
330c0 6f 6c 30 20 2a 20 63 6f 6c 32 20 63 6f 6c 31 20  ol0 * col2 col1 
330d0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
330e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 36 0d 0a 2d  0..----..-706..-
330f0 37 32 30 37 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72  7207..62....quer
33100 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33110 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28  ECT DISTINCT + (
33120 20 2d 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f   - col2 ) + - co
33130 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
33140 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
33150 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d 32 0d 0a 2d 36  --..-164..-2..-6
33160 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
33170 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37  sort..SELECT + 7
33180 33 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  3 + col0 * col1 
33190 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
331a0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
331b0 0a 31 31 31 33 0d 0a 31 35 31 0d 0a 37 31 33 0d  .1113..151..713.
331c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
331d0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34  rt..SELECT ALL 4
331e0 38 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  8 FROM tab2, tab
331f0 30 20 63 6f 72 30 2c 20 74 61 62 31 20 63 6f 72  0 cor0, tab1 cor
33200 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
33210 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 65  es hashing to 0e
33220 66 35 37 31 61 38 37 32 32 61 62 37 32 37 30 61  f571a8722ab7270a
33230 61 37 32 37 32 63 31 31 37 34 62 38 38 65 0d 0a  a7272c1174b88e..
33240 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
33250 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
33260 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
33270 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
33280 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
33290 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
332a0 43 54 20 28 20 2d 20 34 38 20 29 20 63 6f 6c 32  CT ( - 48 ) col2
332b0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
332c0 0a 2d 2d 2d 2d 0d 0a 2d 34 38 0d 0a 2d 34 38 0d  .----..-48..-48.
332d0 0a 2d 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-48....query I 
332e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
332f0 33 36 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63  36 + + col0 AS c
33300 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
33310 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 0d 0a 31  r0..----..114..1
33320 31 35 0d 0a 34 33 0d 0a 0d 0a 71 75 65 72 79 20  15..43....query 
33330 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33340 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33 35 20  T DISTINCT + 35 
33350 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
33360 2d 2d 2d 2d 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72  ----..35....quer
33370 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33380 45 43 54 20 41 4c 4c 20 39 20 2b 20 2d 20 63 6f  ECT ALL 9 + - co
33390 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
333a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
333b0 2d 2d 0d 0a 2d 32 32 0d 0a 2d 35 30 0d 0a 2d 38  --..-22..-50..-8
333c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
333d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
333e0 35 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  51 * - col0 + co
333f0 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32  r0.col0 * + col2
33400 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   - col0 * - col0
33410 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
33420 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
33430 30 30 30 30 0d 0a 31 38 0d 0a 34 34 38 30 0d 0a  0000..18..4480..
33440 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33450 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
33460 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 41 53 20   col1 - col2 AS 
33470 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
33480 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
33490 0d 0a 2d 33 37 0d 0a 2d 37 30 0d 0a 0d 0a 6f 6e  ..-37..-70....on
334a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
334b0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
334c0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
334d0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
334e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
334f0 20 6c 61 62 65 6c 2d 31 34 38 37 0d 0a 53 45 4c   label-1487..SEL
33500 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  ECT + CAST( NULL
33510 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2f 20   AS DECIMAL ) / 
33520 2d 20 37 33 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  - 73 - col0 FROM
33530 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
33540 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
33550 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
33560 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
33570 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
33580 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
33590 38 37 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  87..SELECT + CAS
335a0 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c  T ( NULL AS REAL
335b0 20 29 20 2f 20 2d 20 37 33 20 2d 20 63 6f 6c 30   ) / - 73 - col0
335c0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
335d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
335e0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
335f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33600 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  ELECT + - cor0.c
33610 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 * - cor0.col
33620 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
33630 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
33640 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a  1534..646..837..
33650 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
33660 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
33670 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
33680 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
33690 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
336a0 38 39 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  89..SELECT + - c
336b0 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 * cor0.col0 
336c0 44 49 56 20 2d 20 63 6f 6c 32 20 2b 20 28 20 63  DIV - col2 + ( c
336d0 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol0 ) AS col0 FR
336e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
336f0 0a 2d 2d 2d 2d 0d 0a 31 32 36 30 0d 0a 31 38 35  .----..1260..185
33700 0d 0a 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..41....skipif m
33710 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
33720 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
33730 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38  owsort label-148
33740 39 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  9..SELECT + - co
33750 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2f  l0 * cor0.col0 /
33760 20 2d 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 30   - col2 + ( col0
33770 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
33780 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
33790 2d 2d 0d 0a 31 32 36 30 0d 0a 31 38 35 0d 0a 34  --..1260..185..4
337a0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
337b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38  sort..SELECT + 8
337c0 36 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  6 + + col2 FROM 
337d0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d  tab0..----..119.
337e0 0a 31 36 38 0d 0a 38 37 0d 0a 0d 0a 6f 6e 6c 79  .168..87....only
337f0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
33800 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
33810 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
33820 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
33830 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
33840 61 62 65 6c 2d 31 34 39 31 0d 0a 53 45 4c 45 43  abel-1491..SELEC
33850 54 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20  T CAST( col2 AS 
33860 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20  SIGNED ) * col0 
33870 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
33880 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32  .189..2028..3002
33890 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
338a0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
338b0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
338c0 72 74 20 6c 61 62 65 6c 2d 31 34 39 31 0d 0a 53  rt label-1491..S
338d0 45 4c 45 43 54 20 43 41 53 54 20 28 20 63 6f 6c  ELECT CAST ( col
338e0 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  2 AS INTEGER ) *
338f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
33900 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38  .----..189..2028
33910 0d 0a 33 30 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..3002....onlyif
33920 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
33930 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
33940 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
33950 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
33960 6c 61 62 65 6c 2d 31 34 39 32 0d 0a 53 45 4c 45  label-1492..SELE
33970 43 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 30  CT ALL tab2.col0
33980 20 44 49 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d   DIV - col1 FROM
33990 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   tab2..----..-1.
339a0 0a 2d 34 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-4..0....skipif
339b0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
339c0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
339d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
339e0 34 39 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  492..SELECT ALL 
339f0 74 61 62 32 2e 63 6f 6c 30 20 2f 20 2d 20 63 6f  tab2.col0 / - co
33a00 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
33a10 2d 2d 0d 0a 2d 31 0d 0a 2d 34 0d 0a 30 0d 0a 0d  --..-1..-4..0...
33a20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33a30 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 63  ..SELECT - ( - c
33a40 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 29 20 2a  ol2 + + col2 ) *
33a50 20 31 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   13 AS col0 FROM
33a60 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab0..----..0..
33a70 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  0..0....onlyif m
33a80 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
33a90 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
33aa0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
33ab0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
33ac0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
33ad0 2d 31 34 39 34 0d 0a 53 45 4c 45 43 54 20 43 41  -1494..SELECT CA
33ae0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
33af0 45 44 20 29 20 2b 20 38 36 20 46 52 4f 4d 20 74  ED ) + 86 FROM t
33b00 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab2..----..NULL.
33b10 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
33b20 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
33b30 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
33b40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
33b50 62 65 6c 2d 31 34 39 34 0d 0a 53 45 4c 45 43 54  bel-1494..SELECT
33b60 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
33b70 49 4e 54 45 47 45 52 20 29 20 2b 20 38 36 20 46  INTEGER ) + 86 F
33b80 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
33b90 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
33ba0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33bb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
33bc0 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l1 * - cor0.col1
33bd0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
33be0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
33bf0 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a  ..-7396..-8281..
33c00 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -9409....query I
33c10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33c20 20 41 4c 4c 20 36 38 20 2a 20 2b 20 63 6f 6c 30   ALL 68 * + col0
33c30 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
33c40 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 38 35  ab1..----..-2785
33c50 32 38 0d 0a 2d 34 33 35 32 30 30 0d 0a 2d 36 31  28..-435200..-61
33c60 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
33c70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
33c80 20 2d 20 33 31 20 46 52 4f 4d 20 74 61 62 31 0d   - 31 FROM tab1.
33c90 0a 2d 2d 2d 2d 0d 0a 2d 33 31 0d 0a 2d 33 31 0d  .----..-31..-31.
33ca0 0a 2d 33 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-31....onlyif m
33cb0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
33cc0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
33cd0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
33ce0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
33cf0 62 65 6c 2d 31 34 39 38 0d 0a 53 45 4c 45 43 54  bel-1498..SELECT
33d00 20 44 49 53 54 49 4e 43 54 20 33 37 20 44 49 56   DISTINCT 37 DIV
33d10 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
33d20 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab0..----..0
33d30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
33d40 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
33d50 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
33d60 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 38  wsort label-1498
33d70 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
33d80 54 20 33 37 20 2f 20 63 6f 6c 30 20 41 53 20 63  T 37 / col0 AS c
33d90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
33da0 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65  ---..0..1....que
33db0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33dc0 4c 45 43 54 20 2d 20 33 37 20 41 53 20 63 6f 6c  LECT - 37 AS col
33dd0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
33de0 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
33df0 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab1, tab0 AS cor
33e00 31 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  1, tab0, tab0 AS
33e10 20 63 6f 72 32 2c 20 74 61 62 32 0d 0a 2d 2d 2d   cor2, tab2..---
33e20 2d 0d 0a 37 32 39 20 76 61 6c 75 65 73 20 68 61  -..729 values ha
33e30 73 68 69 6e 67 20 74 6f 20 66 66 35 63 32 34 34  shing to ff5c244
33e40 34 34 32 34 64 61 34 34 62 38 65 30 31 65 36 64  4424da44b8e01e6d
33e50 61 65 33 66 37 33 38 64 33 0d 0a 0d 0a 71 75 65  ae3f738d3....que
33e60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33e70 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  LECT col2 + col0
33e80 20 2a 20 2b 20 32 20 41 53 20 63 6f 6c 32 20 46   * + 2 AS col2 F
33e90 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
33ea0 31 38 32 0d 0a 31 39 36 0d 0a 34 31 0d 0a 0d 0a  182..196..41....
33eb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33ec0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
33ed0 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 28 20 63 6f  l0 + col1 * ( co
33ee0 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l0 ) FROM tab1 A
33ef0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37  S cor0..----..57
33f00 36 0d 0a 37 35 0d 0a 39 36 30 0d 0a 0d 0a 6f 6e  6..75..960....on
33f10 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
33f20 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
33f30 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
33f40 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
33f50 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 32 0d 0a  ort label-1502..
33f60 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
33f70 2b 20 2d 20 63 6f 6c 30 20 2a 20 31 34 20 2b 20  + - col0 * 14 + 
33f80 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 44 49 56 20  col0 * col0 DIV 
33f90 2b 20 33 35 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  + 35 + - col1 * 
33fa0 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
33fb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33fc0 2d 36 33 39 0d 0a 32 35 36 32 0d 0a 38 36 34 0d  -639..2562..864.
33fd0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
33fe0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
33ff0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34000 74 20 6c 61 62 65 6c 2d 31 35 30 32 0d 0a 53 45  t label-1502..SE
34010 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
34020 2d 20 63 6f 6c 30 20 2a 20 31 34 20 2b 20 63 6f  - col0 * 14 + co
34030 6c 30 20 2a 20 63 6f 6c 30 20 2f 20 2b 20 33 35  l0 * col0 / + 35
34040 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   + - col1 * - co
34050 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
34060 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 33 39  cor0..----..-639
34070 0d 0a 32 35 36 32 0d 0a 38 36 34 0d 0a 0d 0a 71  ..2562..864....q
34080 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34090 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20  SELECT + + col1 
340a0 2b 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  + ( col2 ) FROM 
340b0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
340c0 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a  --..55..58..85..
340d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
340e0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
340f0 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  CT - cor0.col2 +
34100 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
34110 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
34120 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d  21..-176..-57...
34130 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
34140 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
34150 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
34160 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
34170 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30  owsort label-150
34180 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  5..SELECT + col1
34190 20 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 32   DIV + cor0.col2
341a0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
341b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
341c0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
341d0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
341e0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
341f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
34200 6c 2d 31 35 30 35 0d 0a 53 45 4c 45 43 54 20 2b  l-1505..SELECT +
34210 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 72 30 2e 63   col1 / + cor0.c
34220 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
34230 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
34240 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
34250 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34260 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
34270 20 2a 20 2b 20 33 33 20 2a 20 2d 20 38 38 20 46   * + 33 * - 88 F
34280 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
34290 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 33 35 32 0d  ..----..-110352.
342a0 0a 2d 37 35 35 30 34 0d 0a 2d 37 38 34 30 38 0d  .-75504..-78408.
342b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
342c0 72 74 0d 0a 53 45 4c 45 43 54 20 38 36 20 41 53  rt..SELECT 86 AS
342d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c   col0 FROM tab1,
342e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
342f0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
34300 73 68 69 6e 67 20 74 6f 20 32 64 38 63 33 61 30  shing to 2d8c3a0
34310 64 31 39 65 61 35 31 34 34 37 66 38 33 63 64 31  d19ea51447f83cd1
34320 38 62 34 39 66 65 65 31 39 0d 0a 0d 0a 6f 6e 6c  8b49fee19....onl
34330 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
34340 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
34350 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
34360 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
34370 72 74 20 6c 61 62 65 6c 2d 31 35 30 38 0d 0a 53  rt label-1508..S
34380 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b  ELECT - - col1 +
34390 20 63 6f 6c 31 20 44 49 56 20 2d 20 36 35 20 41   col1 DIV - 65 A
343a0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
343b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
343c0 38 35 0d 0a 39 30 0d 0a 39 36 0d 0a 0d 0a 73 6b  85..90..96....sk
343d0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
343e0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
343f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
34400 65 6c 2d 31 35 30 38 0d 0a 53 45 4c 45 43 54 20  el-1508..SELECT 
34410 2d 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  - - col1 + col1 
34420 2f 20 2d 20 36 35 20 41 53 20 63 6f 6c 30 20 46  / - 65 AS col0 F
34430 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
34440 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 39 30 0d 0a  ..----..85..90..
34450 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
34460 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
34470 32 34 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  24 * + cor0.col2
34480 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
34490 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
344a0 31 32 39 36 0d 0a 2d 31 33 36 38 0d 0a 2d 32 33  1296..-1368..-23
344b0 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  04....query I ro
344c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
344d0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
344e0 2d 20 63 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 72  - col2 + - ( cor
344f0 30 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31  0.col2 ) AS col1
34500 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
34510 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 30 0d  r0..----..-1560.
34520 0a 2d 36 38 34 0d 0a 2d 38 36 34 0d 0a 0d 0a 71  .-684..-864....q
34530 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34540 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63 6f  SELECT + tab0.co
34550 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
34560 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b0 AS cor0 CROSS
34570 20 4a 4f 49 4e 20 74 61 62 30 0d 0a 2d 2d 2d 2d   JOIN tab0..----
34580 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
34590 69 6e 67 20 74 6f 20 37 37 38 36 37 31 38 62 64  ing to 7786718bd
345a0 38 30 34 32 30 32 32 35 33 37 33 37 38 64 34 30  8042022537378d40
345b0 65 63 38 37 34 37 35 0d 0a 0d 0a 71 75 65 72 79  ec87475....query
345c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
345d0 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20  CT DISTINCT ( - 
345e0 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 41 53  col1 ) * col2 AS
345f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
34600 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31  .----..-1248..-1
34610 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65  404..-570....que
34620 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34630 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 35  LECT DISTINCT 95
34640 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
34650 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
34660 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..95....query I 
34670 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34680 32 36 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  26 * + col1 AS c
34690 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
346a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 33   cor0..----..223
346b0 36 0d 0a 32 33 36 36 0d 0a 32 35 32 32 0d 0a 0d  6..2366..2522...
346c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
346d0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
346e0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
346f0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
34700 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d  -..119..173..98.
34710 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34720 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
34730 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63  NCT - - col0 * c
34740 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
34750 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
34760 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30  ..1343..217..460
34770 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
34780 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
34790 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41   - - cor0.col0 A
347a0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
347b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
347c0 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65  7..78..79....que
347d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
347e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
347f0 35 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  50 + col0 * - co
34800 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
34810 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31 33  cor0..----..-613
34820 34 0d 0a 2d 36 32 39 31 0d 0a 2d 39 39 0d 0a 0d  4..-6291..-99...
34830 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34840 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
34850 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  0 + + cor0.col2 
34860 2a 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  * - col0 * + col
34870 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
34880 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 36 30  or0..----..-3360
34890 0d 0a 2d 36 36 34 30 32 39 0d 0a 2d 36 38 30 38  ..-664029..-6808
348a0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
348b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
348c0 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  or0.col1 * cor0.
348d0 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52  col2 * + col2 FR
348e0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
348f0 2d 2d 0d 0a 31 31 39 38 30 38 0d 0a 33 32 34 39  --..119808..3249
34900 30 0d 0a 37 35 38 31 36 0d 0a 0d 0a 71 75 65 72  0..75816....quer
34910 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34920 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
34930 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol2 * + col1 AS 
34940 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
34950 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
34960 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d  48..1404..570...
34970 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34980 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
34990 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col2 * cor0.col1
349a0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
349b0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
349c0 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a  ..-2838..-7462..
349d0 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -97....query I r
349e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
349f0 20 33 20 2a 20 63 6f 6c 31 20 2b 20 36 34 20 41   3 * col1 + 64 A
34a00 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
34a10 0d 0a 2d 2d 2d 2d 0d 0a 33 32 32 0d 0a 33 33 37  ..----..322..337
34a20 0d 0a 33 35 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..355....onlyif 
34a30 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
34a40 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
34a50 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
34a60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
34a70 61 62 65 6c 2d 31 35 32 34 0d 0a 53 45 4c 45 43  abel-1524..SELEC
34a80 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
34a90 32 20 44 49 56 20 74 61 62 30 2e 63 6f 6c 32 20  2 DIV tab0.col2 
34aa0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
34ab0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 73 6b  0..----..1....sk
34ac0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
34ad0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
34ae0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
34af0 65 6c 2d 31 35 32 34 0d 0a 53 45 4c 45 43 54 20  el-1524..SELECT 
34b00 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
34b10 2f 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63  / tab0.col2 AS c
34b20 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
34b30 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20  ---..1....query 
34b40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34b50 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31 37 20  T DISTINCT - 17 
34b60 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
34b70 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 0d 0a  1..----..-17....
34b80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34b90 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f  .SELECT ALL ( co
34ba0 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63  l1 ) FROM tab0 c
34bb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39  or0..----..86..9
34bc0 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  1..97....query I
34bd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34be0 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 28 20   DISTINCT + ( ( 
34bf0 63 6f 6c 32 20 29 20 29 20 2b 20 2b 20 28 20 36  col2 ) ) + + ( 6
34c00 34 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  4 ) FROM tab2 AS
34c10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32   cor0..----..102
34c20 0d 0a 39 30 0d 0a 39 31 0d 0a 0d 0a 71 75 65 72  ..90..91....quer
34c30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34c40 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b  ECT + + col2 * +
34c50 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41   col0 + + col2 A
34c60 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
34c70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34c80 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35 0d 0a 0d  36..7380..825...
34c90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34ca0 0d 0a 53 45 4c 45 43 54 20 39 31 20 2b 20 63 6f  ..SELECT 91 + co
34cb0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
34cc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 0d  cor0..----..169.
34cd0 0a 31 37 30 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72  .170..98....quer
34ce0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34cf0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 37  ECT DISTINCT + 7
34d00 34 20 2a 20 37 33 20 2b 20 63 6f 6c 31 20 41 53  4 * 73 + col1 AS
34d10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
34d20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
34d30 34 38 38 0d 0a 35 34 39 33 0d 0a 35 34 39 39 0d  488..5493..5499.
34d40 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
34d50 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
34d60 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
34d70 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
34d80 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
34d90 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 31  wsort label-1531
34da0 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28  ..SELECT - CAST(
34db0 20 2b 20 38 30 20 41 53 20 53 49 47 4e 45 44 20   + 80 AS SIGNED 
34dc0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
34dd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 30 0d 0a  or0..----..-80..
34de0 2d 38 30 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70  -80..-80....skip
34df0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
34e00 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
34e10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
34e20 2d 31 35 33 31 0d 0a 53 45 4c 45 43 54 20 2d 20  -1531..SELECT - 
34e30 43 41 53 54 20 28 20 2b 20 38 30 20 41 53 20 49  CAST ( + 80 AS I
34e40 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
34e50 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
34e60 0d 0a 2d 38 30 0d 0a 2d 38 30 0d 0a 2d 38 30 0d  ..-80..-80..-80.
34e70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34e80 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b  rt..SELECT + ( +
34e90 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53 20   cor0.col0 ) AS 
34ea0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
34eb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  S cor0..----..3.
34ec0 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  .64..80....query
34ed0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34ee0 43 54 20 2b 20 34 31 20 46 52 4f 4d 20 74 61 62  CT + 41 FROM tab
34ef0 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  1, tab0 AS cor0.
34f00 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
34f10 68 61 73 68 69 6e 67 20 74 6f 20 35 62 31 38 39  hashing to 5b189
34f20 38 36 62 62 32 39 34 34 31 32 62 33 64 39 66 30  86bb294412b3d9f0
34f30 37 62 37 65 36 66 63 38 32 31 65 0d 0a 0d 0a 71  7b7e6fc821e....q
34f40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34f50 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
34f60 2b 20 63 6f 6c 30 20 2a 20 28 20 2b 20 35 30 20  + col0 * ( + 50 
34f70 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 29 20  + + tab2.col0 ) 
34f80 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
34f90 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 37 37 33  b2..----..-10773
34fa0 0d 0a 2d 32 35 39 35 38 34 0d 0a 2d 33 38 37 32  ..-259584..-3872
34fb0 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
34fc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
34fd0 4c 20 2b 20 31 33 20 46 52 4f 4d 20 74 61 62 31  L + 13 FROM tab1
34fe0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
34ff0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
35000 61 73 68 69 6e 67 20 74 6f 20 31 38 34 65 35 32  ashing to 184e52
35010 64 37 61 61 35 61 61 36 36 35 39 31 32 39 31 65  d7aa5aa66591291e
35020 33 39 63 36 37 61 33 64 66 62 0d 0a 0d 0a 6f 6e  39c67a3dfb....on
35030 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
35040 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
35050 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
35060 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
35070 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35080 20 6c 61 62 65 6c 2d 31 35 33 36 0d 0a 53 45 4c   label-1536..SEL
35090 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
350a0 31 20 2f 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  1 / CAST( NULL A
350b0 53 20 44 45 43 49 4d 41 4c 20 29 20 46 52 4f 4d  S DECIMAL ) FROM
350c0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab0..----..NUL
350d0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
350e0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
350f0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
35100 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 36 0d 0a  ort label-1536..
35110 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
35120 63 6f 6c 31 20 2f 20 43 41 53 54 20 28 20 4e 55  col1 / CAST ( NU
35130 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f  LL AS REAL ) FRO
35140 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab0..----..NU
35150 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
35160 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
35170 53 54 49 4e 43 54 20 38 31 20 41 53 20 63 6f 6c  STINCT 81 AS col
35180 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
35190 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
351a0 0a 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .81....onlyif my
351b0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
351c0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
351d0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
351e0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
351f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
35200 31 35 33 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1538..SELECT col
35210 32 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  2 * - CAST( NULL
35220 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
35230 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
35240 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab2..----..NUL
35250 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
35260 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
35270 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
35280 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
35290 6c 61 62 65 6c 2d 31 35 33 38 0d 0a 53 45 4c 45  label-1538..SELE
352a0 43 54 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54  CT col2 * - CAST
352b0 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
352c0 45 52 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63  ER ) * col2 AS c
352d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
352e0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
352f0 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
35300 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35310 20 44 49 53 54 49 4e 43 54 20 74 61 62 31 2e 63   DISTINCT tab1.c
35320 6f 6c 32 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ol2 + tab1.col0 
35330 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
35340 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
35350 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71  21..176..57....q
35360 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35370 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 30 20  SELECT + ( col0 
35380 29 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ) * + col2 * col
35390 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
353a0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 31 33 36  ab0..----..26136
353b0 0d 0a 33 35 0d 0a 35 39 38 34 33 36 0d 0a 0d 0a  ..35..598436....
353c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
353d0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28 20 2b 20  .SELECT + + ( + 
353e0 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 72 30 2e  col2 ) * - cor0.
353f0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
35400 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
35410 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34  ----..-162..-364
35420 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72  8..-7680....quer
35430 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35440 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2d  ECT - - col2 + -
35450 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20   col2 + col1 AS 
35460 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
35470 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36  S cor0..----..86
35480 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  ..91..97....quer
35490 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
354a0 45 43 54 20 41 4c 4c 20 2b 20 35 35 20 2b 20 2d  ECT ALL + 55 + -
354b0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
354c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
354d0 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 32 34 0d  .----..-23..-24.
354e0 0a 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .48....query I r
354f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
35500 4c 4c 20 2b 20 2b 20 37 35 20 2a 20 63 6f 6c 32  LL + + 75 * col2
35510 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46   + - cor0.col1 F
35520 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
35530 2d 2d 2d 0d 0a 31 38 39 31 0d 0a 31 39 39 34 0d  ---..1891..1994.
35540 0a 32 38 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .2833....query I
35550 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35560 20 2d 20 33 39 20 2d 20 2b 20 34 39 20 46 52 4f   - 39 - + 49 FRO
35570 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  M tab2..----..-8
35580 38 0d 0a 2d 38 38 0d 0a 2d 38 38 0d 0a 0d 0a 71  8..-88..-88....q
35590 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
355a0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
355b0 74 61 62 32 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30  tab2.col1 + col0
355c0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
355d0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 36 0d 0a  2..----..-1226..
355e0 2d 31 38 33 0d 0a 2d 34 34 39 38 0d 0a 0d 0a 71  -183..-4498....q
355f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35600 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
35610 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53  + col2 * col2 AS
35620 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
35630 0a 2d 2d 2d 2d 0d 0a 31 31 37 35 0d 0a 36 38 31  .----..1175..681
35640 35 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  5..98....query I
35650 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35660 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
35670 20 2b 20 2d 20 38 32 20 46 52 4f 4d 20 74 61 62   + - 82 FROM tab
35680 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 32  1..----..-18..-2
35690 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-79....query I
356a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
356b0 20 44 49 53 54 49 4e 43 54 20 2b 20 31 32 20 2a   DISTINCT + 12 *
356c0 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20   col1 + col2 AS 
356d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
356e0 2d 2d 2d 2d 0d 0a 32 34 32 0d 0a 33 39 39 0d 0a  ----..242..399..
356f0 37 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  734....query I r
35700 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
35710 20 39 37 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c   97 * - tab0.col
35720 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
35730 2d 0d 0a 33 32 30 31 0d 0a 37 39 35 34 0d 0a 39  -..3201..7954..9
35740 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
35750 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
35760 54 49 4e 43 54 20 2d 20 31 31 20 2b 20 2d 20 74  TINCT - 11 + - t
35770 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab1.col0 FROM ta
35780 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d  b1..----..-14..-
35790 37 35 0d 0a 2d 39 31 0d 0a 0d 0a 6f 6e 6c 79 69  75..-91....onlyi
357a0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
357b0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
357c0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
357d0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
357e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
357f0 62 65 6c 2d 31 35 35 32 0d 0a 53 45 4c 45 43 54  bel-1552..SELECT
35800 20 41 4c 4c 20 43 41 53 54 28 20 4e 55 4c 4c 20   ALL CAST( NULL 
35810 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f  AS SIGNED ) * co
35820 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  l0 + + col0 * co
35830 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
35840 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab0..----..NULL
35850 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
35860 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
35870 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
35880 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
35890 61 62 65 6c 2d 31 35 35 32 0d 0a 53 45 4c 45 43  abel-1552..SELEC
358a0 54 20 41 4c 4c 20 43 41 53 54 20 28 20 4e 55 4c  T ALL CAST ( NUL
358b0 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
358c0 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a   col0 + + col0 *
358d0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
358e0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab0..----..N
358f0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
35900 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
35910 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
35920 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
35930 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
35940 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
35950 35 35 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  553..SELECT ALL 
35960 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b 20  + tab1.col0 * + 
35970 28 20 2d 20 63 6f 6c 30 20 29 20 44 49 56 20 2b  ( - col0 ) DIV +
35980 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 41   col0 + + col0 A
35990 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
359a0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
359b0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
359c0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
359d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
359e0 74 20 6c 61 62 65 6c 2d 31 35 35 33 0d 0a 53 45  t label-1553..SE
359f0 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 31 2e  LECT ALL + tab1.
35a00 63 6f 6c 30 20 2a 20 2b 20 28 20 2d 20 63 6f 6c  col0 * + ( - col
35a10 30 20 29 20 2f 20 2b 20 63 6f 6c 30 20 2b 20 2b  0 ) / + col0 + +
35a20 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
35a30 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab1..----..0
35a40 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
35a50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35a60 54 20 44 49 53 54 49 4e 43 54 20 39 38 20 2b 20  T DISTINCT 98 + 
35a70 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
35a80 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 37 36 0d 0a  ----..105..176..
35a90 31 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  177....query I r
35aa0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
35ab0 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  LL - col2 * col2
35ac0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
35ad0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 30 0d 0a  1..----..-2890..
35ae0 2d 33 32 33 39 0d 0a 2d 39 32 30 33 0d 0a 0d 0a  -3239..-9203....
35af0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
35b00 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
35b10 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
35b20 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
35b30 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 36  wsort label-1556
35b40 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 28 20 63  ..SELECT ( + ( c
35b50 6f 6c 32 20 29 20 2a 20 74 61 62 32 2e 63 6f 6c  ol2 ) * tab2.col
35b60 30 20 29 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56  0 ) + - col1 DIV
35b70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
35b80 0a 2d 2d 2d 2d 0d 0a 31 38 38 0d 0a 32 30 32 37  .----..188..2027
35b90 0d 0a 33 30 30 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..3001....skipif
35ba0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
35bb0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
35bc0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
35bd0 35 35 36 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20  556..SELECT ( + 
35be0 28 20 63 6f 6c 32 20 29 20 2a 20 74 61 62 32 2e  ( col2 ) * tab2.
35bf0 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 31 20  col0 ) + - col1 
35c00 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  / col1 FROM tab2
35c10 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 0d 0a 32 30 32  ..----..188..202
35c20 37 0d 0a 33 30 30 31 0d 0a 0d 0a 71 75 65 72 79  7..3001....query
35c30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35c40 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a  CT col2 + col1 *
35c50 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
35c60 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 35  1..----..-24..-5
35c70 38 33 0d 0a 2d 39 34 34 0d 0a 0d 0a 71 75 65 72  83..-944....quer
35c80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35c90 45 43 54 20 41 4c 4c 20 2b 20 38 35 20 2a 20 63  ECT ALL + 85 * c
35ca0 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
35cb0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
35cc0 0d 0a 32 35 35 0d 0a 35 34 34 30 0d 0a 36 38 30  ..255..5440..680
35cd0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
35ce0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
35cf0 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63   col0 * col0 + c
35d00 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 * col1 FROM 
35d10 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
35d20 2d 2d 0d 0a 31 30 31 30 0d 0a 36 35 33 30 0d 0a  --..1010..6530..
35d30 39 35 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9565....query I 
35d40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35d50 44 49 53 54 49 4e 43 54 20 2b 20 34 35 20 2a 20  DISTINCT + 45 * 
35d60 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  + col0 + - col1 
35d70 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
35d80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35d90 32 32 34 30 0d 0a 32 35 36 30 0d 0a 35 37 0d 0a  2240..2560..57..
35da0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35db0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
35dc0 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  CT - col0 * col2
35dd0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31   + col0 * - col1
35de0 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41   - - cor0.col2 A
35df0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
35e00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35e10 2d 31 35 33 31 35 0d 0a 2d 32 38 32 33 0d 0a 2d  -15315..-2823..-
35e20 33 34 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3429....query I 
35e30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35e40 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20  + col0 + col0 * 
35e50 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col0 * + cor0.co
35e60 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  l2 + cor0.col0 *
35e70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
35e80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
35e90 31 30 39 36 0d 0a 34 36 35 35 0d 0a 36 35 37 37  1096..4655..6577
35ea0 31 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  10....skipif pos
35eb0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
35ec0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
35ed0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
35ee0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
35ef0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35f00 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
35f10 32 20 2a 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  2 * col1 col0 FR
35f20 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
35f30 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36  .----..-1534..-6
35f40 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 6f 6e 6c 79  46..-837....only
35f50 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
35f60 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
35f70 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
35f80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35f90 74 20 6c 61 62 65 6c 2d 31 35 36 34 0d 0a 53 45  t label-1564..SE
35fa0 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20 63 6f  LECT col2 DIV co
35fb0 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  r0.col0 AS col2 
35fc0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
35fd0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31  0..----..0..0..1
35fe0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
35ff0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
36000 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
36010 72 74 20 6c 61 62 65 6c 2d 31 35 36 34 0d 0a 53  rt label-1564..S
36020 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 63 6f 72  ELECT col2 / cor
36030 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
36040 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
36050 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d  ..----..0..0..1.
36060 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
36070 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
36080 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d  NCT + + col0 * -
36090 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c   col0 + cor0.col
360a0 32 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  2 * col1 * + col
360b0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
360c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 34 30  or0..----..11340
360d0 38 0d 0a 32 38 33 39 34 0d 0a 37 35 38 30 37 0d  8..28394..75807.
360e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
360f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32  rt..SELECT ALL 2
36100 33 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  3 FROM tab2 AS c
36110 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 32  or0..----..23..2
36120 33 0d 0a 32 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  3..23....onlyif 
36130 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
36140 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
36150 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
36160 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
36170 61 62 65 6c 2d 31 35 36 37 0d 0a 53 45 4c 45 43  abel-1567..SELEC
36180 54 20 2b 20 33 36 20 44 49 56 20 63 6f 6c 30 20  T + 36 DIV col0 
36190 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  + - col1 * col2 
361a0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
361b0 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 33  ----..-1248..-13
361c0 39 32 0d 0a 2d 35 37 30 0d 0a 0d 0a 73 6b 69 70  92..-570....skip
361d0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
361e0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
361f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
36200 2d 31 35 36 37 0d 0a 53 45 4c 45 43 54 20 2b 20  -1567..SELECT + 
36210 33 36 20 2f 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  36 / col0 + - co
36220 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
36230 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
36240 2d 31 32 34 38 0d 0a 2d 31 33 39 32 0d 0a 2d 35  -1248..-1392..-5
36250 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
36260 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
36270 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
36280 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
36290 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
362a0 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a  ----..121..176..
362b0 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
362c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 32  wsort..SELECT 12
362d0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
362e0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
362f0 0d 0a 31 32 0d 0a 31 32 0d 0a 31 32 0d 0a 0d 0a  ..12..12..12....
36300 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
36310 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
36320 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
36330 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
36340 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37 30  wsort label-1570
36350 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38  ..SELECT ALL - 8
36360 39 20 2a 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c  9 * col1 DIV col
36370 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
36380 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a  or0..----..-13..
36390 2d 31 34 0d 0a 2d 37 37 31 0d 0a 0d 0a 73 6b 69  -14..-771....ski
363a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
363b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
363c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
363d0 6c 2d 31 35 37 30 0d 0a 53 45 4c 45 43 54 20 41  l-1570..SELECT A
363e0 4c 4c 20 2d 20 38 39 20 2a 20 63 6f 6c 31 20 2f  LL - 89 * col1 /
363f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
36400 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
36410 31 33 0d 0a 2d 31 34 0d 0a 2d 37 37 31 0d 0a 0d  13..-14..-771...
36420 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36430 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
36440 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  2 * + col1 + col
36450 30 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  0 + - col2 FROM 
36460 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
36470 2d 2d 0d 0a 31 35 38 36 0d 0a 36 38 37 0d 0a 38  --..1586..687..8
36480 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  17....query I ro
36490 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
364a0 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30 2e  STINCT - - cor0.
364b0 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col0 + col0 FROM
364c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
364d0 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a 36  ---..128..160..6
364e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
364f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
36500 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 41 53  col1 + - col2 AS
36510 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
36520 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a  cor0..----..53..
36530 39 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  9..96....skipif 
36540 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
36550 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
36560 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36570 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 43 41  + tab1.col2 * CA
36580 53 54 20 28 20 31 39 20 41 53 20 52 45 41 4c 20  ST ( 19 AS REAL 
36590 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  ) + col0 AS col2
365a0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
365b0 0d 0a 31 30 32 39 0d 0a 31 31 34 37 0d 0a 31 39  ..1029..1147..19
365c0 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  04....query I ro
365d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
365e0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
365f0 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col0 + col0 FROM
36600 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
36610 2d 2d 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a  ---..1422..224..
36620 34 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4680....query I 
36630 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36640 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ALL + col2 * col
36650 32 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  2 - col0 FROM ta
36660 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
36670 0d 0a 2d 33 34 0d 0a 31 30 36 35 0d 0a 36 36 33  ..-34..1065..663
36680 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
36690 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
366a0 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2d   + + cor0.col1 -
366b0 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
366c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
366d0 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71  .29..74..93....q
366e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
366f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
36700 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  + col0 + - col2 
36710 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  * col1 AS col2 F
36720 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
36730 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 36 0d 0a 2d  ..----..-1456..-
36740 35 36 37 0d 0a 2d 38 33 30 0d 0a 0d 0a 6f 6e 6c  567..-830....onl
36750 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
36760 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
36770 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
36780 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
36790 72 74 20 6c 61 62 65 6c 2d 31 35 37 39 0d 0a 53  rt label-1579..S
367a0 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20 2d  ELECT col2 DIV -
367b0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
367c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
367d0 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 73 6b 69  2..-5..-7....ski
367e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
367f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
36800 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
36810 6c 2d 31 35 37 39 0d 0a 53 45 4c 45 43 54 20 63  l-1579..SELECT c
36820 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 / - col1 FRO
36830 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
36840 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35 0d 0a 2d 37  ----..-2..-5..-7
36850 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36860 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
36870 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d   * cor0.col0 * -
36880 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
36890 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
368a0 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 38 30 0d 0a 2d  .----..-36480..-
368b0 34 32 31 32 0d 0a 2d 39 39 38 34 30 0d 0a 0d 0a  4212..-99840....
368c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
368d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
368e0 20 63 6f 6c 30 20 2b 20 28 20 2b 20 63 6f 6c 31   col0 + ( + col1
368f0 20 29 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63   ) - + col1 AS c
36900 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
36910 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d   cor0..----..24.
36920 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 6f 6e 6c 79 69  .35..89....onlyi
36930 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
36940 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
36950 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
36960 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36970 20 6c 61 62 65 6c 2d 31 35 38 32 0d 0a 53 45 4c   label-1582..SEL
36980 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
36990 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 2d 20 63  0 DIV - col1 - c
369a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
369b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
369c0 0d 0a 2d 31 39 0d 0a 2d 32 36 0d 0a 0d 0a 73 6b  ..-19..-26....sk
369d0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
369e0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
369f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
36a00 65 6c 2d 31 35 38 32 0d 0a 53 45 4c 45 43 54 20  el-1582..SELECT 
36a10 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2f 20  DISTINCT col0 / 
36a20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 46 52  - col1 - col1 FR
36a30 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
36a40 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 31 39 0d  .----..-16..-19.
36a50 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-26....query I 
36a60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36a70 2b 20 38 39 20 2d 20 63 6f 6c 30 20 41 53 20 63  + 89 - col0 AS c
36a80 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
36a90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d   cor0..----..25.
36aa0 0a 38 36 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20  .86..9....query 
36ab0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36ac0 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2a  T ALL + - col0 *
36ad0 20 32 37 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f   27 + - col2 FRO
36ae0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
36af0 2d 2d 2d 2d 0d 0a 2d 32 31 33 32 0d 0a 2d 32 31  ----..-2132..-21
36b00 36 0d 0a 2d 32 31 37 31 0d 0a 0d 0a 71 75 65 72  6..-2171....quer
36b10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36b20 45 43 54 20 41 4c 4c 20 2b 20 2b 20 28 20 2d 20  ECT ALL + + ( - 
36b30 63 6f 6c 31 20 29 20 2d 20 2b 20 63 6f 6c 32 20  col1 ) - + col2 
36b40 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
36b50 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
36b60 31 31 37 35 0d 0a 2d 36 38 31 35 0d 0a 2d 39 38  1175..-6815..-98
36b70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36b80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 36 20 46  ort..SELECT 46 F
36b90 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
36ba0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
36bb0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
36bc0 6f 20 33 31 38 31 38 63 39 64 34 64 33 32 35 65  o 31818c9d4d325e
36bd0 62 32 34 38 37 33 35 63 39 37 63 62 31 64 63 65  b248735c97cb1dce
36be0 33 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  39....onlyif mys
36bf0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
36c00 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
36c10 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
36c20 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
36c30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
36c40 35 38 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  587..SELECT DIST
36c50 49 4e 43 54 20 2d 20 2d 20 43 41 53 54 28 20 4e  INCT - - CAST( N
36c60 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
36c70 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a 20  * col0 - col1 * 
36c80 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col1 col1 FROM t
36c90 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
36ca0 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
36cb0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
36cc0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
36cd0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
36ce0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
36cf0 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
36d00 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
36d10 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
36d20 72 74 20 6c 61 62 65 6c 2d 31 35 38 37 0d 0a 53  rt label-1587..S
36d30 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
36d40 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
36d50 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f  S INTEGER ) * co
36d60 6c 30 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  l0 - col1 * col1
36d70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
36d80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
36d90 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
36da0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
36db0 20 28 20 38 37 20 29 20 2d 20 2b 20 63 6f 6c 30   ( 87 ) - + col0
36dc0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
36dd0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36de0 0d 0a 2d 31 36 35 0d 0a 2d 31 36 36 0d 0a 2d 39  ..-165..-166..-9
36df0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
36e00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
36e10 20 2d 20 2b 20 37 34 20 41 53 20 63 6f 6c 32 20   - + 74 AS col2 
36e20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
36e30 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34 0d 0a 2d 37  0..----..-74..-7
36e40 34 0d 0a 2d 37 34 0d 0a 0d 0a 71 75 65 72 79 20  4..-74....query 
36e50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36e60 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
36e70 30 20 2b 20 2d 20 32 33 20 46 52 4f 4d 20 74 61  0 + - 23 FROM ta
36e80 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36e90 0d 0a 2d 31 36 0d 0a 35 35 0d 0a 35 36 0d 0a 0d  ..-16..55..56...
36ea0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36eb0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
36ec0 32 20 2a 20 31 36 20 2b 20 2d 20 63 6f 6c 31 20  2 * 16 + - col1 
36ed0 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
36ee0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
36ef0 0d 0a 32 35 39 32 0d 0a 33 34 31 31 0d 0a 39 34  ..2592..3411..94
36f00 31 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  11....onlyif mys
36f10 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
36f20 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
36f30 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
36f40 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
36f50 6c 2d 31 35 39 32 0d 0a 53 45 4c 45 43 54 20 2d  l-1592..SELECT -
36f60 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 44   col0 + + col2 D
36f70 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c  IV - col1 AS col
36f80 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
36f90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d  or0..----..-7..-
36fa0 37 38 0d 0a 2d 38 31 0d 0a 0d 0a 73 6b 69 70 69  78..-81....skipi
36fb0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
36fc0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
36fd0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
36fe0 31 35 39 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1592..SELECT - c
36ff0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2d  ol0 + + col2 / -
37000 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
37010 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
37020 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a  .----..-7..-78..
37030 2d 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -81....onlyif my
37040 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
37050 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
37060 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
37070 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
37080 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
37090 31 35 39 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63  1593..SELECT + c
370a0 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63  ol2 * col0 + - c
370b0 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 43  ol0 + - col1 * C
370c0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
370d0 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20  NED ) FROM tab0 
370e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
370f0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
37100 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
37110 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
37120 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37130 74 20 6c 61 62 65 6c 2d 31 35 39 33 0d 0a 53 45  t label-1593..SE
37140 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  LECT + col2 * co
37150 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  l0 + - col0 + - 
37160 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 4e 55  col1 * CAST ( NU
37170 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
37180 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
37190 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
371a0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
371b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
371c0 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  LECT + + cor0.co
371d0 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 36 30 20 41  l1 * col1 * 60 A
371e0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
371f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37200 34 34 33 37 36 30 0d 0a 34 39 36 38 36 30 0d 0a  443760..496860..
37210 35 36 34 35 34 30 0d 0a 0d 0a 73 6b 69 70 69 66  564540....skipif
37220 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
37230 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
37240 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
37250 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
37260 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
37270 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
37280 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  NCT - cor0.col0 
37290 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  + cor0.col1 * - 
372a0 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
372b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
372c0 2d 0d 0a 2d 33 35 35 39 0d 0a 2d 33 36 38 0d 0a  -..-3559..-368..
372d0 2d 39 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -968....query I 
372e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
372f0 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL + cor0.col0 
37300 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  * + cor0.col2 FR
37310 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
37320 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d  .----..35..7298.
37330 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .792....query I 
37340 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37350 2d 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 30 20  - col2 * ( col0 
37360 29 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ) + + col2 AS co
37370 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
37380 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d  cor0..----..-34.
37390 0a 2d 37 32 31 36 0d 0a 2d 37 35 39 0d 0a 0d 0a  .-7216..-759....
373a0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
373b0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
373c0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
373d0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
373e0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
373f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37400 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   ALL + cor0.col0
37410 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f   + col0 col2 FRO
37420 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37430 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31  ----..14..156..1
37440 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
37450 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
37460 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c 31  cor0.col0 - col1
37470 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
37480 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36  r0..----..-2..-6
37490 32 0d 0a 2d 36 32 0d 0a 0d 0a 73 6b 69 70 69 66  2..-62....skipif
374a0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
374b0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
374c0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
374d0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
374e0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
374f0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
37500 2a 20 2b 20 28 20 36 36 20 2b 20 2d 20 63 6f 6c  * + ( 66 + - col
37510 30 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 ) col0 FROM ta
37520 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
37530 31 38 32 0d 0a 31 36 33 38 0d 0a 32 30 0d 0a 0d  182..1638..20...
37540 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
37550 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
37560 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
37570 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
37580 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
37590 6f 72 74 20 6c 61 62 65 6c 2d 31 36 30 31 0d 0a  ort label-1601..
375a0 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 4e  SELECT - CAST( N
375b0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
375c0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
375d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
375e0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
375f0 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31 35  cd7a7901e47c1515
37600 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30 62  5404aff0d216fe0b
37610 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
37620 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
37630 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
37640 72 74 20 6c 61 62 65 6c 2d 31 36 30 31 0d 0a 53  rt label-1601..S
37650 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 4e  ELECT - CAST ( N
37660 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
37670 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
37680 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
37690 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
376a0 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31   cd7a7901e47c151
376b0 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30  55404aff0d216fe0
376c0 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  b....query I row
376d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
376e0 20 28 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   ( col2 * + col2
376f0 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d   ) FROM tab2..--
37700 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d 0a 37  --..1444..676..7
37710 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  29....query I ro
37720 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
37730 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20  STINCT + col2 * 
37740 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  - col1 + + col2 
37750 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
37760 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  0 cor0..----..-2
37770 38 30 35 0d 0a 2d 37 33 38 30 0d 0a 2d 39 36 0d  805..-7380..-96.
37780 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
37790 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
377a0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
377b0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
377c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
377d0 36 30 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  604..SELECT DIST
377e0 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  INCT cor0.col0 +
377f0 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 46   col1 DIV col2 F
37800 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
37810 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 36 0d  ..----..132..26.
37820 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .90....skipif my
37830 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
37840 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
37850 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 30 34  wsort label-1604
37860 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
37870 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f  T cor0.col0 + co
37880 6c 31 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 / col2 FROM t
37890 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
378a0 2d 0d 0a 31 33 32 0d 0a 32 36 0d 0a 39 30 0d 0a  -..132..26..90..
378b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
378c0 74 0d 0a 53 45 4c 45 43 54 20 34 30 20 2b 20 2b  t..SELECT 40 + +
378d0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
378e0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
378f0 32 32 0d 0a 34 31 0d 0a 37 33 0d 0a 0d 0a 71 75  22..41..73....qu
37900 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37910 45 4c 45 43 54 20 2b 20 38 35 20 41 53 20 63 6f  ELECT + 85 AS co
37920 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
37930 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
37940 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
37950 6e 67 20 74 6f 20 61 61 66 61 38 65 35 63 66 62  ng to aafa8e5cfb
37960 39 65 30 32 63 65 61 38 37 31 37 38 33 33 65 37  9e02cea8717833e7
37970 35 38 31 66 37 62 0d 0a 0d 0a 71 75 65 72 79 20  581f7b....query 
37980 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37990 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  T - col1 + - col
379a0 30 20 2a 20 2b 20 32 35 20 2a 20 2d 20 63 6f 6c  0 * + 25 * - col
379b0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
379c0 2d 0d 0a 31 30 32 33 39 30 0d 0a 31 35 39 39 38  -..102390..15998
379d0 37 0d 0a 31 39 39 0d 0a 0d 0a 71 75 65 72 79 20  7..199....query 
379e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
379f0 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 30 20  T ALL tab0.col0 
37a00 2b 20 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d  + tab0.col2 FROM
37a10 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31   tab0..----..171
37a20 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72  ..36..57....quer
37a30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37a40 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28  ECT DISTINCT + (
37a50 20 74 61 62 31 2e 63 6f 6c 32 20 29 20 2a 20 63   tab1.col2 ) * c
37a60 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ol0 + tab1.col0 
37a70 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
37a80 0a 31 36 35 0d 0a 33 37 31 32 0d 0a 37 37 36 30  .165..3712..7760
37a90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37aa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 34 20 41  ort..SELECT 54 A
37ab0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
37ac0 2c 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  , tab0, tab1 AS 
37ad0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
37ae0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
37af0 20 38 31 31 35 30 64 35 39 64 36 63 33 66 63 34   81150d59d6c3fc4
37b00 38 62 34 65 66 35 61 34 61 35 34 39 35 62 63 37  8b4ef5a4a5495bc7
37b10 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  a....query I row
37b20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
37b30 20 2d 20 33 30 20 2b 20 63 6f 6c 30 20 2a 20 2b   - 30 + col0 * +
37b40 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
37b50 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 0d 0a 37 32  ab0..----..5..72
37b60 36 38 0d 0a 37 36 32 0d 0a 0d 0a 6f 6e 6c 79 69  68..762....onlyi
37b70 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
37b80 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
37b90 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
37ba0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37bb0 20 6c 61 62 65 6c 2d 31 36 31 32 0d 0a 53 45 4c   label-1612..SEL
37bc0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
37bd0 32 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  2 + col2 + col1 
37be0 44 49 56 20 31 30 20 46 52 4f 4d 20 74 61 62 31  DIV 10 FROM tab1
37bf0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 31 35  ..----..110..115
37c00 0d 0a 31 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..193....skipif 
37c10 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
37c20 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
37c30 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36  rowsort label-16
37c40 31 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  12..SELECT DISTI
37c50 4e 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  NCT col2 + col2 
37c60 2b 20 63 6f 6c 31 20 2f 20 31 30 20 46 52 4f 4d  + col1 / 10 FROM
37c70 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30   tab1..----..110
37c80 0d 0a 31 31 35 0d 0a 31 39 33 0d 0a 0d 0a 71 75  ..115..193....qu
37c90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37ca0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
37cb0 20 31 39 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 28   19 + col0 * + (
37cc0 20 63 6f 6c 30 20 29 20 2b 20 74 61 62 30 2e 63   col0 ) + tab0.c
37cd0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
37ce0 2d 2d 2d 0d 0a 31 33 34 31 0d 0a 36 38 31 0d 0a  ---..1341..681..
37cf0 38 30 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8031....query I 
37d00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37d10 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72  ALL + col2 + cor
37d20 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
37d30 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
37d40 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39  ---..119..173..9
37d50 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
37d60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
37d70 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63  TINCT - col1 * c
37d80 6f 6c 30 20 2b 20 28 20 63 6f 6c 32 20 29 20 41  ol0 + ( col2 ) A
37d90 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
37da0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37db0 2d 31 33 30 35 0d 0a 2d 31 39 30 0d 0a 2d 34 35  -1305..-190..-45
37dc0 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
37dd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
37de0 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  L - cor0.col1 FR
37df0 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20 74  OM tab1, tab0, t
37e00 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
37e10 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
37e20 68 69 6e 67 20 74 6f 20 63 37 38 39 30 34 36 39  hing to c7890469
37e30 65 61 62 62 32 63 36 66 63 38 31 34 35 34 62 33  eabb2c6fc81454b3
37e40 35 64 32 33 33 33 62 36 0d 0a 0d 0a 71 75 65 72  5d2333b6....quer
37e50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37e60 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63  ECT ALL col1 * c
37e70 6f 6c 31 20 2b 20 28 20 2b 20 35 33 20 29 20 2a  ol1 + ( + 53 ) *
37e80 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
37e90 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
37ea0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 33 35 0d 0a 35  0..----..3935..5
37eb0 36 34 37 0d 0a 39 33 35 36 0d 0a 0d 0a 71 75 65  647..9356....que
37ec0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37ed0 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20  LECT + - col2 + 
37ee0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
37ef0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
37f00 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
37f10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37f20 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
37f30 2b 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 46  + + ( + col1 ) F
37f40 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
37f50 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a  ..----..55..58..
37f60 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  85....onlyif mys
37f70 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
37f80 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
37f90 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
37fa0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
37fb0 6c 2d 31 36 32 30 0d 0a 53 45 4c 45 43 54 20 41  l-1620..SELECT A
37fc0 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  LL + col1 + + co
37fd0 6c 30 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30  l0 DIV cor0.col0
37fe0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
37ff0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
38000 0d 0a 31 31 0d 0a 31 34 0d 0a 32 37 0d 0a 0d 0a  ..11..14..27....
38010 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
38020 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
38030 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
38040 61 62 65 6c 2d 31 36 32 30 0d 0a 53 45 4c 45 43  abel-1620..SELEC
38050 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 2b  T ALL + col1 + +
38060 20 63 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f 6c   col0 / cor0.col
38070 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
38080 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
38090 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 32 37 0d 0a 0d  -..11..14..27...
380a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
380b0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
380c0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  - cor0.col2 FROM
380d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
380e0 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a  ---..-1..-1089..
380f0 2d 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -6724....query I
38100 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38110 20 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20 41 53   - + ( col1 ) AS
38120 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
38130 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
38140 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a  10..-13..-26....
38150 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38160 0a 53 45 4c 45 43 54 20 34 32 20 41 53 20 63 6f  .SELECT 42 AS co
38170 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
38180 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
38190 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
381a0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
381b0 68 69 6e 67 20 74 6f 20 36 34 63 32 39 64 62 39  hing to 64c29db9
381c0 66 31 63 64 37 65 64 34 64 64 65 62 31 37 33 35  f1cd7ed4ddeb1735
381d0 65 33 65 30 64 34 34 32 0d 0a 0d 0a 71 75 65 72  e3e0d442....quer
381e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
381f0 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  ECT - col0 + col
38200 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  0 * + cor0.col0 
38210 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
38220 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
38230 0a 31 31 39 30 0d 0a 35 35 32 0d 0a 37 38 33 32  .1190..552..7832
38240 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
38250 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
38260 63 6f 6c 30 20 2b 20 2d 20 39 38 20 2a 20 63 6f  col0 + - 98 * co
38270 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
38280 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
38290 2d 2d 0d 0a 2d 31 37 34 35 0d 0a 2d 33 30 34 35  --..-1745..-3045
382a0 0d 0a 2d 35 38 36 30 0d 0a 0d 0a 71 75 65 72 79  ..-5860....query
382b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
382c0 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d 20 31 31  CT ALL col0 - 11
382d0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
382e0 0d 0a 2d 38 0d 0a 35 33 0d 0a 36 39 0d 0a 0d 0a  ..-8..53..69....
382f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38300 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
38310 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2d 20 2b   + tab2.col0 - +
38320 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f   col1 * col0 FRO
38330 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
38340 32 36 34 0d 0a 2d 32 31 30 0d 0a 2d 34 35 32 34  264..-210..-4524
38350 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
38360 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
38370 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 36 30 20 46  cor0.col2 - 60 F
38380 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
38390 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32 0d 0a 2d 36  ..----..-142..-6
383a0 31 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20  1..-93....query 
383b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
383c0 54 20 2b 20 36 39 20 46 52 4f 4d 20 74 61 62 32  T + 69 FROM tab2
383d0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
383e0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
383f0 61 73 68 69 6e 67 20 74 6f 20 38 35 64 39 62 39  ashing to 85d9b9
38400 30 61 30 33 62 39 64 65 66 31 36 31 38 39 31 62  0a03b9def161891b
38410 31 33 30 38 35 32 37 31 66 37 0d 0a 0d 0a 71 75  13085271f7....qu
38420 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38430 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
38440 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31   + col0 + - col1
38450 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
38460 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 0d 0a 71  --..-2..-62....q
38470 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
38480 53 45 4c 45 43 54 20 41 4c 4c 20 36 35 20 2a 20  SELECT ALL 65 * 
38490 2d 20 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d  - tab1.col1 FROM
384a0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   tab1..----..-16
384b0 39 30 0d 0a 2d 36 35 30 0d 0a 2d 38 34 35 0d 0a  90..-650..-845..
384c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
384d0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39 39 20 2a  t..SELECT + 99 *
384e0 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29   ( - cor0.col2 )
384f0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
38500 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
38510 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
38520 68 61 73 68 69 6e 67 20 74 6f 20 64 36 65 30 61  hashing to d6e0a
38530 37 37 30 32 61 33 36 65 39 34 30 65 34 62 63 61  7702a36e940e4bca
38540 39 33 37 35 61 65 30 37 37 36 63 0d 0a 0d 0a 71  9375ae0776c....q
38550 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
38560 53 45 4c 45 43 54 20 37 37 20 46 52 4f 4d 20 74  SELECT 77 FROM t
38570 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 37 37 0d 0a 37  ab1..----..77..7
38580 37 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49  7..77....query I
38590 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
385a0 20 39 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   92 AS col2 FROM
385b0 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
385c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
385d0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
385e0 31 36 66 61 34 35 63 38 62 30 36 66 39 66 36 37  16fa45c8b06f9f67
385f0 64 36 65 35 30 30 62 66 64 34 33 35 63 31 61 0d  d6e500bfd435c1a.
38600 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
38610 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
38620 2a 20 38 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  * 81 AS col2 FRO
38630 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
38640 2d 2d 2d 2d 0d 0a 36 39 36 36 0d 0a 37 33 37 31  ----..6966..7371
38650 0d 0a 37 38 35 37 0d 0a 0d 0a 71 75 65 72 79 20  ..7857....query 
38660 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38670 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  T + cor0.col1 * 
38680 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
38690 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
386a0 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39  -7396..-8281..-9
386b0 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  409....query I r
386c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
386d0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2a   - cor0.col1 ) *
386e0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
386f0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
38700 0a 2d 32 38 39 0d 0a 2d 33 34 38 31 0d 0a 2d 39  .-289..-3481..-9
38710 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
38720 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
38730 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20  STINCT - - col0 
38740 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  * col0 * - col1 
38750 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
38760 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32 35  0..----..-118825
38770 0d 0a 2d 34 39 35 33 36 0d 0a 2d 37 32 30 38 31  ..-49536..-72081
38780 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
38790 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
387a0 54 49 4e 43 54 20 38 36 20 41 53 20 63 6f 6c 32  TINCT 86 AS col2
387b0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
387c0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
387d0 53 20 63 6f 72 31 2c 20 74 61 62 31 20 41 53 20  S cor1, tab1 AS 
387e0 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a  cor2..----..86..
387f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38800 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
38810 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l0 + - cor0.col1
38820 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
38830 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a  r0..----..-110..
38840 2d 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 71 75  -132..-180....qu
38850 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38860 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20  ELECT cor0.col1 
38870 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
38880 30 2c 20 74 61 62 31 20 63 6f 72 30 2c 20 74 61  0, tab1 cor0, ta
38890 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
388a0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
388b0 69 6e 67 20 74 6f 20 64 36 37 31 61 30 36 34 65  ing to d671a064e
388c0 32 64 61 37 30 39 63 61 34 63 64 66 65 61 33 31  2da709ca4cdfea31
388d0 37 62 38 65 38 39 32 0d 0a 0d 0a 71 75 65 72 79  7b8e892....query
388e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
388f0 43 54 20 2d 20 31 32 20 41 53 20 63 6f 6c 30 20  CT - 12 AS col0 
38900 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
38910 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31  0..----..-12..-1
38920 32 0d 0a 2d 31 32 0d 0a 0d 0a 71 75 65 72 79 20  2..-12....query 
38930 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38940 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  T cor0.col2 * co
38950 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
38960 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
38970 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37  --..162..3648..7
38980 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  680....query I r
38990 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
389a0 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 29 20 2b   + tab2.col0 ) +
389b0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
389c0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
389d0 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 71  04..117..34....q
389e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
389f0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 32  SELECT ALL + ( 2
38a00 35 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  5 ) AS col1 FROM
38a10 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d   tab1..----..25.
38a20 0a 32 35 0d 0a 32 35 0d 0a 0d 0a 71 75 65 72 79  .25..25....query
38a30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38a40 43 54 20 2b 20 2b 20 31 39 20 46 52 4f 4d 20 74  CT + + 19 FROM t
38a50 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
38a60 2d 0d 0a 31 39 0d 0a 31 39 0d 0a 31 39 0d 0a 0d  -..19..19..19...
38a70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38a80 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d  ..SELECT ALL ( -
38a90 20 63 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 31   col0 ) * - col1
38aa0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
38ab0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a  b2..----..1343..
38ac0 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65  217..4602....que
38ad0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38ae0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
38af0 63 6f 6c 32 20 2b 20 2b 20 74 61 62 31 2e 63 6f  col2 + + tab1.co
38b00 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
38b10 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d  tab1..----..-28.
38b20 0a 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65  .-47..-83....que
38b30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38b40 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 20  LECT DISTINCT 4 
38b50 2a 20 2b 20 31 36 20 2b 20 63 6f 6c 30 20 2a 20  * + 16 + col0 * 
38b60 63 6f 6c 31 20 2a 20 2b 20 28 20 2d 20 63 6f 6c  col1 * + ( - col
38b70 31 20 2b 20 28 20 63 6f 6c 31 20 29 20 29 20 41  1 + ( col1 ) ) A
38b80 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
38b90 0d 0a 2d 2d 2d 2d 0d 0a 36 34 0d 0a 0d 0a 71 75  ..----..64....qu
38ba0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38bb0 45 4c 45 43 54 20 2d 20 31 36 20 2a 20 2b 20 63  ELECT - 16 * + c
38bc0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
38bd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 36 0d 0a  r0..----..-416..
38be0 2d 34 33 32 0d 0a 2d 36 30 38 0d 0a 0d 0a 71 75  -432..-608....qu
38bf0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38c00 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20 29  ELECT - ( col2 )
38c10 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
38c20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
38c30 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37  .-162..-3648..-7
38c40 36 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  680....onlyif my
38c50 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
38c60 65