sqllogictest
Hex Artifact Content
Not logged in

Artifact 793c34cf7e8fa219469157d099aeb668d2492d00:


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 2d 20 63 6f 6c 30 20 2d 20 2d  NCT - - col0 - -
02f0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
0300: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
0310: 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a  .----..171..36..
0320: 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
0330: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
0340: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 32 36  + cor0.col1 + 26
0350: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
0360: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
0370: 0d 0a 34 33 0d 0a 35 37 0d 0a 38 35 0d 0a 0d 0a  ..43..57..85....
0380: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0390: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
03a0: 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 31 32 20 46   - + col1 * 12 F
03b0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
03c0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 32 0d 0a 2d  ..----..-1032..-
03d0: 31 30 39 32 0d 0a 2d 31 31 36 34 0d 0a 0d 0a 71  1092..-1164....q
03e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
03f0: 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20  SELECT col1 * + 
0400: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32  cor0.col2 + col2
0410: 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
0420: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
0430: 2d 0d 0a 2d 37 39 38 0d 0a 31 30 38 0d 0a 38 35  -..-798..108..85
0440: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
0450: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
0460: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 34  ol1 * + col1 + 4
0470: 33 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  3 + col0 FROM ta
0480: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
0490: 0d 0a 2d 31 36 37 0d 0a 2d 33 33 36 30 0d 0a 2d  ..-167..-3360..-
04a0: 39 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  911....query I r
04b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
04c0: 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
04d0: 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 + - cor0.col
04e0: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
04f0: 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
0500: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d  0..----..-137..-
0510: 33 38 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69  38..-96....skipi
0520: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
0530: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
0540: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
0550: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
0560: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
0570: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
0580: 2d 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 30 20  - col1 ) + col0 
0590: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
05a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37  or0..----..29..7
05b0: 34 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49  4..93....query I
05c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
05d0: 20 2b 20 63 6f 6c 30 20 2a 20 33 31 20 46 52 4f   + col0 * 31 FRO
05e0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 31  M tab2..----..21
05f0: 37 0d 0a 32 34 31 38 0d 0a 32 34 34 39 0d 0a 0d  7..2418..2449...
0600: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0610: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 39 20  ..SELECT ALL 29 
0620: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20  FROM tab1, tab2 
0630: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
0640: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
0650: 74 6f 20 31 65 37 31 32 30 62 61 38 65 39 31 39  to 1e7120ba8e919
0660: 31 30 38 34 31 37 32 64 64 63 65 64 31 37 65 35  1084172ddced17e5
0670: 65 62 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  eb2....query I r
0680: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
0690: 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  LL - - cor0.col1
06a0: 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   * + col2 * col1
06b0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
06c0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
06d0: 0d 0a 31 30 39 38 32 0d 0a 32 35 39 34 37 0d 0a  ..10982..25947..
06e0: 39 30 35 30 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  90506....skipif 
06f0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
0700: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
0710: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
0720: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
0730: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0740: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
0750: 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31   * + col1 * col1
0760: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
0770: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
0780: 32 38 33 31 0d 0a 32 37 31 35 31 38 0d 0a 36 37  2831..271518..67
0790: 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  27....query I ro
07a0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
07b0: 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 38 20  l1 + col1 * - 8 
07c0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
07d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d  0..----..-119..-
07e0: 32 31 37 0d 0a 2d 34 31 33 0d 0a 0d 0a 71 75 65  217..-413....que
07f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0800: 4c 45 43 54 20 2b 20 2d 20 37 31 20 2d 20 2d 20  LECT + - 71 - - 
0810: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
0820: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
0830: 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 31 37 0d 0a  ----..-14..-17..
0840: 32 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  25....onlyif mys
0850: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
0860: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
0870: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
0880: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
0890: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
08a0: 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 33 36  3..SELECT - + 36
08b0: 20 2a 20 63 6f 6c 30 20 2d 20 2b 20 43 41 53 54   * col0 - + CAST
08c0: 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41  ( NULL AS DECIMA
08d0: 4c 20 29 20 2a 20 36 35 20 46 52 4f 4d 20 74 61  L ) * 65 FROM ta
08e0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
08f0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
0900: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
0910: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
0920: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
0930: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 0d 0a 53  sort label-13..S
0940: 45 4c 45 43 54 20 2d 20 2b 20 33 36 20 2a 20 63  ELECT - + 36 * c
0950: 6f 6c 30 20 2d 20 2b 20 43 41 53 54 20 28 20 4e  ol0 - + CAST ( N
0960: 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2a 20  ULL AS REAL ) * 
0970: 36 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  65 FROM tab2 AS 
0980: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
0990: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
09a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
09b0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
09c0: 20 2d 20 39 30 20 2a 20 63 6f 6c 32 20 2d 20 2b   - 90 * col2 - +
09d0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
09e0: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35 0d 0a 2d 32 39  .----..-125..-29
09f0: 39 34 0d 0a 2d 37 34 36 39 0d 0a 0d 0a 71 75 65  94..-7469....que
0a00: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0a10: 4c 45 43 54 20 36 35 20 2a 20 2b 20 37 38 20 2a  LECT 65 * + 78 *
0a20: 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 28 20 2b 20   + col0 - + ( + 
0a30: 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46  col0 ) AS col0 F
0a40: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
0a50: 31 35 32 30 37 0d 0a 33 32 34 34 31 36 0d 0a 34  15207..324416..4
0a60: 30 35 35 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  05520....onlyif 
0a70: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
0a80: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
0a90: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
0aa0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
0ab0: 61 62 65 6c 2d 31 36 0d 0a 53 45 4c 45 43 54 20  abel-16..SELECT 
0ac0: 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 2b 20  cor0.col1 DIV + 
0ad0: 33 34 20 2b 20 38 34 20 44 49 56 20 2b 20 63 6f  34 + 84 DIV + co
0ae0: 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
0af0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
0b00: 0a 32 0d 0a 34 0d 0a 35 0d 0a 0d 0a 73 6b 69 70  .2..4..5....skip
0b10: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
0b20: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
0b30: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
0b40: 2d 31 36 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  -16..SELECT cor0
0b50: 2e 63 6f 6c 31 20 2f 20 2b 20 33 34 20 2b 20 38  .col1 / + 34 + 8
0b60: 34 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  4 / + cor0.col0 
0b70: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
0b80: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 34 0d 0a 35  0..----..2..4..5
0b90: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0ba0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
0bb0: 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  INCT + cor0.col0
0bc0: 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
0bd0: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
0be0: 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39  ----..24..35..89
0bf0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0c00: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
0c10: 49 4e 43 54 20 2b 20 34 34 20 2a 20 63 6f 72 30  INCT + 44 * cor0
0c20: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52  .col2 AS col0 FR
0c30: 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74  OM tab0, tab2, t
0c40: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
0c50: 2d 0d 0a 31 34 35 32 0d 0a 33 36 30 38 0d 0a 34  -..1452..3608..4
0c60: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
0c70: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
0c80: 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63  TINCT + + cor0.c
0c90: 6f 6c 31 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 - + cor0.col
0ca0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
0cb0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
0cc0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0cd0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
0ce0: 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2d 20 63   col1 * col1 - c
0cf0: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol1 * + col1 FRO
0d00: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
0d10: 2d 2d 2d 2d 0d 0a 2d 31 31 32 37 31 0d 0a 2d 32  ----..-11271..-2
0d20: 36 39 30 38 0d 0a 2d 39 33 39 38 37 0d 0a 0d 0a  6908..-93987....
0d30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0d40: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31  .SELECT - - col1
0d50: 20 2b 20 63 6f 6c 32 20 2a 20 38 30 20 46 52 4f   + col2 * 80 FRO
0d60: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
0d70: 2d 2d 2d 2d 0d 0a 31 37 37 0d 0a 32 37 32 36 0d  ----..177..2726.
0d80: 0a 36 36 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .6651....query I
0d90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0da0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
0db0: 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 39 37 20 46   - col2 + + 97 F
0dc0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
0dd0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 37 0d 0a 2d  ..----..-1347..-
0de0: 35 37 39 0d 0a 2d 36 33 32 0d 0a 0d 0a 71 75 65  579..-632....que
0df0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0e00: 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  LECT col1 * col1
0e10: 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 39 31 20 41   * col0 + - 91 A
0e20: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
0e30: 0d 0a 2d 2d 2d 2d 0d 0a 31 37 37 34 31 33 0d 0a  ..----..177413..
0e40: 33 32 39 32 32 34 0d 0a 37 33 36 39 31 38 0d 0a  329224..736918..
0e50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0e60: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
0e70: 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30  CT col1 + + col0
0e80: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   + - col2 * col2
0e90: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
0ea0: 0d 0a 2d 32 38 38 37 0d 0a 2d 33 31 37 35 0d 0a  ..-2887..-3175..
0eb0: 2d 39 31 32 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -9123....onlyif 
0ec0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
0ed0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
0ee0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
0ef0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
0f00: 61 62 65 6c 2d 32 35 0d 0a 53 45 4c 45 43 54 20  abel-25..SELECT 
0f10: 32 39 20 44 49 56 20 2b 20 74 61 62 32 2e 63 6f  29 DIV + tab2.co
0f20: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
0f30: 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73  --..0..0..1....s
0f40: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
0f50: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
0f60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
0f70: 62 65 6c 2d 32 35 0d 0a 53 45 4c 45 43 54 20 32  bel-25..SELECT 2
0f80: 39 20 2f 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20  9 / + tab2.col1 
0f90: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
0fa0: 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .0..0..1....quer
0fb0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0fc0: 45 43 54 20 38 35 20 41 53 20 63 6f 6c 32 20 46  ECT 85 AS col2 F
0fd0: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
0fe0: 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  S cor0, tab1 AS 
0ff0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
1000: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1010: 20 65 34 63 66 39 34 63 66 30 63 63 36 33 32 61   e4cf94cf0cc632a
1020: 63 66 66 33 30 61 64 31 64 61 63 36 31 37 63 62  cff30ad1dac617cb
1030: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1040: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1050: 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 41 53 20   - cor1.col1 AS 
1060: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
1070: 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
1080: 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61  SS JOIN tab2, ta
1090: 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
10a0: 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68  ..81 values hash
10b0: 69 6e 67 20 74 6f 20 62 37 61 31 62 33 38 66 65  ing to b7a1b38fe
10c0: 38 65 34 66 33 34 33 38 38 65 33 62 65 31 66 35  8e4f34388e3be1f5
10d0: 32 36 30 31 61 65 35 0d 0a 0d 0a 71 75 65 72 79  2601ae5....query
10e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
10f0: 43 54 20 44 49 53 54 49 4e 43 54 20 34 39 20 2b  CT DISTINCT 49 +
1100: 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
1110: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1120: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37 0d 0a 2d 35  0..----..-47..-5
1130: 0d 0a 2d 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-8....query I 
1140: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1150: 2d 20 33 20 2b 20 2b 20 37 35 20 46 52 4f 4d 20  - 3 + + 75 FROM 
1160: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1170: 2d 2d 0d 0a 37 32 0d 0a 37 32 0d 0a 37 32 0d 0a  --..72..72..72..
1180: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1190: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
11a0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
11b0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
11c0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30  rowsort label-30
11d0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
11e0: 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  T + cor0.col1 + 
11f0: 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 44 49  - col2 + col2 DI
1200: 56 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  V - col0 AS col1
1210: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1220: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 31  r0..----..-21..1
1230: 0d 0a 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..33....skipif m
1240: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1250: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1260: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 0d  owsort label-30.
1270: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1280: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d   + cor0.col1 + -
1290: 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2f 20 2d   col2 + col2 / -
12a0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
12b0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
12c0: 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 31 0d 0a 33  .----..-21..1..3
12d0: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
12e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
12f0: 20 36 35 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c   65 * col1 + col
1300: 31 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 - col2 FROM ta
1310: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1320: 0d 0a 2d 35 35 33 37 0d 0a 2d 35 39 30 36 0d 0a  ..-5537..-5906..
1330: 2d 36 32 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -6209....query I
1340: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1350: 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30   + + col0 * cor0
1360: 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20  .col1 FROM tab1 
1370: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1380: 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a  040..640..78....
1390: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13a0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
13b0: 20 2b 20 63 6f 6c 30 20 2a 20 37 32 20 41 53 20   + col0 * 72 AS 
13c0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
13d0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33  S cor0..----..53
13e0: 35 0d 0a 35 36 37 35 0d 0a 35 37 30 35 0d 0a 0d  5..5675..5705...
13f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1400: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1410: 54 20 2d 20 28 20 63 6f 6c 31 20 29 20 2b 20 2d  T - ( col1 ) + -
1420: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46   col1 * + col2 F
1430: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1440: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 31 0d 0a 2d  ..----..-1261..-
1450: 31 34 33 30 0d 0a 2d 35 38 30 0d 0a 0d 0a 71 75  1430..-580....qu
1460: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1470: 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 32  ELECT + ( + col2
1480: 20 29 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) - col2 FROM t
1490: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
14a0: 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e  -..0..0..0....on
14b0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
14c0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
14d0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
14e0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
14f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1500: 20 6c 61 62 65 6c 2d 33 36 0d 0a 53 45 4c 45 43   label-36..SELEC
1510: 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53  T + col1 + - CAS
1520: 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45  T( col0 AS SIGNE
1530: 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  D ) FROM tab0 AS
1540: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a   cor0..----..2..
1550: 36 32 0d 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69 66  62..62....skipif
1560: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1570: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1580: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
1590: 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  6..SELECT + col1
15a0: 20 2b 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 30   + - CAST ( col0
15b0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
15c0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
15d0: 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32  .----..2..62..62
15e0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15f0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
1600: 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  l1 + - col1 * + 
1610: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1620: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1630: 32 36 31 0d 0a 2d 31 34 33 30 0d 0a 2d 35 38 30  261..-1430..-580
1640: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1650: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1660: 2d 20 2b 20 31 33 20 46 52 4f 4d 20 74 61 62 31  - + 13 FROM tab1
1670: 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
1680: 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31  OIN tab1 AS cor1
1690: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
16a0: 20 68 61 73 68 69 6e 67 20 74 6f 20 65 39 35 66   hashing to e95f
16b0: 35 66 34 62 64 30 66 34 38 30 33 39 37 63 63 65  5f4bd0f480397cce
16c0: 64 35 66 35 65 38 61 32 33 37 39 32 0d 0a 0d 0a  d5f5e8a23792....
16d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16e0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
16f0: 20 2d 20 33 35 20 2a 20 2b 20 63 6f 6c 32 20 41   - 35 * + col2 A
1700: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
1710: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1720: 2d 31 31 37 39 0d 0a 2d 32 39 35 39 0d 0a 2d 37  -1179..-2959..-7
1730: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1740: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1750: 32 20 2b 20 33 34 20 2a 20 63 6f 72 30 2e 63 6f  2 + 34 * cor0.co
1760: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
1770: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 37 0d  cor0..----..397.
1780: 0a 35 33 38 0d 0a 39 33 38 0d 0a 0d 0a 71 75 65  .538..938....que
1790: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17a0: 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  LECT + col1 * + 
17b0: 35 38 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41  58 + cor0.col0 A
17c0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
17d0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17e0: 35 30 31 32 0d 0a 35 33 36 37 0d 0a 35 36 36 31  5012..5367..5661
17f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1800: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1810: 49 4e 43 54 20 63 6f 6c 31 20 2b 20 37 37 20 2a  INCT col1 + 77 *
1820: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
1830: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1840: 0a 31 30 31 34 0d 0a 32 30 32 38 0d 0a 37 38 30  .1014..2028..780
1850: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1860: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1870: 63 6f 6c 30 20 2a 20 28 20 2b 20 63 6f 6c 32 20  col0 * ( + col2 
1880: 29 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ) * + col0 FROM 
1890: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 33  tab2..----..1323
18a0: 0d 0a 31 35 38 31 38 34 0d 0a 32 33 37 31 35 38  ..158184..237158
18b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
18d0: 49 4e 43 54 20 63 6f 6c 31 20 2a 20 28 20 39 33  INCT col1 * ( 93
18e0: 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d   ) FROM tab1..--
18f0: 2d 2d 0d 0a 31 32 30 39 0d 0a 32 34 31 38 0d 0a  --..1209..2418..
1900: 39 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  930....query I r
1910: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1920: 49 53 54 49 4e 43 54 20 2d 20 2b 20 36 31 20 41  ISTINCT - + 61 A
1930: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
1940: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31   cor0..----..-61
1950: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1960: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1970: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1980: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1990: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
19a0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 0d  owsort label-46.
19b0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
19c0: 20 43 41 53 54 28 20 35 37 20 41 53 20 53 49 47   CAST( 57 AS SIG
19d0: 4e 45 44 20 29 20 2a 20 2b 20 63 6f 6c 31 20 46  NED ) * + col1 F
19e0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
19f0: 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 37 0d 0a 33 33  ..----..1767..33
1a00: 36 33 0d 0a 39 36 39 0d 0a 0d 0a 73 6b 69 70 69  63..969....skipi
1a10: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1a20: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1a30: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a40: 34 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  46..SELECT DISTI
1a50: 4e 43 54 20 43 41 53 54 20 28 20 35 37 20 41 53  NCT CAST ( 57 AS
1a60: 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63   INTEGER ) * + c
1a70: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1a80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36   cor0..----..176
1a90: 37 0d 0a 33 33 36 33 0d 0a 39 36 39 0d 0a 0d 0a  7..3363..969....
1aa0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1ab0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1ac0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1ad0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1ae0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 0d 0a  wsort label-47..
1af0: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
1b00: 44 49 56 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20  DIV tab2.col1 + 
1b10: 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63  col2 + col0 AS c
1b20: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
1b30: 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 31 38 0d 0a 33  ---..105..118..3
1b40: 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
1b50: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1b60: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1b70: 6f 72 74 20 6c 61 62 65 6c 2d 34 37 0d 0a 53 45  ort label-47..SE
1b80: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2f 20  LECT ALL col1 / 
1b90: 74 61 62 32 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32  tab2.col1 + col2
1ba0: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
1bb0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1bc0: 0a 31 30 35 0d 0a 31 31 38 0d 0a 33 35 0d 0a 0d  .105..118..35...
1bd0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1be0: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1bf0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1c00: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1c10: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1c20: 6f 72 74 20 6c 61 62 65 6c 2d 34 38 0d 0a 53 45  ort label-48..SE
1c30: 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 28  LECT ALL + CAST(
1c40: 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31   - col2 + + col1
1c50: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
1c60: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
1c70: 2d 2d 2d 0d 0a 31 32 37 32 0d 0a 33 33 36 30 0d  ---..1272..3360.
1c80: 0a 38 30 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .801....skipif m
1c90: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1ca0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1cb0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 38 0d  owsort label-48.
1cc0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41  .SELECT ALL + CA
1cd0: 53 54 20 28 20 2d 20 63 6f 6c 32 20 2b 20 2b 20  ST ( - col2 + + 
1ce0: 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
1cf0: 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) * col0 FROM ta
1d00: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 32 0d 0a  b0..----..1272..
1d10: 33 33 36 30 0d 0a 38 30 31 0d 0a 0d 0a 71 75 65  3360..801....que
1d20: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d30: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 38 33  LECT + col0 + 83
1d40: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1d50: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 0d 0a 31  b0..----..107..1
1d60: 31 38 0d 0a 31 37 32 0d 0a 0d 0a 71 75 65 72 79  18..172....query
1d70: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d80: 43 54 20 32 35 20 2a 20 33 37 20 2b 20 63 6f 6c  CT 25 * 37 + col
1d90: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
1da0: 2d 0d 0a 31 30 30 37 0d 0a 39 32 36 0d 0a 39 35  -..1007..926..95
1db0: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1dc0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
1dd0: 20 35 36 20 2a 20 28 20 63 6f 72 30 2e 63 6f 6c   56 * ( cor0.col
1de0: 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  0 * - cor0.col2 
1df0: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
1e00: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1e10: 2d 0d 0a 32 30 34 32 38 38 0d 0a 34 33 30 30 38  -..204288..43008
1e20: 30 0d 0a 39 30 37 32 0d 0a 0d 0a 71 75 65 72 79  0..9072....query
1e30: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e40: 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20 63 6f 6c  CT ALL + ( - col
1e50: 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  2 ) FROM tab0 co
1e60: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33  r0..----..-1..-3
1e70: 33 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20  3..-82....query 
1e80: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e90: 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  T + col2 * col1 
1ea0: 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  * cor0.col1 FROM
1eb0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1ec0: 2d 2d 2d 0d 0a 31 30 39 38 32 0d 0a 32 35 39 34  ---..10982..2594
1ed0: 37 0d 0a 39 30 35 30 36 0d 0a 0d 0a 71 75 65 72  7..90506....quer
1ee0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1ef0: 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ECT + col1 * col
1f00: 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  0 * col1 AS col2
1f10: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1f20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38 33 31 0d  r0..----..22831.
1f30: 0a 32 37 31 35 31 38 0d 0a 36 37 32 37 0d 0a 0d  .271518..6727...
1f40: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f50: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
1f60: 2a 20 28 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f  * ( + col0 ) FRO
1f70: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1f80: 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d  ----..1343..217.
1f90: 0a 34 36 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .4602....skipif 
1fa0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1fb0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1fc0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1fd0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1fe0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ff0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 33 20 63  t..SELECT + 23 c
2000: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
2010: 2d 2d 2d 0d 0a 32 33 0d 0a 32 33 0d 0a 32 33 0d  ---..23..23..23.
2020: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2030: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34  rt..SELECT ALL 4
2040: 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
2050: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 36 0d 0a  b1..----..1066..
2060: 34 31 30 0d 0a 35 33 33 0d 0a 0d 0a 71 75 65 72  410..533....quer
2070: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2080: 45 43 54 20 41 4c 4c 20 35 39 20 2d 20 74 61 62  ECT ALL 59 - tab
2090: 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  2.col0 FROM tab2
20a0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 32 30  ..----..-19..-20
20b0: 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..52....query I 
20c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20d0: 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20  ALL tab0.col2 * 
20e0: 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  + col1 + - col1 
20f0: 2d 20 2d 20 33 31 20 46 52 4f 4d 20 74 61 62 30  - - 31 FROM tab0
2100: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 38 33 0d 0a 33 31  ..----..2783..31
2110: 0d 0a 37 34 30 32 0d 0a 0d 0a 73 6b 69 70 69 66  ..7402....skipif
2120: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2130: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2140: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2150: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2160: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
2170: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
2180: 30 2e 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  0.col1 col0 FROM
2190: 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
21a0: 6f 72 30 20 57 48 45 52 45 20 4e 4f 54 20 28 20  or0 WHERE NOT ( 
21b0: 4e 55 4c 4c 20 29 20 4e 4f 54 20 42 45 54 57 45  NULL ) NOT BETWE
21c0: 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e 55 4c 4c  EN NULL AND NULL
21d0: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
21e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21f0: 54 20 2b 20 2b 20 36 38 20 2b 20 2b 20 63 6f 6c  T + + 68 + + col
2200: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
2210: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2220: 2d 0d 0a 31 33 32 0d 0a 31 34 38 0d 0a 37 31 0d  -..132..148..71.
2230: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2240: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2250: 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 32 2e 63   col1 + - tab2.c
2260: 6f 6c 31 20 2a 20 28 20 28 20 63 6f 6c 31 20 29  ol1 * ( ( col1 )
2270: 20 29 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d   ) * - col1 FROM
2280: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35   tab2..----..205
2290: 33 32 30 0d 0a 32 39 37 36 30 0d 0a 34 38 39 36  320..29760..4896
22a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
22c0: 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 28 20  cor0.col1 * + ( 
22d0: 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c 32 20  col0 ) + + col2 
22e0: 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  * col1 FROM tab0
22f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32   cor0..----..-32
2300: 39 38 0d 0a 2d 36 33 37 0d 0a 37 37 34 0d 0a 0d  98..-637..774...
2310: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2320: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2330: 54 20 63 6f 6c 31 20 2b 20 2d 20 28 20 28 20 63  T col1 + - ( ( c
2340: 6f 6c 32 20 29 20 29 20 46 52 4f 4d 20 74 61 62  ol2 ) ) FROM tab
2350: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  1 cor0..----..-2
2360: 38 0d 0a 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 73  8..-47..-83....s
2370: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2380: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2390: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
23a0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
23b0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
23c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23d0: 63 6f 6c 30 20 2b 20 33 36 20 2a 20 38 38 20 2a  col0 + 36 * 88 *
23e0: 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20   col0 col1 FROM 
23f0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2400: 2d 2d 0d 0a 32 32 31 38 33 0d 0a 32 34 37 31 38  --..22183..24718
2410: 32 0d 0a 32 35 30 33 35 31 0d 0a 0d 0a 71 75 65  2..250351....que
2420: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2430: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2440: 63 6f 6c 31 20 2b 20 2b 20 36 20 46 52 4f 4d 20  col1 + + 6 FROM 
2450: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2460: 0a 31 30 33 0d 0a 39 32 0d 0a 39 37 0d 0a 0d 0a  .103..92..97....
2470: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2480: 0a 53 45 4c 45 43 54 20 39 36 20 2a 20 63 6f 6c  .SELECT 96 * col
2490: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
24a0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 32 0d  ab2..----..1632.
24b0: 0a 32 39 37 36 0d 0a 35 36 36 34 0d 0a 0d 0a 71  .2976..5664....q
24c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24d0: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
24e0: 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20  * col0 + col2 * 
24f0: 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col2 * cor0.col1
2500: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2510: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36 34 38 0d  r0..----..22648.
2520: 0a 33 30 37 38 39 0d 0a 34 35 39 36 38 0d 0a 0d  .30789..45968...
2530: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2540: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2550: 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 36 20 41  T + - col0 + 6 A
2560: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2570: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2580: 2d 31 0d 0a 2d 37 32 0d 0a 2d 37 33 0d 0a 0d 0a  -1..-72..-73....
2590: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25a0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
25b0: 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 30 20 2b 20  l2 + ( - col0 + 
25c0: 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31  col1 ) FROM tab1
25d0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25e0: 32 39 0d 0a 33 0d 0a 37 37 0d 0a 0d 0a 71 75 65  29..3..77....que
25f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2600: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
2610: 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63  col1 * col2 AS c
2620: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2630: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
2640: 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37 30 0d  48..-1404..-570.
2650: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2660: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
2670: 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  or0.col1 + cor0.
2680: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
2690: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
26a0: 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a 36  ----..118..34..6
26b0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
26c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
26d0: 54 49 4e 43 54 20 38 36 20 2a 20 63 6f 6c 31 20  TINCT 86 * col1 
26e0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
26f0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2700: 0a 31 34 36 32 0d 0a 32 36 36 36 0d 0a 35 30 37  .1462..2666..507
2710: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2720: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2730: 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2d   col2 * col1 + -
2740: 20 63 6f 6c 32 20 2d 20 2b 20 32 34 20 41 53 20   col2 - + 24 AS 
2750: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2760: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
2770: 32 38 0d 0a 31 33 32 36 0d 0a 34 38 39 0d 0a 0d  28..1326..489...
2780: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2790: 0d 0a 53 45 4c 45 43 54 20 2d 20 34 30 20 2b 20  ..SELECT - 40 + 
27a0: 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
27b0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
27c0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 37 31  ..----..-57..-71
27d0: 0d 0a 2d 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-99....query I
27e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27f0: 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 31 33   DISTINCT + - 13
2800: 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 39 20 46 52   * + col2 + 9 FR
2810: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2820: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 37 0d 0a 2d 34  .----..-1057..-4
2830: 0d 0a 2d 34 32 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-420....query 
2840: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2850: 54 20 2d 20 37 35 20 2a 20 63 6f 6c 31 20 2b 20  T - 75 * col1 + 
2860: 32 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  21 * col2 FROM t
2870: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2880: 2d 0d 0a 2d 31 37 35 38 0d 0a 2d 33 38 37 39 0d  -..-1758..-3879.
2890: 0a 2d 34 37 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-477....onlyif 
28a0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
28b0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
28c0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
28d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28e0: 61 62 65 6c 2d 37 38 0d 0a 53 45 4c 45 43 54 20  abel-78..SELECT 
28f0: 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  ALL col1 * col1 
2900: 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  * col2 + - col1 
2910: 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  DIV col1 AS col0
2920: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2930: 0d 0a 31 30 39 38 31 0d 0a 32 35 39 34 36 0d 0a  ..10981..25946..
2940: 39 30 35 30 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  90505....skipif 
2950: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2960: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2970: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38  rowsort label-78
2980: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
2990: 31 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  1 * col1 * col2 
29a0: 2b 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20  + - col1 / col1 
29b0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
29c0: 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 38 31 0d 0a  2..----..10981..
29d0: 32 35 39 34 36 0d 0a 39 30 35 30 35 0d 0a 0d 0a  25946..90505....
29e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29f0: 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f  .SELECT + ( + co
2a00: 6c 30 20 29 20 2b 20 74 61 62 31 2e 63 6f 6c 32  l0 ) + tab1.col2
2a10: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2a20: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31  b1..----..121..1
2a30: 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20  76..57....query 
2a40: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a50: 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72  T - col1 + + cor
2a60: 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53  0.col1 * col0 AS
2a70: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2a80: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2a90: 30 32 37 0d 0a 35 32 0d 0a 36 33 30 0d 0a 0d 0a  027..52..630....
2aa0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ab0: 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 31  .SELECT ( + col1
2ac0: 20 29 20 2b 20 63 6f 6c 30 20 2b 20 37 38 20 41   ) + col0 + 78 A
2ad0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2ae0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2af0: 31 31 36 0d 0a 31 37 34 0d 0a 32 31 35 0d 0a 0d  116..174..215...
2b00: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b10: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 39 20  ..SELECT ALL 69 
2b20: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2b30: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2b40: 0a 36 39 0d 0a 36 39 0d 0a 36 39 0d 0a 0d 0a 71  .69..69..69....q
2b50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b60: 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20  SELECT col0 * - 
2b70: 31 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  18 AS col0 FROM 
2b80: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2b90: 2d 2d 0d 0a 2d 31 36 30 32 0d 0a 2d 34 33 32 0d  --..-1602..-432.
2ba0: 0a 2d 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-630....query I
2bb0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2bc0: 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32   - col0 - - col2
2bd0: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
2be0: 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d 0a  .----..-34..-7..
2bf0: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
2c00: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2c10: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2c20: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2c30: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2c40: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35  rowsort label-85
2c50: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2c60: 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T - CAST( NULL A
2c70: 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63  S SIGNED ) * - c
2c80: 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  ol0 + col0 + - c
2c90: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
2ca0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2cb0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
2cc0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2cd0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2ce0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2cf0: 6c 2d 38 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-85..SELECT DIS
2d00: 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 4e  TINCT - CAST ( N
2d10: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
2d20: 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30   * - col0 + col0
2d30: 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
2d40: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
2d50: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2d60: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d70: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2d80: 20 2b 20 32 32 20 41 53 20 63 6f 6c 32 20 46 52   + 22 AS col2 FR
2d90: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2da0: 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 32 32 0d  .----..-22..-22.
2db0: 0a 2d 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-22....query I 
2dc0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2dd0: 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  ALL cor0.col1 + 
2de0: 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  ( col2 ) FROM ta
2df0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2e00: 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a  ..119..173..98..
2e10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e20: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2e30: 38 38 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  88 * + col0 * co
2e40: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
2e50: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 31  cor0..----..-181
2e60: 36 33 32 0d 0a 2d 32 39 38 37 36 30 0d 0a 2d 37  632..-298760..-7
2e70: 31 32 37 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  12712....onlyif 
2e80: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2e90: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2ea0: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2eb0: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2ec0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2ed0: 6c 2d 38 39 0d 0a 53 45 4c 45 43 54 20 2b 20 43  l-89..SELECT + C
2ee0: 41 53 54 28 20 2d 20 63 6f 6c 32 20 41 53 20 53  AST( - col2 AS S
2ef0: 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 30  IGNED ) + - col0
2f00: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2f10: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2f20: 0d 0a 2d 31 37 31 0d 0a 2d 33 36 0d 0a 2d 35 37  ..-171..-36..-57
2f30: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2f40: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2f50: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2f60: 72 74 20 6c 61 62 65 6c 2d 38 39 0d 0a 53 45 4c  rt label-89..SEL
2f70: 45 43 54 20 2b 20 43 41 53 54 20 28 20 2d 20 63  ECT + CAST ( - c
2f80: 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
2f90: 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + - col0 AS col
2fa0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2fb0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d  or0..----..-171.
2fc0: 0a 2d 33 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65  .-36..-57....que
2fd0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2fe0: 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  LECT - cor0.col2
2ff0: 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30   * - col0 + col0
3000: 20 2a 20 2b 20 36 37 20 46 52 4f 4d 20 74 61 62   * + 67 FROM tab
3010: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  0 cor0..----..13
3020: 32 36 31 0d 0a 32 33 38 30 0d 0a 32 34 30 30 0d  261..2380..2400.
3030: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3040: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
3050: 20 63 6f 6c 31 20 2a 20 74 61 62 32 2e 63 6f 6c   col1 * tab2.col
3060: 32 20 2a 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20  2 * tab2.col2 + 
3070: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
3080: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32  M tab2..----..22
3090: 36 30 36 0d 0a 32 34 36 32 37 0d 0a 33 39 39 36  606..24627..3996
30a0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
30b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
30c0: 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a   col1 + - col2 *
30d0: 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 46 52 4f   col0 - col0 FRO
30e0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab0..----..-7
30f0: 32 39 36 0d 0a 2d 37 33 30 0d 0a 32 37 0d 0a 0d  296..-730..27...
3100: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3110: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
3120: 2b 20 37 36 20 46 52 4f 4d 20 74 61 62 32 0d 0a  + 76 FROM tab2..
3130: 2d 2d 2d 2d 0d 0a 35 33 32 0d 0a 35 39 32 38 0d  ----..532..5928.
3140: 0a 36 30 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .6004....query I
3150: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3160: 20 41 4c 4c 20 34 32 20 2a 20 37 35 20 41 53 20   ALL 42 * 75 AS 
3170: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20  col0 FROM tab2, 
3180: 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f  tab1 AS cor0 CRO
3190: 53 53 20 4a 4f 49 4e 20 74 61 62 30 0d 0a 2d 2d  SS JOIN tab0..--
31a0: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
31b0: 73 68 69 6e 67 20 74 6f 20 30 63 30 35 36 30 31  shing to 0c05601
31c0: 39 65 66 39 64 36 64 63 39 37 66 63 37 65 63 31  9ef9d6dc97fc7ec1
31d0: 39 38 64 37 33 65 37 61 66 0d 0a 0d 0a 6f 6e 6c  98d73e7af....onl
31e0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
31f0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
3200: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
3210: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
3220: 72 74 20 6c 61 62 65 6c 2d 39 35 0d 0a 53 45 4c  rt label-95..SEL
3230: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28  ECT DISTINCT + (
3240: 20 63 6f 6c 32 20 29 20 44 49 56 20 63 6f 6c 31   col2 ) DIV col1
3250: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
3260: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
3270: 0d 0a 32 0d 0a 35 0d 0a 37 0d 0a 0d 0a 73 6b 69  ..2..5..7....ski
3280: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
3290: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
32a0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
32b0: 6c 2d 39 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-95..SELECT DIS
32c0: 54 49 4e 43 54 20 2b 20 28 20 63 6f 6c 32 20 29  TINCT + ( col2 )
32d0: 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   / col1 AS col2 
32e0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
32f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35 0d 0a 37  0..----..2..5..7
3300: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3310: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 37 20 2b  ort..SELECT 57 +
3320: 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46   - col1 + col1 F
3330: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
3340: 0d 0a 2d 2d 2d 2d 0d 0a 35 37 0d 0a 35 37 0d 0a  ..----..57..57..
3350: 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
3360: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
3370: 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63  ( + col0 ) * + c
3380: 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 * + cor0.col
3390: 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
33a0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 30 39 37 0d  ..----..-106097.
33b0: 0a 2d 31 35 31 39 0d 0a 2d 33 35 38 39 35 36 0d  .-1519..-358956.
33c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33d0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
33e0: 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  0.col2 + + col2 
33f0: 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  + col1 * + col0 
3400: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
3410: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
3420: 0a 31 34 31 39 0d 0a 32 37 31 0d 0a 34 36 35 34  .1419..271..4654
3430: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3440: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 33  ort..SELECT + 73
3450: 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   * - col2 * col1
3460: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 38 20   + - col2 * + 8 
3470: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
3480: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 31 39 30  0..----..-112190
3490: 0d 0a 2d 34 37 34 36 32 0d 0a 2d 36 31 33 31 37  ..-47462..-61317
34a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
34c0: 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  - + col1 * col1 
34d0: 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72  + - col2 * - cor
34e0: 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0.col2 FROM tab0
34f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3500: 2d 31 35 35 37 0d 0a 2d 36 33 30 37 0d 0a 2d 39  -1557..-6307..-9
3510: 34 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  408....query I r
3520: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
3530: 20 33 37 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f   37 * col0 AS co
3540: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
3550: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 39 0d  cor0..----..259.
3560: 0a 32 38 38 36 0d 0a 32 39 32 33 0d 0a 0d 0a 71  .2886..2923....q
3570: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3580: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
3590: 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20  - col2 * col0 * 
35a0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
35b0: 2d 2d 2d 2d 0d 0a 2d 31 31 34 30 37 36 0d 0a 2d  ----..-114076..-
35c0: 35 31 30 33 0d 0a 2d 35 32 37 32 38 0d 0a 0d 0a  5103..-52728....
35d0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
35e0: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
35f0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
3600: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
3610: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
3620: 72 74 20 6c 61 62 65 6c 2d 31 30 33 0d 0a 53 45  rt label-103..SE
3630: 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20  LECT CAST( NULL 
3640: 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20  AS SIGNED ) * - 
3650: 63 6f 6c 31 20 2a 20 2d 20 74 61 62 32 2e 63 6f  col1 * - tab2.co
3660: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
3670: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab2..----..NULL
3680: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
3690: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
36a0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
36b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
36c0: 61 62 65 6c 2d 31 30 33 0d 0a 53 45 4c 45 43 54  abel-103..SELECT
36d0: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
36e0: 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f  INTEGER ) * - co
36f0: 6c 31 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 32  l1 * - tab2.col2
3700: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
3710: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b2..----..NULL..
3720: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
3730: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3740: 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d  ELECT - col2 + -
3750: 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20   col1 + col1 AS 
3760: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
3770: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
3780: 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 71 75  ..-33..-82....qu
3790: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37a0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39  ELECT DISTINCT 9
37b0: 36 20 2b 20 37 37 20 41 53 20 63 6f 6c 32 20 46  6 + 77 AS col2 F
37c0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
37d0: 0d 0a 2d 2d 2d 2d 0d 0a 31 37 33 0d 0a 0d 0a 71  ..----..173....q
37e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37f0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
3800: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col0 * - col1 FR
3810: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
3820: 30 36 30 39 37 0d 0a 31 35 31 39 0d 0a 33 35 38  06097..1519..358
3830: 39 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  956....query I r
3840: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
3850: 49 53 54 49 4e 43 54 20 2b 20 37 35 20 2b 20 2b  ISTINCT + 75 + +
3860: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
3870: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
3880: 30 38 0d 0a 31 35 37 0d 0a 37 36 0d 0a 0d 0a 71  08..157..76....q
3890: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
38a0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
38b0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
38c0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  ab2..----..0....
38d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38e0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
38f0: 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20  - col1 + + col0 
3900: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
3910: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a  ab1..----..-23..
3920: 35 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20  54..67....query 
3930: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3940: 54 20 41 4c 4c 20 2d 20 31 20 41 53 20 63 6f 6c  T ALL - 1 AS col
3950: 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
3960: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a  ..----..-1..-1..
3970: 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -1....query I ro
3980: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
3990: 53 54 49 4e 43 54 20 63 6f 72 31 2e 63 6f 6c 31  STINCT cor1.col1
39a0: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
39b0: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
39c0: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor1..----..17
39d0: 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72  ..31..59....quer
39e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
39f0: 45 43 54 20 41 4c 4c 20 2b 20 37 37 20 2b 20 63  ECT ALL + 77 + c
3a00: 6f 72 30 2e 63 6f 6c 32 20 2a 20 28 20 63 6f 6c  or0.col2 * ( col
3a10: 31 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  1 ) FROM tab2 AS
3a20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31   cor0..----..161
3a30: 31 0d 0a 37 32 33 0d 0a 39 31 34 0d 0a 0d 0a 71  1..723..914....q
3a40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3a50: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20  SELECT - col2 * 
3a60: 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col0 + col0 * - 
3a70: 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col1 * col1 FROM
3a80: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
3a90: 2d 2d 2d 0d 0a 2d 31 37 38 32 39 36 0d 0a 2d 33  ---..-178296..-3
3aa0: 32 39 33 35 30 0d 0a 2d 37 34 34 33 30 37 0d 0a  29350..-744307..
3ab0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3ac0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 33 30  t..SELECT + - 30
3ad0: 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   * cor0.col2 FRO
3ae0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
3af0: 2d 2d 2d 2d 0d 0a 2d 31 36 32 30 0d 0a 2d 31 37  ----..-1620..-17
3b00: 31 30 0d 0a 2d 32 38 38 30 0d 0a 0d 0a 71 75 65  10..-2880....que
3b10: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3b20: 4c 45 43 54 20 37 31 20 41 53 20 63 6f 6c 32 20  LECT 71 AS col2 
3b30: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
3b40: 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
3b50: 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  0 cor1..----..9 
3b60: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
3b70: 6f 20 63 31 61 61 63 65 35 64 35 66 65 32 37 37  o c1aace5d5fe277
3b80: 32 31 63 63 39 32 35 35 35 32 35 31 33 63 38 35  21cc925552513c85
3b90: 63 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  c0....query I ro
3ba0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
3bb0: 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20  + col2 * col2 + 
3bc0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
3bd0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36 31 0d  or0..----..1461.
3be0: 0a 37 33 35 0d 0a 37 36 30 0d 0a 0d 0a 71 75 65  .735..760....que
3bf0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3c00: 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  LECT col2 * - co
3c10: 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 + col0 FROM t
3c20: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3c30: 2d 0d 0a 2d 37 32 30 39 0d 0a 2d 37 36 38 0d 0a  -..-7209..-768..
3c40: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
3c50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
3c60: 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  or0.col1 + col1 
3c70: 2a 20 28 20 2b 20 28 20 63 6f 6c 31 20 29 20 2a  * ( + ( col1 ) *
3c80: 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 29 20   + ( + col0 ) ) 
3c90: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
3ca0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
3cb0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 39 32 37 0d  r0..----..22927.
3cc0: 0a 32 37 31 36 35 35 0d 0a 36 37 36 35 0d 0a 0d  .271655..6765...
3cd0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3ce0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
3cf0: 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 28 20 63  T - col0 * + ( c
3d00: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 29 20 2d  ol2 * - col2 ) -
3d10: 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   - ( - cor0.col2
3d20: 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d   ) * - col2 FROM
3d30: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
3d40: 2d 2d 2d 0d 0a 32 37 32 32 35 0d 0a 33 36 0d 0a  ---..27225..36..
3d50: 36 30 35 31 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  605160....onlyif
3d60: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
3d70: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
3d80: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
3d90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
3da0: 6c 61 62 65 6c 2d 31 32 30 0d 0a 53 45 4c 45 43  label-120..SELEC
3db0: 54 20 2d 20 2b 20 63 6f 6c 30 20 44 49 56 20 2b  T - + col0 DIV +
3dc0: 20 33 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53   32 FROM tab2 AS
3dd0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
3de0: 0a 2d 32 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-2..0....skipif
3df0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
3e00: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
3e10: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
3e20: 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  20..SELECT - + c
3e30: 6f 6c 30 20 2f 20 2b 20 33 32 20 46 52 4f 4d 20  ol0 / + 32 FROM 
3e40: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
3e50: 2d 2d 0d 0a 2d 32 0d 0a 2d 32 0d 0a 30 0d 0a 0d  --..-2..-2..0...
3e60: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3e70: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
3e80: 30 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 28 20 63  0 + col1 * + ( c
3e90: 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol2 ) AS col2 FR
3ea0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
3eb0: 0a 2d 2d 2d 2d 0d 0a 31 33 32 38 0d 0a 31 34 30  .----..1328..140
3ec0: 37 0d 0a 36 33 34 0d 0a 0d 0a 71 75 65 72 79 20  7..634....query 
3ed0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3ee0: 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63  T ALL - - cor0.c
3ef0: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63  ol2 * + col1 + c
3f00: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
3f10: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37   cor0..----..287
3f20: 31 0d 0a 37 35 34 34 0d 0a 39 38 0d 0a 0d 0a 71  1..7544..98....q
3f30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3f40: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
3f50: 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 31 20 29 20  col0 + ( col1 ) 
3f60: 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * + col0 FROM ta
3f70: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
3f80: 0d 0a 32 30 38 38 0d 0a 33 34 33 30 0d 0a 38 31  ..2088..3430..81
3f90: 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
3fa0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
3fb0: 4c 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 35  L + + col2 + - 5
3fc0: 35 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  5 FROM tab1 AS c
3fd0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 32  or0..----..-1..2
3fe0: 0d 0a 34 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..41....onlyif m
3ff0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
4000: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
4010: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
4020: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
4030: 62 65 6c 2d 31 32 35 0d 0a 53 45 4c 45 43 54 20  bel-125..SELECT 
4040: 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20  DISTINCT col1 * 
4050: 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 31 20  col2 DIV - col1 
4060: 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
4070: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
4080: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31  ..----..-121..-1
4090: 37 36 0d 0a 2d 35 37 0d 0a 0d 0a 73 6b 69 70 69  76..-57....skipi
40a0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
40b0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
40c0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
40d0: 31 32 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  125..SELECT DIST
40e0: 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  INCT col1 * col2
40f0: 20 2f 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 30   / - col1 - col0
4100: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
4110: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
4120: 0d 0a 2d 31 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35  ..-121..-176..-5
4130: 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
4140: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
4150: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
4160: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
4170: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4180: 2d 31 32 36 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  -126..SELECT + -
4190: 20 28 20 2d 20 36 31 20 29 20 2a 20 63 6f 6c 31   ( - 61 ) * col1
41a0: 20 2b 20 34 34 20 44 49 56 20 2b 20 63 6f 6c 32   + 44 DIV + col2
41b0: 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46   + + cor0.col0 F
41c0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
41d0: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 39 0d 0a 36 37  ..----..1589..67
41e0: 34 0d 0a 38 37 33 0d 0a 0d 0a 73 6b 69 70 69 66  4..873....skipif
41f0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
4200: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
4210: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
4220: 32 36 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28  26..SELECT + - (
4230: 20 2d 20 36 31 20 29 20 2a 20 63 6f 6c 31 20 2b   - 61 ) * col1 +
4240: 20 34 34 20 2f 20 2b 20 63 6f 6c 32 20 2b 20 2b   44 / + col2 + +
4250: 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
4260: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
4270: 2d 2d 0d 0a 31 35 38 39 0d 0a 36 37 34 0d 0a 38  --..1589..674..8
4280: 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  73....query I ro
4290: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
42a0: 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  - col0 * - col2 
42b0: 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  * + col0 + - col
42c0: 32 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  2 - col0 FROM ta
42d0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
42e0: 0d 0a 2d 31 33 35 37 0d 0a 2d 31 35 38 32 38 38  ..-1357..-158288
42f0: 0d 0a 2d 32 33 37 32 37 35 0d 0a 0d 0a 73 6b 69  ..-237275....ski
4300: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
4310: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
4320: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
4330: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
4340: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
4350: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
4360: 6c 32 20 2a 20 2d 20 28 20 36 38 20 29 20 2a 20  l2 * - ( 68 ) * 
4370: 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col2 col2 FROM t
4380: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 38 32  ab1..----..-1982
4390: 38 38 0d 0a 2d 32 32 30 39 33 32 0d 0a 2d 36 32  88..-220932..-62
43a0: 36 36 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6688....query I 
43b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
43c0: 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  + + col1 * col2 
43d0: 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  * - col2 + + col
43e0: 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
43f0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 37 39 35 0d  ..----..-119795.
4400: 0a 2d 33 32 34 38 30 0d 0a 2d 37 35 37 39 30 0d  .-32480..-75790.
4410: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4420: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
4430: 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63  ol2 * col1 + - c
4440: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
4450: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36   cor0..----..116
4460: 38 0d 0a 31 34 30 31 0d 0a 35 30 36 0d 0a 0d 0a  8..1401..506....
4470: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
4480: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
4490: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
44a0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
44b0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
44c0: 72 74 20 6c 61 62 65 6c 2d 31 33 31 0d 0a 53 45  rt label-131..SE
44d0: 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c  LECT + CAST( NUL
44e0: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f 20  L AS SIGNED ) / 
44f0: 2b 20 34 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 40 AS col0 FRO
4500: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
4510: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
4520: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
4530: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
4540: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
4550: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
4560: 33 31 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  31..SELECT + CAS
4570: 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
4580: 47 45 52 20 29 20 2f 20 2b 20 34 30 20 41 53 20  GER ) / + 40 AS 
4590: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
45a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
45b0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
45c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
45d0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20  t..SELECT - ( - 
45e0: 37 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  7 ) AS col0 FROM
45f0: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
4600: 0d 0a 37 0d 0a 37 0d 0a 37 0d 0a 0d 0a 71 75 65  ..7..7..7....que
4610: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4620: 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  LECT + + cor0.co
4630: 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 + col0 AS col
4640: 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
4650: 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d  ..----..171..36.
4660: 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .57....query I r
4670: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
4680: 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a   + col2 + col1 *
4690: 20 2d 20 36 31 20 46 52 4f 4d 20 74 61 62 30 20   - 61 FROM tab0 
46a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
46b0: 35 32 37 39 0d 0a 2d 35 36 33 33 0d 0a 2d 35 39  5279..-5633..-59
46c0: 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  18....query I ro
46d0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
46e0: 53 54 49 4e 43 54 20 63 6f 6c 31 20 46 52 4f 4d  STINCT col1 FROM
46f0: 20 74 61 62 31 20 57 48 45 52 45 20 4e 55 4c 4c   tab1 WHERE NULL
4700: 20 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f 6c 32   NOT IN ( + col2
4710: 20 2b 20 2b 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d   + + col2 )..---
4720: 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
4730: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74  sort..SELECT + t
4740: 61 62 32 2e 63 6f 6c 31 20 2a 20 74 61 62 32 2e  ab2.col1 * tab2.
4750: 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col0 * col1 FROM
4760: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38   tab2..----..228
4770: 33 31 0d 0a 32 37 31 35 31 38 0d 0a 36 37 32 37  31..271518..6727
4780: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4790: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
47a0: 6c 31 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l1 - + cor0.col0
47b0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
47c0: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
47d0: 31 31 30 0d 0a 2d 31 33 32 0d 0a 2d 31 38 30 0d  110..-132..-180.
47e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
47f0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 20 2b  rt..SELECT + 2 +
4800: 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
4810: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
4820: 0a 2d 31 35 0d 0a 2d 32 39 0d 0a 2d 35 37 0d 0a  .-15..-29..-57..
4830: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
4840: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
4850: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
4860: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
4870: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
4880: 39 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  9..SELECT + + co
4890: 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30  l2 DIV cor0.col0
48a0: 20 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46   + + col1 col0 F
48b0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
48c0: 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 39 31 0d 0a  ..----..87..91..
48d0: 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  97....skipif pos
48e0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
48f0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
4900: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
4910: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
4920: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
4930: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
4940: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
4950: 62 65 6c 2d 31 33 39 0d 0a 53 45 4c 45 43 54 20  bel-139..SELECT 
4960: 2b 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 72 30 2e  + + col2 / cor0.
4970: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 63 6f  col0 + + col1 co
4980: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
4990: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a  cor0..----..87..
49a0: 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  91..97....query 
49b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
49c0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
49d0: 6f 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol1 + col1 + col
49e0: 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  0 * - cor0.col2 
49f0: 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * - col1 FROM ta
4a00: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
4a10: 0d 0a 33 33 39 35 0d 0a 36 36 34 31 31 38 0d 0a  ..3395..664118..
4a20: 36 38 31 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49  68112....query I
4a30: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4a40: 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 28 20   - - col1 + + ( 
4a50: 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32  - col1 ) AS col2
4a60: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
4a70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
4a80: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
4a90: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
4aa0: 20 63 6f 6c 32 20 2b 20 37 35 20 41 53 20 63 6f   col2 + 75 AS co
4ab0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
4ac0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 0d 0a  cor0..----..37..
4ad0: 34 38 0d 0a 34 39 0d 0a 0d 0a 71 75 65 72 79 20  48..49....query 
4ae0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4af0: 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 35  T ALL - col1 * 5
4b00: 35 20 2b 20 2d 20 37 32 20 41 53 20 63 6f 6c 30  5 + - 72 AS col0
4b10: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
4b20: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 37 0d 0a 2d 31  .----..-1007..-1
4b30: 37 37 37 0d 0a 2d 33 33 31 37 0d 0a 0d 0a 71 75  777..-3317....qu
4b40: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4b50: 45 4c 45 43 54 20 38 38 20 2a 20 2d 20 74 61 62  ELECT 88 * - tab
4b60: 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0.col2 FROM tab0
4b70: 2c 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  , tab1, tab1 AS 
4b80: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
4b90: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
4ba0: 20 31 38 64 35 65 34 34 32 34 38 66 61 66 33 39   18d5e44248faf39
4bb0: 30 31 39 62 30 66 37 64 38 36 30 32 34 35 35 37  019b0f7d86024557
4bc0: 64 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  d....onlyif mysq
4bd0: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
4be0: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
4bf0: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
4c00: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
4c10: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
4c20: 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  5..SELECT ALL + 
4c30: 63 6f 6c 32 20 2a 20 43 41 53 54 28 20 63 6f 72  col2 * CAST( cor
4c40: 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  0.col0 * col0 + 
4c50: 35 38 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  58 AS SIGNED ) A
4c60: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
4c70: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4c80: 31 35 39 36 39 32 0d 0a 32 33 39 33 36 32 0d 0a  159692..239362..
4c90: 32 38 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  2889....skipif m
4ca0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
4cb0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
4cc0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35  owsort label-145
4cd0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
4ce0: 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 63 6f 72  ol2 * CAST ( cor
4cf0: 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  0.col0 * col0 + 
4d00: 35 38 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  58 AS INTEGER ) 
4d10: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
4d20: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
4d30: 0a 31 35 39 36 39 32 0d 0a 32 33 39 33 36 32 0d  .159692..239362.
4d40: 0a 32 38 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .2889....query I
4d50: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4d60: 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 28 20 2b 20   - - col1 * ( + 
4d70: 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32  col1 ) FROM tab2
4d80: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4d90: 32 38 39 0d 0a 33 34 38 31 0d 0a 39 36 31 0d 0a  289..3481..961..
4da0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4db0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
4dc0: 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  CT + col0 * - co
4dd0: 6c 31 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 30  l1 + col0 - col0
4de0: 20 2a 20 2b 20 31 34 20 2a 20 63 6f 72 30 2e 63   * + 14 * cor0.c
4df0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
4e00: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
4e10: 30 31 38 32 0d 0a 2d 31 33 31 32 38 0d 0a 2d 33  0182..-13128..-3
4e20: 38 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  850....query I r
4e30: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
4e40: 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  or0.col1 + - col
4e50: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
4e60: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
4e70: 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75 65  53..9..96....que
4e80: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4e90: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 31 2e  LECT ALL + cor1.
4ea0: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
4eb0: 4d 20 74 61 62 30 2c 20 74 61 62 32 20 63 6f 72  M tab0, tab2 cor
4ec0: 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 2c  0, tab1 AS cor1,
4ed0: 20 74 61 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d   tab1 AS cor2..-
4ee0: 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68  ---..81 values h
4ef0: 61 73 68 69 6e 67 20 74 6f 20 65 32 38 62 66 37  ashing to e28bf7
4f00: 66 39 32 32 36 35 30 63 61 34 32 33 61 64 65 33  f922650ca423ade3
4f10: 36 34 32 63 65 30 32 38 35 62 0d 0a 0d 0a 71 75  642ce0285b....qu
4f20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4f30: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
4f40: 20 63 6f 6c 30 20 2d 20 2b 20 74 61 62 31 2e 63   col0 - + tab1.c
4f50: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
4f60: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39   tab1..----..-29
4f70: 0d 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d 0a 6f 6e  ..-74..-93....on
4f80: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
4f90: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
4fa0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
4fb0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
4fc0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4fd0: 20 6c 61 62 65 6c 2d 31 35 31 0d 0a 53 45 4c 45   label-151..SELE
4fe0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
4ff0: 6c 30 20 2b 20 43 41 53 54 28 20 39 36 20 41 53  l0 + CAST( 96 AS
5000: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
5010: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
5020: 2d 0d 0a 31 36 0d 0a 33 32 0d 0a 39 33 0d 0a 0d  -..16..32..93...
5030: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
5040: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
5050: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
5060: 6c 61 62 65 6c 2d 31 35 31 0d 0a 53 45 4c 45 43  label-151..SELEC
5070: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
5080: 30 20 2b 20 43 41 53 54 20 28 20 39 36 20 41 53  0 + CAST ( 96 AS
5090: 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
50a0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
50b0: 2d 2d 0d 0a 31 36 0d 0a 33 32 0d 0a 39 33 0d 0a  --..16..32..93..
50c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
50d0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 34 20 41  t..SELECT + 14 A
50e0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
50f0: 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 34 0d 0a  ..----..14..14..
5100: 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  14....query I ro
5110: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
5120: 4c 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 28 20 2d  L - col2 + - ( -
5130: 20 34 39 20 29 20 46 52 4f 4d 20 74 61 62 30 0d   49 ) FROM tab0.
5140: 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 31 36 0d 0a  .----..-33..16..
5150: 34 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  48....skipif pos
5160: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
5170: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
5180: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
5190: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
51a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
51b0: 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20  SELECT col2 * - 
51c0: 36 36 20 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c 32  66 + + col2 col2
51d0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
51e0: 0d 0a 2d 32 31 34 35 0d 0a 2d 35 33 33 30 0d 0a  ..-2145..-5330..
51f0: 2d 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -65....query I r
5200: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74  owsort..SELECT t
5210: 61 62 30 2e 63 6f 6c 30 20 2b 20 28 20 63 6f 6c  ab0.col0 + ( col
5220: 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  1 ) AS col2 FROM
5230: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30   tab0..----..110
5240: 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75  ..132..180....qu
5250: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5260: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 31  ELECT ALL + cor1
5270: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c  .col2 FROM tab2,
5280: 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
5290: 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
52a0: 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
52b0: 68 69 6e 67 20 74 6f 20 34 30 66 64 38 63 63 30  hing to 40fd8cc0
52c0: 64 65 39 32 65 61 36 38 64 37 33 36 33 34 63 32  de92ea68d73634c2
52d0: 64 38 66 37 35 62 66 35 0d 0a 0d 0a 6f 6e 6c 79  d8f75bf5....only
52e0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
52f0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
5300: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
5310: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5320: 74 20 6c 61 62 65 6c 2d 31 35 37 0d 0a 53 45 4c  t label-157..SEL
5330: 45 43 54 20 63 6f 6c 32 20 44 49 56 20 63 6f 72  ECT col2 DIV cor
5340: 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  0.col0 + + col1 
5350: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
5360: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 34 0d  0..----..10..14.
5370: 0a 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .44....skipif my
5380: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
5390: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
53a0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37 0d  wsort label-157.
53b0: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 63  .SELECT col2 / c
53c0: 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  or0.col0 + + col
53d0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
53e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  or0..----..10..1
53f0: 34 0d 0a 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  4..44....query I
5400: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5410: 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 2b 20   ALL - col2 + + 
5420: 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63  col0 * col2 AS c
5430: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
5440: 2d 2d 2d 0d 0a 31 30 38 0d 0a 33 35 39 31 0d 0a  ---..108..3591..
5450: 37 35 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7584....query I 
5460: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5470: 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 2a 20  - col2 - col1 * 
5480: 2d 20 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f  - ( col0 ) AS co
5490: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
54a0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  cor0..----..24..
54b0: 35 38 33 0d 0a 39 34 34 0d 0a 0d 0a 6f 6e 6c 79  583..944....only
54c0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
54d0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
54e0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
54f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5500: 74 20 6c 61 62 65 6c 2d 31 36 30 0d 0a 53 45 4c  t label-160..SEL
5510: 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  ECT col0 + - col
5520: 32 20 44 49 56 20 2b 20 28 20 2b 20 63 6f 6c 31  2 DIV + ( + col1
5530: 20 2a 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   * col1 ) FROM t
5540: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
5550: 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a  -..7..78..79....
5560: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
5570: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
5580: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5590: 61 62 65 6c 2d 31 36 30 0d 0a 53 45 4c 45 43 54  abel-160..SELECT
55a0: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2f   col0 + - col2 /
55b0: 20 2b 20 28 20 2b 20 63 6f 6c 31 20 2a 20 63 6f   + ( + col1 * co
55c0: 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  l1 ) FROM tab2 A
55d0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d  S cor0..----..7.
55e0: 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79  .78..79....query
55f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5600: 43 54 20 41 4c 4c 20 2d 20 36 37 20 2a 20 63 6f  CT ALL - 67 * co
5610: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
5620: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
5630: 2d 2d 0d 0a 2d 33 36 31 38 0d 0a 2d 33 38 31 39  --..-3618..-3819
5640: 0d 0a 2d 36 34 33 32 0d 0a 0d 0a 71 75 65 72 79  ..-6432....query
5650: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5660: 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20  CT ALL col2 * - 
5670: 74 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab2.col2 AS col
5680: 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
5690: 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37 36 0d 0a  -..-1444..-676..
56a0: 2d 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -729....query I 
56b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
56c0: 2b 20 63 6f 6c 30 20 2d 20 2b 20 36 37 20 41 53  + col0 - + 67 AS
56d0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
56e0: 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d 0a 2d 34 33 0d  .----..-32..-43.
56f0: 0a 32 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .22....onlyif my
5700: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
5710: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
5720: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
5730: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
5740: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
5750: 31 36 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  164..SELECT - co
5760: 6c 30 20 2d 20 2d 20 28 20 63 6f 6c 32 20 2b 20  l0 - - ( col2 + 
5770: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
5780: 47 4e 45 44 20 29 20 29 20 2a 20 2b 20 28 20 2d  GNED ) ) * + ( -
5790: 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
57a0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
57b0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
57c0: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
57d0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
57e0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
57f0: 6f 72 74 20 6c 61 62 65 6c 2d 31 36 34 0d 0a 53  ort label-164..S
5800: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2d 20 2d  ELECT - col0 - -
5810: 20 28 20 63 6f 6c 32 20 2b 20 43 41 53 54 20 28   ( col2 + CAST (
5820: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
5830: 20 29 20 29 20 2a 20 2b 20 28 20 2d 20 63 6f 6c   ) ) * + ( - col
5840: 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  2 ) AS col0 FROM
5850: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab2..----..NUL
5860: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
5870: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5880: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2d 20  ..SELECT col1 - 
5890: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
58a0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
58b0: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
58c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
58d0: 43 54 20 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f  CT ( col1 ) * co
58e0: 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31  r0.col0 * + col1
58f0: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
5900: 0a 2d 2d 2d 2d 0d 0a 31 37 37 35 30 34 0d 0a 33  .----..177504..3
5910: 32 39 33 31 35 0d 0a 37 33 37 30 30 39 0d 0a 0d  29315..737009...
5920: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
5930: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
5940: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
5950: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
5960: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
5970: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5980: 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  T - - col0 + col
5990: 30 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  0 + col1 col0 FR
59a0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
59b0: 0a 2d 2d 2d 2d 0d 0a 31 33 38 0d 0a 31 37 33 0d  .----..138..173.
59c0: 0a 33 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .32....onlyif my
59d0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
59e0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
59f0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
5a00: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
5a10: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
5a20: 31 36 38 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  168..SELECT cor0
5a30: 2e 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28 20  .col0 * + CAST( 
5a40: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
5a50: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
5a60: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
5a70: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
5a80: 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31   cd7a7901e47c151
5a90: 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30  55404aff0d216fe0
5aa0: 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  b....skipif mysq
5ab0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
5ac0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
5ad0: 6f 72 74 20 6c 61 62 65 6c 2d 31 36 38 0d 0a 53  ort label-168..S
5ae0: 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20  ELECT cor0.col0 
5af0: 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  * + CAST ( NULL 
5b00: 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
5b10: 4d 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72  M tab1, tab2 cor
5b20: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
5b30: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37  s hashing to cd7
5b40: 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34 30  a7901e47c1515540
5b50: 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d  4aff0d216fe0b...
5b60: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5b70: 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 30 2e  ..SELECT - tab0.
5b80: 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 39 39  col0 * col0 * 99
5b90: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
5ba0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 32 37 34  0..----..-121274
5bb0: 0d 0a 2d 35 36 39 39 31 0d 0a 2d 37 38 34 30 39  ..-56991..-78409
5bc0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
5bd0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
5be0: 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2d 20 74  TINCT - col2 - t
5bf0: 61 62 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  ab0.col0 * col0 
5c00: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
5c10: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 36 0d 0a  0..----..-1226..
5c20: 2d 36 30 39 0d 0a 2d 38 30 30 33 0d 0a 0d 0a 73  -609..-8003....s
5c30: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
5c40: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
5c50: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
5c60: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
5c70: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
5c80: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5c90: 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  - col2 + - col1 
5ca0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
5cb0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
5cc0: 30 39 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a 0d 0a  09..-67..-80....
5cd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5ce0: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
5cf0: 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 30   * - col1 - col0
5d00: 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
5d10: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
5d20: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 39  or0..----..-1619
5d30: 38 0d 0a 2d 34 31 32 38 0d 0a 2d 36 37 39 30 0d  8..-4128..-6790.
5d40: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5d50: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 31 20  rt..SELECT - 41 
5d60: 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  + + col1 * - col
5d70: 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  2 * - col0 FROM 
5d80: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
5d90: 2d 2d 0d 0a 33 33 35 34 0d 0a 36 36 34 30 37 37  --..3354..664077
5da0: 0d 0a 36 38 30 37 31 0d 0a 0d 0a 71 75 65 72 79  ..68071....query
5db0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5dc0: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  CT + col2 * - co
5dd0: 6c 30 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  l0 - col2 * - co
5de0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
5df0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 39  cor0..----..-399
5e00: 0d 0a 31 35 33 36 0d 0a 32 37 35 34 0d 0a 0d 0a  ..1536..2754....
5e10: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5e20: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30  .SELECT + - col0
5e30: 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
5e40: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
5e50: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 31  0..----..-14..-1
5e60: 35 36 0d 0a 2d 31 35 38 0d 0a 0d 0a 71 75 65 72  56..-158....quer
5e70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5e80: 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  ECT col2 * col0 
5e90: 2d 20 33 33 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 33 AS col0 FRO
5ea0: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
5eb0: 2d 0d 0a 32 0d 0a 37 32 36 35 0d 0a 37 35 39 0d  -..2..7265..759.
5ec0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
5ed0: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
5ee0: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
5ef0: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
5f00: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
5f10: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 37 0d  wsort label-177.
5f20: 0a 53 45 4c 45 43 54 20 2d 20 34 30 20 2a 20 63  .SELECT - 40 * c
5f30: 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 37 38  ol1 * + CAST( 78
5f40: 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
5f50: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
5f60: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 34 30  or0..----..-1840
5f70: 38 30 0d 0a 2d 35 33 30 34 30 0d 0a 2d 39 36 37  80..-53040..-967
5f80: 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  20....skipif mys
5f90: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
5fa0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
5fb0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 37 0d 0a  sort label-177..
5fc0: 53 45 4c 45 43 54 20 2d 20 34 30 20 2a 20 63 6f  SELECT - 40 * co
5fd0: 6c 31 20 2a 20 2b 20 43 41 53 54 20 28 20 37 38  l1 * + CAST ( 78
5fe0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
5ff0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
6000: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 34  cor0..----..-184
6010: 30 38 30 0d 0a 2d 35 33 30 34 30 0d 0a 2d 39 36  080..-53040..-96
6020: 37 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  720....query I r
6030: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74  owsort..SELECT t
6040: 61 62 32 2e 63 6f 6c 32 20 2b 20 2b 20 74 61 62  ab2.col2 + + tab
6050: 32 2e 63 6f 6c 31 20 2a 20 2b 20 74 61 62 32 2e  2.col1 * + tab2.
6060: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52  col0 * - col2 FR
6070: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
6080: 31 31 39 36 32 36 0d 0a 2d 35 30 39 39 36 0d 0a  119626..-50996..
6090: 2d 35 38 33 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -5832....onlyif 
60a0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
60b0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
60c0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
60d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
60e0: 61 62 65 6c 2d 31 37 39 0d 0a 53 45 4c 45 43 54  abel-179..SELECT
60f0: 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
6100: 6c 31 20 44 49 56 20 63 6f 6c 30 20 2b 20 63 6f  l1 DIV col0 + co
6110: 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l2 * + col2 FROM
6120: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
6130: 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d 0a  ---..1444..676..
6140: 37 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  733....skipif my
6150: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
6160: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
6170: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 39 0d  wsort label-179.
6180: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
6190: 20 2d 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 30   - - col1 / col0
61a0: 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   + col2 * + col2
61b0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
61c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a  r0..----..1444..
61d0: 36 37 36 0d 0a 37 33 33 0d 0a 0d 0a 6f 6e 6c 79  676..733....only
61e0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
61f0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
6200: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
6210: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6220: 74 20 6c 61 62 65 6c 2d 31 38 30 0d 0a 53 45 4c  t label-180..SEL
6230: 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT - col2 * col
6240: 30 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 63  0 + - col0 DIV c
6250: 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 + - col0 AS 
6260: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
6270: 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a 2d 37 33 38 37  ----..-70..-7387
6280: 0d 0a 2d 38 31 36 0d 0a 0d 0a 73 6b 69 70 69 66  ..-816....skipif
6290: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
62a0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
62b0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
62c0: 38 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  80..SELECT - col
62d0: 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  2 * col0 + - col
62e0: 30 20 2f 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  0 / col1 + - col
62f0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
6300: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a  ab0..----..-70..
6310: 2d 37 33 38 37 0d 0a 2d 38 31 36 0d 0a 0d 0a 71  -7387..-816....q
6320: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6330: 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 74 61  SELECT col1 + ta
6340: 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 74 61 62 31  b1.col1 * - tab1
6350: 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f  .col2 * col0 FRO
6360: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab1..----..-3
6370: 36 34 37 30 0d 0a 2d 34 31 38 36 0d 0a 2d 39 39  6470..-4186..-99
6380: 38 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  827....query I r
6390: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
63a0: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
63b0: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30   + col1 * + col0
63c0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
63d0: 0d 0a 31 33 30 35 0d 0a 31 39 30 0d 0a 34 35 37  ..1305..190..457
63e0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
63f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
6400: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63  ol2 * - col1 + c
6410: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
6420: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a 32  r0..----..194..2
6430: 39 32 34 0d 0a 37 35 35 33 0d 0a 0d 0a 6f 6e 6c  924..7553....onl
6440: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
6450: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
6460: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
6470: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
6480: 72 74 20 6c 61 62 65 6c 2d 31 38 34 0d 0a 53 45  rt label-184..SE
6490: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20 2d 20  LECT - col1 - - 
64a0: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 44 49  col0 * - col1 DI
64b0: 56 20 2d 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52  V - col1 col2 FR
64c0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
64d0: 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a  .----..-2..-62..
64e0: 2d 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -62....skipif po
64f0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
6500: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
6510: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
6520: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
6530: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
6540: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
6550: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
6560: 61 62 65 6c 2d 31 38 34 0d 0a 53 45 4c 45 43 54  abel-184..SELECT
6570: 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30   - col1 - - col0
6580: 20 2a 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63 6f   * - col1 / - co
6590: 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l1 col2 FROM tab
65a0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
65b0: 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d  .-2..-62..-62...
65c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
65d0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
65e0: 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  T + - cor0.col2 
65f0: 2a 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63 6f  * col0 - cor0.co
6600: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
6610: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
6620: 2d 2d 0d 0a 2d 31 38 38 0d 0a 2d 33 36 35 38 0d  --..-188..-3658.
6630: 0a 2d 37 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20  .-7693....query 
6640: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6650: 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2d  T ALL + + col2 -
6660: 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46   col2 * - col2 F
6670: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
6680: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 32 0d 0a 32 0d  ..----..1122..2.
6690: 0a 36 38 30 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .6806....onlyif 
66a0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
66b0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
66c0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
66d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
66e0: 61 62 65 6c 2d 31 38 37 0d 0a 53 45 4c 45 43 54  abel-187..SELECT
66f0: 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 44   + col1 + col2 D
6700: 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  IV + col1 FROM t
6710: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
6720: 2d 0d 0a 31 35 0d 0a 32 30 0d 0a 32 38 0d 0a 0d  -..15..20..28...
6730: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
6740: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
6750: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6760: 6c 61 62 65 6c 2d 31 38 37 0d 0a 53 45 4c 45 43  label-187..SELEC
6770: 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  T + col1 + col2 
6780: 2f 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  / + col1 FROM ta
6790: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
67a0: 0d 0a 31 35 0d 0a 32 30 0d 0a 32 38 0d 0a 0d 0a  ..15..20..28....
67b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
67c0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
67d0: 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46   - col0 * col1 F
67e0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
67f0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 37 0d 0a 2d  ..----..-1027..-
6800: 35 32 0d 0a 2d 36 33 30 0d 0a 0d 0a 71 75 65 72  52..-630....quer
6810: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6820: 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 63  ECT - - col1 * c
6830: 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d  ol2 + - col1 * -
6840: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
6850: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
6860: 0a 2d 2d 2d 2d 0d 0a 31 31 34 30 0d 0a 32 34 39  .----..1140..249
6870: 36 0d 0a 32 38 30 38 0d 0a 0d 0a 71 75 65 72 79  6..2808....query
6880: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6890: 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  CT - col1 + col0
68a0: 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   * cor0.col2 FRO
68b0: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
68c0: 2d 0d 0a 2d 36 32 0d 0a 37 30 36 0d 0a 37 32 30  -..-62..706..720
68d0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
68e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
68f0: 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ol1 + col1 * - c
6900: 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  or0.col0 AS col0
6910: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
6920: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a  r0..----..-104..
6930: 2d 31 30 35 33 0d 0a 2d 36 35 30 0d 0a 0d 0a 6f  -1053..-650....o
6940: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
6950: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
6960: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
6970: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
6980: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 32 0d 0a  sort label-192..
6990: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e  SELECT + + cor0.
69a0: 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 41 53  col0 DIV col0 AS
69b0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
69c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
69d0: 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..1..1....skipif
69e0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
69f0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
6a00: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
6a10: 39 32 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  92..SELECT + + c
6a20: 6f 72 30 2e 63 6f 6c 30 20 2f 20 63 6f 6c 30 20  or0.col0 / col0 
6a30: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
6a40: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
6a50: 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .1..1..1....quer
6a60: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6a70: 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  ECT + col2 * - c
6a80: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
6a90: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
6aa0: 0d 0a 2d 32 39 31 36 0d 0a 2d 33 32 34 39 0d 0a  ..-2916..-3249..
6ab0: 2d 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -9216....query I
6ac0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6ad0: 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f   DISTINCT - + co
6ae0: 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l1 + col2 AS col
6af0: 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
6b00: 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37 0d 0a  ..----..28..47..
6b10: 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  83....onlyif mys
6b20: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
6b30: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
6b40: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
6b50: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
6b60: 6c 2d 31 39 35 0d 0a 53 45 4c 45 43 54 20 41 4c  l-195..SELECT AL
6b70: 4c 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  L + + col0 + - c
6b80: 6f 6c 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol1 DIV cor0.col
6b90: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
6ba0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34  or0..----..3..64
6bb0: 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..80....skipif m
6bc0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
6bd0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
6be0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 35  owsort label-195
6bf0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
6c00: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2f   col0 + - col1 /
6c10: 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
6c20: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
6c30: 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d  --..3..64..80...
6c40: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6c50: 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f  ..SELECT tab0.co
6c60: 6c 31 20 2d 20 2b 20 74 61 62 30 2e 63 6f 6c 32  l1 - + tab0.col2
6c70: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
6c80: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d  b0..----..53..9.
6c90: 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .96....onlyif my
6ca0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
6cb0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
6cc0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
6cd0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
6ce0: 65 6c 2d 31 39 37 0d 0a 53 45 4c 45 43 54 20 74  el-197..SELECT t
6cf0: 61 62 31 2e 63 6f 6c 32 20 44 49 56 20 2d 20 63  ab1.col2 DIV - c
6d00: 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20  ol2 + - col1 AS 
6d10: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
6d20: 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 31 34 0d 0a  ----..-11..-14..
6d30: 2d 32 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -27....skipif my
6d40: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
6d50: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
6d60: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 37 0d  wsort label-197.
6d70: 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c  .SELECT tab1.col
6d80: 32 20 2f 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63  2 / - col2 + - c
6d90: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
6da0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   tab1..----..-11
6db0: 0d 0a 2d 31 34 0d 0a 2d 32 37 0d 0a 0d 0a 73 6b  ..-14..-27....sk
6dc0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
6dd0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
6de0: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
6df0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
6e00: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
6e10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
6e20: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 74   col2 * col2 + t
6e30: 61 62 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  ab0.col0 * - col
6e40: 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  1 col2 FROM tab0
6e50: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 38 32 33 0d 0a  ..----..-14823..
6e60: 2d 33 31 35 33 0d 0a 2d 33 33 39 36 0d 0a 0d 0a  -3153..-3396....
6e70: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
6e80: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
6e90: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
6ea0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
6eb0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
6ec0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6ed0: 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 32   ALL col0 * col2
6ee0: 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32   + - col1 * col2
6ef0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
6f00: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 32 0d 0a 33 30  .----..-1242..30
6f10: 37 38 0d 0a 36 34 33 32 0d 0a 0d 0a 71 75 65 72  78..6432....quer
6f20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6f30: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
6f40: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b  ol1 * - col0 + +
6f50: 20 63 6f 6c 31 20 2b 20 74 61 62 32 2e 63 6f 6c   col1 + tab2.col
6f60: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
6f70: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 39 38 0d  ab2..----..1398.
6f80: 0a 32 37 35 0d 0a 34 36 38 37 0d 0a 0d 0a 71 75  .275..4687....qu
6f90: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6fa0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74  ELECT DISTINCT t
6fb0: 61 62 32 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  ab2.col0 * - col
6fc0: 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  1 + - col2 * col
6fd0: 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  1 + - col1 * + c
6fe0: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
6ff0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   tab2..----..-20
7000: 31 35 0d 0a 2d 32 32 37 38 0d 0a 2d 39 36 31 37  15..-2278..-9617
7010: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7020: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
7030: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col1 * + col1 + 
7040: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
7050: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34  M tab0..----..74
7060: 32 39 0d 0a 38 33 36 33 0d 0a 39 34 31 30 0d 0a  29..8363..9410..
7070: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
7080: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
7090: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
70a0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
70b0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
70c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
70d0: 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 32  CT ALL tab1.col2
70e0: 20 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46   + + col2 col0 F
70f0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
7100: 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d  108..114..192...
7110: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7120: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
7130: 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72  0 * + col1 + cor
7140: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0.col0 FROM tab2
7150: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7160: 31 34 32 32 0d 0a 32 32 34 0d 0a 34 36 38 30 0d  1422..224..4680.
7170: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7180: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 30 20  rt..SELECT - 70 
7190: 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  * + col2 AS col0
71a0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
71b0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 32 30 0d  r0..----..-1820.
71c0: 0a 2d 31 38 39 30 0d 0a 2d 32 36 36 30 0d 0a 0d  .-1890..-2660...
71d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
71e0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
71f0: 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20  T col1 + col2 * 
7200: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
7210: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
7220: 39 33 0d 0a 36 36 33 0d 0a 38 36 38 0d 0a 0d 0a  93..663..868....
7230: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7240: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35 35 20 2b  .SELECT ALL 55 +
7250: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   - cor0.col1 AS 
7260: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
7270: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 34  or0..----..29..4
7280: 32 0d 0a 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  2..45....skipif 
7290: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
72a0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
72b0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
72c0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
72d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
72e0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
72f0: 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 63   * col1 * col2 c
7300: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
7310: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39   cor0..----..339
7320: 35 0d 0a 36 36 34 31 31 38 0d 0a 36 38 31 31 32  5..664118..68112
7330: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
7340: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
7350: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
7360: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
7370: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7380: 32 30 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  209..SELECT ALL 
7390: 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 31 20  ( col0 ) + col1 
73a0: 2d 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 63  - + col1 DIV - c
73b0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
73c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31   cor0..----..111
73d0: 0d 0a 31 33 33 0d 0a 31 38 31 0d 0a 0d 0a 73 6b  ..133..181....sk
73e0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
73f0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
7400: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
7410: 65 6c 2d 32 30 39 0d 0a 53 45 4c 45 43 54 20 41  el-209..SELECT A
7420: 4c 4c 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f  LL ( col0 ) + co
7430: 6c 31 20 2d 20 2b 20 63 6f 6c 31 20 2f 20 2d 20  l1 - + col1 / - 
7440: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
7450: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
7460: 31 0d 0a 31 33 33 0d 0a 31 38 31 0d 0a 0d 0a 71  1..133..181....q
7470: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7480: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
7490: 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c  ( - col1 ) * col
74a0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
74b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34  or0..----..-2064
74c0: 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a  ..-3395..-8099..
74d0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
74e0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
74f0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
7500: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
7510: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
7520: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7530: 43 54 20 44 49 53 54 49 4e 43 54 20 32 30 20 63  CT DISTINCT 20 c
7540: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
7550: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d   cor0..----..20.
7560: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7570: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
7580: 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63   cor0.col0 + + c
7590: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
75a0: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
75b0: 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d  ..137..38..96...
75c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
75d0: 0d 0a 53 45 4c 45 43 54 20 2d 20 32 31 20 41 53  ..SELECT - 21 AS
75e0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
75f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
7600: 32 31 0d 0a 2d 32 31 0d 0a 2d 32 31 0d 0a 0d 0a  21..-21..-21....
7610: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7620: 0a 53 45 4c 45 43 54 20 2d 20 38 39 20 2b 20 63  .SELECT - 89 + c
7630: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
7640: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
7650: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 32 0d  r0..----..-3..2.
7660: 0a 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .8....onlyif mys
7670: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
7680: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
7690: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
76a0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
76b0: 6c 2d 32 31 35 0d 0a 53 45 4c 45 43 54 20 41 4c  l-215..SELECT AL
76c0: 4c 20 2b 20 28 20 63 6f 6c 30 20 29 20 44 49 56  L + ( col0 ) DIV
76d0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63   - cor0.col2 + c
76e0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
76f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
7700: 32 34 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69 66  24..88....skipif
7710: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
7720: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
7730: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
7740: 31 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  15..SELECT ALL +
7750: 20 28 20 63 6f 6c 30 20 29 20 2f 20 2d 20 63 6f   ( col0 ) / - co
7760: 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46  r0.col2 + col0 F
7770: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
7780: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 34 0d 0a 38  ..----..0..24..8
7790: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
77a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
77b0: 54 49 4e 43 54 20 2b 20 31 38 20 2a 20 74 61 62  TINCT + 18 * tab
77c0: 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  1.col2 FROM tab1
77d0: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 36 0d 0a 31 37  ..----..1026..17
77e0: 32 38 0d 0a 39 37 32 0d 0a 0d 0a 71 75 65 72 79  28..972....query
77f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7800: 43 54 20 2d 20 28 20 28 20 2b 20 63 6f 6c 30 20  CT - ( ( + col0 
7810: 29 20 29 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f  ) ) + - col1 FRO
7820: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
7830: 33 37 0d 0a 2d 33 38 0d 0a 2d 39 36 0d 0a 0d 0a  37..-38..-96....
7840: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7850: 0a 53 45 4c 45 43 54 20 36 20 2d 20 74 61 62 30  .SELECT 6 - tab0
7860: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
7870: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
7880: 31 38 0d 0a 2d 32 39 0d 0a 2d 38 33 0d 0a 0d 0a  18..-29..-83....
7890: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
78a0: 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63  .SELECT col0 * c
78b0: 6f 6c 30 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 - col2 AS co
78c0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
78d0: 2d 2d 0d 0a 32 32 0d 0a 36 30 35 38 0d 0a 36 32  --..22..6058..62
78e0: 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  03....query I ro
78f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 37  wsort..SELECT 17
7900: 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
7910: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 0d 0a 34 31  0..----..106..41
7920: 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..52....query I 
7930: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7940: 2b 20 28 20 74 61 62 30 2e 63 6f 6c 32 20 29 20  + ( tab0.col2 ) 
7950: 2a 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62 30 2e  * col0 * + tab0.
7960: 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 41 53 20 63  col2 - col1 AS c
7970: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
7980: 2d 2d 2d 0d 0a 2d 36 32 0d 0a 32 36 30 35 30 0d  ---..-62..26050.
7990: 0a 35 39 38 33 34 35 0d 0a 0d 0a 71 75 65 72 79  .598345....query
79a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
79b0: 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a  CT col0 * col2 *
79c0: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
79d0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
79e0: 0a 2d 32 36 31 33 36 0d 0a 2d 33 35 0d 0a 2d 35  .-26136..-35..-5
79f0: 39 38 34 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  98436....query I
7a00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7a10: 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 31 36   DISTINCT - - 16
7a20: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
7a30: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 0d 0a  r0..----..16....
7a40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7a50: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
7a60: 20 34 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   40 AS col1 FROM
7a70: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
7a80: 2d 2d 2d 0d 0a 34 30 0d 0a 0d 0a 71 75 65 72 79  ---..40....query
7a90: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7aa0: 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 31  CT DISTINCT tab1
7ab0: 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2d  .col0 * - col2 -
7ac0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
7ad0: 0a 2d 2d 2d 2d 0d 0a 2d 31 38 38 0d 0a 2d 33 36  .----..-188..-36
7ae0: 35 38 0d 0a 2d 37 36 39 33 0d 0a 0d 0a 6f 6e 6c  58..-7693....onl
7af0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
7b00: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
7b10: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
7b20: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
7b30: 72 74 20 6c 61 62 65 6c 2d 32 32 36 0d 0a 53 45  rt label-226..SE
7b40: 4c 45 43 54 20 32 34 20 44 49 56 20 63 6f 6c 32  LECT 24 DIV col2
7b50: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
7b60: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34  1..----..-3..-64
7b70: 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-80....skipif 
7b80: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
7b90: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
7ba0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32  rowsort label-22
7bb0: 36 0d 0a 53 45 4c 45 43 54 20 32 34 20 2f 20 63  6..SELECT 24 / c
7bc0: 6f 6c 32 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 - col0 FROM 
7bd0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a  tab1..----..-3..
7be0: 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72  -64..-80....quer
7bf0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7c00: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2d  ECT ALL - col1 -
7c10: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
7c20: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
7c30: 32 30 0d 0a 2d 32 36 0d 0a 2d 35 32 0d 0a 0d 0a  20..-26..-52....
7c40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7c50: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
7c60: 20 35 38 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63   58 * - col1 + c
7c70: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
7c80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
7c90: 30 35 0d 0a 2d 35 31 36 0d 0a 2d 36 37 34 0d 0a  05..-516..-674..
7ca0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
7cb0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
7cc0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
7cd0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
7ce0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32  rowsort label-22
7cf0: 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
7d00: 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30  CT col0 + + col0
7d10: 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74   DIV col2 FROM t
7d20: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 37  ab0..----..24..7
7d30: 30 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  0..90....skipif 
7d40: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
7d50: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
7d60: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32  rowsort label-22
7d70: 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
7d80: 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30  CT col0 + + col0
7d90: 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   / col2 FROM tab
7da0: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 37 30 0d  0..----..24..70.
7db0: 0a 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .90....onlyif my
7dc0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
7dd0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
7de0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
7df0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
7e00: 65 6c 2d 32 33 30 0d 0a 53 45 4c 45 43 54 20 63  el-230..SELECT c
7e10: 6f 6c 31 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d  ol1 + col1 DIV -
7e20: 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20   col1 col0 FROM 
7e30: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a  tab0..----..85..
7e40: 39 30 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  90..96....skipif
7e50: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
7e60: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
7e70: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
7e80: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
7e90: 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
7ea0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
7eb0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7ec0: 74 20 6c 61 62 65 6c 2d 32 33 30 0d 0a 53 45 4c  t label-230..SEL
7ed0: 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  ECT col1 + col1 
7ee0: 2f 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  / - col1 col0 FR
7ef0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38  OM tab0..----..8
7f00: 35 0d 0a 39 30 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c  5..90..96....onl
7f10: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
7f20: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
7f30: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
7f40: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
7f50: 72 74 20 6c 61 62 65 6c 2d 32 33 31 0d 0a 53 45  rt label-231..SE
7f60: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20  LECT - col1 + + 
7f70: 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 44 49  col2 + - col0 DI
7f80: 56 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  V + col1 AS col2
7f90: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
7fa0: 0d 0a 2d 33 34 0d 0a 2d 34 0d 0a 31 37 0d 0a 0d  ..-34..-4..17...
7fb0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
7fc0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
7fd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7fe0: 6c 61 62 65 6c 2d 32 33 31 0d 0a 53 45 4c 45 43  label-231..SELEC
7ff0: 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  T - col1 + + col
8000: 32 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 63  2 + - col0 / + c
8010: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
8020: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34   tab2..----..-34
8030: 0d 0a 2d 34 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72  ..-4..17....quer
8040: 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
8050: 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
8060: 20 74 61 62 30 20 57 48 45 52 45 20 2d 20 63 6f   tab0 WHERE - co
8070: 6c 32 20 49 4e 20 28 20 2b 20 74 61 62 30 2e 63  l2 IN ( + tab0.c
8080: 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ol2 )..----....q
8090: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
80a0: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
80b0: 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
80c0: 20 57 48 45 52 45 20 4e 55 4c 4c 20 4e 4f 54 20   WHERE NULL NOT 
80d0: 42 45 54 57 45 45 4e 20 63 6f 6c 31 20 41 4e 44  BETWEEN col1 AND
80e0: 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   col0..----....q
80f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8100: 53 45 4c 45 43 54 20 63 6f 6c 32 20 46 52 4f 4d  SELECT col2 FROM
8110: 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20   tab1 WHERE NOT 
8120: 63 6f 6c 30 20 4e 4f 54 20 49 4e 20 28 20 2d 20  col0 NOT IN ( - 
8130: 74 61 62 31 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30  tab1.col1 * col0
8140: 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72   )..----....quer
8150: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8160: 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62  ECT col0 + - tab
8170: 31 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  1.col2 * - col2 
8180: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
8190: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 39 0d 0a 33  1..----..2919..3
81a0: 33 31 33 0d 0a 39 32 39 36 0d 0a 0d 0a 71 75 65  313..9296....que
81b0: 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
81c0: 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f  SELECT ALL * FRO
81d0: 4d 20 74 61 62 31 20 57 48 45 52 45 20 2b 20 63  M tab1 WHERE + c
81e0: 6f 6c 31 20 3e 20 28 20 4e 55 4c 4c 20 29 0d 0a  ol1 > ( NULL )..
81f0: 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49  ----....query II
8200: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8210: 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48  T * FROM tab2 WH
8220: 45 52 45 20 4e 4f 54 20 63 6f 6c 31 20 3d 20 4e  ERE NOT col1 = N
8230: 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ULL..----....que
8240: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
8250: 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f  LECT ALL tab1.co
8260: 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  l2 - + col0 * - 
8270: 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col2 * col1 FROM
8280: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 35   tab1..----..365
8290: 33 37 0d 0a 34 32 36 36 0d 0a 39 39 39 33 36 0d  37..4266..99936.
82a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
82b0: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
82c0: 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 63 6f  + tab1.col0 * co
82d0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
82e0: 2d 2d 0d 0a 34 31 35 33 0d 0a 36 33 0d 0a 36 34  --..4153..63..64
82f0: 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
8300: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
8310: 53 54 49 4e 43 54 20 63 6f 6c 30 20 2d 20 2d 20  STINCT col0 - - 
8320: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
8330: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39  M tab1..----..29
8340: 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72  ..74..93....quer
8350: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8360: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74  ECT DISTINCT + t
8370: 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab2.col2 FROM ta
8380: 62 32 20 57 48 45 52 45 20 4e 55 4c 4c 20 42 45  b2 WHERE NULL BE
8390: 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e  TWEEN NULL AND N
83a0: 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ULL..----....que
83b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
83c0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
83d0: 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  col1 + col0 * co
83e0: 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 * col0 AS col
83f0: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
8400: 2d 0d 0a 31 32 39 32 0d 0a 31 35 38 31 32 35 0d  -..1292..158125.
8410: 0a 32 33 37 31 34 31 0d 0a 0d 0a 71 75 65 72 79  .237141....query
8420: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8430: 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a  CT + tab2.col1 *
8440: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46   - col1 * col2 F
8450: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
8460: 2d 31 30 39 38 32 0d 0a 2d 32 35 39 34 37 0d 0a  -10982..-25947..
8470: 2d 39 30 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20  -90506....query 
8480: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8490: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
84a0: 31 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 - col2 FROM ta
84b0: 62 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 3c 3e  b0 WHERE NULL <>
84c0: 20 28 20 2b 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d   ( + col0 )..---
84d0: 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  -....query III r
84e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
84f0: 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74  ISTINCT * FROM t
8500: 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20 2b 20  ab1 WHERE NOT + 
8510: 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 4e 4f 54 20  col2 + col2 NOT 
8520: 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44  BETWEEN NULL AND
8530: 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f   NULL..----....o
8540: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
8550: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
8560: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
8570: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
8580: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 36 0d 0a  sort label-246..
8590: 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20  SELECT col2 DIV 
85a0: 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  + col2 + - col0 
85b0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
85c0: 0a 2d 32 0d 0a 2d 36 33 0d 0a 2d 37 39 0d 0a 0d  .-2..-63..-79...
85d0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
85e0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
85f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
8600: 6c 61 62 65 6c 2d 32 34 36 0d 0a 53 45 4c 45 43  label-246..SELEC
8610: 54 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20  T col2 / + col2 
8620: 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
8630: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36  b1..----..-2..-6
8640: 33 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20  3..-79....query 
8650: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8660: 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2d  T ALL + col2 + -
8670: 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f   tab2.col1 AS co
8680: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
8690: 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d  --..-33..-4..21.
86a0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
86b0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
86c0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
86d0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
86e0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
86f0: 34 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  48..SELECT col0 
8700: 44 49 56 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20  DIV tab1.col0 + 
8710: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
8720: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 0d  M tab1..----..4.
8730: 0a 36 35 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69  .65..81....skipi
8740: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
8750: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
8760: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
8770: 32 34 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  248..SELECT col0
8780: 20 2f 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63   / tab1.col0 + c
8790: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
87a0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a   tab1..----..4..
87b0: 36 35 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20  65..81....query 
87c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
87d0: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
87e0: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2d 20  + col0 * col1 - 
87f0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
8800: 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d  ----..1343..217.
8810: 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .4602....query I
8820: 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
8830: 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57  CT * FROM tab1 W
8840: 48 45 52 45 20 4e 4f 54 20 28 20 63 6f 6c 31 20  HERE NOT ( col1 
8850: 2a 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c  * + col1 - + col
8860: 32 20 29 20 4e 4f 54 20 42 45 54 57 45 45 4e 20  2 ) NOT BETWEEN 
8870: 63 6f 6c 30 20 41 4e 44 20 28 20 2d 20 63 6f 6c  col0 AND ( - col
8880: 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  1 + + col2 * + c
8890: 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a  ol2 )..----..3..
88a0: 32 36 0d 0a 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  26..54....onlyif
88b0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
88c0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
88d0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
88e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
88f0: 6c 61 62 65 6c 2d 32 35 31 0d 0a 53 45 4c 45 43  label-251..SELEC
8900: 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 31 20  T ALL tab0.col1 
8910: 2a 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20  * col2 DIV col2 
8920: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
8930: 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73  .86..91..97....s
8940: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
8950: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
8960: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
8970: 62 65 6c 2d 32 35 31 0d 0a 53 45 4c 45 43 54 20  bel-251..SELECT 
8980: 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20  ALL tab0.col1 * 
8990: 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 46 52 4f 4d  col2 / col2 FROM
89a0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d   tab0..----..86.
89b0: 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69  .91..97....onlyi
89c0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
89d0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
89e0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
89f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8a00: 20 6c 61 62 65 6c 2d 32 35 32 0d 0a 53 45 4c 45   label-252..SELE
8a10: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61  CT DISTINCT - ta
8a20: 62 30 2e 63 6f 6c 32 20 44 49 56 20 2d 20 74 61  b0.col2 DIV - ta
8a30: 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b0.col1 FROM tab
8a40: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b  0..----..0....sk
8a50: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
8a60: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
8a70: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
8a80: 65 6c 2d 32 35 32 0d 0a 53 45 4c 45 43 54 20 44  el-252..SELECT D
8a90: 49 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e 63  ISTINCT - tab0.c
8aa0: 6f 6c 32 20 2f 20 2d 20 74 61 62 30 2e 63 6f 6c  ol2 / - tab0.col
8ab0: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
8ac0: 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..0....query I 
8ad0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8ae0: 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2d 20  DISTINCT col1 - 
8af0: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col2 * - col1 * 
8b00: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
8b10: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab2..----..10
8b20: 39 39 39 0d 0a 32 35 39 37 38 0d 0a 39 30 35 36  999..25978..9056
8b30: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  5....query III r
8b40: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
8b50: 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74  ISTINCT * FROM t
8b60: 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20 4e 55  ab0 WHERE NOT NU
8b70: 4c 4c 20 3c 3d 20 63 6f 6c 30 20 2f 20 2b 20 63  LL <= col0 / + c
8b80: 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69  ol0..----....ski
8b90: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
8ba0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
8bb0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
8bc0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
8bd0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
8be0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
8bf0: 4c 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2d 20  L + tab0.col0 - 
8c00: 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 63 6f  - col0 * col2 co
8c10: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
8c20: 2d 2d 0d 0a 37 30 0d 0a 37 33 38 37 0d 0a 38 31  --..70..7387..81
8c30: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
8c40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
8c50: 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c  TINCT col0 * col
8c60: 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  0 * - col2 AS co
8c70: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
8c80: 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 31 39 30 30  --..-1225..-1900
8c90: 38 0d 0a 2d 36 34 39 35 32 32 0d 0a 0d 0a 6f 6e  8..-649522....on
8ca0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
8cb0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
8cc0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
8cd0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
8ce0: 6f 72 74 20 6c 61 62 65 6c 2d 32 35 37 0d 0a 53  ort label-257..S
8cf0: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49 56  ELECT - col1 DIV
8d00: 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41   + col0 + col0 A
8d10: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
8d20: 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 36 34 0d 0a  ..----..-5..64..
8d30: 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  80....skipif mys
8d40: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
8d50: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
8d60: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 37 0d 0a  sort label-257..
8d70: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20  SELECT - col1 / 
8d80: 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53  + col0 + col0 AS
8d90: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
8da0: 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 36 34 0d 0a 38  .----..-5..64..8
8db0: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
8dc0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
8dd0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
8de0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
8df0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8e00: 2d 32 35 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -258..SELECT ALL
8e10: 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   + + col1 * - co
8e20: 6c 30 20 44 49 56 20 63 6f 6c 30 20 2b 20 2b 20  l0 DIV col0 + + 
8e30: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 41 53  col2 * + col2 AS
8e40: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
8e50: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
8e60: 38 39 30 0d 0a 33 32 33 39 0d 0a 39 32 30 33 0d  890..3239..9203.
8e70: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
8e80: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
8e90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8ea0: 74 20 6c 61 62 65 6c 2d 32 35 38 0d 0a 53 45 4c  t label-258..SEL
8eb0: 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31  ECT ALL + + col1
8ec0: 20 2a 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 30   * - col0 / col0
8ed0: 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   + + col2 * + co
8ee0: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
8ef0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
8f00: 2d 2d 0d 0a 32 38 39 30 0d 0a 33 32 33 39 0d 0a  --..2890..3239..
8f10: 39 32 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9203....query I 
8f20: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8f30: 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d  ALL + - col0 + -
8f40: 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20   col2 * col0 AS 
8f50: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
8f60: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
8f70: 39 36 0d 0a 2d 32 31 30 36 0d 0a 2d 33 30 38 31  96..-2106..-3081
8f80: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8f90: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30  ort..SELECT tab0
8fa0: 2e 63 6f 6c 32 20 2d 20 74 61 62 30 2e 63 6f 6c  .col2 - tab0.col
8fb0: 30 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  0 * + col1 * + c
8fc0: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
8fd0: 20 74 61 62 30 20 57 48 45 52 45 20 4e 55 4c 4c   tab0 WHERE NULL
8fe0: 20 49 4e 20 28 20 2d 20 63 6f 6c 32 20 29 0d 0a   IN ( - col2 )..
8ff0: 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ----....skipif p
9000: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
9010: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
9020: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
9030: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
9040: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9050: 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 32 2e  ..SELECT + tab2.
9060: 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 63 6f 6c 32  col0 + col2 col2
9070: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
9080: 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a  ..104..117..34..
9090: 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
90a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
90b0: 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f  OM tab1 WHERE NO
90c0: 54 20 28 20 4e 55 4c 4c 20 29 20 3c 20 63 6f 6c  T ( NULL ) < col
90d0: 30 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  0 * col1 + - col
90e0: 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69  1..----....skipi
90f0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
9100: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
9110: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
9120: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
9130: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
9140: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 31  ort..SELECT tab1
9150: 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20  .col2 col1 FROM 
9160: 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20 28  tab1 WHERE NOT (
9170: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 29   - col1 * col1 )
9180: 20 3c 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a   <> NULL..----..
9190: 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
91a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
91b0: 2a 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52  * FROM tab0 WHER
91c0: 45 20 28 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  E ( col0 * + col
91d0: 30 20 2f 20 63 6f 6c 32 20 29 20 3c 3d 20 63 6f  0 / col2 ) <= co
91e0: 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  l1 * + col1 + - 
91f0: 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  col0..----..9 va
9200: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
9210: 33 38 61 31 36 37 33 65 32 65 30 39 64 36 39 34  38a1673e2e09d694
9220: 63 38 63 65 63 34 35 63 37 39 37 30 33 34 61 37  c8cec45c797034a7
9230: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
9240: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
9250: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
9260: 63 6f 72 30 20 57 48 45 52 45 20 4e 4f 54 20 4e  cor0 WHERE NOT N
9270: 55 4c 4c 20 42 45 54 57 45 45 4e 20 2d 20 63 6f  ULL BETWEEN - co
9280: 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  l2 * col0 + + co
9290: 6c 32 20 2f 20 63 6f 6c 31 20 41 4e 44 20 28 20  l2 / col1 AND ( 
92a0: 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  NULL )..----....
92b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
92c0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a  .SELECT + col0 *
92d0: 20 63 6f 6c 31 20 2b 20 2d 20 34 36 20 2a 20 37   col1 + - 46 * 7
92e0: 39 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  9 FROM tab0 AS c
92f0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 37 30  or0..----..-1570
9300: 0d 0a 2d 32 33 39 0d 0a 34 34 36 35 0d 0a 0d 0a  ..-239..4465....
9310: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
9320: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
9330: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
9340: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
9350: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
9360: 72 74 20 6c 61 62 65 6c 2d 32 36 37 0d 0a 53 45  rt label-267..SE
9370: 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
9380: 31 20 2a 20 63 6f 6c 30 20 2f 20 2d 20 43 41 53  1 * col0 / - CAS
9390: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
93a0: 44 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  D ) + col0 FROM 
93b0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
93c0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
93d0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
93e0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
93f0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
9400: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 37  owsort label-267
9410: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
9420: 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2f 20 2d   col1 * col0 / -
9430: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
9440: 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 30  INTEGER ) + col0
9450: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
9460: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
9470: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
9480: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9490: 45 4c 45 43 54 20 37 36 20 2a 20 2d 20 63 6f 6c  ELECT 76 * - col
94a0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
94b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 38 0d  or0..----..-228.
94c0: 0a 2d 34 38 36 34 0d 0a 2d 36 30 38 30 0d 0a 0d  .-4864..-6080...
94d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
94e0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
94f0: 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2d 20  T col0 * col1 - 
9500: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
9510: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
9520: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37   cor0..----..197
9530: 38 0d 0a 33 32 39 38 0d 0a 38 30 30 38 0d 0a 0d  8..3298..8008...
9540: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9550: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
9560: 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  * - col1 + - col
9570: 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
9580: 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 38 0d 0a 33 32  ..----..1978..32
9590: 39 38 0d 0a 38 30 30 38 0d 0a 0d 0a 71 75 65 72  98..8008....quer
95a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
95b0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
95c0: 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63   col2 * + cor0.c
95d0: 6f 6c 32 20 2b 20 28 20 2b 20 36 36 20 29 20 41  ol2 + ( + 66 ) A
95e0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
95f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9600: 2d 32 38 35 30 0d 0a 2d 33 31 38 33 0d 0a 2d 39  -2850..-3183..-9
9610: 31 35 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  150....onlyif my
9620: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
9630: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
9640: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
9650: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
9660: 65 6c 2d 32 37 32 0d 0a 53 45 4c 45 43 54 20 2d  el-272..SELECT -
9670: 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63   col0 + + cor0.c
9680: 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 46 52 4f  ol1 DIV col0 FRO
9690: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
96a0: 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a  ----..-64..-80..
96b0: 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
96c0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
96d0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
96e0: 6f 72 74 20 6c 61 62 65 6c 2d 32 37 32 0d 0a 53  ort label-272..S
96f0: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b  ELECT - col0 + +
9700: 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c   cor0.col1 / col
9710: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
9720: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a  or0..----..-64..
9730: 2d 38 30 0d 0a 35 0d 0a 0d 0a 71 75 65 72 79 20  -80..5....query 
9740: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9750: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 31  T DISTINCT - + 1
9760: 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 * - col0 AS co
9770: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
9780: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 34 0d  cor0..----..264.
9790: 0a 33 38 35 0d 0a 39 37 39 0d 0a 0d 0a 71 75 65  .385..979....que
97a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
97b0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
97c0: 2a 20 32 35 20 2b 20 2d 20 63 6f 6c 32 20 2d 20  * 25 + - col2 - 
97d0: 2d 20 33 39 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 39 AS col1 FRO
97e0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
97f0: 30 39 33 0d 0a 2d 38 31 39 0d 0a 31 33 0d 0a 0d  093..-819..13...
9800: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9810: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28  ..SELECT ALL + (
9820: 20 2d 20 63 6f 6c 32 20 29 20 2d 20 2d 20 63 6f   - col2 ) - - co
9830: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
9840: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a  tab0..----..53..
9850: 39 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  9..96....query I
9860: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9870: 20 2b 20 34 20 2a 20 63 6f 6c 30 20 46 52 4f 4d   + 4 * col0 FROM
9880: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30   tab0..----..140
9890: 0d 0a 33 35 36 0d 0a 39 36 0d 0a 0d 0a 71 75 65  ..356..96....que
98a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
98b0: 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2b  LECT tab1.col2 +
98c0: 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f   + tab1.col2 FRO
98d0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
98e0: 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d 0a 73  8..114..192....s
98f0: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
9900: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
9910: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
9920: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
9930: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
9940: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9950: 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20  - col0 * col1 + 
9960: 2d 20 34 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63  - 4 + + col2 * c
9970: 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
9980: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
9990: 0d 0a 33 30 30 34 0d 0a 36 36 33 36 0d 0a 38 30  ..3004..6636..80
99a0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
99b0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
99c0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
99d0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
99e0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
99f0: 32 37 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  279..SELECT col0
9a00: 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20 28 20   DIV + col0 + ( 
9a10: 2d 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c  - col1 ) * + col
9a20: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
9a30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 37  or0..----..-2837
9a40: 0d 0a 2d 37 34 36 31 0d 0a 2d 39 36 0d 0a 0d 0a  ..-7461..-96....
9a50: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
9a60: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
9a70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
9a80: 61 62 65 6c 2d 32 37 39 0d 0a 53 45 4c 45 43 54  abel-279..SELECT
9a90: 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20 2b   col0 / + col0 +
9aa0: 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 2b 20   ( - col1 ) * + 
9ab0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
9ac0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
9ad0: 38 33 37 0d 0a 2d 37 34 36 31 0d 0a 2d 39 36 0d  837..-7461..-96.
9ae0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
9af0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
9b00: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
9b10: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
9b20: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
9b30: 38 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  80..SELECT ALL -
9b40: 20 2d 20 30 20 2a 20 2d 20 63 6f 6c 30 20 44 49   - 0 * - col0 DI
9b50: 56 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  V cor0.col1 AS c
9b60: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
9b70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
9b80: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
9b90: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
9ba0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
9bb0: 6f 72 74 20 6c 61 62 65 6c 2d 32 38 30 0d 0a 53  ort label-280..S
9bc0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 30 20  ELECT ALL - - 0 
9bd0: 2a 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 72 30 2e  * - col0 / cor0.
9be0: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
9bf0: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
9c00: 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
9c10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9c20: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b  ELECT - col0 + +
9c30: 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20   col1 + col0 AS 
9c40: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
9c50: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
9c60: 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 6f 6e 6c 79  ..13..26....only
9c70: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
9c80: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
9c90: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
9ca0: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
9cb0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
9cc0: 61 62 65 6c 2d 32 38 32 0d 0a 53 45 4c 45 43 54  abel-282..SELECT
9cd0: 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 74 61 62 30   ALL col0 * tab0
9ce0: 2e 63 6f 6c 32 20 2b 20 43 41 53 54 28 20 63 6f  .col2 + CAST( co
9cf0: 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l2 AS SIGNED ) *
9d00: 20 2b 20 63 6f 6c 30 20 2b 20 33 20 46 52 4f 4d   + col0 + 3 FROM
9d10: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35   tab0..----..145
9d20: 39 39 0d 0a 31 35 38 37 0d 0a 37 33 0d 0a 0d 0a  99..1587..73....
9d30: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
9d40: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
9d50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
9d60: 61 62 65 6c 2d 32 38 32 0d 0a 53 45 4c 45 43 54  abel-282..SELECT
9d70: 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 74 61 62 30   ALL col0 * tab0
9d80: 2e 63 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 63  .col2 + CAST ( c
9d90: 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
9da0: 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 33 20 46 52   * + col0 + 3 FR
9db0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
9dc0: 34 35 39 39 0d 0a 31 35 38 37 0d 0a 37 33 0d 0a  4599..1587..73..
9dd0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
9de0: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
9df0: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
9e00: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
9e10: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
9e20: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38 33 0d 0a  sort label-283..
9e30: 53 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c  SELECT CAST( NUL
9e40: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  L AS SIGNED ) FR
9e50: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  OM tab2 AS cor0 
9e60: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c  CROSS JOIN tab2,
9e70: 20 74 61 62 32 20 63 6f 72 31 2c 20 74 61 62 30   tab2 cor1, tab0
9e80: 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
9e90: 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  81 values hashin
9ea0: 67 20 74 6f 20 63 62 33 33 63 33 30 64 36 66 35  g to cb33c30d6f5
9eb0: 32 62 62 62 32 34 33 33 38 61 32 39 33 63 37 34  2bbb24338a293c74
9ec0: 30 66 32 39 63 0d 0a 0d 0a 73 6b 69 70 69 66 20  0f29c....skipif 
9ed0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
9ee0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
9ef0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38  rowsort label-28
9f00: 33 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  3..SELECT CAST (
9f10: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
9f20: 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
9f30: 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
9f40: 74 61 62 32 2c 20 74 61 62 32 20 63 6f 72 31 2c  tab2, tab2 cor1,
9f50: 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d   tab0 AS cor2..-
9f60: 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68  ---..81 values h
9f70: 61 73 68 69 6e 67 20 74 6f 20 63 62 33 33 63 33  ashing to cb33c3
9f80: 30 64 36 66 35 32 62 62 62 32 34 33 33 38 61 32  0d6f52bbb24338a2
9f90: 39 33 63 37 34 30 66 32 39 63 0d 0a 0d 0a 6f 6e  93c740f29c....on
9fa0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
9fb0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
9fc0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
9fd0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
9fe0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9ff0: 20 6c 61 62 65 6c 2d 32 38 34 0d 0a 53 45 4c 45   label-284..SELE
a000: 43 54 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 43 41  CT + col2 - - CA
a010: 53 54 28 20 2d 20 39 36 20 41 53 20 53 49 47 4e  ST( - 96 AS SIGN
a020: 45 44 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  ED ) * + col2 * 
a030: 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
a040: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30 36 0d 0a 33  ..----..15606..3
a050: 35 30 32 36 35 0d 0a 37 33 37 33 37 36 0d 0a 0d  50265..737376...
a060: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
a070: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
a080: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
a090: 6c 61 62 65 6c 2d 32 38 34 0d 0a 53 45 4c 45 43  label-284..SELEC
a0a0: 54 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 43 41 53  T + col2 - - CAS
a0b0: 54 20 28 20 2d 20 39 36 20 41 53 20 49 4e 54 45  T ( - 96 AS INTE
a0c0: 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2a  GER ) * + col2 *
a0d0: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
a0e0: 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30 36 0d 0a  1..----..15606..
a0f0: 33 35 30 32 36 35 0d 0a 37 33 37 33 37 36 0d 0a  350265..737376..
a100: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
a110: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
a120: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
a130: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
a140: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
a150: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38 35 0d 0a  sort label-285..
a160: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20  SELECT - col2 / 
a170: 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  + col0 + cor0.co
a180: 6c 32 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c  l2 + + CAST( NUL
a190: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
a1a0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
a1b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
a1c0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
a1d0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
a1e0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
a1f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a200: 74 20 6c 61 62 65 6c 2d 32 38 35 0d 0a 53 45 4c  t label-285..SEL
a210: 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63  ECT - col2 / + c
a220: 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ol0 + cor0.col2 
a230: 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + + CAST ( NULL 
a240: 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
a250: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
a260: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
a270: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
a280: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a290: 74 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 30  t..SELECT ( col0
a2a0: 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 32 20   ) + - col0 + 2 
a2b0: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  * col2 FROM tab1
a2c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a2d0: 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d  108..114..192...
a2e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a2f0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 74  ..SELECT ALL ( t
a300: 61 62 32 2e 63 6f 6c 31 20 29 20 2b 20 63 6f 6c  ab2.col1 ) + col
a310: 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 * + col1 FROM 
a320: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 33  tab2..----..1593
a330: 0d 0a 36 36 33 0d 0a 38 36 38 0d 0a 0d 0a 71 75  ..663..868....qu
a340: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
a350: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 37  ELECT DISTINCT 7
a360: 30 20 2a 20 28 20 74 61 62 30 2e 63 6f 6c 32 20  0 * ( tab0.col2 
a370: 29 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 31 37 20  ) + + col2 * 17 
a380: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
a390: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d 0a 37  0..----..2871..7
a3a0: 31 33 34 0d 0a 38 37 0d 0a 0d 0a 6f 6e 6c 79 69  134..87....onlyi
a3b0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
a3c0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
a3d0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
a3e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a3f0: 20 6c 61 62 65 6c 2d 32 38 39 0d 0a 53 45 4c 45   label-289..SELE
a400: 43 54 20 2b 20 31 39 20 44 49 56 20 2d 20 63 6f  CT + 19 DIV - co
a410: 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  l2 + col1 + - co
a420: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
a430: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
a440: 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d 38  --..-28..-47..-8
a450: 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
a460: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
a470: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
a480: 6f 72 74 20 6c 61 62 65 6c 2d 32 38 39 0d 0a 53  ort label-289..S
a490: 45 4c 45 43 54 20 2b 20 31 39 20 2f 20 2d 20 63  ELECT + 19 / - c
a4a0: 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63  ol2 + col1 + - c
a4b0: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
a4c0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
a4d0: 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d  ---..-28..-47..-
a4e0: 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
a4f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
a500: 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  col2 + - col2 * 
a510: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
a520: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
a530: 2d 0d 0a 2d 31 35 36 30 0d 0a 2d 36 38 34 0d 0a  -..-1560..-684..
a540: 2d 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -864....query I 
a550: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a560: 2d 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20  - + col0 - col1 
a570: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
a580: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d  0..----..-110..-
a590: 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 71 75 65  132..-180....que
a5a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a5b0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
a5c0: 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  col2 + cor0.col2
a5d0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
a5e0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
a5f0: 0d 0a 35 32 0d 0a 35 34 0d 0a 37 36 0d 0a 0d 0a  ..52..54..76....
a600: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a610: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 31 31 20 2a  .SELECT - - 11 *
a620: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
a630: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
a640: 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 33 36 33 0d 0a  .----..11..363..
a650: 39 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  902....query I r
a660: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
a670: 20 28 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20   ( + ( - col2 ) 
a680: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
a690: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
a6a0: 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d  -..26..27..38...
a6b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a6c0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
a6d0: 54 20 2b 20 35 30 20 2a 20 2b 20 63 6f 6c 32 20  T + 50 * + col2 
a6e0: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
a6f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37   cor0..----..147
a700: 0d 0a 31 37 33 36 0d 0a 34 31 39 31 0d 0a 0d 0a  ..1736..4191....
a710: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a720: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
a730: 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor1.col1 FROM 
a740: 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
a750: 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d  r0, tab2 cor1..-
a760: 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d  ---..17..31..59.
a770: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a780: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
a790: 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  1 + + col0 * col
a7a0: 32 20 2b 20 34 38 20 41 53 20 63 6f 6c 30 20 46  2 + 48 AS col0 F
a7b0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
a7c0: 0d 0a 2d 2d 2d 2d 0d 0a 32 33 36 0d 0a 33 37 30  ..----..236..370
a7d0: 36 0d 0a 37 37 34 31 0d 0a 0d 0a 71 75 65 72 79  6..7741....query
a7e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a7f0: 43 54 20 2d 20 35 35 20 2b 20 2b 20 63 6f 6c 30  CT - 55 + + col0
a800: 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * + col2 AS col
a810: 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
a820: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 0d 0a 31 39 37  ..----..134..197
a830: 33 0d 0a 32 39 34 37 0d 0a 0d 0a 6f 6e 6c 79 69  3..2947....onlyi
a840: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
a850: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
a860: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
a870: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
a880: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
a890: 62 65 6c 2d 32 39 39 0d 0a 53 45 4c 45 43 54 20  bel-299..SELECT 
a8a0: 2b 20 43 41 53 54 28 20 28 20 63 6f 6c 30 20 29  + CAST( ( col0 )
a8b0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b   AS SIGNED ) * +
a8c0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
a8d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
a8e0: 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
a8f0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
a900: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
a910: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a920: 74 20 6c 61 62 65 6c 2d 32 39 39 0d 0a 53 45 4c  t label-299..SEL
a930: 45 43 54 20 2b 20 43 41 53 54 20 28 20 28 20 63  ECT + CAST ( ( c
a940: 6f 6c 30 20 29 20 41 53 20 49 4e 54 45 47 45 52  ol0 ) AS INTEGER
a950: 20 29 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   ) * + col1 FROM
a960: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
a970: 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d  ---..2064..3395.
a980: 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .8099....query I
a990: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a9a0: 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30   + col0 * - cor0
a9b0: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
a9c0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
a9d0: 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32  .----..-1343..-2
a9e0: 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65  17..-4602....que
a9f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
aa00: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
aa10: 2d 20 63 6f 6c 30 20 2a 20 34 33 20 41 53 20 63  - col0 * 43 AS c
aa20: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
aa30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39   cor0..----..129
aa40: 0d 0a 32 37 35 32 0d 0a 33 34 34 30 0d 0a 0d 0a  ..2752..3440....
aa50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
aa60: 0a 53 45 4c 45 43 54 20 39 20 2a 20 32 38 20 46  .SELECT 9 * 28 F
aa70: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
aa80: 0d 0a 2d 2d 2d 2d 0d 0a 32 35 32 0d 0a 32 35 32  ..----..252..252
aa90: 0d 0a 32 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..252....query I
aaa0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
aab0: 20 41 4c 4c 20 2b 20 2d 20 28 20 63 6f 6c 30 20   ALL + - ( col0 
aac0: 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ) * - cor0.col1 
aad0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
aae0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
aaf0: 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39  .2064..3395..809
ab00: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
ab10: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
ab20: 20 31 37 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29   17 + - ( col0 )
ab30: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
ab40: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
ab50: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33  0..----..-24..-3
ab60: 35 0d 0a 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  5..37....query I
ab70: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ab80: 20 2b 20 2b 20 38 30 20 2b 20 35 31 20 46 52 4f   + + 80 + 51 FRO
ab90: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
aba0: 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 31 33 31 0d 0a  ----..131..131..
abb0: 31 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  131....query I r
abc0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
abd0: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a  ISTINCT + col2 *
abe0: 20 37 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20   71 * cor0.col2 
abf0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
ac00: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 30 33 36 0d  0..----..207036.
ac10: 0a 32 33 30 36 37 39 0d 0a 36 35 34 33 33 36 0d  .230679..654336.
ac20: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
ac30: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
ac40: 20 33 36 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c   36 * + cor0.col
ac50: 31 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63  1 + + col2 + + c
ac60: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
ac70: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
ac80: 2d 2d 2d 0d 0a 2d 33 30 33 39 0d 0a 2d 33 31 30  ---..-3039..-310
ac90: 35 0d 0a 2d 33 34 35 36 0d 0a 0d 0a 71 75 65 72  5..-3456....quer
aca0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
acb0: 45 43 54 20 41 4c 4c 20 31 20 2b 20 2b 20 63 6f  ECT ALL 1 + + co
acc0: 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  r0.col2 AS col2 
acd0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
ace0: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 38 0d  0..----..27..28.
acf0: 0a 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .39....query I r
ad00: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
ad10: 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   - col2 * + col0
ad20: 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32   + ( + cor0.col2
ad30: 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   ) + col0 FROM t
ad40: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
ad50: 2d 31 35 35 0d 0a 2d 31 39 32 34 0d 0a 2d 32 38  -155..-1924..-28
ad60: 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
ad70: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
ad80: 4c 20 63 6f 72 31 2e 63 6f 6c 30 20 41 53 20 63  L cor1.col0 AS c
ad90: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
ada0: 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
adb0: 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20  2 AS cor1, tab0 
adc0: 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor2..----..8
add0: 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
ade0: 20 74 6f 20 30 35 38 33 35 66 32 39 64 64 39 63   to 05835f29dd9c
adf0: 64 34 66 61 31 36 38 38 39 64 65 35 34 64 65 63  d4fa16889de54dec
ae00: 33 63 62 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3cb6....onlyif m
ae10: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
ae20: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
ae30: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
ae40: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
ae50: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
ae60: 2d 33 31 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -311..SELECT ALL
ae70: 20 2d 20 38 34 20 2b 20 2b 20 63 6f 6c 30 20 2b   - 84 + + col0 +
ae80: 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 2a 20   CAST( + col1 * 
ae90: 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29  col1 AS SIGNED )
aea0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
aeb0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 34 0d 0a 33  r0..----..284..3
aec0: 34 37 35 0d 0a 38 38 34 0d 0a 0d 0a 73 6b 69 70  475..884....skip
aed0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
aee0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
aef0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
af00: 2d 33 31 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -311..SELECT ALL
af10: 20 2d 20 38 34 20 2b 20 2b 20 63 6f 6c 30 20 2b   - 84 + + col0 +
af20: 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 31 20 2a   CAST ( + col1 *
af30: 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52   col1 AS INTEGER
af40: 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
af50: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 34 0d  cor0..----..284.
af60: 0a 33 34 37 35 0d 0a 38 38 34 0d 0a 0d 0a 71 75  .3475..884....qu
af70: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
af80: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 37 20 41  ELECT ALL + 77 A
af90: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
afa0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
afb0: 37 37 0d 0a 37 37 0d 0a 37 37 0d 0a 0d 0a 71 75  77..77..77....qu
afc0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
afd0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74  ELECT DISTINCT t
afe0: 61 62 31 2e 63 6f 6c 31 20 2d 20 63 6f 6c 31 20  ab1.col1 - col1 
aff0: 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  * - col2 AS col0
b000: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
b010: 0d 0a 31 32 36 31 0d 0a 31 34 33 30 0d 0a 35 38  ..1261..1430..58
b020: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
b030: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35  sort..SELECT + 5
b040: 35 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  5 * - col0 AS co
b050: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
b060: 2d 2d 0d 0a 2d 33 38 35 0d 0a 2d 34 32 39 30 0d  --..-385..-4290.
b070: 0a 2d 34 33 34 35 0d 0a 0d 0a 71 75 65 72 79 20  .-4345....query 
b080: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b090: 54 20 2d 20 34 31 20 41 53 20 63 6f 6c 31 20 46  T - 41 AS col1 F
b0a0: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
b0b0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
b0c0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
b0d0: 6f 20 34 62 61 30 63 31 30 32 30 39 31 66 39 63  o 4ba0c102091f9c
b0e0: 62 63 39 66 65 39 34 33 39 62 30 34 35 38 34 65  bc9fe9439b04584e
b0f0: 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
b100: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
b110: 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31  STINCT cor0.col1
b120: 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31   + col0 * + col1
b130: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
b140: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
b150: 0d 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31  ..2150..3492..81
b160: 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
b170: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
b180: 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f  STINCT + cor0.co
b190: 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l2 + + col0 FROM
b1a0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
b1b0: 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35  ---..121..176..5
b1c0: 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
b1d0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
b1e0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
b1f0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
b200: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
b210: 2d 33 31 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  -318..SELECT DIS
b220: 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63  TINCT + + cor0.c
b230: 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b  ol1 + - col0 + +
b240: 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 72 30   col1 DIV + cor0
b250: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20  .col0 FROM tab0 
b260: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
b270: 0d 0a 36 34 0d 0a 36 35 0d 0a 0d 0a 73 6b 69 70  ..64..65....skip
b280: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
b290: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
b2a0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
b2b0: 2d 33 31 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  -318..SELECT DIS
b2c0: 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63  TINCT + + cor0.c
b2d0: 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b  ol1 + - col0 + +
b2e0: 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 72 30 2e 63   col1 / + cor0.c
b2f0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
b300: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a   cor0..----..3..
b310: 36 34 0d 0a 36 35 0d 0a 0d 0a 71 75 65 72 79 20  64..65....query 
b320: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b330: 54 20 2d 20 37 30 20 46 52 4f 4d 20 74 61 62 30  T - 70 FROM tab0
b340: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20  , tab0 AS cor0, 
b350: 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
b360: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
b370: 73 68 69 6e 67 20 74 6f 20 63 32 61 32 39 39 34  shing to c2a2994
b380: 61 34 65 39 34 35 38 33 36 38 33 63 63 64 61 32  a4e94583683ccda2
b390: 63 63 30 39 38 63 35 38 66 0d 0a 0d 0a 6f 6e 6c  cc098c58f....onl
b3a0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
b3b0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
b3c0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
b3d0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
b3e0: 72 74 20 6c 61 62 65 6c 2d 33 32 30 0d 0a 53 45  rt label-320..SE
b3f0: 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 72  LECT ALL + + cor
b400: 30 2e 63 6f 6c 32 20 2b 20 2d 20 39 32 20 44 49  0.col2 + - 92 DI
b410: 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V + col0 FROM ta
b420: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
b430: 0d 0a 32 34 0d 0a 35 36 0d 0a 39 35 0d 0a 0d 0a  ..24..56..95....
b440: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
b450: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
b460: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
b470: 61 62 65 6c 2d 33 32 30 0d 0a 53 45 4c 45 43 54  abel-320..SELECT
b480: 20 41 4c 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f   ALL + + cor0.co
b490: 6c 32 20 2b 20 2d 20 39 32 20 2f 20 2b 20 63 6f  l2 + - 92 / + co
b4a0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
b4b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  cor0..----..24..
b4c0: 35 36 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20  56..95....query 
b4d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b4e0: 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 30  T + - col2 * + 0
b4f0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
b500: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
b510: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
b520: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b530: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20  LECT ALL col1 + 
b540: 2b 20 33 38 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  + 38 * - cor0.co
b550: 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 * col1 FROM t
b560: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
b570: 2d 0d 0a 2d 32 35 36 36 32 0d 0a 2d 33 37 39 30  -..-25662..-3790
b580: 0d 0a 2d 36 34 30 39 0d 0a 0d 0a 71 75 65 72 79  ..-6409....query
b590: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
b5a0: 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2d  CT - tab1.col0 -
b5b0: 20 74 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f   tab1.col2 AS co
b5c0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
b5d0: 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31 37 36 0d 0a  --..-121..-176..
b5e0: 2d 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -57....onlyif my
b5f0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
b600: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
b610: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
b620: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
b630: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
b640: 33 32 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  324..SELECT DIST
b650: 49 4e 43 54 20 43 41 53 54 28 20 2b 20 33 38 20  INCT CAST( + 38 
b660: 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f  AS SIGNED ) * co
b670: 6c 31 20 2a 20 35 32 20 46 52 4f 4d 20 74 61 62  l1 * 52 FROM tab
b680: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
b690: 0a 31 31 36 35 38 34 0d 0a 33 33 35 39 32 0d 0a  .116584..33592..
b6a0: 36 31 32 35 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  61256....skipif 
b6b0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
b6c0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
b6d0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32  rowsort label-32
b6e0: 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
b6f0: 43 54 20 43 41 53 54 20 28 20 2b 20 33 38 20 41  CT CAST ( + 38 A
b700: 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f  S INTEGER ) * co
b710: 6c 31 20 2a 20 35 32 20 46 52 4f 4d 20 74 61 62  l1 * 52 FROM tab
b720: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
b730: 0a 31 31 36 35 38 34 0d 0a 33 33 35 39 32 0d 0a  .116584..33592..
b740: 36 31 32 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  61256....query I
b750: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b760: 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20   ALL + col2 + + 
b770: 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  col2 + cor0.col0
b780: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
b790: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
b7a0: 0d 0a 32 35 33 0d 0a 33 37 0d 0a 39 30 0d 0a 0d  ..253..37..90...
b7b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b7c0: 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f  ..SELECT tab1.co
b7d0: 6c 30 20 2b 20 39 34 20 2a 20 63 6f 6c 31 20 41  l0 + 94 * col1 A
b7e0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
b7f0: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 34 0d 0a 31 33  ..----..1004..13
b800: 30 32 0d 0a 32 34 34 37 0d 0a 0d 0a 71 75 65 72  02..2447....quer
b810: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b820: 45 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20  ECT - tab0.col2 
b830: 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  * - col1 * col1 
b840: 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  + - col1 * - col
b850: 32 20 2b 20 31 33 20 2a 20 28 20 63 6f 6c 32 20  2 + 13 * ( col2 
b860: 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
b870: 2d 0d 0a 32 34 37 33 33 35 0d 0a 36 38 37 35 37  -..247335..68757
b880: 30 0d 0a 39 35 31 39 0d 0a 0d 0a 71 75 65 72 79  0..9519....query
b890: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
b8a0: 43 54 20 63 6f 6c 32 20 2d 20 63 6f 72 30 2e 63  CT col2 - cor0.c
b8b0: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol2 * + col1 FRO
b8c0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
b8d0: 2d 2d 2d 2d 0d 0a 2d 32 38 30 35 0d 0a 2d 37 33  ----..-2805..-73
b8e0: 38 30 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79  80..-96....query
b8f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
b900: 43 54 20 63 6f 6c 32 20 2a 20 2b 20 74 61 62 32  CT col2 * + tab2
b910: 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 41  .col1 + + col1 A
b920: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
b930: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 33 0d 0a 36 36  ..----..1593..66
b940: 33 0d 0a 38 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  3..868....onlyif
b950: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
b960: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
b970: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
b980: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
b990: 6c 61 62 65 6c 2d 33 33 30 0d 0a 53 45 4c 45 43  label-330..SELEC
b9a0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
b9b0: 31 20 2a 20 63 6f 6c 31 20 44 49 56 20 2b 20 63  1 * col1 DIV + c
b9c0: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
b9d0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
b9e0: 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d  ---..17..31..59.
b9f0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
ba00: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
ba10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ba20: 74 20 6c 61 62 65 6c 2d 33 33 30 0d 0a 53 45 4c  t label-330..SEL
ba30: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
ba40: 6f 6c 31 20 2a 20 63 6f 6c 31 20 2f 20 2b 20 63  ol1 * col1 / + c
ba50: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
ba60: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
ba70: 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d  ---..17..31..59.
ba80: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
ba90: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
baa0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
bab0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
bac0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
bad0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
bae0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 35  ECT DISTINCT - 5
baf0: 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  1 col1 FROM tab2
bb00: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
bb10: 2d 35 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -51....onlyif my
bb20: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
bb30: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
bb40: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
bb50: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
bb60: 65 6c 2d 33 33 32 0d 0a 53 45 4c 45 43 54 20 41  el-332..SELECT A
bb70: 4c 4c 20 2b 20 39 34 20 44 49 56 20 63 6f 6c 30  LL + 94 DIV col0
bb80: 20 2b 20 28 20 63 6f 6c 32 20 29 20 44 49 56 20   + ( col2 ) DIV 
bb90: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
bba0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
bbb0: 2d 34 0d 0a 2d 36 0d 0a 32 39 0d 0a 0d 0a 73 6b  -4..-6..29....sk
bbc0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
bbd0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
bbe0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
bbf0: 65 6c 2d 33 33 32 0d 0a 53 45 4c 45 43 54 20 41  el-332..SELECT A
bc00: 4c 4c 20 2b 20 39 34 20 2f 20 63 6f 6c 30 20 2b  LL + 94 / col0 +
bc10: 20 28 20 63 6f 6c 32 20 29 20 2f 20 2d 20 63 6f   ( col2 ) / - co
bc20: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
bc30: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a  cor0..----..-4..
bc40: 2d 36 0d 0a 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  -6..29....onlyif
bc50: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
bc60: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
bc70: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
bc80: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
bc90: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
bca0: 65 6c 2d 33 33 33 0d 0a 53 45 4c 45 43 54 20 2d  el-333..SELECT -
bcb0: 20 43 41 53 54 28 20 33 38 20 41 53 20 53 49 47   CAST( 38 AS SIG
bcc0: 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52  NED ) AS col2 FR
bcd0: 4f 4d 20 74 61 62 32 20 63 6f 72 30 20 43 52 4f  OM tab2 cor0 CRO
bce0: 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20  SS JOIN tab0 AS 
bcf0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
bd00: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
bd10: 65 35 37 31 35 34 31 61 65 34 30 63 62 30 64 64  e571541ae40cb0dd
bd20: 61 63 61 31 36 65 31 31 66 34 33 35 39 35 30 37  aca16e11f4359507
bd30: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
bd40: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
bd50: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
bd60: 72 74 20 6c 61 62 65 6c 2d 33 33 33 0d 0a 53 45  rt label-333..SE
bd70: 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 33 38  LECT - CAST ( 38
bd80: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
bd90: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
bda0: 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
bdb0: 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
bdc0: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
bdd0: 68 69 6e 67 20 74 6f 20 65 35 37 31 35 34 31 61  hing to e571541a
bde0: 65 34 30 63 62 30 64 64 61 63 61 31 36 65 31 31  e40cb0ddaca16e11
bdf0: 66 34 33 35 39 35 30 37 0d 0a 0d 0a 71 75 65 72  f4359507....quer
be00: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
be10: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
be20: 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   + col2 + - col2
be30: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
be40: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d  r0..----..-36..-
be50: 37 33 38 30 0d 0a 2d 38 32 35 0d 0a 0d 0a 71 75  7380..-825....qu
be60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
be70: 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63  ELECT + col0 * c
be80: 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 * col1 FROM 
be90: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34 0d  tab1..----..234.
bea0: 0a 34 30 39 36 30 0d 0a 38 33 32 30 30 0d 0a 0d  .40960..83200...
beb0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
bec0: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
bed0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
bee0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
bef0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
bf00: 6f 72 74 20 6c 61 62 65 6c 2d 33 33 36 0d 0a 53  ort label-336..S
bf10: 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c  ELECT CAST( NULL
bf20: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
bf30: 20 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   3 AS col2 FROM 
bf40: 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
bf50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
bf60: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64  es hashing to cd
bf70: 37 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34  7a7901e47c151554
bf80: 30 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a  04aff0d216fe0b..
bf90: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
bfa0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
bfb0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
bfc0: 20 6c 61 62 65 6c 2d 33 33 36 0d 0a 53 45 4c 45   label-336..SELE
bfd0: 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  CT CAST ( NULL A
bfe0: 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20  S INTEGER ) * - 
bff0: 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  3 AS col2 FROM t
c000: 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
c010: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
c020: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37  s hashing to cd7
c030: 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34 30  a7901e47c1515540
c040: 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d  4aff0d216fe0b...
c050: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c060: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
c070: 2b 20 2b 20 33 31 20 46 52 4f 4d 20 74 61 62 31  + + 31 FROM tab1
c080: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 0d   cor0..----..41.
c090: 0a 34 34 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79  .44..57....query
c0a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c0b0: 43 54 20 41 4c 4c 20 37 36 20 41 53 20 63 6f 6c  CT ALL 76 AS col
c0c0: 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
c0d0: 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  2 AS cor0, tab2 
c0e0: 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
c0f0: 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
c100: 20 74 6f 20 37 62 32 62 30 38 64 64 33 66 31 61   to 7b2b08dd3f1a
c110: 64 65 66 30 32 38 64 33 66 34 30 65 66 37 63 37  def028d3f40ef7c7
c120: 31 36 64 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20  16da....query I 
c130: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c140: 2d 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 36 34 20  - - col2 - - 64 
c150: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
c160: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36 0d 0a 36 35  0..----..146..65
c170: 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
c180: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c190: 41 4c 4c 20 2d 20 2b 20 33 36 20 46 52 4f 4d 20  ALL - + 36 FROM 
c1a0: 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62 32  tab1, tab2, tab2
c1b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c1c0: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
c1d0: 67 20 74 6f 20 33 62 63 64 30 37 64 32 32 62 36  g to 3bcd07d22b6
c1e0: 32 64 32 30 34 32 62 34 39 39 32 35 33 62 31 63  2d2042b499253b1c
c1f0: 31 33 64 39 65 0d 0a 0d 0a 71 75 65 72 79 20 49  13d9e....query I
c200: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c210: 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 2b   col1 + col2 * +
c220: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
c230: 0a 2d 2d 2d 2d 0d 0a 31 31 37 35 0d 0a 36 38 31  .----..1175..681
c240: 35 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  5..98....query I
c250: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c260: 20 2d 20 28 20 2b 20 32 38 20 29 20 2b 20 2b 20   - ( + 28 ) + + 
c270: 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 30 20 29 20  col2 * ( col0 ) 
c280: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
c290: 0a 31 36 31 0d 0a 32 30 30 30 0d 0a 32 39 37 34  .161..2000..2974
c2a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c2b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
c2c0: 38 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  82 * col2 FROM t
c2d0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
c2e0: 2d 0d 0a 32 37 30 36 0d 0a 36 37 32 34 0d 0a 38  -..2706..6724..8
c2f0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
c300: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28  sort..SELECT + (
c310: 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 32   col2 ) * + col2
c320: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
c330: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
c340: 0d 0a 31 34 34 34 0d 0a 36 37 36 0d 0a 37 32 39  ..1444..676..729
c350: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c360: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
c370: 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63  r0.col0 + cor0.c
c380: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
c390: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   cor0..----..-54
c3a0: 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 6f 6e 6c  ..-67..23....onl
c3b0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
c3c0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
c3d0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
c3e0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
c3f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
c400: 6c 61 62 65 6c 2d 33 34 36 0d 0a 53 45 4c 45 43  label-346..SELEC
c410: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
c420: 30 20 2b 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c  0 + + ( cor0.col
c430: 30 20 29 20 2b 20 43 41 53 54 28 20 63 6f 6c 30  0 ) + CAST( col0
c440: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
c450: 6f 6c 32 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 31  ol2 * - ( - col1
c460: 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
c470: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36  cor0..----..1196
c480: 35 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35 39 0d  52..51034..5859.
c490: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
c4a0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
c4b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c4c0: 74 20 6c 61 62 65 6c 2d 33 34 36 0d 0a 53 45 4c  t label-346..SEL
c4d0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
c4e0: 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 72 30 2e 63  ol0 + + ( cor0.c
c4f0: 6f 6c 30 20 29 20 2b 20 43 41 53 54 20 28 20 63  ol0 ) + CAST ( c
c500: 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
c510: 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2d 20   * col2 * - ( - 
c520: 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32  col1 ) FROM tab2
c530: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c540: 31 31 39 36 35 32 0d 0a 35 31 30 33 34 0d 0a 35  119652..51034..5
c550: 38 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  859....onlyif my
c560: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
c570: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
c580: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
c590: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
c5a0: 65 6c 2d 33 34 37 0d 0a 53 45 4c 45 43 54 20 2b  el-347..SELECT +
c5b0: 20 63 6f 72 32 2e 63 6f 6c 30 20 44 49 56 20 2d   cor2.col0 DIV -
c5c0: 20 31 38 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   18 FROM tab1, t
c5d0: 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab1 AS cor0, tab
c5e0: 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32 20  1 AS cor1, tab2 
c5f0: 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor2..----..8
c600: 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
c610: 20 74 6f 20 64 39 35 62 63 63 37 32 62 30 31 32   to d95bcc72b012
c620: 33 64 66 66 36 64 65 36 37 30 30 36 33 32 32 32  3dff6de670063222
c630: 31 33 36 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1363....skipif m
c640: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
c650: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
c660: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34 37  owsort label-347
c670: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 32 2e  ..SELECT + cor2.
c680: 63 6f 6c 30 20 2f 20 2d 20 31 38 20 46 52 4f 4d  col0 / - 18 FROM
c690: 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
c6a0: 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
c6b0: 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 32 0d  1, tab2 AS cor2.
c6c0: 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73  .----..81 values
c6d0: 20 68 61 73 68 69 6e 67 20 74 6f 20 64 39 35 62   hashing to d95b
c6e0: 63 63 37 32 62 30 31 32 33 64 66 66 36 64 65 36  cc72b0123dff6de6
c6f0: 37 30 30 36 33 32 32 32 31 33 36 33 0d 0a 0d 0a  700632221363....
c700: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c710: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30  .SELECT + + cor0
c720: 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a  .col2 + + col1 *
c730: 20 2b 20 28 20 2b 20 28 20 2b 20 63 6f 6c 30 20   + ( + ( + col0 
c740: 29 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ) ) FROM tab0 AS
c750: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39   cor0..----..209
c760: 37 0d 0a 33 33 39 36 0d 0a 38 31 38 31 0d 0a 0d  7..3396..8181...
c770: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c780: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
c790: 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  + + col1 * + col
c7a0: 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
c7b0: 0d 0a 2d 2d 2d 2d 0d 0a 37 33 31 30 0d 0a 38 31  ..----..7310..81
c7c0: 39 30 0d 0a 39 33 31 32 0d 0a 0d 0a 71 75 65 72  90..9312....quer
c7d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c7e0: 45 43 54 20 2b 20 36 30 20 2b 20 63 6f 6c 32 20  ECT + 60 + col2 
c7f0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
c800: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  0 cor0..----..14
c810: 32 0d 0a 36 31 0d 0a 39 33 0d 0a 0d 0a 71 75 65  2..61..93....que
c820: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c830: 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f  LECT - + cor0.co
c840: 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l2 * - cor0.col1
c850: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
c860: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a  r0..----..2838..
c870: 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  7462..97....quer
c880: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c890: 45 43 54 20 2b 20 37 33 20 41 53 20 63 6f 6c 31  ECT + 73 AS col1
c8a0: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
c8b0: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
c8c0: 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
c8d0: 68 61 73 68 69 6e 67 20 74 6f 20 33 39 33 33 61  hashing to 3933a
c8e0: 39 30 36 64 31 37 61 38 32 30 63 63 66 39 35 34  906d17a820ccf954
c8f0: 36 37 65 32 32 30 36 64 66 38 66 0d 0a 0d 0a 71  67e2206df8f....q
c900: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c910: 53 45 4c 45 43 54 20 2b 20 35 20 46 52 4f 4d 20  SELECT + 5 FROM 
c920: 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 2c  tab1, tab2 cor0,
c930: 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
c940: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
c950: 61 73 68 69 6e 67 20 74 6f 20 36 37 39 37 64 34  ashing to 6797d4
c960: 30 30 39 39 30 32 33 37 37 39 62 38 39 66 65 62  0099023779b89feb
c970: 36 32 37 64 39 34 61 33 65 37 0d 0a 0d 0a 6f 6e  627d94a3e7....on
c980: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
c990: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
c9a0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
c9b0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
c9c0: 6f 72 74 20 6c 61 62 65 6c 2d 33 35 34 0d 0a 53  ort label-354..S
c9d0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
c9e0: 20 63 6f 6c 31 20 44 49 56 20 2d 20 28 20 63 6f   col1 DIV - ( co
c9f0: 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l2 ) FROM tab0 A
ca00: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
ca10: 0a 32 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  .2..97....skipif
ca20: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
ca30: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
ca40: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
ca50: 35 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  54..SELECT DISTI
ca60: 4e 43 54 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 28  NCT - col1 / - (
ca70: 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
ca80: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
ca90: 0a 31 0d 0a 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65  .1..2..97....que
caa0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
cab0: 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  LECT - - cor0.co
cac0: 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l0 * - col0 AS c
cad0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
cae0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30   cor0..----..-40
caf0: 39 36 0d 0a 2d 36 34 30 30 0d 0a 2d 39 0d 0a 0d  96..-6400..-9...
cb00: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
cb10: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
cb20: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
cb30: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
cb40: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35 36  owsort label-356
cb50: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
cb60: 63 6f 6c 30 20 44 49 56 20 34 35 20 63 6f 6c 31  col0 DIV 45 col1
cb70: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
cb80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d  r0..----..-1..0.
cb90: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .0....skipif pos
cba0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
cbb0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
cbc0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
cbd0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
cbe0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
cbf0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
cc00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
cc10: 62 65 6c 2d 33 35 36 0d 0a 53 45 4c 45 43 54 20  bel-356..SELECT 
cc20: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 34 35  - cor0.col0 / 45
cc30: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
cc40: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
cc50: 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  1..0..0....query
cc60: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
cc70: 43 54 20 2d 20 31 39 20 41 53 20 63 6f 6c 30 20  CT - 19 AS col0 
cc80: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20  FROM tab1, tab2 
cc90: 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
cca0: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
ccb0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
ccc0: 6f 20 30 66 62 62 66 66 32 38 61 37 62 36 33 63  o 0fbbff28a7b63c
ccd0: 33 37 62 30 31 63 66 33 36 39 66 39 33 32 35 36  37b01cf369f93256
cce0: 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  62....skipif pos
ccf0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
cd00: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
cd10: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
cd20: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
cd30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
cd40: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
cd50: 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 36 37 20  ( + col0 ) + 67 
cd60: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
cd70: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
cd80: 31 0d 0a 2d 35 37 33 0d 0a 2d 39 37 33 0d 0a 0d  1..-573..-973...
cd90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
cda0: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
cdb0: 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  0 + - col2 * col
cdc0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
cdd0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 36 38  or0..----..-1168
cde0: 0d 0a 2d 31 34 30 31 0d 0a 2d 35 30 36 0d 0a 0d  ..-1401..-506...
cdf0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
ce00: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
ce10: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
ce20: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
ce30: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
ce40: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
ce50: 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  T + + col1 * - c
ce60: 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52  or0.col2 col1 FR
ce70: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
ce80: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36  .----..-1534..-6
ce90: 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72  46..-837....quer
cea0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ceb0: 45 43 54 20 2b 20 2b 20 28 20 33 33 20 29 20 46  ECT + + ( 33 ) F
cec0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
ced0: 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a 33 33 0d 0a  ..----..33..33..
cee0: 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  33....query I ro
cef0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
cf00: 2b 20 36 38 20 2a 20 34 31 20 41 53 20 63 6f 6c  + 68 * 41 AS col
cf10: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
cf20: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 38 38 0d  or0..----..2788.
cf30: 0a 32 37 38 38 0d 0a 32 37 38 38 0d 0a 0d 0a 71  .2788..2788....q
cf40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
cf50: 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20  SELECT col2 * + 
cf60: 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  2 + - col0 FROM 
cf70: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
cf80: 0a 2d 32 36 0d 0a 2d 33 0d 0a 34 37 0d 0a 0d 0a  .-26..-3..47....
cf90: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
cfa0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
cfb0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
cfc0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
cfd0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 36 34 0d  wsort label-364.
cfe0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
cff0: 6c 31 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f  l1 + col2 DIV co
d000: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
d010: 2d 2d 0d 0a 31 35 0d 0a 32 30 0d 0a 32 38 0d 0a  --..15..20..28..
d020: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
d030: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
d040: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d050: 20 6c 61 62 65 6c 2d 33 36 34 0d 0a 53 45 4c 45   label-364..SELE
d060: 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20  CT ALL + col1 + 
d070: 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  col2 / col1 FROM
d080: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d   tab1..----..15.
d090: 0a 32 30 0d 0a 32 38 0d 0a 0d 0a 71 75 65 72 79  .20..28....query
d0a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d0b0: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
d0c0: 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46   * col1 + col1 F
d0d0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
d0e0: 31 35 39 33 0d 0a 36 36 33 0d 0a 38 36 38 0d 0a  1593..663..868..
d0f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d100: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30  t..SELECT + tab0
d110: 2e 63 6f 6c 30 20 2a 20 2d 20 39 20 2a 20 63 6f  .col0 * - 9 * co
d120: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
d130: 2d 2d 0d 0a 2d 33 31 35 0d 0a 2d 36 35 36 38 32  --..-315..-65682
d140: 0d 0a 2d 37 31 32 38 0d 0a 0d 0a 6f 6e 6c 79 69  ..-7128....onlyi
d150: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
d160: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
d170: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
d180: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d190: 20 6c 61 62 65 6c 2d 33 36 37 0d 0a 53 45 4c 45   label-367..SELE
d1a0: 43 54 20 63 6f 6c 30 20 2b 20 74 61 62 30 2e 63  CT col0 + tab0.c
d1b0: 6f 6c 31 20 44 49 56 20 33 36 20 46 52 4f 4d 20  ol1 DIV 36 FROM 
d1c0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a  tab0..----..26..
d1d0: 33 37 0d 0a 39 31 0d 0a 0d 0a 73 6b 69 70 69 66  37..91....skipif
d1e0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
d1f0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
d200: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
d210: 36 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  67..SELECT col0 
d220: 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2f 20 33 36  + tab0.col1 / 36
d230: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
d240: 0d 0a 32 36 0d 0a 33 37 0d 0a 39 31 0d 0a 0d 0a  ..26..37..91....
d250: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d260: 0a 53 45 4c 45 43 54 20 33 37 20 2a 20 63 6f 6c  .SELECT 37 * col
d270: 31 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  1 - cor0.col2 * 
d280: 2b 20 34 33 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 43 AS col0 FRO
d290: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
d2a0: 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 31 37 36 33  ----..-159..1763
d2b0: 0d 0a 33 35 34 36 0d 0a 0d 0a 71 75 65 72 79 20  ..3546....query 
d2c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d2d0: 54 20 2b 20 38 31 20 2b 20 63 6f 6c 32 20 41 53  T + 81 + col2 AS
d2e0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
d2f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
d300: 30 37 0d 0a 31 30 38 0d 0a 31 31 39 0d 0a 0d 0a  07..108..119....
d310: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d320: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
d330: 20 2a 20 34 33 20 2b 20 2b 20 74 61 62 30 2e 63   * 43 + + tab0.c
d340: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
d350: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34   tab0..----..144
d360: 33 0d 0a 33 36 31 35 0d 0a 37 38 0d 0a 0d 0a 73  3..3615..78....s
d370: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
d380: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
d390: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
d3a0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
d3b0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
d3c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
d3d0: 2d 20 63 6f 6c 30 20 2b 20 33 36 20 2a 20 63 6f  - col0 + 36 * co
d3e0: 6c 31 20 2a 20 2b 20 28 20 74 61 62 31 2e 63 6f  l1 * + ( tab1.co
d3f0: 6c 31 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 ) col2 FROM t
d400: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33 33 33  ab1..----..24333
d410: 0d 0a 33 35 33 36 0d 0a 36 30 30 34 0d 0a 0d 0a  ..3536..6004....
d420: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d430: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
d440: 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20   * + ( - col2 ) 
d450: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
d460: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30  0..----..-1..-10
d470: 38 39 0d 0a 2d 36 37 32 34 0d 0a 0d 0a 71 75 65  89..-6724....que
d480: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d490: 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  LECT + + col1 + 
d4a0: 2d 20 37 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52  - 70 + - col0 FR
d4b0: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
d4c0: 2d 2d 0d 0a 2d 31 32 34 0d 0a 2d 31 33 37 0d 0a  --..-124..-137..
d4d0: 2d 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -47....query I r
d4e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
d4f0: 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20 63 6f  ISTINCT - ( - co
d500: 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 31 20 46 52  l0 ) * - col1 FR
d510: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
d520: 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d  --..-1343..-217.
d530: 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20  .-4602....query 
d540: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d550: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
d560: 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol1 * cor0.col1 
d570: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
d580: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
d590: 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37  .-100..-169..-67
d5a0: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
d5b0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
d5c0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
d5d0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
d5e0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
d5f0: 2d 33 37 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -376..SELECT ALL
d600: 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 44   - + cor0.col0 D
d610: 49 56 20 38 31 20 41 53 20 63 6f 6c 30 20 46 52  IV 81 AS col0 FR
d620: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
d630: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
d640: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
d650: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
d660: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d670: 20 6c 61 62 65 6c 2d 33 37 36 0d 0a 53 45 4c 45   label-376..SELE
d680: 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e  CT ALL - + cor0.
d690: 63 6f 6c 30 20 2f 20 38 31 20 41 53 20 63 6f 6c  col0 / 81 AS col
d6a0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
d6b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
d6c0: 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
d6d0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
d6e0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
d6f0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
d700: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
d710: 6c 2d 33 37 37 0d 0a 53 45 4c 45 43 54 20 2b 20  l-377..SELECT + 
d720: 2d 20 63 6f 6c 31 20 2b 20 37 39 20 44 49 56 20  - col1 + 79 DIV 
d730: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
d740: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
d750: 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 73  6..-91..-97....s
d760: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
d770: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
d780: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
d790: 62 65 6c 2d 33 37 37 0d 0a 53 45 4c 45 43 54 20  bel-377..SELECT 
d7a0: 2b 20 2d 20 63 6f 6c 31 20 2b 20 37 39 20 2f 20  + - col1 + 79 / 
d7b0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
d7c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
d7d0: 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 6f  6..-91..-97....o
d7e0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
d7f0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
d800: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
d810: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
d820: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d830: 74 20 6c 61 62 65 6c 2d 33 37 38 0d 0a 53 45 4c  t label-378..SEL
d840: 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53  ECT DISTINCT CAS
d850: 54 28 20 2b 20 37 38 20 41 53 20 53 49 47 4e 45  T( + 78 AS SIGNE
d860: 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  D ) FROM tab1 AS
d870: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 38 0d   cor0..----..78.
d880: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
d890: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
d8a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d8b0: 74 20 6c 61 62 65 6c 2d 33 37 38 0d 0a 53 45 4c  t label-378..SEL
d8c0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53  ECT DISTINCT CAS
d8d0: 54 20 28 20 2b 20 37 38 20 41 53 20 49 4e 54 45  T ( + 78 AS INTE
d8e0: 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20  GER ) FROM tab1 
d8f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
d900: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
d910: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
d920: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
d930: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
d940: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
d950: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
d960: 39 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20  9..SELECT CAST( 
d970: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
d980: 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30   * col1 * + col0
d990: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
d9a0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
d9b0: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
d9c0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
d9d0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
d9e0: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 39 0d 0a  sort label-379..
d9f0: 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55  SELECT CAST ( NU
da00: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
da10: 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  * col1 * + col0 
da20: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
da30: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
da40: 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
da50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
da60: 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 28 20 32  or0.col2 + - ( 2
da70: 39 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  9 ) * col1 FROM 
da80: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
da90: 0a 2d 32 34 36 31 0d 0a 2d 32 35 35 37 0d 0a 2d  .-2461..-2557..-
daa0: 32 38 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2812....query I 
dab0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
dac0: 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ALL - col2 * col
dad0: 30 20 2a 20 31 31 20 46 52 4f 4d 20 74 61 62 30  0 * 11 FROM tab0
dae0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
daf0: 2d 33 38 35 0d 0a 2d 38 30 32 37 38 0d 0a 2d 38  -385..-80278..-8
db00: 37 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  712....query I r
db10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
db20: 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31   + col0 * - col1
db30: 20 2b 20 2b 20 31 39 20 46 52 4f 4d 20 74 61 62   + + 19 FROM tab
db40: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
db50: 0a 2d 31 30 32 31 0d 0a 2d 35 39 0d 0a 2d 36 32  .-1021..-59..-62
db60: 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
db70: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
db80: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
db90: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
dba0: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
dbb0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38  rowsort label-38
dbc0: 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  3..SELECT - col0
dbd0: 20 2a 20 2b 20 43 41 53 54 28 20 63 6f 6c 30 20   * + CAST( col0 
dbe0: 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
dbf0: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
dc00: 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37 36 0d 0a 2d  ..-1225..-576..-
dc10: 37 39 32 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7921....skipif m
dc20: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
dc30: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
dc40: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 33  owsort label-383
dc50: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
dc60: 2a 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 30 20  * + CAST ( col0 
dc70: 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
dc80: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
dc90: 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37 36 0d 0a  -..-1225..-576..
dca0: 2d 37 39 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -7921....onlyif 
dcb0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
dcc0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
dcd0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
dce0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
dcf0: 61 62 65 6c 2d 33 38 34 0d 0a 53 45 4c 45 43 54  abel-384..SELECT
dd00: 20 2b 20 32 38 20 44 49 56 20 2d 20 74 61 62 30   + 28 DIV - tab0
dd10: 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d  .col1 FROM tab0.
dd20: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
dd30: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
dd40: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
dd50: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
dd60: 20 6c 61 62 65 6c 2d 33 38 34 0d 0a 53 45 4c 45   label-384..SELE
dd70: 43 54 20 2b 20 32 38 20 2f 20 2d 20 74 61 62 30  CT + 28 / - tab0
dd80: 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d  .col1 FROM tab0.
dd90: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
dda0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
ddb0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
ddc0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
ddd0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
dde0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
ddf0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
de00: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
de10: 72 30 2e 63 6f 6c 32 20 2a 20 36 30 20 63 6f 6c  r0.col2 * 60 col
de20: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
de30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 38 30  or0..----..-1980
de40: 0d 0a 2d 34 39 32 30 0d 0a 2d 36 30 0d 0a 0d 0a  ..-4920..-60....
de50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
de60: 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 28  .SELECT col0 * (
de70: 20 2b 20 63 6f 6c 31 20 29 20 2d 20 63 6f 72 30   + col1 ) - cor0
de80: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
de90: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
dea0: 30 33 31 0d 0a 33 33 39 34 0d 0a 38 30 31 37 0d  031..3394..8017.
deb0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
dec0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
ded0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
dee0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
def0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
df00: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
df10: 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 31  ECT ALL + ( col1
df20: 20 29 20 2a 20 2b 20 38 33 20 63 6f 6c 30 20 46   ) * + 83 col0 F
df30: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
df40: 31 30 37 39 0d 0a 32 31 35 38 0d 0a 38 33 30 0d  1079..2158..830.
df50: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
df60: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
df70: 31 20 2a 20 28 20 2b 20 74 61 62 31 2e 63 6f 6c  1 * ( + tab1.col
df80: 30 20 29 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c  0 ) * - tab1.col
df90: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
dfa0: 2d 0d 0a 32 33 34 0d 0a 34 30 39 36 30 0d 0a 38  -..234..40960..8
dfb0: 33 32 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3200....query I 
dfc0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
dfd0: 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2d 20  DISTINCT col1 - 
dfe0: 2b 20 28 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  + ( + col0 + col
dff0: 31 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  1 ) FROM tab2..-
e000: 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37  ---..-7..-78..-7
e010: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
e020: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
e030: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
e040: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
e050: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
e060: 2d 33 39 30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -390..SELECT col
e070: 32 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20 63  2 DIV - col1 + c
e080: 6f 6c 32 20 2a 20 63 6f 6c 32 20 2d 20 63 6f 6c  ol2 * col2 - col
e090: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
e0a0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 38 38 0d  ab1..----..2888.
e0b0: 0a 33 32 33 34 0d 0a 39 31 39 36 0d 0a 0d 0a 73  .3234..9196....s
e0c0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
e0d0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
e0e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
e0f0: 62 65 6c 2d 33 39 30 0d 0a 53 45 4c 45 43 54 20  bel-390..SELECT 
e100: 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 2b 20  col2 / - col1 + 
e110: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2d 20 63 6f  col2 * col2 - co
e120: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
e130: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 38 38  tab1..----..2888
e140: 0d 0a 33 32 33 34 0d 0a 39 31 39 36 0d 0a 0d 0a  ..3234..9196....
e150: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
e160: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
e170: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
e180: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
e190: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
e1a0: 72 74 20 6c 61 62 65 6c 2d 33 39 31 0d 0a 53 45  rt label-391..SE
e1b0: 4c 45 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 31  LECT - tab1.col1
e1c0: 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   * CAST( NULL AS
e1d0: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
e1e0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
e1f0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
e200: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
e210: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
e220: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
e230: 62 65 6c 2d 33 39 31 0d 0a 53 45 4c 45 43 54 20  bel-391..SELECT 
e240: 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 43 41  - tab1.col1 * CA
e250: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
e260: 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31  EGER ) FROM tab1
e270: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
e280: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
e290: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e2a0: 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  ECT - col1 + - c
e2b0: 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 * col1 FROM 
e2c0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
e2d0: 2d 2d 0d 0a 2d 31 35 39 33 0d 0a 2d 36 36 33 0d  --..-1593..-663.
e2e0: 0a 2d 38 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-868....onlyif 
e2f0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
e300: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
e310: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
e320: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
e330: 61 62 65 6c 2d 33 39 33 0d 0a 53 45 4c 45 43 54  abel-393..SELECT
e340: 20 41 4c 4c 20 2b 20 35 37 20 44 49 56 20 2d 20   ALL + 57 DIV - 
e350: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
e360: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
e370: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
e380: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
e390: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
e3a0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
e3b0: 39 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  93..SELECT ALL +
e3c0: 20 35 37 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f   57 / - col0 FRO
e3d0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
e3e0: 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 30 0d 0a 30 0d 0a  ----..-8..0..0..
e3f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e400: 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 74 61  t..SELECT ( + ta
e410: 62 31 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74  b1.col2 ) FROM t
e420: 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab1, tab0 AS cor
e430: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
e440: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 30 63  s hashing to 80c
e450: 61 30 61 31 63 63 33 33 37 61 37 37 31 34 61 38  a0a1cc337a7714a8
e460: 39 39 30 61 37 36 34 63 66 64 62 31 37 0d 0a 0d  990a764cfdb17...
e470: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e480: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
e490: 54 20 2d 20 31 37 20 41 53 20 63 6f 6c 31 20 46  T - 17 AS col1 F
e4a0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
e4b0: 2d 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -17....query I r
e4c0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
e4d0: 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 63  ol1 * col2 * + c
e4e0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
e4f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 38 32 0d  r0..----..10982.
e500: 0a 32 35 39 34 37 0d 0a 39 30 35 30 36 0d 0a 0d  .25947..90506...
e510: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e520: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
e530: 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  * - col0 + - col
e540: 32 20 2a 20 2d 20 34 34 20 41 53 20 63 6f 6c 32  2 * - 44 AS col2
e550: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
e560: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32 39 0d  r0..----..11529.
e570: 0a 31 32 36 39 0d 0a 32 30 32 38 0d 0a 0d 0a 71  .1269..2028....q
e580: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e590: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
e5a0: 2d 20 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f  - ( col0 ) AS co
e5b0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
e5c0: 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38  --..-24..-35..-8
e5d0: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
e5e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
e5f0: 20 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   4 AS col2 FROM 
e600: 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
e610: 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20  SS JOIN tab2 AS 
e620: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
e630: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
e640: 36 66 65 63 39 36 35 62 36 30 62 39 38 38 35 63  6fec965b60b9885c
e650: 34 61 66 37 33 65 38 35 34 32 32 63 66 64 39 62  4af73e85422cfd9b
e660: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
e670: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
e680: 31 39 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  19 * + col0 FROM
e690: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
e6a0: 2d 2d 2d 0d 0a 2d 31 33 33 0d 0a 2d 31 34 38 32  ---..-133..-1482
e6b0: 0d 0a 2d 31 35 30 31 0d 0a 0d 0a 71 75 65 72 79  ..-1501....query
e6c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e6d0: 43 54 20 41 4c 4c 20 2b 20 36 39 20 2d 20 63 6f  CT ALL + 69 - co
e6e0: 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
e6f0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
e700: 0a 2d 31 37 0d 0a 2d 32 32 0d 0a 2d 32 38 0d 0a  .-17..-22..-28..
e710: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e720: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
e730: 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + - col1 * + co
e740: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
e750: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
e760: 2d 2d 0d 0a 2d 31 33 36 30 0d 0a 2d 32 34 38 0d  --..-1360..-248.
e770: 0a 2d 34 36 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-4661....onlyif
e780: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
e790: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
e7a0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
e7b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
e7c0: 6c 61 62 65 6c 2d 34 30 33 0d 0a 53 45 4c 45 43  label-403..SELEC
e7d0: 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T + cor0.col2 * 
e7e0: 63 6f 6c 30 20 44 49 56 20 43 41 53 54 28 20 2b  col0 DIV CAST( +
e7f0: 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20   col1 AS SIGNED 
e800: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
e810: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
e820: 2d 0d 0a 31 37 36 0d 0a 33 34 0d 0a 36 0d 0a 0d  -..176..34..6...
e830: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
e840: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
e850: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
e860: 6c 61 62 65 6c 2d 34 30 33 0d 0a 53 45 4c 45 43  label-403..SELEC
e870: 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T + cor0.col2 * 
e880: 63 6f 6c 30 20 2f 20 43 41 53 54 20 28 20 2b 20  col0 / CAST ( + 
e890: 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
e8a0: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
e8b0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
e8c0: 2d 0d 0a 31 37 36 0d 0a 33 34 0d 0a 36 0d 0a 0d  -..176..34..6...
e8d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e8e0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
e8f0: 54 20 37 37 20 46 52 4f 4d 20 74 61 62 32 2c 20  T 77 FROM tab2, 
e900: 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
e910: 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
e920: 0d 0a 37 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..77....onlyif m
e930: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
e940: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
e950: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
e960: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
e970: 62 65 6c 2d 34 30 35 0d 0a 53 45 4c 45 43 54 20  bel-405..SELECT 
e980: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
e990: 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20 63  + - col0 DIV - c
e9a0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
e9b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d   cor0..----..27.
e9c0: 0a 32 38 0d 0a 33 39 0d 0a 0d 0a 73 6b 69 70 69  .28..39....skipi
e9d0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
e9e0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
e9f0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
ea00: 34 30 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  405..SELECT DIST
ea10: 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  INCT + col2 + - 
ea20: 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20 46 52  col0 / - col0 FR
ea30: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
ea40: 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 38 0d 0a 33  .----..27..28..3
ea50: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
ea60: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
ea70: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
ea80: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
ea90: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
eaa0: 2d 34 30 36 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  -406..SELECT + -
eab0: 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 32   col2 DIV + col2
eac0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
ead0: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
eae0: 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69  1..-1..-1....ski
eaf0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
eb00: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
eb10: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
eb20: 6c 2d 34 30 36 0d 0a 53 45 4c 45 43 54 20 2b 20  l-406..SELECT + 
eb30: 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20  - col2 / + col2 
eb40: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
eb50: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  0 cor0..----..-1
eb60: 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72  ..-1..-1....quer
eb70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
eb80: 45 43 54 20 41 4c 4c 20 2d 20 74 61 62 32 2e 63  ECT ALL - tab2.c
eb90: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
eba0: 20 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62   tab2, tab1, tab
ebb0: 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  1 AS cor0, tab1 
ebc0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor1..----..81 v
ebd0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
ebe0: 20 63 35 36 39 36 33 38 65 38 61 30 39 66 66 38   c569638e8a09ff8
ebf0: 31 39 34 35 38 64 36 32 64 64 62 64 65 39 39 34  19458d62ddbde994
ec00: 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  c....query I row
ec10: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
ec20: 6f 6c 32 20 2b 20 28 20 2b 20 28 20 63 6f 6c 32  ol2 + ( + ( col2
ec30: 20 29 20 29 20 2a 20 2d 20 63 6f 6c 30 20 41 53   ) ) * - col0 AS
ec40: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
ec50: 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 37 33 38  .----..-36..-738
ec60: 30 0d 0a 2d 38 32 35 0d 0a 0d 0a 71 75 65 72 79  0..-825....query
ec70: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ec80: 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  CT + cor0.col2 +
ec90: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
eca0: 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  M tab1, tab1 AS 
ecb0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
ecc0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
ecd0: 38 37 33 33 62 61 32 64 64 35 36 38 39 33 38 65  8733ba2dd568938e
ece0: 33 33 38 62 32 37 61 64 37 35 37 64 33 65 33 62  338b27ad757d3e3b
ecf0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ed00: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
ed10: 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  - col2 * - col0 
ed20: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  + col1 * col2 FR
ed30: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
ed40: 2d 2d 0d 0a 31 33 32 0d 0a 31 34 37 36 30 0d 0a  --..132..14760..
ed50: 33 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3630....query I 
ed60: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ed70: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
ed80: 2a 20 2b 20 28 20 63 6f 6c 30 20 29 20 2b 20 63  * + ( col0 ) + c
ed90: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
eda0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
edb0: 2d 2d 2d 0d 0a 32 30 38 37 0d 0a 32 32 30 0d 0a  ---..2087..220..
edc0: 33 30 31 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3019....onlyif m
edd0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
ede0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
edf0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
ee00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
ee10: 62 65 6c 2d 34 31 32 0d 0a 53 45 4c 45 43 54 20  bel-412..SELECT 
ee20: 44 49 53 54 49 4e 43 54 20 2b 20 35 37 20 44 49  DISTINCT + 57 DI
ee30: 56 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20  V + tab1.col0 + 
ee40: 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 31 20  col2 DIV - col1 
ee50: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
ee60: 0a 2d 35 0d 0a 2d 37 0d 0a 31 37 0d 0a 0d 0a 73  .-5..-7..17....s
ee70: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
ee80: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
ee90: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
eea0: 62 65 6c 2d 34 31 32 0d 0a 53 45 4c 45 43 54 20  bel-412..SELECT 
eeb0: 44 49 53 54 49 4e 43 54 20 2b 20 35 37 20 2f 20  DISTINCT + 57 / 
eec0: 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63 6f  + tab1.col0 + co
eed0: 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l2 / - col1 FROM
eee0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d   tab1..----..-5.
eef0: 0a 2d 37 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72 79  .-7..17....query
ef00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ef10: 43 54 20 2b 20 2b 20 37 32 20 2b 20 2d 20 39 37  CT + + 72 + - 97
ef20: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
ef30: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
ef40: 0d 0a 2d 32 35 0d 0a 2d 32 35 0d 0a 2d 32 35 0d  ..-25..-25..-25.
ef50: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
ef60: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
ef70: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
ef80: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
ef90: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
efa0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 34 0d  wsort label-414.
efb0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
efc0: 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
efd0: 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 31   SIGNED ) + col1
efe0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
eff0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
f000: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
f010: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
f020: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
f030: 31 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  14..SELECT DISTI
f040: 4e 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  NCT - CAST ( NUL
f050: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  L AS INTEGER ) +
f060: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
f070: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f  .----..NULL....o
f080: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
f090: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
f0a0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
f0b0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
f0c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f0d0: 74 20 6c 61 62 65 6c 2d 34 31 35 0d 0a 53 45 4c  t label-415..SEL
f0e0: 45 43 54 20 2d 20 43 41 53 54 28 20 39 37 20 41  ECT - CAST( 97 A
f0f0: 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
f100: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 37 0d  tab1..----..-97.
f110: 0a 2d 39 37 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69  .-97..-97....ski
f120: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
f130: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
f140: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
f150: 6c 2d 34 31 35 0d 0a 53 45 4c 45 43 54 20 2d 20  l-415..SELECT - 
f160: 43 41 53 54 20 28 20 39 37 20 41 53 20 49 4e 54  CAST ( 97 AS INT
f170: 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31  EGER ) FROM tab1
f180: 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 37 0d 0a 2d 39 37  ..----..-97..-97
f190: 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-97....query I
f1a0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f1b0: 20 36 36 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f   66 + col1 AS co
f1c0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
f1d0: 2d 2d 0d 0a 31 32 35 0d 0a 38 33 0d 0a 39 37 0d  --..125..83..97.
f1e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
f1f0: 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e  rt..SELECT tab0.
f200: 63 6f 6c 30 20 2b 20 36 33 20 41 53 20 63 6f 6c  col0 + 63 AS col
f210: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
f220: 2d 0d 0a 31 35 32 0d 0a 38 37 0d 0a 39 38 0d 0a  -..152..87..98..
f230: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f240: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
f250: 43 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  CT ( - cor0.col1
f260: 20 29 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   ) * + col1 FROM
f270: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
f280: 0d 0a 2d 32 38 39 0d 0a 2d 33 34 38 31 0d 0a 2d  ..-289..-3481..-
f290: 39 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  961....onlyif my
f2a0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
f2b0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
f2c0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
f2d0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
f2e0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
f2f0: 34 31 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  419..SELECT ALL 
f300: 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  + + CAST( NULL A
f310: 53 20 44 45 43 49 4d 41 4c 20 29 20 41 53 20 63  S DECIMAL ) AS c
f320: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
f330: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
f340: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
f350: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
f360: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
f370: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
f380: 65 6c 2d 34 31 39 0d 0a 53 45 4c 45 43 54 20 41  el-419..SELECT A
f390: 4c 4c 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55  LL + + CAST ( NU
f3a0: 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 41 53 20  LL AS REAL ) AS 
f3b0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
f3c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
f3d0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f  .NULL..NULL....o
f3e0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
f3f0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
f400: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
f410: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
f420: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f430: 74 20 6c 61 62 65 6c 2d 34 32 30 0d 0a 53 45 4c  t label-420..SEL
f440: 45 43 54 20 2d 20 2b 20 43 41 53 54 28 20 63 6f  ECT - + CAST( co
f450: 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  l2 AS SIGNED ) +
f460: 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
f470: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
f480: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d  0..----..-104..-
f490: 31 31 37 0d 0a 2d 33 34 0d 0a 0d 0a 73 6b 69 70  117..-34....skip
f4a0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
f4b0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
f4c0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
f4d0: 2d 34 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -420..SELECT - +
f4e0: 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20   CAST ( col2 AS 
f4f0: 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f  INTEGER ) + - co
f500: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
f510: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
f520: 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 31 37 0d 0a  --..-104..-117..
f530: 2d 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -34....query I r
f540: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
f550: 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 38 33  LL - col2 * + 83
f560: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
f570: 0a 2d 2d 2d 2d 0d 0a 2d 34 34 38 32 0d 0a 2d 34  .----..-4482..-4
f580: 37 33 31 0d 0a 2d 37 39 36 38 0d 0a 0d 0a 71 75  731..-7968....qu
f590: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f5a0: 45 4c 45 43 54 20 41 4c 4c 20 39 30 20 2b 20 63  ELECT ALL 90 + c
f5b0: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
f5c0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
f5d0: 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 30 33 0d 0a 31  ---..100..103..1
f5e0: 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
f5f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
f600: 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20  STINCT + + col0 
f610: 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20  * col0 + col2 + 
f620: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
f630: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
f640: 36 31 0d 0a 36 33 33 0d 0a 38 30 39 32 0d 0a 0d  61..633..8092...
f650: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f660: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
f670: 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  T - - cor0.col1 
f680: 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  * - col2 AS col1
f690: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
f6a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d  r0..----..-1534.
f6b0: 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71  .-646..-837....q
f6c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
f6d0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
f6e0: 2d 20 2b 20 34 38 20 46 52 4f 4d 20 74 61 62 32  - + 48 FROM tab2
f6f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
f700: 2d 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -48....query I r
f710: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
f720: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a  ISTINCT - col2 *
f730: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c   cor0.col0 * col
f740: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
f750: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
f760: 2d 0d 0a 2d 32 30 37 39 33 36 0d 0a 2d 37 33 37  -..-207936..-737
f770: 32 38 30 0d 0a 2d 38 37 34 38 0d 0a 0d 0a 71 75  280..-8748....qu
f780: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f790: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b  ELECT - col1 * +
f7a0: 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 46 52 4f   col2 - col1 FRO
f7b0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
f7c0: 39 34 0d 0a 2d 32 39 32 34 0d 0a 2d 37 35 35 33  94..-2924..-7553
f7d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f7e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
f7f0: 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b 20 28 20  tab1.col0 * + ( 
f800: 2d 20 35 32 20 29 20 46 52 4f 4d 20 74 61 62 31  - 52 ) FROM tab1
f810: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20  , tab2 AS cor0, 
f820: 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
f830: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
f840: 73 68 69 6e 67 20 74 6f 20 35 38 32 64 61 35 36  shing to 582da56
f850: 31 35 64 30 66 39 65 66 36 37 33 31 33 64 32 30  15d0f9ef67313d20
f860: 65 34 33 31 66 64 63 62 66 0d 0a 0d 0a 6f 6e 6c  e431fdcbf....onl
f870: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
f880: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
f890: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
f8a0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
f8b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
f8c0: 6c 61 62 65 6c 2d 34 32 39 0d 0a 53 45 4c 45 43  label-429..SELEC
f8d0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
f8e0: 32 20 2b 20 63 6f 6c 32 20 2b 20 43 41 53 54 28  2 + col2 + CAST(
f8f0: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
f900: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
f910: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
f920: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
f930: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
f940: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
f950: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 32 39  owsort label-429
f960: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
f970: 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  T + col2 + col2 
f980: 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
f990: 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
f9a0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
f9b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
f9c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f9d0: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
f9e0: 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  0 * + col0 AS co
f9f0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
fa00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 36  cor0..----..4096
fa10: 0d 0a 36 34 30 30 0d 0a 39 0d 0a 0d 0a 71 75 65  ..6400..9....que
fa20: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
fa30: 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 37 37 20  LECT ALL + ( 77 
fa40: 29 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  ) + col2 + col2 
fa50: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
fa60: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
fa70: 0a 31 38 35 0d 0a 31 39 31 0d 0a 32 36 39 0d 0a  .185..191..269..
fa80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fa90: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
faa0: 43 54 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 30 20  CT + - ( - col0 
fab0: 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  ) * - col0 FROM 
fac0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
fad0: 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37 36 0d  --..-1225..-576.
fae0: 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20  .-7921....query 
faf0: 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 20  IIIIIIIIIIIIIII 
fb00: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
fb10: 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c  ALL * FROM tab0,
fb20: 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
fb30: 61 62 31 20 63 6f 72 31 2c 20 74 61 62 31 2c 20  ab1 cor1, tab1, 
fb40: 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab2 AS cor2..--
fb50: 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20  --..3645 values 
fb60: 68 61 73 68 69 6e 67 20 74 6f 20 39 34 34 65 35  hashing to 944e5
fb70: 34 38 37 32 65 63 32 37 31 38 66 35 63 31 63 32  4872ec2718f5c1c2
fb80: 37 31 30 65 31 38 30 36 65 33 36 0d 0a 0d 0a 6f  710e1806e36....o
fb90: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
fba0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
fbb0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
fbc0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
fbd0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fbe0: 74 20 6c 61 62 65 6c 2d 34 33 34 0d 0a 53 45 4c  t label-434..SEL
fbf0: 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 43 41 53  ECT - col2 + CAS
fc00: 54 28 20 2d 20 63 6f 6c 30 20 41 53 20 53 49 47  T( - col0 AS SIG
fc10: 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 0d  NED ) FROM tab0.
fc20: 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a 2d 33 36  .----..-171..-36
fc30: 0d 0a 2d 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-57....skipif 
fc40: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
fc50: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
fc60: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33  rowsort label-43
fc70: 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  4..SELECT - col2
fc80: 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 30   + CAST ( - col0
fc90: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
fca0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
fcb0: 31 37 31 0d 0a 2d 33 36 0d 0a 2d 35 37 0d 0a 0d  171..-36..-57...
fcc0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
fcd0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
fce0: 35 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  50 AS col0 FROM 
fcf0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 30  tab0..----..1200
fd00: 0d 0a 31 37 35 30 0d 0a 34 34 35 30 0d 0a 0d 0a  ..1750..4450....
fd10: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
fd20: 0a 53 45 4c 45 43 54 20 35 31 20 41 53 20 63 6f  .SELECT 51 AS co
fd30: 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
fd40: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
fd50: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
fd60: 6e 67 20 74 6f 20 64 38 62 66 30 61 30 35 63 39  ng to d8bf0a05c9
fd70: 63 34 64 32 61 39 33 38 31 32 64 31 30 36 62 61  c4d2a93812d106ba
fd80: 61 65 34 37 35 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  ae4752....onlyif
fd90: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
fda0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
fdb0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
fdc0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
fdd0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
fde0: 65 6c 2d 34 33 37 0d 0a 53 45 4c 45 43 54 20 44  el-437..SELECT D
fdf0: 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 34 39  ISTINCT CAST( 49
fe00: 20 41 53 20 53 49 47 4e 45 44 20 29 20 63 6f 6c   AS SIGNED ) col
fe10: 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
fe20: 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
fe30: 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 0d 0a 73 6b 69  .----..49....ski
fe40: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
fe50: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
fe60: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
fe70: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
fe80: 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
fe90: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
fea0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
feb0: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33 37 0d 0a  sort label-437..
fec0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
fed0: 43 41 53 54 20 28 20 34 39 20 41 53 20 49 4e 54  CAST ( 49 AS INT
fee0: 45 47 45 52 20 29 20 63 6f 6c 32 20 46 52 4f 4d  EGER ) col2 FROM
fef0: 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62   tab1, tab2, tab
ff00: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
ff10: 0a 34 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .49....skipif po
ff20: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
ff30: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
ff40: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
ff50: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
ff60: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ff70: 0a 53 45 4c 45 43 54 20 2d 20 32 34 20 63 6f 6c  .SELECT - 24 col
ff80: 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
ff90: 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  0, tab0 AS cor0.
ffa0: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
ffb0: 20 68 61 73 68 69 6e 67 20 74 6f 20 66 32 65 34   hashing to f2e4
ffc0: 30 66 36 65 35 63 64 62 63 32 38 37 37 38 34 33  0f6e5cdbc2877843
ffd0: 31 39 31 63 62 32 36 31 39 37 35 66 0d 0a 0d 0a  191cb261975f....
ffe0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
fff0: 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28 20 63 6f  .SELECT - + ( co
10000 6c 30 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52  l0 ) + + col1 FR
10010 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
10020 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32  .----..2..62..62
10030 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10040 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
10050 2b 20 28 20 2b 20 36 38 20 29 20 41 53 20 63 6f  + ( + 68 ) AS co
10060 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
10070 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 38 0d 0a  cor0..----..68..
10080 36 38 0d 0a 36 38 0d 0a 0d 0a 71 75 65 72 79 20  68..68....query 
10090 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
100a0 54 20 41 4c 4c 20 2b 20 31 34 20 2a 20 2d 20 38  T ALL + 14 * - 8
100b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
100c0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
100d0 0d 0a 2d 31 31 32 0d 0a 2d 31 31 32 0d 0a 2d 31  ..-112..-112..-1
100e0 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  12....query I ro
100f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
10100 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
10110 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  1, tab0 AS cor0,
10120 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74   tab2 AS cor1, t
10130 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab0 AS cor2..---
10140 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73  -..81 values has
10150 68 69 6e 67 20 74 6f 20 65 39 33 38 37 37 37 65  hing to e938777e
10160 62 66 66 63 32 65 33 65 39 63 30 63 64 66 61 61  bffc2e3e9c0cdfaa
10170 34 66 37 33 32 63 30 35 0d 0a 0d 0a 71 75 65 72  4f732c05....quer
10180 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10190 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
101a0 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol2 + col0 * col
101b0 30 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  0 + - col2 FROM 
101c0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35  tab0..----..1225
101d0 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a 71  ..576..7921....q
101e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
101f0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20  SELECT + col0 + 
10200 2d 20 37 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  - 7 * col0 FROM 
10210 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
10220 2d 2d 0d 0a 2d 31 38 0d 0a 2d 33 38 34 0d 0a 2d  --..-18..-384..-
10230 34 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  480....query I r
10240 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
10250 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b  ISTINCT - col1 +
10260 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 74 61 62 31   - col1 + + tab1
10270 2e 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 32 20 29  .col1 * ( col2 )
10280 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
10290 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 32 0d 0a  b1..----..1222..
102a0 31 33 35 32 0d 0a 35 35 30 0d 0a 0d 0a 71 75 65  1352..550....que
102b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
102c0 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e  LECT ALL + cor0.
102d0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
102e0 4d 20 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61  M tab2, tab1, ta
102f0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor0..----..2
10300 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
10310 20 74 6f 20 64 36 37 31 61 30 36 34 65 32 64 61   to d671a064e2da
10320 37 30 39 63 61 34 63 64 66 65 61 33 31 37 62 38  709ca4cdfea317b8
10330 65 38 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  e892....onlyif m
10340 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
10350 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
10360 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
10370 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
10380 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10390 2d 34 34 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  -447..SELECT DIS
103a0 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63  TINCT + col1 + c
103b0 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28 20 4e 55  ol2 * - CAST( NU
103c0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 63  LL AS SIGNED ) c
103d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
103e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
103f0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  L....skipif post
10400 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
10410 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
10420 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
10430 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
10440 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
10450 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
10460 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
10470 65 6c 2d 34 34 37 0d 0a 53 45 4c 45 43 54 20 44  el-447..SELECT D
10480 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b  ISTINCT + col1 +
10490 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 20 28   col2 * - CAST (
104a0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
104b0 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
104c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
104d0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
104e0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
104f0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
10500 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
10510 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
10520 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10530 74 0d 0a 53 45 4c 45 43 54 20 32 31 20 2a 20 63  t..SELECT 21 * c
10540 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  ol2 + col1 * + c
10550 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
10560 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
10570 0d 0a 32 31 34 31 0d 0a 35 31 34 38 0d 0a 37 38  ..2141..5148..78
10580 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
10590 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
105a0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
105b0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
105c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
105d0 2d 34 34 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -449..SELECT - c
105e0 6f 6c 31 20 44 49 56 20 2b 20 63 6f 72 30 2e 63  ol1 DIV + cor0.c
105f0 6f 6c 31 20 2b 20 2d 20 28 20 38 31 20 2a 20 63  ol1 + - ( 81 * c
10600 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol1 ) FROM tab2 
10610 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
10620 31 33 37 38 0d 0a 2d 32 35 31 32 0d 0a 2d 34 37  1378..-2512..-47
10630 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  80....skipif mys
10640 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
10650 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
10660 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 39 0d 0a  sort label-449..
10670 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20  SELECT - col1 / 
10680 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20  + cor0.col1 + - 
10690 28 20 38 31 20 2a 20 63 6f 6c 31 20 29 20 46 52  ( 81 * col1 ) FR
106a0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
106b0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 38 0d 0a 2d 32  .----..-1378..-2
106c0 35 31 32 0d 0a 2d 34 37 38 30 0d 0a 0d 0a 71 75  512..-4780....qu
106d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
106e0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
106f0 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  l0 * col2 + col1
10700 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
10710 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 37  r0..----..132..7
10720 33 38 39 0d 0a 38 37 38 0d 0a 0d 0a 71 75 65 72  389..878....quer
10730 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10740 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
10750 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 46   col1 + - col1 F
10760 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
10770 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32 0d 0a 2d 31  ..----..-172..-1
10780 38 32 0d 0a 2d 31 39 34 0d 0a 0d 0a 71 75 65 72  82..-194....quer
10790 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
107a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 33 20  ECT DISTINCT 43 
107b0 2a 20 63 6f 6c 30 20 2b 20 2d 20 28 20 2b 20 28  * col0 + - ( + (
107c0 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 29   col2 ) + col0 )
107d0 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   * col1 AS col1 
107e0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
107f0 0a 2d 31 33 35 33 0d 0a 31 31 35 32 0d 0a 31 35  .-1353..1152..15
10800 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  42....query I ro
10810 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
10820 31 39 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  19 * - col2 FROM
10830 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39   tab2..----..-49
10840 34 0d 0a 2d 35 31 33 0d 0a 2d 37 32 32 0d 0a 0d  4..-513..-722...
10850 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
10860 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
10870 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
10880 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
10890 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
108a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
108b0 54 20 39 33 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  T 93 * - col1 + 
108c0 2d 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  - col1 col2 FROM
108d0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   tab1..----..-12
108e0 32 32 0d 0a 2d 32 34 34 34 0d 0a 2d 39 34 30 0d  22..-2444..-940.
108f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10900 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
10910 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 74 61 62  NCT + col2 + tab
10920 32 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53  2.col0 + col0 AS
10930 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
10940 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 39 36 0d  .----..182..196.
10950 0a 34 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .41....onlyif my
10960 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
10970 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
10980 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
10990 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
109a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
109b0 34 35 36 0d 0a 53 45 4c 45 43 54 20 74 61 62 31  456..SELECT tab1
109c0 2e 63 6f 6c 30 20 2f 20 2b 20 43 41 53 54 28 20  .col0 / + CAST( 
109d0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
109e0 20 2b 20 2d 20 33 30 20 46 52 4f 4d 20 74 61 62   + - 30 FROM tab
109f0 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  1, tab0 AS cor0.
10a00 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
10a10 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37  hashing to cd7a7
10a20 39 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61  901e47c15155404a
10a30 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73  ff0d216fe0b....s
10a40 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
10a50 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
10a60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10a70 62 65 6c 2d 34 35 36 0d 0a 53 45 4c 45 43 54 20  bel-456..SELECT 
10a80 74 61 62 31 2e 63 6f 6c 30 20 2f 20 2b 20 43 41  tab1.col0 / + CA
10a90 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
10aa0 45 47 45 52 20 29 20 2b 20 2d 20 33 30 20 46 52  EGER ) + - 30 FR
10ab0 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
10ac0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
10ad0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
10ae0 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31   cd7a7901e47c151
10af0 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30  55404aff0d216fe0
10b00 62 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  b....onlyif mysq
10b10 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
10b20 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
10b30 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
10b40 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10b50 2d 34 35 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -457..SELECT ALL
10b60 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   - + col2 + col2
10b70 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63   DIV - col1 AS c
10b80 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
10b90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
10ba0 33 0d 0a 2d 35 36 0d 0a 2d 36 32 0d 0a 0d 0a 73  3..-56..-62....s
10bb0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
10bc0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
10bd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10be0 62 65 6c 2d 34 35 37 0d 0a 53 45 4c 45 43 54 20  bel-457..SELECT 
10bf0 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 63  ALL - + col2 + c
10c00 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20  ol2 / - col1 AS 
10c10 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
10c20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
10c30 30 33 0d 0a 2d 35 36 0d 0a 2d 36 32 0d 0a 0d 0a  03..-56..-62....
10c40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10c50 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
10c60 20 63 6f 6c 30 20 2b 20 2b 20 39 37 20 46 52 4f   col0 + + 97 FRO
10c70 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
10c80 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 37 35 0d 0a  ----..104..175..
10c90 31 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  176....query I r
10ca0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
10cb0 6f 6c 32 20 2a 20 2d 20 33 35 20 2b 20 63 6f 6c  ol2 * - 35 + col
10cc0 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  2 * col1 FROM ta
10cd0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
10ce0 0d 0a 2d 31 34 32 35 0d 0a 2d 32 31 31 32 0d 0a  ..-1425..-2112..
10cf0 2d 34 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -486....query I 
10d00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10d10 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL - cor0.col0 
10d20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52  * col1 * col0 FR
10d30 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
10d40 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34 0d 0a 2d 34 30  .----..-234..-40
10d50 39 36 30 0d 0a 2d 38 33 32 30 30 0d 0a 0d 0a 71  960..-83200....q
10d60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10d70 53 45 4c 45 43 54 20 2d 20 31 34 20 2b 20 2b 20  SELECT - 14 + + 
10d80 63 6f 72 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor1.col2 AS col
10d90 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
10da0 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
10db0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
10dc0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
10dd0 20 74 6f 20 62 32 62 63 33 30 31 63 63 30 39 35   to b2bc301cc095
10de0 39 30 34 38 37 31 32 36 34 64 36 37 38 63 37 65  904871264d678c7e
10df0 31 61 37 62 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  1a7b....onlyif m
10e00 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
10e10 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
10e20 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
10e30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10e40 62 65 6c 2d 34 36 32 0d 0a 53 45 4c 45 43 54 20  bel-462..SELECT 
10e50 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20  DISTINCT col1 * 
10e60 2d 20 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 31 20  - col1 + ( col1 
10e70 29 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f  ) DIV + col1 FRO
10e80 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
10e90 2d 2d 2d 2d 0d 0a 2d 37 33 39 35 0d 0a 2d 38 32  ----..-7395..-82
10ea0 38 30 0d 0a 2d 39 34 30 38 0d 0a 0d 0a 73 6b 69  80..-9408....ski
10eb0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
10ec0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
10ed0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
10ee0 6c 2d 34 36 32 0d 0a 53 45 4c 45 43 54 20 44 49  l-462..SELECT DI
10ef0 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d 20  STINCT col1 * - 
10f00 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 31 20 29 20  col1 + ( col1 ) 
10f10 2f 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  / + col1 FROM ta
10f20 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
10f30 0d 0a 2d 37 33 39 35 0d 0a 2d 38 32 38 30 0d 0a  ..-7395..-8280..
10f40 2d 39 34 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -9408....onlyif 
10f50 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
10f60 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
10f70 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
10f80 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
10f90 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
10fa0 6c 2d 34 36 33 0d 0a 53 45 4c 45 43 54 20 44 49  l-463..SELECT DI
10fb0 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20  STINCT + - col0 
10fc0 2a 20 43 41 53 54 28 20 2d 20 32 32 20 2b 20 63  * CAST( - 22 + c
10fd0 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol0 AS SIGNED ) 
10fe0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
10ff0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 35 0d 0a 2d  0..----..-455..-
11000 34 38 0d 0a 2d 35 39 36 33 0d 0a 0d 0a 73 6b 69  48..-5963....ski
11010 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
11020 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
11030 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11040 6c 2d 34 36 33 0d 0a 53 45 4c 45 43 54 20 44 49  l-463..SELECT DI
11050 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20  STINCT + - col0 
11060 2a 20 43 41 53 54 20 28 20 2d 20 32 32 20 2b 20  * CAST ( - 22 + 
11070 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20  col0 AS INTEGER 
11080 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
11090 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 35 0d  or0..----..-455.
110a0 0a 2d 34 38 0d 0a 2d 35 39 36 33 0d 0a 0d 0a 71  .-48..-5963....q
110b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
110c0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20  SELECT col0 * + 
110d0 32 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  24 FROM tab0 AS 
110e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 33 36  cor0..----..2136
110f0 0d 0a 35 37 36 0d 0a 38 34 30 0d 0a 0d 0a 6f 6e  ..576..840....on
11100 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
11110 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
11120 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
11130 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
11140 6f 72 74 20 6c 61 62 65 6c 2d 34 36 35 0d 0a 53  ort label-465..S
11150 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
11160 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20 2d 20   DIV + col0 + - 
11170 37 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  77 FROM tab2 AS 
11180 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 37 0d  cor0..----..-77.
11190 0a 2d 37 37 0d 0a 2d 38 31 0d 0a 0d 0a 73 6b 69  .-77..-81....ski
111a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
111b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
111c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
111d0 6c 2d 34 36 35 0d 0a 53 45 4c 45 43 54 20 41 4c  l-465..SELECT AL
111e0 4c 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c  L - col1 / + col
111f0 30 20 2b 20 2d 20 37 37 20 46 52 4f 4d 20 74 61  0 + - 77 FROM ta
11200 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
11210 0d 0a 2d 37 37 0d 0a 2d 37 37 0d 0a 2d 38 31 0d  ..-77..-77..-81.
11220 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11230 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
11240 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol0 * cor0.col1 
11250 2b 20 2d 20 31 37 20 46 52 4f 4d 20 74 61 62 30  + - 17 FROM tab0
11260 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34   cor0..----..204
11270 37 0d 0a 33 33 37 38 0d 0a 38 30 38 32 0d 0a 0d  7..3378..8082...
11280 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
11290 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
112a0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
112b0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
112c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 37  owsort label-467
112d0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
112e0 2d 20 35 39 20 44 49 56 20 2b 20 36 37 20 41 53  - 59 DIV + 67 AS
112f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
11300 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
11310 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 73 6b 69  6..27..38....ski
11320 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
11330 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
11340 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11350 6c 2d 34 36 37 0d 0a 53 45 4c 45 43 54 20 63 6f  l-467..SELECT co
11360 6c 32 20 2b 20 2d 20 35 39 20 2f 20 2b 20 36 37  l2 + - 59 / + 67
11370 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
11380 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
11390 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a  ..26..27..38....
113a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
113b0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
113c0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
113d0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
113e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 38 0d  wsort label-468.
113f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
11400 20 2b 20 2b 20 63 6f 6c 30 20 44 49 56 20 38 30   + + col0 DIV 80
11410 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
11420 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
11430 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..1....skipif
11440 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
11450 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
11460 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
11470 36 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  68..SELECT DISTI
11480 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 38  NCT + + col0 / 8
11490 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
114a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
114b0 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79  -..0..1....query
114c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
114d0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
114e0 31 31 20 2b 20 33 35 20 41 53 20 63 6f 6c 31 20  11 + 35 AS col1 
114f0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
11500 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a 2d 38  0..----..-42..-8
11510 32 33 0d 0a 2d 38 33 34 0d 0a 0d 0a 71 75 65 72  23..-834....quer
11520 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11530 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 28  ECT + col2 * - (
11540 20 74 61 62 30 2e 63 6f 6c 32 20 29 20 46 52 4f   tab0.col2 ) FRO
11550 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
11560 0d 0a 2d 31 30 38 39 0d 0a 2d 36 37 32 34 0d 0a  ..-1089..-6724..
11570 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11580 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
11590 43 54 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2d 20  CT col1 * - ( - 
115a0 74 61 62 31 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30  tab1.col1 + col0
115b0 20 29 20 2a 20 38 20 41 53 20 63 6f 6c 32 20 46   ) * 8 AS col2 F
115c0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
115d0 2d 34 33 32 30 0d 0a 2d 36 39 36 38 0d 0a 34 37  -4320..-6968..47
115e0 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  84....query I ro
115f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 38  wsort..SELECT 58
11600 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
11610 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
11620 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
11630 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
11640 74 6f 20 39 65 65 33 36 33 63 36 61 63 31 39 63  to 9ee363c6ac19c
11650 66 64 62 38 61 35 30 63 37 64 66 64 35 63 63 32  fdb8a50c7dfd5cc2
11660 62 38 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  b8a....query I r
11670 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
11680 6f 6c 31 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 30  ol1 * + ( - col0
11690 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   ) + + col1 FROM
116a0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
116b0 2d 2d 2d 0d 0a 2d 31 30 32 37 0d 0a 2d 35 32 0d  ---..-1027..-52.
116c0 0a 2d 36 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-630....onlyif 
116d0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
116e0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
116f0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
11700 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
11710 61 62 65 6c 2d 34 37 34 0d 0a 53 45 4c 45 43 54  abel-474..SELECT
11720 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
11730 6c 31 20 2b 20 2d 20 43 41 53 54 28 20 2d 20 39  l1 + - CAST( - 9
11740 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 44 49  2 AS SIGNED ) DI
11750 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  V col1 AS col2 F
11760 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
11770 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 33 33 0d 0a  ..----..22..33..
11780 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  60....skipif mys
11790 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
117a0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
117b0 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 34 0d 0a  sort label-474..
117c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
117d0 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53  + + col1 + - CAS
117e0 54 20 28 20 2d 20 39 32 20 41 53 20 49 4e 54 45  T ( - 92 AS INTE
117f0 47 45 52 20 29 20 2f 20 63 6f 6c 31 20 41 53 20  GER ) / col1 AS 
11800 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
11810 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  S cor0..----..22
11820 0d 0a 33 33 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72  ..33..60....quer
11830 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11840 45 43 54 20 41 4c 4c 20 38 33 20 46 52 4f 4d 20  ECT ALL 83 FROM 
11850 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
11860 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
11870 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
11880 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 30 32  s hashing to 002
11890 61 37 31 37 61 33 64 39 30 32 64 39 37 32 32 30  a717a3d902d97220
118a0 37 35 39 30 36 35 66 62 31 30 37 63 33 0d 0a 0d  759065fb107c3...
118b0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
118c0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
118d0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
118e0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
118f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 36  owsort label-476
11900 0d 0a 53 45 4c 45 43 54 20 36 35 20 2b 20 2d 20  ..SELECT 65 + - 
11910 33 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30  31 DIV cor0.col0
11920 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11930 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
11940 0d 0a 35 35 0d 0a 36 35 0d 0a 36 35 0d 0a 0d 0a  ..55..65..65....
11950 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
11960 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
11970 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
11980 61 62 65 6c 2d 34 37 36 0d 0a 53 45 4c 45 43 54  abel-476..SELECT
11990 20 36 35 20 2b 20 2d 20 33 31 20 2f 20 63 6f 72   65 + - 31 / cor
119a0 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  0.col0 AS col1 F
119b0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
119c0 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 36 35 0d 0a  ..----..55..65..
119d0 36 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  65....skipif pos
119e0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
119f0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
11a00 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
11a10 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
11a20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11a30 53 45 4c 45 43 54 20 28 20 2b 20 37 20 29 20 63  SELECT ( + 7 ) c
11a40 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
11a50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a   cor0..----..7..
11a60 37 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7..7....query I 
11a70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11a80 2b 20 2b 20 63 6f 6c 30 20 2a 20 31 37 20 41 53  + + col0 * 17 AS
11a90 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
11aa0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
11ab0 31 39 0d 0a 31 33 32 36 0d 0a 31 33 34 33 0d 0a  19..1326..1343..
11ac0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11ad0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
11ae0 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  l1 + col1 * + co
11af0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
11b00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 38  cor0..----..1978
11b10 0d 0a 33 32 39 38 0d 0a 38 30 30 38 0d 0a 0d 0a  ..3298..8008....
11b20 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
11b30 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
11b40 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
11b50 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
11b60 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 38 30 0d  wsort label-480.
11b70 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44  .SELECT - col2 D
11b80 49 56 20 35 37 20 63 6f 6c 30 20 46 52 4f 4d 20  IV 57 col0 FROM 
11b90 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
11ba0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .0..0..0....skip
11bb0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
11bc0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
11bd0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
11be0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
11bf0 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
11c00 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
11c10 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
11c20 6f 72 74 20 6c 61 62 65 6c 2d 34 38 30 0d 0a 53  ort label-480..S
11c30 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 35  ELECT - col2 / 5
11c40 37 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  7 col0 FROM tab2
11c50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
11c60 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
11c70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11c80 2b 20 63 6f 6c 31 20 2b 20 31 36 20 2a 20 2b 20  + col1 + 16 * + 
11c90 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
11ca0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
11cb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 36 33 0d 0a  or0..----..463..
11cc0 34 37 35 0d 0a 36 32 35 0d 0a 0d 0a 71 75 65 72  475..625....quer
11cd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11ce0 45 43 54 20 2d 20 32 32 20 2d 20 2d 20 63 6f 72  ECT - 22 - - cor
11cf0 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  0.col2 * + col0 
11d00 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
11d10 2d 2d 2d 2d 0d 0a 31 36 37 0d 0a 32 30 30 36 0d  ----..167..2006.
11d20 0a 32 39 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .2980....query I
11d30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11d40 20 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 30 20   ALL - ( + col0 
11d50 29 20 2b 20 2b 20 37 37 20 46 52 4f 4d 20 74 61  ) + + 77 FROM ta
11d60 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
11d70 0d 0a 2d 33 0d 0a 31 33 0d 0a 37 34 0d 0a 0d 0a  ..-3..13..74....
11d80 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
11d90 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
11da0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
11db0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
11dc0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
11dd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11de0 20 2d 20 2b 20 34 37 20 2a 20 63 6f 72 30 2e 63   - + 47 * cor0.c
11df0 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 + - cor0.col
11e00 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0 col1 FROM tab1
11e10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11e20 2d 31 32 32 35 0d 0a 2d 35 33 34 0d 0a 2d 36 39  -1225..-534..-69
11e30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
11e40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
11e50 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b  TINCT + + col1 +
11e60 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
11e70 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
11e80 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d  .----..119..173.
11e90 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .98....query I r
11ea0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
11eb0 49 53 54 49 4e 43 54 20 37 20 2a 20 63 6f 6c 32  ISTINCT 7 * col2
11ec0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11ed0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
11ee0 0d 0a 31 38 32 0d 0a 31 38 39 0d 0a 32 36 36 0d  ..182..189..266.
11ef0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11f00 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
11f10 6f 6c 32 20 2a 20 63 6f 6c 32 20 2d 20 33 31 20  ol2 * col2 - 31 
11f20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
11f30 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
11f40 34 37 35 0d 0a 2d 37 30 37 0d 0a 2d 37 36 30 0d  475..-707..-760.
11f50 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
11f60 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
11f70 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
11f80 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
11f90 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
11fa0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 38 38 0d  wsort label-488.
11fb0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20  .SELECT ALL ( - 
11fc0 63 6f 6c 30 20 29 20 2b 20 43 41 53 54 28 20 63  col0 ) + CAST( c
11fd0 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol1 AS SIGNED ) 
11fe0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  * col2 AS col0 F
11ff0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
12000 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 36 0d 0a 35 36  ..----..1456..56
12010 37 0d 0a 38 33 30 0d 0a 0d 0a 73 6b 69 70 69 66  7..830....skipif
12020 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
12030 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
12040 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
12050 38 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  88..SELECT ALL (
12060 20 2d 20 63 6f 6c 30 20 29 20 2b 20 43 41 53 54   - col0 ) + CAST
12070 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   ( col1 AS INTEG
12080 45 52 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63  ER ) * col2 AS c
12090 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
120a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35   cor0..----..145
120b0 36 0d 0a 35 36 37 0d 0a 38 33 30 0d 0a 0d 0a 71  6..567..830....q
120c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
120d0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 32  SELECT ALL + + 2
120e0 37 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  7 * + cor0.col2 
120f0 2b 20 2d 20 33 30 20 2b 20 63 6f 6c 32 20 2a 20  + - 30 + col2 * 
12100 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
12110 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
12120 2d 2d 2d 2d 0d 0a 31 36 35 33 0d 0a 33 32 0d 0a  ----..1653..32..
12130 39 34 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9482....query I 
12140 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12150 2d 20 31 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  - 10 * - col0 + 
12160 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
12170 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 30  S cor0..----..80
12180 36 0d 0a 38 32 38 0d 0a 39 37 0d 0a 0d 0a 73 6b  6..828..97....sk
12190 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
121a0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
121b0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
121c0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
121d0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
121e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31  owsort..SELECT 1
121f0 33 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 39  3 + - col1 * - 9
12200 39 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  9 col0 FROM tab1
12210 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12220 31 30 30 33 0d 0a 31 33 30 30 0d 0a 32 35 38 37  1003..1300..2587
12230 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12240 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 34  ort..SELECT + 34
12250 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
12260 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
12270 2d 0d 0a 32 31 0d 0a 32 34 0d 0a 38 0d 0a 0d 0a  -..21..24..8....
12280 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
12290 0a 53 45 4c 45 43 54 20 2b 20 2d 20 35 36 20 41  .SELECT + - 56 A
122a0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
122b0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
122c0 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
122d0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
122e0 73 68 69 6e 67 20 74 6f 20 33 64 33 64 61 62 34  shing to 3d3dab4
122f0 30 30 65 65 66 39 33 63 30 39 38 61 63 62 62 62  00eef93c098acbbb
12300 61 33 66 63 39 62 64 63 36 0d 0a 0d 0a 71 75 65  a3fc9bdc6....que
12310 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12320 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
12330 2b 20 34 34 20 2a 20 38 34 20 41 53 20 63 6f 6c  + 44 * 84 AS col
12340 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
12350 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
12360 61 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor1..----..
12370 33 36 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3696....query I 
12380 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12390 2b 20 63 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f  + col1 * tab0.co
123a0 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 + col0 AS col
123b0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
123c0 2d 0d 0a 32 30 38 38 0d 0a 33 34 33 30 0d 0a 38  -..2088..3430..8
123d0 31 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  188....onlyif my
123e0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
123f0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
12400 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
12410 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
12420 65 6c 2d 34 39 36 0d 0a 53 45 4c 45 43 54 20 44  el-496..SELECT D
12430 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 63  ISTINCT col2 * c
12440 6f 6c 30 20 44 49 56 20 28 20 33 35 20 29 20 2b  ol0 DIV ( 35 ) +
12450 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
12460 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
12470 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 32 39 39 0d  .----..108..299.
12480 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .98....skipif my
12490 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
124a0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
124b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 36 0d  wsort label-496.
124c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
124d0 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2f 20 28   col2 * col0 / (
124e0 20 33 35 20 29 20 2b 20 63 6f 6c 31 20 41 53 20   35 ) + col1 AS 
124f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
12500 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
12510 38 0d 0a 32 39 39 0d 0a 39 38 0d 0a 0d 0a 71 75  8..299..98....qu
12520 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12530 45 4c 45 43 54 20 41 4c 4c 20 37 32 20 41 53 20  ELECT ALL 72 AS 
12540 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
12550 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
12560 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31  b0 AS cor1, tab1
12570 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
12580 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  81 values hashin
12590 67 20 74 6f 20 65 31 36 31 38 61 62 66 65 31 32  g to e1618abfe12
125a0 62 65 36 61 39 35 30 63 63 35 37 35 64 36 39 35  be6a950cc575d695
125b0 36 33 39 62 37 0d 0a 0d 0a 71 75 65 72 79 20 49  639b7....query I
125c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
125d0 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 32 33   - + col2 + - 23
125e0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
125f0 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 35 30 0d  .----..-49..-50.
12600 0a 2d 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-61....query I 
12610 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12620 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20  DISTINCT col0 + 
12630 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53  col2 * + col1 AS
12640 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
12650 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
12660 33 32 0d 0a 32 38 36 32 0d 0a 37 35 35 31 0d 0a  32..2862..7551..
12670 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12680 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
12690 20 2a 20 2b 20 37 36 20 41 53 20 63 6f 6c 30 20   * + 76 AS col0 
126a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
126b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37 36 0d 0a  0..----..-1976..
126c0 2d 37 36 30 0d 0a 2d 39 38 38 0d 0a 0d 0a 71 75  -760..-988....qu
126d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
126e0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b  ELECT ALL col2 +
126f0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63   cor0.col0 * - c
12700 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
12710 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
12720 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 35 38 33 0d 0a  ---..-24..-583..
12730 2d 39 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -944....onlyif m
12740 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
12750 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
12760 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
12770 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
12780 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12790 2d 35 30 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -502..SELECT - -
127a0 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2d   col0 * col0 + -
127b0 20 38 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c   81 * + cor0.col
127c0 30 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  0 + + CAST( NULL
127d0 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
127e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
127f0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
12800 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
12810 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
12820 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
12830 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
12840 30 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  02..SELECT - - c
12850 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 38  ol0 * col0 + - 8
12860 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  1 * + cor0.col0 
12870 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + + CAST ( NULL 
12880 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
12890 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
128a0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
128b0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
128c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
128d0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
128e0 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  2 * - cor0.col2 
128f0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
12900 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39 0d 0a 36  ----..1..1089..6
12910 37 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  724....onlyif my
12920 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
12930 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
12940 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
12950 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
12960 65 6c 2d 35 30 34 0d 0a 53 45 4c 45 43 54 20 63  el-504..SELECT c
12970 6f 6c 31 20 2a 20 34 32 20 2b 20 63 6f 6c 30 20  ol1 * 42 + col0 
12980 44 49 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  DIV - col1 FROM 
12990 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
129a0 2d 2d 0d 0a 31 33 30 32 0d 0a 32 34 37 37 0d 0a  --..1302..2477..
129b0 37 31 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  710....skipif my
129c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
129d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
129e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 34 0d  wsort label-504.
129f0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 34  .SELECT col1 * 4
12a00 32 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  2 + col0 / - col
12a10 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
12a20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 32 0d  or0..----..1302.
12a30 0a 32 34 37 37 0d 0a 37 31 30 0d 0a 0d 0a 6f 6e  .2477..710....on
12a40 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
12a50 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
12a60 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
12a70 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
12a80 6f 72 74 20 6c 61 62 65 6c 2d 35 30 35 0d 0a 53  ort label-505..S
12a90 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 28  ELECT + col2 + (
12aa0 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 30 20 44   col0 ) * col0 D
12ab0 49 56 20 35 38 20 46 52 4f 4d 20 74 61 62 31 20  IV 58 FROM tab1 
12ac0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
12ad0 32 37 0d 0a 32 30 36 0d 0a 35 34 0d 0a 0d 0a 73  27..206..54....s
12ae0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
12af0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
12b00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
12b10 62 65 6c 2d 35 30 35 0d 0a 53 45 4c 45 43 54 20  bel-505..SELECT 
12b20 2b 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 30 20  + col2 + ( col0 
12b30 29 20 2a 20 63 6f 6c 30 20 2f 20 35 38 20 46 52  ) * col0 / 58 FR
12b40 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
12b50 0a 2d 2d 2d 2d 0d 0a 31 32 37 0d 0a 32 30 36 0d  .----..127..206.
12b60 0a 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .54....query I r
12b70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
12b80 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  LL + + col0 * + 
12b90 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
12ba0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d  or0..----..2064.
12bb0 0a 33 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 73  .3395..8099....s
12bc0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
12bd0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
12be0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
12bf0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
12c00 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
12c10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12c20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46  cor0.col2 col1 F
12c30 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41  ROM tab0, tab2 A
12c40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
12c50 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
12c60 6f 20 35 39 31 31 62 61 63 35 31 34 34 31 66 34  o 5911bac51441f4
12c70 66 66 36 34 30 62 32 61 32 62 37 32 31 65 61 38  ff640b2a2b721ea8
12c80 65 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  e3....query I ro
12c90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
12ca0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20  STINCT + col0 * 
12cb0 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20  - col0 + col0 * 
12cc0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
12cd0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
12ce0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
12cf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12d00 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
12d10 2a 20 2d 20 28 20 63 6f 6c 31 20 2a 20 63 6f 72  * - ( col1 * cor
12d20 30 2e 63 6f 6c 31 20 2b 20 2d 20 34 39 20 2a 20  0.col1 + - 49 * 
12d30 36 36 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63  66 ) FROM tab0 c
12d40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 37 39  or0..----..-3579
12d50 33 32 0d 0a 2d 34 35 39 32 37 37 0d 0a 2d 35 39  32..-459277..-59
12d60 38 39 37 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8975....onlyif m
12d70 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
12d80 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
12d90 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
12da0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
12db0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12dc0 2d 35 31 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  -510..SELECT DIS
12dd0 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63  TINCT - + cor0.c
12de0 6f 6c 32 20 2a 20 2b 20 43 41 53 54 28 20 4e 55  ol2 * + CAST( NU
12df0 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20  LL AS DECIMAL ) 
12e00 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
12e10 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  0 cor0..----..NU
12e20 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
12e30 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
12e40 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
12e50 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 30 0d 0a  sort label-510..
12e60 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
12e70 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  - + cor0.col2 * 
12e80 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
12e90 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 31 20   REAL ) AS col1 
12ea0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
12eb0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
12ec0 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
12ed0 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
12ee0 61 62 31 20 57 48 45 52 45 20 63 6f 6c 31 20 3d  ab1 WHERE col1 =
12ef0 20 2d 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d   - col0..----...
12f00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12f10 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
12f20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  + col2 * + col2 
12f30 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
12f40 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 39 36 31  b0..----..-35961
12f50 0d 0a 2d 33 36 0d 0a 2d 35 35 31 34 35 37 0d 0a  ..-36..-551457..
12f60 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
12f70 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
12f80 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
12f90 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
12fa0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31  rowsort label-51
12fb0 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
12fc0 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  CT + col2 * + co
12fd0 6c 31 20 44 49 56 20 63 6f 6c 31 20 2b 20 2d 20  l1 DIV col1 + - 
12fe0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
12ff0 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d 0a 39  ----..-34..-7..9
13000 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
13010 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
13020 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
13030 72 74 20 6c 61 62 65 6c 2d 35 31 33 0d 0a 53 45  rt label-513..SE
13040 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
13050 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2f 20  col2 * + col1 / 
13060 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 46 52  col1 + - col0 FR
13070 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
13080 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 71 75 65  34..-7..9....que
13090 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
130a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
130b0 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63  l1 - - col2 AS c
130c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
130d0 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39  ---..119..173..9
130e0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
130f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
13100 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b   - col2 * col1 +
13110 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
13120 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a  2..----..-1508..
13130 2d 36 30 38 0d 0a 2d 38 31 30 0d 0a 0d 0a 71 75  -608..-810....qu
13140 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13150 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63  ELECT - col0 + c
13160 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 57 48  ol0 FROM tab1 WH
13170 45 52 45 20 4e 4f 54 20 28 20 4e 55 4c 4c 20 29  ERE NOT ( NULL )
13180 20 4e 4f 54 20 49 4e 20 28 20 63 6f 6c 31 20 2b   NOT IN ( col1 +
13190 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 29   + col0 + col2 )
131a0 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
131b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
131c0 54 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20  T - tab0.col1 * 
131d0 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  + col0 * + col1 
131e0 2d 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  - + col2 FROM ta
131f0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37 35 33  b0..----..-17753
13200 37 0d 0a 2d 33 32 39 33 31 36 0d 0a 2d 37 33 37  7..-329316..-737
13210 30 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  091....query I r
13220 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
13230 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b  ISTINCT col1 * +
13240 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 31 20 46   col1 - + col1 F
13250 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
13260 37 33 31 30 0d 0a 38 31 39 30 0d 0a 39 33 31 32  7310..8190..9312
13270 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13280 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
13290 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2d 20 74 61  INCT col0 + - ta
132a0 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b2.col2 FROM tab
132b0 32 20 57 48 45 52 45 20 4e 55 4c 4c 20 3e 3d 20  2 WHERE NULL >= 
132c0 2b 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  + col1..----....
132d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
132e0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
132f0 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   + + col2 * col1
13300 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
13310 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
13320 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a 32 39  0..----..194..29
13330 32 34 0d 0a 37 35 35 33 0d 0a 0d 0a 73 6b 69 70  24..7553....skip
13340 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
13350 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
13360 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
13370 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
13380 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
13390 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
133a0 6f 6c 30 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c  ol0 * + tab2.col
133b0 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0 col0 FROM tab2
133c0 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34  ..----..49..6084
133d0 0d 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20  ..6241....query 
133e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
133f0 54 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63  T tab0.col2 AS c
13400 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 57 48  ol2 FROM tab0 WH
13410 45 52 45 20 4e 55 4c 4c 20 42 45 54 57 45 45 4e  ERE NULL BETWEEN
13420 20 28 20 4e 55 4c 4c 20 29 20 41 4e 44 20 4e 55   ( NULL ) AND NU
13430 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79  LL..----....only
13440 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
13450 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
13460 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
13470 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13480 74 20 6c 61 62 65 6c 2d 35 32 33 0d 0a 53 45 4c  t label-523..SEL
13490 45 43 54 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c  ECT col1 DIV col
134a0 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0 col1 FROM tab1
134b0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 38 0d  ..----..0..0..8.
134c0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
134d0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
134e0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
134f0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
13500 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
13510 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
13520 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
13530 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
13540 2d 35 32 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -523..SELECT col
13550 31 20 2f 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52  1 / col0 col1 FR
13560 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab1..----..0
13570 0d 0a 30 0d 0a 38 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..8....skipif
13580 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
13590 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
135a0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
135b0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
135c0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
135d0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
135e0 4e 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  NCT col1 * - col
135f0 31 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20  1 * tab0.col2 + 
13600 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d  + col1 col1 FROM
13610 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   tab0..----..-24
13620 33 39 38 32 0d 0a 2d 36 37 38 39 35 31 0d 0a 2d  3982..-678951..-
13630 39 33 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49  9312....query II
13640 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13650 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62  T ALL * FROM tab
13660 32 20 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 30  2 WHERE NOT col0
13670 20 3c 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a   <> NULL..----..
13680 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13690 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
136a0 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   + + col0 * + co
136b0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
136c0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 34  tab0..----..1224
136d0 0d 0a 35 34 33 0d 0a 37 38 33 39 0d 0a 0d 0a 71  ..543..7839....q
136e0 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
136f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
13700 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57 48  T * FROM tab0 WH
13710 45 52 45 20 2b 20 63 6f 6c 30 20 3e 3d 20 4e 55  ERE + col0 >= NU
13720 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72  LL..----....quer
13730 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13740 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
13750 30 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62  0 * col0 + - tab
13760 30 2e 63 6f 6c 30 20 2a 20 2d 20 74 61 62 30 2e  0.col0 * - tab0.
13770 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
13780 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab0..----..12
13790 36 30 0d 0a 31 33 36 38 0d 0a 31 35 32 31 39 0d  60..1368..15219.
137a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
137b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
137c0 4e 43 54 20 2b 20 32 37 20 2a 20 63 6f 6c 30 20  NCT + 27 * col0 
137d0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
137e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
137f0 31 30 37 0d 0a 31 37 33 38 0d 0a 32 31 37 33 0d  107..1738..2173.
13800 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13810 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
13820 20 2b 20 38 30 20 2b 20 63 6f 6c 30 20 46 52 4f   + 80 + col0 FRO
13830 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
13840 2d 0d 0a 31 30 34 0d 0a 31 31 35 0d 0a 31 36 39  -..104..115..169
13850 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13860 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 34 20 2a  ort..SELECT 54 *
13870 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
13880 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
13890 0a 2d 2d 2d 2d 0d 0a 33 37 38 0d 0a 34 32 31 32  .----..378..4212
138a0 0d 0a 34 32 36 36 0d 0a 0d 0a 71 75 65 72 79 20  ..4266....query 
138b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
138c0 54 20 41 4c 4c 20 2b 20 2b 20 38 35 20 41 53 20  T ALL + + 85 AS 
138d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
138e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 38  or0..----..85..8
138f0 35 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  5..85....query I
13900 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13910 20 44 49 53 54 49 4e 43 54 20 2d 20 36 34 20 2b   DISTINCT - 64 +
13920 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
13930 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
13940 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 37 0d  .----..-33..-47.
13950 0a 2d 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .-5....onlyif my
13960 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
13970 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
13980 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
13990 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
139a0 65 6c 2d 35 33 34 0d 0a 53 45 4c 45 43 54 20 2d  el-534..SELECT -
139b0 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32   + col0 + + col2
139c0 20 44 49 56 20 28 20 2b 20 37 33 20 29 20 41 53   DIV ( + 73 ) AS
139d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
139e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
139f0 33 0d 0a 2d 36 34 0d 0a 2d 37 39 0d 0a 0d 0a 73  3..-64..-79....s
13a00 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
13a10 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
13a20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
13a30 62 65 6c 2d 35 33 34 0d 0a 53 45 4c 45 43 54 20  bel-534..SELECT 
13a40 2d 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  - + col0 + + col
13a50 32 20 2f 20 28 20 2b 20 37 33 20 29 20 41 53 20  2 / ( + 73 ) AS 
13a60 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
13a70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
13a80 0d 0a 2d 36 34 0d 0a 2d 37 39 0d 0a 0d 0a 71 75  ..-64..-79....qu
13a90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13aa0 45 4c 45 43 54 20 41 4c 4c 20 35 34 20 2b 20 2b  ELECT ALL 54 + +
13ab0 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20   col0 * col1 AS 
13ac0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
13ad0 2d 2d 2d 2d 0d 0a 31 33 39 37 0d 0a 32 37 31 0d  ----..1397..271.
13ae0 0a 34 36 35 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .4656....onlyif 
13af0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
13b00 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
13b10 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
13b20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
13b30 61 62 65 6c 2d 35 33 36 0d 0a 53 45 4c 45 43 54  abel-536..SELECT
13b40 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 44 49 56   + tab1.col2 DIV
13b50 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2d   col2 + - col2 -
13b60 20 2d 20 33 32 20 46 52 4f 4d 20 74 61 62 31 0d   - 32 FROM tab1.
13b70 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 32 34 0d  .----..-21..-24.
13b80 0a 2d 36 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-63....skipif m
13b90 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
13ba0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
13bb0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33 36  owsort label-536
13bc0 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e  ..SELECT + tab1.
13bd0 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 2b 20 2d 20  col2 / col2 + - 
13be0 63 6f 6c 32 20 2d 20 2d 20 33 32 20 46 52 4f 4d  col2 - - 32 FROM
13bf0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   tab1..----..-21
13c00 0d 0a 2d 32 34 0d 0a 2d 36 33 0d 0a 0d 0a 71 75  ..-24..-63....qu
13c10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13c20 45 4c 45 43 54 20 41 4c 4c 20 34 38 20 41 53 20  ELECT ALL 48 AS 
13c30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
13c40 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
13c50 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
13c60 68 69 6e 67 20 74 6f 20 38 62 30 39 63 63 32 63  hing to 8b09cc2c
13c70 39 39 63 32 31 30 32 30 33 36 31 36 32 64 30 36  99c2102036162d06
13c80 33 65 30 65 35 61 34 62 0d 0a 0d 0a 71 75 65 72  3e0e5a4b....quer
13c90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13ca0 45 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f 72 30  ECT ALL ( + cor0
13cb0 2e 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c 31  .col0 ) + + col1
13cc0 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
13cd0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
13ce0 2d 0d 0a 31 36 31 32 0d 0a 37 32 35 0d 0a 38 34  -..1612..725..84
13cf0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
13d00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
13d10 54 49 4e 43 54 20 2b 20 28 20 2b 20 63 6f 6c 32  TINCT + ( + col2
13d20 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63   ) * + col1 AS c
13d30 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
13d40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   cor0..----..124
13d50 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a  8..1404..570....
13d60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13d70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
13d80 20 2b 20 39 32 20 41 53 20 63 6f 6c 30 20 46 52   + 92 AS col0 FR
13d90 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
13da0 2d 2d 0d 0a 39 32 0d 0a 0d 0a 73 6b 69 70 69 66  --..92....skipif
13db0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
13dc0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
13dd0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
13de0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
13df0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
13e00 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
13e10 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30   - col2 + + cor0
13e20 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63  .col1 * + cor0.c
13e30 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
13e40 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
13e50 0d 0a 32 38 30 35 0d 0a 37 33 38 30 0d 0a 39 36  ..2805..7380..96
13e60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13e70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
13e80 6c 31 20 2a 20 2b 20 28 20 2b 20 74 61 62 31 2e  l1 * + ( + tab1.
13e90 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46  col1 ) AS col2 F
13ea0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
13eb0 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36  -100..-169..-676
13ec0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13ed0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
13ee0 2d 20 63 6f 6c 31 20 2a 20 74 61 62 32 2e 63 6f  - col1 * tab2.co
13ef0 6c 32 20 2a 20 28 20 2b 20 74 61 62 32 2e 63 6f  l2 * ( + tab2.co
13f00 6c 32 20 29 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  l2 ) + col2 + - 
13f10 38 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  82 AS col0 FROM 
13f20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 36  tab2..----..-226
13f30 35 34 0d 0a 2d 32 34 35 39 32 0d 0a 2d 33 39 39  54..-24592..-399
13f40 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  40....query I ro
13f50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
13f60 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  l1 * col1 * - co
13f70 6c 32 20 2b 20 28 20 34 34 20 29 20 46 52 4f 4d  l2 + ( 44 ) FROM
13f80 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   tab1..----..-16
13f90 31 38 30 0d 0a 2d 33 36 34 36 30 0d 0a 2d 35 36  180..-36460..-56
13fa0 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  56....query I ro
13fb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
13fc0 4c 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 37 34 20  L + col0 - - 74 
13fd0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
13fe0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
13ff0 0a 31 30 39 0d 0a 31 36 33 0d 0a 39 38 0d 0a 0d  .109..163..98...
14000 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14010 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
14020 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  T + cor0.col0 FR
14030 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
14040 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
14050 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or1, tab1 AS cor
14060 32 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d  2..----..24..35.
14070 0a 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .89....onlyif my
14080 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
14090 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
140a0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
140b0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
140c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
140d0 35 34 37 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41  547..SELECT + CA
140e0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
140f0 45 44 20 29 20 2b 20 2d 20 28 20 63 6f 6c 32 20  ED ) + - ( col2 
14100 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
14110 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
14120 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
14130 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
14140 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
14150 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34 37 0d  wsort label-547.
14160 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28  .SELECT + CAST (
14170 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
14180 20 29 20 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20   ) + - ( col2 ) 
14190 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
141a0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
141b0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
141c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
141d0 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63  TINCT + col0 + c
141e0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  ol1 * - col0 FRO
141f0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
14200 30 34 30 0d 0a 2d 33 33 36 30 0d 0a 2d 38 30 31  040..-3360..-801
14210 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
14220 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 39 20  sort..SELECT 29 
14230 2b 20 36 39 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 69 AS col1 FRO
14240 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61  M tab1, tab2, ta
14250 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
14260 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
14270 69 6e 67 20 74 6f 20 63 37 35 38 65 38 61 66 62  ing to c758e8afb
14280 64 66 61 36 61 61 65 32 37 39 30 34 35 62 30 65  dfa6aae279045b0e
14290 39 63 62 61 63 63 32 0d 0a 0d 0a 71 75 65 72 79  9cbacc2....query
142a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
142b0 43 54 20 63 6f 6c 32 20 2a 20 2b 20 35 37 20 2b  CT col2 * + 57 +
142c0 20 63 6f 6c 32 20 2b 20 2d 20 32 36 20 41 53 20   col2 + - 26 AS 
142d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
142e0 2d 2d 2d 2d 0d 0a 31 38 38 38 0d 0a 33 32 0d 0a  ----..1888..32..
142f0 34 37 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4730....query I 
14300 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14310 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  col2 * + col2 + 
14320 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e  + col1 * + cor0.
14330 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63  col1 + col2 AS c
14340 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
14350 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30   cor0..----..150
14360 38 37 0d 0a 38 35 31 38 0d 0a 39 34 31 31 0d 0a  87..8518..9411..
14370 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14380 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
14390 43 54 20 2b 20 34 34 20 41 53 20 63 6f 6c 30 20  CT + 44 AS col0 
143a0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
143b0 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34 0d 0a 0d 0a 71  0..----..44....q
143c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
143d0 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 33 36 20  SELECT + ( + 36 
143e0 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
143f0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
14400 2d 0d 0a 33 36 0d 0a 33 36 0d 0a 33 36 0d 0a 0d  -..36..36..36...
14410 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
14420 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
14430 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
14440 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
14450 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
14460 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14470 54 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63  T DISTINCT ( + c
14480 6f 6c 32 20 29 20 2a 20 63 6f 6c 31 20 63 6f 6c  ol2 ) * col1 col
14490 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
144a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d  or0..----..1248.
144b0 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75  .1404..570....qu
144c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
144d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 31  ELECT DISTINCT 1
144e0 36 20 2a 20 2b 20 31 31 20 46 52 4f 4d 20 74 61  6 * + 11 FROM ta
144f0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
14500 0d 0a 31 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..176....query I
14510 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14520 20 44 49 53 54 49 4e 43 54 20 2b 20 36 36 20 2a   DISTINCT + 66 *
14530 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
14540 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
14550 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 36 0d 0a  0..----..-1716..
14560 2d 31 37 38 32 0d 0a 2d 32 35 30 38 0d 0a 0d 0a  -1782..-2508....
14570 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14580 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
14590 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 28   col0 + col2 * (
145a0 20 2d 20 31 38 20 29 20 2b 20 63 6f 6c 30 20 41   - 18 ) + col0 A
145b0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
145c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
145d0 2d 31 31 33 31 0d 0a 2d 34 36 31 30 0d 0a 2d 39  -1131..-4610..-9
145e0 33 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  328....query I r
145f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
14600 4c 4c 20 2b 20 38 30 20 2b 20 2d 20 63 6f 6c 30  LL + 80 + - col0
14610 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + - col0 AS col
14620 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
14630 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 38 0d 0a  or0..----..-98..
14640 31 30 0d 0a 33 32 0d 0a 0d 0a 71 75 65 72 79 20  10..32....query 
14650 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14660 54 20 2d 20 32 35 20 2b 20 2b 20 63 6f 6c 31 20  T - 25 + + col1 
14670 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
14680 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
14690 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 0d 0a 36 35 31  ..----..144..651
146a0 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..75....query I 
146b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
146c0 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  ALL col1 * + col
146d0 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  1 + cor0.col1 FR
146e0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
146f0 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 38 32 0d  .----..110..182.
14700 0a 37 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .702....query I 
14710 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14720 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
14730 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  * + col2 + col2 
14740 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
14750 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
14760 0a 32 30 35 34 0d 0a 32 31 36 0d 0a 33 30 34 30  .2054..216..3040
14770 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
14780 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
14790 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  l2 + + col1 * + 
147a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
147b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
147c0 37 0d 0a 32 36 35 0d 0a 37 33 30 0d 0a 0d 0a 71  7..265..730....q
147d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
147e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
147f0 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + - col2 * - col
14800 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  2 + cor0.col1 FR
14810 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
14820 0a 2d 2d 2d 2d 0d 0a 31 31 37 35 0d 0a 36 38 31  .----..1175..681
14830 35 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  5..98....query I
14840 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14850 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
14860 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63  .col2 * col1 + c
14870 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
14880 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
14890 30 35 0d 0a 2d 37 33 38 30 0d 0a 2d 39 36 0d 0a  05..-7380..-96..
148a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
148b0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 20 2a 20  t..SELECT - 2 * 
148c0 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col2 + + col1 * 
148d0 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  - col2 FROM tab2
148e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
148f0 2d 31 35 38 36 0d 0a 2d 37 32 32 0d 0a 2d 38 39  -1586..-722..-89
14900 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
14910 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
14920 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
14930 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
14940 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
14950 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14960 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63  ELECT col2 * - c
14970 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c  ol1 + - col1 col
14980 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
14990 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 31  or0..----..-1261
149a0 0d 0a 2d 31 34 33 30 0d 0a 2d 35 38 30 0d 0a 0d  ..-1430..-580...
149b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
149c0 0d 0a 53 45 4c 45 43 54 20 2d 20 36 20 2b 20 63  ..SELECT - 6 + c
149d0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
149e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
149f0 2d 2d 2d 0d 0a 32 30 0d 0a 32 31 0d 0a 33 32 0d  ---..20..21..32.
14a00 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
14a10 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
14a20 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
14a30 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
14a40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
14a50 36 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  68..SELECT ALL c
14a60 6f 6c 31 20 2a 20 63 6f 6c 31 20 44 49 56 20 63  ol1 * col1 DIV c
14a70 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
14a80 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a  b1..----..1..1..
14a90 31 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  12....skipif pos
14aa0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
14ab0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
14ac0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
14ad0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
14ae0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
14af0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
14b00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
14b10 62 65 6c 2d 35 36 38 0d 0a 53 45 4c 45 43 54 20  bel-568..SELECT 
14b20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  ALL col1 * col1 
14b30 2f 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  / col2 col1 FROM
14b40 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab1..----..1..
14b50 31 0d 0a 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49  1..12....query I
14b60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14b70 20 44 49 53 54 49 4e 43 54 20 2b 20 38 33 20 2a   DISTINCT + 83 *
14b80 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2b   col2 + col0 * +
14b90 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
14ba0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 38  cor0..----..1308
14bb0 0d 0a 31 34 37 32 37 0d 0a 33 33 31 35 0d 0a 0d  ..14727..3315...
14bc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14bd0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
14be0 2a 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20  * - col0 - col1 
14bf0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
14c00 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
14c10 0a 2d 31 33 36 30 0d 0a 2d 32 34 38 0d 0a 2d 34  .-1360..-248..-4
14c20 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  661....query I r
14c30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
14c40 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 35 31 20 2b  LL col1 * + 51 +
14c50 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63   cor0.col0 * - c
14c60 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
14c70 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
14c80 0d 0a 2d 33 31 33 38 0d 0a 2d 37 30 31 37 0d 0a  ..-3138..-7017..
14c90 31 31 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1164....query I 
14ca0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14cb0 2d 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63 6f  - col0 - cor0.co
14cc0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
14cd0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
14ce0 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d  --..-137..-38..-
14cf0 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
14d00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
14d10 6c 31 20 2d 20 2d 20 33 20 46 52 4f 4d 20 74 61  l1 - - 3 FROM ta
14d20 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
14d30 0d 0a 32 30 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a  ..20..34..62....
14d40 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
14d50 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
14d60 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
14d70 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
14d80 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 34 0d  wsort label-574.
14d90 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
14da0 39 39 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  99 * col2 + - co
14db0 72 30 2e 63 6f 6c 30 20 44 49 56 20 63 6f 72 30  r0.col0 DIV cor0
14dc0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
14dd0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
14de0 0a 2d 2d 2d 2d 0d 0a 32 35 37 33 0d 0a 32 36 37  .----..2573..267
14df0 33 0d 0a 33 37 35 38 0d 0a 0d 0a 73 6b 69 70 69  3..3758....skipi
14e00 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
14e10 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
14e20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
14e30 35 37 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  574..SELECT ALL 
14e40 2b 20 2b 20 39 39 20 2a 20 63 6f 6c 32 20 2b 20  + + 99 * col2 + 
14e50 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 63 6f  - cor0.col0 / co
14e60 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  r0.col1 AS col2 
14e70 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
14e80 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 37 33 0d 0a 32  0..----..2573..2
14e90 36 37 33 0d 0a 33 37 35 38 0d 0a 0d 0a 71 75 65  673..3758....que
14ea0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14eb0 4c 45 43 54 20 41 4c 4c 20 2b 20 31 34 20 46 52  LECT ALL + 14 FR
14ec0 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
14ed0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
14ee0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
14ef0 20 38 33 65 35 37 37 39 64 32 34 38 37 64 31 32   83e5779d2487d12
14f00 34 39 35 65 37 64 38 31 36 63 37 39 37 32 36 34  495e7d816c797264
14f10 66 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  f....query I row
14f20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
14f30 30 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29  0 + + ( - col0 )
14f40 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
14f50 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b1..----..0..0..
14f60 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
14f70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34  sort..SELECT - 4
14f80 36 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  6 + col2 AS col0
14f90 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
14fa0 0d 0a 2d 31 39 0d 0a 2d 32 30 0d 0a 2d 38 0d 0a  ..-19..-20..-8..
14fb0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
14fc0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
14fd0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
14fe0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
14ff0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
15000 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15010 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
15020 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 63  l2 + tab0.col1 c
15030 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
15040 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39  ---..119..173..9
15050 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
15060 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
15070 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
15080 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
15090 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
150a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37  rowsort label-57
150b0 39 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54  9..SELECT + CAST
150c0 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
150d0 20 29 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) / col1 FROM t
150e0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
150f0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
15100 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
15110 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
15120 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
15130 62 65 6c 2d 35 37 39 0d 0a 53 45 4c 45 43 54 20  bel-579..SELECT 
15140 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
15150 20 49 4e 54 45 47 45 52 20 29 20 2f 20 63 6f 6c   INTEGER ) / col
15160 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
15170 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
15180 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ULL....onlyif my
15190 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
151a0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
151b0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
151c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
151d0 65 6c 2d 35 38 30 0d 0a 53 45 4c 45 43 54 20 37  el-580..SELECT 7
151e0 34 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20 63  4 DIV - col1 + c
151f0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
15200 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
15210 2d 2d 2d 0d 0a 31 33 0d 0a 32 39 0d 0a 35 38 0d  ---..13..29..58.
15220 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
15230 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
15240 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15250 74 20 6c 61 62 65 6c 2d 35 38 30 0d 0a 53 45 4c  t label-580..SEL
15260 45 43 54 20 37 34 20 2f 20 2d 20 63 6f 6c 31 20  ECT 74 / - col1 
15270 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
15280 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
15290 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 32 39 0d 0a  ..----..13..29..
152a0 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
152b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
152c0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
152d0 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e 63 6f  col0 + - tab1.co
152e0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
152f0 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d  --..3..64..80...
15300 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15310 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
15320 2a 20 2b 20 63 6f 6c 32 20 2a 20 74 61 62 30 2e  * + col2 * tab0.
15330 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
15340 2d 2d 2d 2d 0d 0a 32 36 31 33 36 0d 0a 33 35 0d  ----..26136..35.
15350 0a 35 39 38 34 33 36 0d 0a 0d 0a 71 75 65 72 79  .598436....query
15360 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15370 43 54 20 2d 20 28 20 2b 20 32 37 20 29 20 2a 20  CT - ( + 27 ) * 
15380 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
15390 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 31 30  ----..-189..-210
153a0 36 0d 0a 2d 32 31 33 33 0d 0a 0d 0a 73 6b 69 70  6..-2133....skip
153b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
153c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
153d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
153e0 43 54 20 43 41 53 54 20 28 20 34 32 20 41 53 20  CT CAST ( 42 AS 
153f0 52 45 41 4c 20 29 20 2b 20 2d 20 63 6f 6c 32 20  REAL ) + - col2 
15400 2a 20 74 61 62 30 2e 63 6f 6c 31 20 2f 20 63 6f  * tab0.col1 / co
15410 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
15420 2d 2d 0d 0a 2d 34 30 0d 0a 34 31 0d 0a 39 0d 0a  --..-40..41..9..
15430 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15440 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
15450 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63   col0 * + cor0.c
15460 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
15470 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38   cor0..----..118
15480 38 32 35 0d 0a 34 39 35 33 36 0d 0a 37 32 30 38  825..49536..7208
15490 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  11....query III 
154a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
154b0 2a 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  * FROM tab0 AS c
154c0 6f 72 30 20 57 48 45 52 45 20 28 20 2d 20 63 6f  or0 WHERE ( - co
154d0 6c 31 20 29 20 3c 3d 20 4e 55 4c 4c 0d 0a 2d 2d  l1 ) <= NULL..--
154e0 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
154f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
15500 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
15510 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54  M tab1 WHERE NOT
15520 20 28 20 2d 20 63 6f 6c 31 20 29 20 3c 20 63 6f   ( - col1 ) < co
15530 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72  l0..----....quer
15540 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15550 45 43 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c  ECT ALL tab2.col
15560 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  0 * + col2 AS co
15570 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
15580 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33  --..189..2028..3
15590 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
155a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
155b0 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32  LL col1 * + col2
155c0 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
155d0 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 63 6f  ab2 WHERE NOT co
155e0 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 3e 3d 20 28  l1 + - col2 >= (
155f0 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   NULL )..----...
15600 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15610 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
15620 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 41 53  + col0 - col0 AS
15630 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
15640 0a 2d 2d 2d 2d 0d 0a 31 35 39 0d 0a 33 35 38 34  .----..159..3584
15650 0d 0a 37 36 30 30 0d 0a 0d 0a 71 75 65 72 79 20  ..7600....query 
15660 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
15670 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
15680 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 63  ROM tab0 WHERE c
15690 6f 6c 31 20 3c 3d 20 28 20 63 6f 6c 30 20 2a 20  ol1 <= ( col0 * 
156a0 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  - col0 + + col0 
156b0 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
156c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
156d0 43 54 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2d  CT tab1.col0 * -
156e0 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a   col2 + - col0 *
156f0 20 63 6f 6c 32 20 2b 20 2b 20 74 61 62 31 2e 63   col2 + + tab1.c
15700 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 * col0 FROM 
15710 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 35  tab1..----..-315
15720 0d 0a 2d 33 32 30 30 0d 0a 2d 38 39 36 30 0d 0a  ..-3200..-8960..
15730 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15740 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
15750 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46   col2 * - col1 F
15760 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
15770 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 32 0d 0a 2d  ..----..-1152..-
15780 31 33 35 30 0d 0a 2d 35 31 33 0d 0a 0d 0a 71 75  1350..-513....qu
15790 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
157a0 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63  ELECT + col1 * c
157b0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 74  ol2 * + col2 + t
157c0 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ab2.col1 FROM ta
157d0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36 33 30 0d  b2..----..22630.
157e0 0a 32 34 35 36 35 0d 0a 33 39 39 34 33 0d 0a 0d  .24565..39943...
157f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15800 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
15810 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  T + + col0 * col
15820 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
15830 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
15840 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39  2064..3395..8099
15850 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
15860 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
15870 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
15880 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
15890 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
158a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
158b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
158c0 72 30 2e 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f  r0.col1 col0 FRO
158d0 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  M tab2, tab2 AS 
158e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a  cor0..----..17..
158f0 33 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20  31..59....query 
15900 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15910 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
15920 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  1 * - col1 AS co
15930 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
15940 2d 2d 0d 0a 32 38 39 0d 0a 33 34 38 31 0d 0a 39  --..289..3481..9
15950 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
15960 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
15970 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  + col0 * + col2 
15980 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
15990 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34  ----..-162..-364
159a0 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72  8..-7680....quer
159b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
159c0 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ECT - cor0.col1 
159d0 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  * - cor0.col1 FR
159e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
159f0 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32 38  .----..7396..828
15a00 31 0d 0a 39 34 30 39 0d 0a 0d 0a 73 6b 69 70 69  1..9409....skipi
15a10 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
15a20 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
15a30 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
15a40 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
15a50 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
15a60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
15a70 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a 20  col0 * - col2 * 
15a80 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  - col0 col1 FROM
15a90 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
15aa0 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 31 39 30  ---..-1225..-190
15ab0 30 38 0d 0a 2d 36 34 39 35 32 32 0d 0a 0d 0a 71  08..-649522....q
15ac0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15ad0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
15ae0 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  + col1 * - col0 
15af0 2b 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d  + tab1.col2 FROM
15b00 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36   tab1..----..-36
15b10 34 32 33 0d 0a 2d 34 31 35 38 0d 0a 2d 39 39 37  423..-4158..-997
15b20 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  44....onlyif mys
15b30 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
15b40 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
15b50 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
15b60 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
15b70 6c 2d 36 30 32 0d 0a 53 45 4c 45 43 54 20 2b 20  l-602..SELECT + 
15b80 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 44 49 56 20  col1 + col0 DIV 
15b90 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
15ba0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
15bb0 2d 0d 0a 38 37 0d 0a 39 32 0d 0a 39 38 0d 0a 0d  -..87..92..98...
15bc0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
15bd0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
15be0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
15bf0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
15c00 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
15c10 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
15c20 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
15c30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
15c40 30 32 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  02..SELECT + col
15c50 31 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20  1 + col0 / col0 
15c60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
15c70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37  S cor0..----..87
15c80 0d 0a 39 32 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c 79  ..92..98....only
15c90 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
15ca0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
15cb0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
15cc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15cd0 74 20 6c 61 62 65 6c 2d 36 30 33 0d 0a 53 45 4c  t label-603..SEL
15ce0 45 43 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 63  ECT - col0 DIV c
15cf0 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
15d00 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
15d10 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a  ..-1..-1..-1....
15d20 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
15d30 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
15d40 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
15d50 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
15d60 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
15d70 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
15d80 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
15d90 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30  rowsort label-60
15da0 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  3..SELECT - col0
15db0 20 2f 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f   / col0 col0 FRO
15dc0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
15dd0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31  ----..-1..-1..-1
15de0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15df0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
15e00 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col2 + - cor0.co
15e10 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
15e20 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a 2d  0..----..-171..-
15e30 33 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79  36..-57....query
15e40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15e50 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20  CT ALL + col2 + 
15e60 2d 20 28 20 2b 20 33 20 29 20 2a 20 63 6f 6c 31  - ( + 3 ) * col1
15e70 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
15e80 0d 0a 2d 31 39 31 0d 0a 2d 32 32 35 0d 0a 2d 32  ..-191..-225..-2
15e90 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
15ea0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
15eb0 62 30 2e 63 6f 6c 30 20 2a 20 2d 20 33 38 20 41  b0.col0 * - 38 A
15ec0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
15ed0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 30 0d 0a 2d  ..----..-1330..-
15ee0 33 33 38 32 0d 0a 2d 39 31 32 0d 0a 0d 0a 73 6b  3382..-912....sk
15ef0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
15f00 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
15f10 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
15f20 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
15f30 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
15f40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
15f50 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 63 6f 6c   col1 - col2 col
15f60 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
15f70 2d 0d 0a 2d 35 35 0d 0a 2d 35 38 0d 0a 2d 38 35  -..-55..-58..-85
15f80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15f90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 31  ort..SELECT tab1
15fa0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
15fb0 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
15fc0 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
15fd0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
15fe0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
15ff0 64 36 37 31 61 30 36 34 65 32 64 61 37 30 39 63  d671a064e2da709c
16000 61 34 63 64 66 65 61 33 31 37 62 38 65 38 39 32  a4cdfea317b8e892
16010 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16020 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
16030 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 38 34  - tab0.col0 * 84
16040 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
16050 0d 0a 2d 32 30 31 36 0d 0a 2d 32 39 34 30 0d 0a  ..-2016..-2940..
16060 2d 37 34 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -7476....onlyif 
16070 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
16080 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
16090 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
160a0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
160b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
160c0 6c 2d 36 31 30 0d 0a 53 45 4c 45 43 54 20 2b 20  l-610..SELECT + 
160d0 2d 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 28  - col2 * + CAST(
160e0 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20   col1 AS SIGNED 
160f0 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
16100 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38  or0..----..-2838
16110 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a  ..-7462..-97....
16120 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
16130 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
16140 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16150 61 62 65 6c 2d 36 31 30 0d 0a 53 45 4c 45 43 54  abel-610..SELECT
16160 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 43 41   + - col2 * + CA
16170 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54  ST ( col1 AS INT
16180 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30  EGER ) FROM tab0
16190 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
161a0 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39  -2838..-7462..-9
161b0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
161c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
161d0 32 20 2a 20 39 38 20 2b 20 2d 20 35 33 20 41 53  2 * 98 + - 53 AS
161e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
161f0 0a 2d 2d 2d 2d 0d 0a 33 31 38 31 0d 0a 34 35 0d  .----..3181..45.
16200 0a 37 39 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .7983....onlyif 
16210 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
16220 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
16230 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
16240 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16250 61 62 65 6c 2d 36 31 32 0d 0a 53 45 4c 45 43 54  abel-612..SELECT
16260 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 44   DISTINCT col2 D
16270 49 56 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 34  IV tab1.col0 + 4
16280 38 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  8 FROM tab1..---
16290 2d 0d 0a 34 38 0d 0a 34 39 0d 0a 36 36 0d 0a 0d  -..48..49..66...
162a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
162b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
162c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
162d0 6c 61 62 65 6c 2d 36 31 32 0d 0a 53 45 4c 45 43  label-612..SELEC
162e0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
162f0 2f 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 34 38  / tab1.col0 + 48
16300 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
16310 0d 0a 34 38 0d 0a 34 39 0d 0a 36 36 0d 0a 0d 0a  ..48..49..66....
16320 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16330 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
16340 20 63 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c   col1 + tab1.col
16350 30 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  0 * col2 * col1 
16360 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
16370 0a 32 38 30 38 0d 0a 33 35 39 31 30 0d 0a 39 38  .2808..35910..98
16380 35 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  592....query I r
16390 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
163a0 6f 6c 30 20 2a 20 37 32 20 41 53 20 63 6f 6c 31  ol0 * 72 AS col1
163b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
163c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 38 0d 0a  r0..----..1728..
163d0 32 35 32 30 0d 0a 36 34 30 38 0d 0a 0d 0a 71 75  2520..6408....qu
163e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
163f0 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63  ELECT + col1 * c
16400 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  or0.col0 * - col
16410 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
16420 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 38  or0..----..-3648
16430 30 0d 0a 2d 34 32 31 32 0d 0a 2d 39 39 38 34 30  0..-4212..-99840
16440 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
16450 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
16460 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
16470 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
16480 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
16490 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
164a0 4c 45 43 54 20 2b 20 28 20 63 6f 6c 32 20 29 20  LECT + ( col2 ) 
164b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
164c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32  or0..----..26..2
164d0 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49  7..38....query I
164e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
164f0 20 2d 20 2b 20 37 20 2a 20 63 6f 6c 30 20 46 52   - + 7 * col0 FR
16500 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
16510 0a 2d 2d 2d 2d 0d 0a 2d 31 36 38 0d 0a 2d 32 34  .----..-168..-24
16520 35 0d 0a 2d 36 32 33 0d 0a 0d 0a 71 75 65 72 79  5..-623....query
16530 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16540 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 46  CT + tab1.col1 F
16550 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
16560 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
16570 4e 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  N tab1..----..27
16580 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
16590 74 6f 20 64 36 37 31 61 30 36 34 65 32 64 61 37  to d671a064e2da7
165a0 30 39 63 61 34 63 64 66 65 61 33 31 37 62 38 65  09ca4cdfea317b8e
165b0 38 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  892....skipif po
165c0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
165d0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
165e0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
165f0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
16600 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16610 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 30  .SELECT ( + col0
16620 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
16630 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
16640 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71  .24..35..89....q
16650 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16660 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
16670 2b 20 2d 20 37 32 20 41 53 20 63 6f 6c 30 20 46  + - 72 AS col0 F
16680 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
16690 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 39 0d 0a 2d 38 0d  ..----..-69..-8.
166a0 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .8....query I ro
166b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
166c0 4c 20 28 20 34 20 29 20 2a 20 63 6f 6c 32 20 41  L ( 4 ) * col2 A
166d0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
166e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32   cor0..----..132
166f0 0d 0a 33 32 38 0d 0a 34 0d 0a 0d 0a 71 75 65 72  ..328..4....quer
16700 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16710 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 31 33 20  ECT col0 * - 13 
16720 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
16730 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
16740 0a 2d 31 30 34 30 0d 0a 2d 33 39 0d 0a 2d 38 33  .-1040..-39..-83
16750 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
16760 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
16770 20 2d 20 2b 20 28 20 32 31 20 29 20 2b 20 63 6f   - + ( 21 ) + co
16780 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
16790 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
167a0 2d 2d 0d 0a 2d 31 38 0d 0a 34 33 0d 0a 35 39 0d  --..-18..43..59.
167b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
167c0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
167d0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
167e0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
167f0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
16800 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 34 0d  wsort label-624.
16810 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
16820 20 2d 20 2b 20 43 41 53 54 28 20 2b 20 63 6f 72   - + CAST( + cor
16830 30 2e 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  0.col2 AS SIGNED
16840 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   ) + cor0.col1 *
16850 20 2d 20 36 38 20 41 53 20 63 6f 6c 31 20 46 52   - 68 AS col1 FR
16860 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
16870 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 34 0d 0a 2d 32  .----..-1194..-2
16880 31 33 35 0d 0a 2d 34 30 33 38 0d 0a 0d 0a 73 6b  135..-4038....sk
16890 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
168a0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
168b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
168c0 65 6c 2d 36 32 34 0d 0a 53 45 4c 45 43 54 20 44  el-624..SELECT D
168d0 49 53 54 49 4e 43 54 20 2d 20 2b 20 43 41 53 54  ISTINCT - + CAST
168e0 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41   ( + cor0.col2 A
168f0 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f  S INTEGER ) + co
16900 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 36 38 20 41  r0.col1 * - 68 A
16910 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
16920 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16930 2d 31 31 39 34 0d 0a 2d 32 31 33 35 0d 0a 2d 34  -1194..-2135..-4
16940 30 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  038....query I r
16950 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
16960 20 2d 20 63 6f 6c 32 20 29 20 2a 20 63 6f 72 30   - col2 ) * cor0
16970 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
16980 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
16990 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 36 0d 0a 2d 33  .----..-2916..-3
169a0 32 34 39 0d 0a 2d 39 32 31 36 0d 0a 0d 0a 73 6b  249..-9216....sk
169b0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
169c0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
169d0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
169e0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
169f0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
16a00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
16a10 49 53 54 49 4e 43 54 20 2d 20 33 36 20 63 6f 6c  ISTINCT - 36 col
16a20 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
16a30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a  or0..----..-36..
16a40 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
16a50 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
16a60 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
16a70 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
16a80 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
16a90 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 37 0d 0a  sort label-627..
16aa0 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 4e  SELECT - CAST( N
16ab0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
16ac0 2a 20 2d 20 38 35 20 46 52 4f 4d 20 74 61 62 30  * - 85 FROM tab0
16ad0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16ae0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
16af0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
16b00 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
16b10 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
16b20 72 74 20 6c 61 62 65 6c 2d 36 32 37 0d 0a 53 45  rt label-627..SE
16b30 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55  LECT - CAST ( NU
16b40 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
16b50 2a 20 2d 20 38 35 20 46 52 4f 4d 20 74 61 62 30  * - 85 FROM tab0
16b60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16b70 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
16b80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16b90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
16ba0 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  l1 * col1 * col1
16bb0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
16bc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 33 36 30 35  r0..----..-63605
16bd0 36 0d 0a 2d 37 35 33 35 37 31 0d 0a 2d 39 31 32  6..-753571..-912
16be0 36 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  673....query I r
16bf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
16c00 4c 4c 20 2d 20 2d 20 28 20 63 6f 6c 30 20 29 20  LL - - ( col0 ) 
16c10 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  * - col1 AS col0
16c20 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
16c30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d  r0..----..-2064.
16c40 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d  .-3395..-8099...
16c50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16c60 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
16c70 20 36 33 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f   63 * - col0 FRO
16c80 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
16c90 2d 0d 0a 31 35 31 32 0d 0a 32 32 30 35 0d 0a 35  -..1512..2205..5
16ca0 36 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  607....query I r
16cb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
16cc0 20 63 6f 6c 31 20 29 20 2a 20 33 38 20 46 52 4f   col1 ) * 38 FRO
16cd0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32  M tab0..----..32
16ce0 36 38 0d 0a 33 34 35 38 0d 0a 33 36 38 36 0d 0a  68..3458..3686..
16cf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16d00 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 33 31  t..SELECT + + 31
16d10 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 28 20 28 20   * col0 - - ( ( 
16d20 2b 20 63 6f 6c 32 20 29 20 29 20 2a 20 63 6f 72  + col2 ) ) * cor
16d30 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0.col2 FROM tab2
16d40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16d50 33 30 39 34 0d 0a 33 38 39 33 0d 0a 39 34 36 0d  3094..3893..946.
16d60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16d70 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 35  rt..SELECT - + 5
16d80 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   * + col2 * - co
16d90 6c 32 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 - col0 AS col
16da0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
16db0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 30 32 0d  or0..----..3302.
16dc0 0a 33 36 33 38 0d 0a 37 31 34 31 0d 0a 0d 0a 71  .3638..7141....q
16dd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16de0 53 45 4c 45 43 54 20 2d 20 2d 20 36 31 20 2a 20  SELECT - - 61 * 
16df0 2d 20 63 6f 6c 30 20 2d 20 2b 20 28 20 63 6f 6c  - col0 - + ( col
16e00 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  0 ) AS col2 FROM
16e10 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16e20 2d 2d 2d 0d 0a 2d 34 33 34 0d 0a 2d 34 38 33 36  ---..-434..-4836
16e30 0d 0a 2d 34 38 39 38 0d 0a 0d 0a 71 75 65 72 79  ..-4898....query
16e40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16e50 43 54 20 2d 20 2d 20 37 32 20 2b 20 63 6f 72 30  CT - - 72 + cor0
16e60 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
16e70 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
16e80 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 35 34 0d  .----..105..154.
16e90 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .73....query I r
16ea0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
16eb0 4c 4c 20 63 6f 6c 32 20 2a 20 35 39 20 46 52 4f  LL col2 * 59 FRO
16ec0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
16ed0 2d 2d 2d 2d 0d 0a 31 39 34 37 0d 0a 34 38 33 38  ----..1947..4838
16ee0 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..59....query I 
16ef0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16f00 2d 20 2d 20 63 6f 6c 31 20 2a 20 37 31 20 2b 20  - - col1 * 71 + 
16f10 2b 20 37 34 20 46 52 4f 4d 20 74 61 62 30 20 41  + 74 FROM tab0 A
16f20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31  S cor0..----..61
16f30 38 30 0d 0a 36 35 33 35 0d 0a 36 39 36 31 0d 0a  80..6535..6961..
16f40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16f50 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
16f60 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f 6c 31 20  col1 + + ( col1 
16f70 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
16f80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a  or0..----..118..
16f90 33 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20  34..62....query 
16fa0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16fb0 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20  T ALL cor0.col0 
16fc0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
16fd0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16fe0 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31 35  ---..14..156..15
16ff0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
17000 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
17010 6f 6c 32 20 2d 20 33 35 20 2a 20 63 6f 6c 30 20  ol2 - 35 * col0 
17020 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
17030 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  2 cor0..----..-2
17040 31 38 0d 0a 2d 32 37 30 34 0d 0a 2d 32 37 32 37  18..-2704..-2727
17050 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17060 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
17070 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  - col2 * + col1 
17080 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  + - col0 AS col1
17090 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
170a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 38 0d  r0..----..-1328.
170b0 0a 2d 31 34 30 37 0d 0a 2d 36 33 34 0d 0a 0d 0a  .-1407..-634....
170c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
170d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
170e0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 32   - cor0.col2 * 2
170f0 36 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  6 FROM tab1 AS c
17100 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 34  or0..----..-1404
17110 0d 0a 2d 31 34 38 32 0d 0a 2d 32 34 39 36 0d 0a  ..-1482..-2496..
17120 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17130 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
17140 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  CT - - cor0.col1
17150 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + + col2 FROM t
17160 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
17170 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d  -..55..58..85...
17180 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
17190 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
171a0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
171b0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
171c0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
171d0 6f 72 74 20 6c 61 62 65 6c 2d 36 34 34 0d 0a 53  ort label-644..S
171e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
171f0 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54   + col2 * + CAST
17200 28 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  ( - col1 * + col
17210 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  0 AS SIGNED ) AS
17220 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
17230 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
17240 31 31 39 36 35 32 0d 0a 2d 35 31 30 33 34 0d 0a  119652..-51034..
17250 2d 35 38 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  -5859....skipif 
17260 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
17270 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
17280 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34  rowsort label-64
17290 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
172a0 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  CT + + col2 * + 
172b0 43 41 53 54 20 28 20 2d 20 63 6f 6c 31 20 2a 20  CAST ( - col1 * 
172c0 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  + col0 AS INTEGE
172d0 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  R ) AS col0 FROM
172e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
172f0 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32 0d 0a 2d 35  ---..-119652..-5
17300 31 30 33 34 0d 0a 2d 35 38 35 39 0d 0a 0d 0a 71  1034..-5859....q
17310 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17320 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
17330 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 39 34  cor0.col2 * - 94
17340 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
17350 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
17360 0d 0a 2d 33 31 30 32 0d 0a 2d 37 37 30 38 0d 0a  ..-3102..-7708..
17370 2d 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -94....query I r
17380 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
17390 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c  ISTINCT cor0.col
173a0 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 34 31 20  2 * col0 * - 41 
173b0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
173c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
173d0 0a 2d 31 34 39 35 36 38 0d 0a 2d 33 31 34 38 38  .-149568..-31488
173e0 30 0d 0a 2d 36 36 34 32 0d 0a 0d 0a 6f 6e 6c 79  0..-6642....only
173f0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
17400 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
17410 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
17420 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17430 74 20 6c 61 62 65 6c 2d 36 34 37 0d 0a 53 45 4c  t label-647..SEL
17440 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
17450 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20 41   col0 DIV col2 A
17460 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
17470 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17480 30 0d 0a 31 0d 0a 33 35 0d 0a 0d 0a 73 6b 69 70  0..1..35....skip
17490 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
174a0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
174b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
174c0 2d 36 34 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  -647..SELECT DIS
174d0 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2f  TINCT + + col0 /
174e0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
174f0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
17500 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 35 0d  .----..0..1..35.
17510 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17520 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
17530 6f 6c 32 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 30  ol2 * - ( + col0
17540 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
17550 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
17560 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33  --..189..2028..3
17570 30 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  002....skipif po
17580 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
17590 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
175a0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
175b0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
175c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
175d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
175e0 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 38 36  l2 + col0 * + 86
175f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
17600 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
17610 30 34 0d 0a 35 34 34 37 0d 0a 36 37 38 34 0d 0a  04..5447..6784..
17620 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17630 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
17640 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 31 38   * + col0 + - 18
17650 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
17660 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 0d 0a 33  r0..----..144..3
17670 36 33 30 0d 0a 37 36 36 32 0d 0a 0d 0a 71 75 65  630..7662....que
17680 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17690 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
176a0 6c 30 20 2a 20 28 20 63 6f 72 30 2e 63 6f 6c 31  l0 * ( cor0.col1
176b0 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72   ) FROM tab2 cor
176c0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32  0..----..1343..2
176d0 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 6f 6e 6c 79  17..4602....only
176e0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
176f0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
17700 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
17710 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
17720 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17730 61 62 65 6c 2d 36 35 32 0d 0a 53 45 4c 45 43 54  abel-652..SELECT
17740 20 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 63 6f   col1 * CAST( co
17750 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  l2 AS SIGNED ) F
17760 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
17770 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d  ---..1248..1404.
17780 0a 35 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .570....skipif m
17790 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
177a0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
177b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 32  owsort label-652
177c0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
177d0 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49  CAST ( col2 AS I
177e0 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
177f0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
17800 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a  248..1404..570..
17810 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17820 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
17830 43 54 20 63 6f 6c 30 20 2b 20 74 61 62 30 2e 63  CT col0 + tab0.c
17840 6f 6c 32 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20  ol2 * tab0.col1 
17850 2d 20 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  - 9 AS col1 FROM
17860 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33   tab0..----..123
17870 0d 0a 32 38 35 33 0d 0a 37 35 34 32 0d 0a 0d 0a  ..2853..7542....
17880 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17890 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
178a0 20 35 34 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63   54 + + col1 * c
178b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
178c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30   cor0..----..120
178d0 37 0d 0a 32 36 33 35 0d 0a 36 36 36 37 0d 0a 0d  7..2635..6667...
178e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
178f0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
17900 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20  * col1 + + col1 
17910 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  * col2 AS col0 F
17920 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
17930 2d 2d 2d 0d 0a 31 31 34 30 0d 0a 32 34 39 36 0d  ---..1140..2496.
17940 0a 32 38 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .2808....query I
17950 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17960 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
17970 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   - + cor0.col1 F
17980 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
17990 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 32 36  ..----..-20..-26
179a0 0d 0a 2d 35 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-52....skipif 
179b0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
179c0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
179d0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
179e0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
179f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17a00 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
17a10 2e 63 6f 6c 32 20 2a 20 33 38 20 2b 20 38 34 20  .col2 * 38 + 84 
17a20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
17a30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
17a40 37 32 0d 0a 31 31 31 30 0d 0a 31 35 32 38 0d 0a  72..1110..1528..
17a50 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
17a60 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
17a70 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
17a80 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
17a90 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
17aa0 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 38 0d 0a  sort label-658..
17ab0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
17ac0 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
17ad0 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 32 20  SIGNED ) * col2 
17ae0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
17af0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
17b00 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
17b10 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
17b20 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
17b30 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
17b40 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
17b50 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
17b60 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
17b70 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
17b80 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 38  owsort label-658
17b90 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
17ba0 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + - CAST ( NULL 
17bb0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63  AS INTEGER ) * c
17bc0 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
17bd0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b1 cor0..----..N
17be0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
17bf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17c00 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
17c10 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63  NCT + - col1 + c
17c20 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  or0.col0 * - col
17c30 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  0 + + cor0.col1 
17c40 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
17c50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a  0..----..-4096..
17c60 2d 36 34 30 30 0d 0a 2d 39 0d 0a 0d 0a 73 6b 69  -6400..-9....ski
17c70 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
17c80 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
17c90 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
17ca0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
17cb0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
17cc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
17cd0 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32 20  STINCT + + col2 
17ce0 2d 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  - col2 col1 FROM
17cf0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
17d00 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ---..0....onlyif
17d10 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
17d20 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
17d30 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
17d40 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
17d50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
17d60 65 6c 2d 36 36 31 0d 0a 53 45 4c 45 43 54 20 43  el-661..SELECT C
17d70 41 53 54 28 20 2d 20 38 38 20 41 53 20 53 49 47  AST( - 88 AS SIG
17d80 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20  NED ) FROM tab2 
17d90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 38 0d  cor0..----..-88.
17da0 0a 2d 38 38 0d 0a 2d 38 38 0d 0a 0d 0a 73 6b 69  .-88..-88....ski
17db0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
17dc0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
17dd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
17de0 6c 2d 36 36 31 0d 0a 53 45 4c 45 43 54 20 43 41  l-661..SELECT CA
17df0 53 54 20 28 20 2d 20 38 38 20 41 53 20 49 4e 54  ST ( - 88 AS INT
17e00 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32  EGER ) FROM tab2
17e10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 38   cor0..----..-88
17e20 0d 0a 2d 38 38 0d 0a 2d 38 38 0d 0a 0d 0a 71 75  ..-88..-88....qu
17e30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17e40 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63  ELECT col0 * - c
17e50 6f 6c 31 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20  ol1 + tab2.col2 
17e60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
17e70 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 35 0d 0a  2..----..-1305..
17e80 2d 31 39 30 0d 0a 2d 34 35 37 36 0d 0a 0d 0a 71  -190..-4576....q
17e90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17ea0 53 45 4c 45 43 54 20 2b 20 2d 20 35 30 20 2a 20  SELECT + - 50 * 
17eb0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
17ec0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 35 30  or0..----..-1550
17ed0 0d 0a 2d 32 39 35 30 0d 0a 2d 38 35 30 0d 0a 0d  ..-2950..-850...
17ee0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17ef0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
17f00 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 33 20 2a  T + col2 + - 3 *
17f10 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 33 36 20 41   - col1 * + 36 A
17f20 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
17f30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17f40 31 38 37 34 0d 0a 33 33 37 35 0d 0a 36 33 39 38  1874..3375..6398
17f50 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
17f60 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
17f70 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
17f80 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
17f90 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
17fa0 36 36 35 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  665..SELECT - + 
17fb0 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 41 53  col1 DIV col1 AS
17fc0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
17fd0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
17fe0 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69  1..-1..-1....ski
17ff0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
18000 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
18010 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
18020 6c 2d 36 36 35 0d 0a 53 45 4c 45 43 54 20 2d 20  l-665..SELECT - 
18030 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 41 53  + col1 / col1 AS
18040 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
18050 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
18060 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65  1..-1..-1....que
18070 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18080 4c 45 43 54 20 2d 20 32 30 20 2b 20 36 32 20 46  LECT - 20 + 62 F
18090 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
180a0 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  S cor0, tab2 AS 
180b0 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63 6f  cor1, tab0 AS co
180c0 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  r2..----..81 val
180d0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
180e0 64 34 39 64 35 66 66 65 35 33 33 65 39 32 63 66  d49d5ffe533e92cf
180f0 30 36 64 39 38 63 62 35 39 61 31 39 62 31 30 0d  06d98cb59a19b10.
18100 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
18110 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
18120 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
18130 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
18140 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
18150 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 37 0d  wsort label-667.
18160 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
18170 6c 32 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  l2 + CAST( NULL 
18180 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
18190 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
181a0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
181b0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
181c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
181d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
181e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36  rowsort label-66
181f0 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  7..SELECT ALL + 
18200 63 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 4e 55  col2 + CAST ( NU
18210 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
18220 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
18230 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
18240 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
18250 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18260 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
18270 6c 31 20 2a 20 28 20 2d 20 36 34 20 29 20 2b 20  l1 * ( - 64 ) + 
18280 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
18290 2d 2d 2d 2d 0d 0a 2d 31 36 36 31 0d 0a 2d 35 37  ----..-1661..-57
182a0 36 0d 0a 2d 37 35 32 0d 0a 0d 0a 71 75 65 72 79  6..-752....query
182b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
182c0 43 54 20 2b 20 63 6f 6c 31 20 2a 20 28 20 28 20  CT + col1 * ( ( 
182d0 2d 20 63 6f 6c 30 20 29 20 2b 20 2d 20 28 20 2d  - col0 ) + - ( -
182e0 20 63 6f 6c 31 20 29 20 29 20 41 53 20 63 6f 6c   col1 ) ) AS col
182f0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
18300 2d 0d 0a 2d 31 30 35 34 0d 0a 2d 31 31 32 31 0d  -..-1054..-1121.
18310 0a 37 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .744....skipif p
18320 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
18330 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
18340 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
18350 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
18360 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18370 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
18380 54 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20  T - col1 - col1 
18390 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
183a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
183b0 30 0d 0a 2d 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 71  0..-26..-52....q
183c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
183d0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
183e0 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 34 37 20  + + col1 * - 47 
183f0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
18400 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 30 0d 0a  0..----..-1450..
18410 2d 32 36 39 35 0d 0a 2d 37 32 30 0d 0a 0d 0a 71  -2695..-720....q
18420 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18430 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
18440 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63  ol2 - + col1 * c
18450 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
18460 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
18470 30 38 0d 0a 2d 36 30 38 0d 0a 2d 38 31 30 0d 0a  08..-608..-810..
18480 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
18490 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
184a0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
184b0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
184c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37  rowsort label-67
184d0 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
184e0 43 54 20 2b 20 38 30 20 2a 20 63 6f 6c 31 20 2b  CT + 80 * col1 +
184f0 20 2b 20 34 37 20 44 49 56 20 2b 20 28 20 2d 20   + 47 DIV + ( - 
18500 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46  col2 ) AS col0 F
18510 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
18520 0d 0a 2d 2d 2d 2d 0d 0a 36 38 37 39 0d 0a 37 32  ..----..6879..72
18530 38 30 0d 0a 37 37 31 33 0d 0a 0d 0a 73 6b 69 70  80..7713....skip
18540 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
18550 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
18560 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
18570 2d 36 37 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -673..SELECT DIS
18580 54 49 4e 43 54 20 2b 20 38 30 20 2a 20 63 6f 6c  TINCT + 80 * col
18590 31 20 2b 20 2b 20 34 37 20 2f 20 2b 20 28 20 2d  1 + + 47 / + ( -
185a0 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
185b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
185c0 30 0d 0a 2d 2d 2d 2d 0d 0a 36 38 37 39 0d 0a 37  0..----..6879..7
185d0 32 38 30 0d 0a 37 37 31 33 0d 0a 0d 0a 71 75 65  280..7713....que
185e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
185f0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
18600 2a 20 63 6f 6c 31 20 2d 20 31 39 20 41 53 20 63  * col1 - 19 AS c
18610 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
18620 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
18630 35 33 0d 0a 2d 36 36 35 0d 0a 2d 38 35 36 0d 0a  53..-665..-856..
18640 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18650 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
18660 28 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 29 20  ( + tab2.col1 ) 
18670 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
18680 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a  ..----..55..58..
18690 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
186a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
186b0 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  col1 + col0 + co
186c0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
186d0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  tab0..----..24..
186e0 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20  35..89....query 
186f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18700 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32 36 20  T DISTINCT + 26 
18710 2d 20 2d 20 38 36 20 46 52 4f 4d 20 74 61 62 30  - - 86 FROM tab0
18720 2c 20 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62  , tab1 cor0, tab
18730 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
18740 0a 31 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .112....query I 
18750 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18760 44 49 53 54 49 4e 43 54 20 2b 20 28 20 63 6f 6c  DISTINCT + ( col
18770 30 20 2a 20 63 6f 6c 31 20 29 20 2b 20 74 61 62  0 * col1 ) + tab
18780 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2.col2 FROM tab2
18790 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34  ..----..1381..24
187a0 34 0d 0a 34 36 32 38 0d 0a 0d 0a 71 75 65 72 79  4..4628....query
187b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
187c0 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b  CT col1 * col0 +
187d0 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 30   ( col2 ) * col0
187e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
187f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 30 0d 0a 34  r0..----..240..4
18800 32 38 38 0d 0a 38 37 32 30 0d 0a 0d 0a 71 75 65  288..8720....que
18810 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18820 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c  LECT ALL + - col
18830 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  0 + - col1 * col
18840 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
18850 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 38  or0..----..-1328
18860 0d 0a 2d 31 34 30 37 0d 0a 2d 36 33 34 0d 0a 0d  ..-1407..-634...
18870 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18880 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63  ..SELECT + ( - c
18890 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20 41 53 20  ol2 ) + col1 AS 
188a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
188b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33  S cor0..----..53
188c0 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69  ..9..96....skipi
188d0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
188e0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
188f0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
18900 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
18910 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
18920 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
18930 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 63 6f  col0 + - col0 co
18940 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
18950 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 38  cor0..----..-178
18960 0d 0a 2d 34 38 0d 0a 2d 37 30 0d 0a 0d 0a 71 75  ..-48..-70....qu
18970 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18980 45 4c 45 43 54 20 41 4c 4c 20 2b 20 36 31 20 2b  ELECT ALL + 61 +
18990 20 2b 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63   + ( col1 ) AS c
189a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
189b0 2d 2d 2d 0d 0a 31 34 37 0d 0a 31 35 32 0d 0a 31  ---..147..152..1
189c0 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
189d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
189e0 53 54 49 4e 43 54 20 28 20 63 6f 72 30 2e 63 6f  STINCT ( cor0.co
189f0 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  l1 ) * - col2 + 
18a00 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  col2 + col1 * co
18a10 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
18a20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
18a30 2d 2d 0d 0a 2d 37 34 31 0d 0a 33 32 39 39 0d 0a  --..-741..3299..
18a40 37 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  719....query I r
18a50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
18a60 4c 4c 20 34 33 20 2a 20 33 32 20 41 53 20 63 6f  LL 43 * 32 AS co
18a70 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
18a80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 36  cor0..----..1376
18a90 0d 0a 31 33 37 36 0d 0a 31 33 37 36 0d 0a 0d 0a  ..1376..1376....
18aa0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18ab0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28 20 63 6f  .SELECT + + ( co
18ac0 72 30 2e 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 32  r0.col1 ) + col2
18ad0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
18ae0 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d  .----..119..173.
18af0 0a 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .98....onlyif my
18b00 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
18b10 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
18b20 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
18b30 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
18b40 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
18b50 36 38 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  687..SELECT DIST
18b60 49 4e 43 54 20 2b 20 2d 20 43 41 53 54 28 20 4e  INCT + - CAST( N
18b70 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
18b80 20 2f 20 2b 20 36 39 20 2b 20 2b 20 63 6f 6c 31   / + 69 + + col1
18b90 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
18ba0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
18bb0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
18bc0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
18bd0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
18be0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
18bf0 38 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  87..SELECT DISTI
18c00 4e 43 54 20 2b 20 2d 20 43 41 53 54 20 28 20 4e  NCT + - CAST ( N
18c10 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2f 20  ULL AS REAL ) / 
18c20 2b 20 36 39 20 2b 20 2b 20 63 6f 6c 31 20 41 53  + 69 + + col1 AS
18c30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
18c40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
18c50 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
18c60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
18c70 49 53 54 49 4e 43 54 20 2b 20 33 20 2a 20 63 6f  ISTINCT + 3 * co
18c80 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41  l1 + cor0.col1 A
18c90 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
18ca0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18cb0 31 32 34 0d 0a 32 33 36 0d 0a 36 38 0d 0a 0d 0a  124..236..68....
18cc0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
18cd0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
18ce0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
18cf0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
18d00 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
18d10 72 74 20 6c 61 62 65 6c 2d 36 38 39 0d 0a 53 45  rt label-689..SE
18d20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
18d30 32 35 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  25 * col0 + + co
18d40 6c 32 20 2a 20 43 41 53 54 28 20 2d 20 32 35 20  l2 * CAST( - 25 
18d50 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20  AS SIGNED ) * - 
18d60 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
18d70 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
18d80 2d 2d 2d 2d 0d 0a 31 35 35 30 0d 0a 31 38 34 33  ----..1550..1843
18d90 32 35 0d 0a 37 30 33 35 30 0d 0a 0d 0a 73 6b 69  25..70350....ski
18da0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
18db0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
18dc0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
18dd0 6c 2d 36 38 39 0d 0a 53 45 4c 45 43 54 20 44 49  l-689..SELECT DI
18de0 53 54 49 4e 43 54 20 2d 20 32 35 20 2a 20 63 6f  STINCT - 25 * co
18df0 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 43 41  l0 + + col2 * CA
18e00 53 54 20 28 20 2d 20 32 35 20 41 53 20 49 4e 54  ST ( - 25 AS INT
18e10 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 31 20  EGER ) * - col1 
18e20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
18e30 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
18e40 0a 31 35 35 30 0d 0a 31 38 34 33 32 35 0d 0a 37  .1550..184325..7
18e50 30 33 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0350....query I 
18e60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18e70 41 4c 4c 20 28 20 2d 20 28 20 63 6f 72 30 2e 63  ALL ( - ( cor0.c
18e80 6f 6c 31 20 29 20 29 20 41 53 20 63 6f 6c 32 20  ol1 ) ) AS col2 
18e90 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
18ea0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39  0..----..-86..-9
18eb0 31 0d 0a 2d 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  1..-97....onlyif
18ec0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
18ed0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
18ee0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
18ef0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
18f00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18f10 65 6c 2d 36 39 31 0d 0a 53 45 4c 45 43 54 20 44  el-691..SELECT D
18f20 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 32 20  ISTINCT CAST( 2 
18f30 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
18f40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
18f50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a   cor0..----..2..
18f60 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
18f70 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
18f80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18f90 20 6c 61 62 65 6c 2d 36 39 31 0d 0a 53 45 4c 45   label-691..SELE
18fa0 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54  CT DISTINCT CAST
18fb0 20 28 20 32 20 41 53 20 49 4e 54 45 47 45 52 20   ( 2 AS INTEGER 
18fc0 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
18fd0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
18fe0 2d 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..2....query I 
18ff0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19000 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  ALL - col1 * - c
19010 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 + col1 FROM 
19020 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
19030 2d 2d 0d 0a 31 30 34 0d 0a 31 30 35 33 0d 0a 36  --..104..1053..6
19040 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  50....query I ro
19050 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
19060 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 39 33  l2 + - col1 * 93
19070 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
19080 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
19090 0d 0a 2d 31 35 34 33 0d 0a 2d 32 38 35 36 0d 0a  ..-1543..-2856..
190a0 2d 35 34 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -5461....query I
190b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
190c0 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32   + + col0 * col2
190d0 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30   + + col2 * cor0
190e0 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20  .col0 FROM tab0 
190f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
19100 34 35 39 36 0d 0a 31 35 38 34 0d 0a 37 30 0d 0a  4596..1584..70..
19110 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
19120 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
19130 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
19140 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
19150 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
19160 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 35 0d 0a  sort label-695..
19170 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c  SELECT + ( + col
19180 30 20 29 20 2b 20 2d 20 43 41 53 54 28 20 4e 55  0 ) + - CAST( NU
19190 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  LL AS SIGNED ) *
191a0 20 32 39 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20   29 * col2 FROM 
191b0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
191c0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
191d0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
191e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
191f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
19200 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 35  owsort label-695
19210 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63  ..SELECT + ( + c
19220 6f 6c 30 20 29 20 2b 20 2d 20 43 41 53 54 20 28  ol0 ) + - CAST (
19230 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
19240 20 29 20 2a 20 32 39 20 2a 20 63 6f 6c 32 20 46   ) * 29 * col2 F
19250 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
19260 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
19270 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
19280 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
19290 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
192a0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
192b0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
192c0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
192d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
192e0 20 33 33 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   33 col0 FROM ta
192f0 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
19300 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
19310 20 68 61 73 68 69 6e 67 20 74 6f 20 36 32 30 64   hashing to 620d
19320 33 38 34 32 38 36 65 38 32 64 31 63 36 63 38 62  384286e82d1c6c8b
19330 31 62 32 62 31 30 39 61 37 64 61 35 0d 0a 0d 0a  1b2b109a7da5....
19340 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
19350 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
19360 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
19370 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
19380 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 37 0d  wsort label-697.
19390 0a 53 45 4c 45 43 54 20 2d 20 35 30 20 44 49 56  .SELECT - 50 DIV
193a0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
193b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
193c0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
193d0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
193e0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
193f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19400 20 6c 61 62 65 6c 2d 36 39 37 0d 0a 53 45 4c 45   label-697..SELE
19410 43 54 20 2d 20 35 30 20 2f 20 63 6f 6c 32 20 41  CT - 50 / col2 A
19420 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
19430 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19440 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69  0..0..0....onlyi
19450 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
19460 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
19470 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
19480 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19490 20 6c 61 62 65 6c 2d 36 39 38 0d 0a 53 45 4c 45   label-698..SELE
194a0 43 54 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f  CT col2 DIV - co
194b0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
194c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
194d0 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a  --..-1..0..0....
194e0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
194f0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
19500 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
19510 61 62 65 6c 2d 36 39 38 0d 0a 53 45 4c 45 43 54  abel-698..SELECT
19520 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 41   col2 / - col0 A
19530 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
19540 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19550 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  -1..0..0....only
19560 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
19570 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
19580 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
19590 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
195a0 74 20 6c 61 62 65 6c 2d 36 39 39 0d 0a 53 45 4c  t label-699..SEL
195b0 45 43 54 20 2d 20 2d 20 33 20 44 49 56 20 63 6f  ECT - - 3 DIV co
195c0 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  r0.col2 AS col2 
195d0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
195e0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 33  0..----..0..0..3
195f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
19600 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
19610 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
19620 72 74 20 6c 61 62 65 6c 2d 36 39 39 0d 0a 53 45  rt label-699..SE
19630 4c 45 43 54 20 2d 20 2d 20 33 20 2f 20 63 6f 72  LECT - - 3 / cor
19640 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  0.col2 AS col2 F
19650 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
19660 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 33 0d  ..----..0..0..3.
19670 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
19680 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
19690 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
196a0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
196b0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
196c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
196d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
196e0 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 63   col2 + - col2 c
196f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
19700 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
19710 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19720 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
19730 43 54 20 2d 20 28 20 63 6f 72 31 2e 63 6f 6c 30  CT - ( cor1.col0
19740 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
19750 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
19760 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
19770 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d  ..----..-3..-64.
19780 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-80....onlyif m
19790 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
197a0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
197b0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
197c0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
197d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
197e0 2d 37 30 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  -702..SELECT DIS
197f0 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d  TINCT - col2 * -
19800 20 43 41 53 54 28 20 2d 20 32 37 20 2b 20 63 6f   CAST( - 27 + co
19810 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l1 AS SIGNED ) *
19820 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
19830 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
19840 0a 34 33 30 33 33 36 0d 0a 36 34 32 35 31 0d 0a  .430336..64251..
19850 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  70....skipif mys
19860 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
19870 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
19880 73 6f 72 74 20 6c 61 62 65 6c 2d 37 30 32 0d 0a  sort label-702..
19890 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
198a0 2d 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 20  - col2 * - CAST 
198b0 28 20 2d 20 32 37 20 2b 20 63 6f 6c 31 20 41 53  ( - 27 + col1 AS
198c0 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63   INTEGER ) * + c
198d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
198e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33 30   cor0..----..430
198f0 33 33 36 0d 0a 36 34 32 35 31 0d 0a 37 30 0d 0a  336..64251..70..
19900 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19910 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
19920 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  CT + col2 + + co
19930 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
19940 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
19950 0a 35 32 0d 0a 35 34 0d 0a 37 36 0d 0a 0d 0a 6f  .52..54..76....o
19960 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
19970 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
19980 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
19990 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
199a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
199b0 74 20 6c 61 62 65 6c 2d 37 30 34 0d 0a 53 45 4c  t label-704..SEL
199c0 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 43  ECT + col1 + + C
199d0 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47  AST( col2 AS SIG
199e0 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52  NED ) AS col2 FR
199f0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab2..----..5
19a00 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 73 6b 69  5..58..85....ski
19a10 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
19a20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
19a30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
19a40 6c 2d 37 30 34 0d 0a 53 45 4c 45 43 54 20 2b 20  l-704..SELECT + 
19a50 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 20 28 20  col1 + + CAST ( 
19a60 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
19a70 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
19a80 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35  ab2..----..55..5
19a90 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  8..85....query I
19aa0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19ab0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
19ac0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b   + cor0.col2 * +
19ad0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
19ae0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
19af0 2d 2d 0d 0a 31 37 35 37 36 0d 0a 31 39 36 38 33  --..17576..19683
19b00 0d 0a 35 34 38 37 32 0d 0a 0d 0a 71 75 65 72 79  ..54872....query
19b10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19b20 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
19b30 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 36 38  l0 * + col0 + 68
19b40 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
19b50 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
19b60 0a 2d 32 32 30 0d 0a 31 32 38 0d 0a 33 36 36 33  .-220..128..3663
19b70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19b80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
19b90 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  col2 + col1 * - 
19ba0 63 6f 6c 31 20 2b 20 2b 20 37 38 20 2a 20 2d 20  col1 + + 78 * - 
19bb0 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
19bc0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
19bd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 39  or0..----..-1459
19be0 35 0d 0a 2d 39 34 38 36 0d 0a 2d 39 39 33 37 0d  5..-9486..-9937.
19bf0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
19c00 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
19c10 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
19c20 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
19c30 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
19c40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19c50 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  ECT col2 + - col
19c60 30 20 2d 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20  0 - - col0 col1 
19c70 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
19c80 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a  0..----..1..33..
19c90 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
19ca0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
19cb0 28 20 28 20 2d 20 63 6f 6c 30 20 29 20 29 20 2b  ( ( - col0 ) ) +
19cc0 20 28 20 2b 20 31 35 20 29 20 2b 20 2d 20 63 6f   ( + 15 ) + - co
19cd0 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  l2 * col1 * col0
19ce0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
19cf0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 37 31  r0..----..-11971
19d00 35 0d 0a 2d 35 31 30 39 38 0d 0a 2d 35 38 35 31  5..-51098..-5851
19d10 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
19d20 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
19d30 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
19d40 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
19d50 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
19d60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19d70 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  LECT cor0.col1 *
19d80 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 63   - col2 - col0 c
19d90 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
19da0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
19db0 31 32 0d 0a 2d 37 32 35 0d 0a 2d 38 34 34 0d 0a  12..-725..-844..
19dc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19dd0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
19de0 20 2b 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f   + + col0 - - co
19df0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
19e00 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
19e10 2d 2d 0d 0a 32 31 0d 0a 32 33 34 0d 0a 32 33 37  --..21..234..237
19e20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19e30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
19e40 2d 20 31 33 20 29 20 41 53 20 63 6f 6c 31 20 46  - 13 ) AS col1 F
19e50 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
19e60 2d 2d 2d 0d 0a 31 33 0d 0a 31 33 0d 0a 31 33 0d  ---..13..13..13.
19e70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19e80 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39 39 20  rt..SELECT - 99 
19e90 2b 20 2d 20 38 36 20 2d 20 63 6f 6c 30 20 2a 20  + - 86 - col0 * 
19ea0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
19eb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19ec0 2d 32 32 31 33 0d 0a 2d 33 31 38 37 0d 0a 2d 33  -2213..-3187..-3
19ed0 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
19ee0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
19ef0 53 54 49 4e 43 54 20 37 37 20 2a 20 2d 20 28 20  STINCT 77 * - ( 
19f00 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46 52  + cor0.col0 ) FR
19f10 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  OM tab2, tab0 AS
19f20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
19f30 34 38 0d 0a 2d 32 36 39 35 0d 0a 2d 36 38 35 33  48..-2695..-6853
19f40 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
19f50 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
19f60 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
19f70 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
19f80 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
19f90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 31 35  owsort label-715
19fa0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
19fb0 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  T CAST( NULL AS 
19fc0 44 45 43 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c  DECIMAL ) AS col
19fd0 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
19fe0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
19ff0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
1a000 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1a010 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1a020 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 31  rowsort label-71
1a030 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
1a040 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  CT CAST ( NULL A
1a050 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 30  S REAL ) AS col0
1a060 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
1a070 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1a080 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
1a090 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a0a0 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
1a0b0 2d 20 63 6f 6c 32 20 2d 20 2d 20 74 61 62 31 2e  - col2 - - tab1.
1a0c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
1a0d0 2d 2d 2d 2d 0d 0a 2d 32 38 39 30 0d 0a 2d 33 32  ----..-2890..-32
1a0e0 33 39 0d 0a 2d 39 32 30 33 0d 0a 0d 0a 71 75 65  39..-9203....que
1a0f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a100 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 31 20  LECT DISTINCT 1 
1a110 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
1a120 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1a130 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a140 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 39 20 41  ort..SELECT 99 A
1a150 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1a160 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
1a170 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
1a180 61 73 68 69 6e 67 20 74 6f 20 34 62 37 37 34 36  ashing to 4b7746
1a190 37 64 64 35 66 33 34 36 31 30 39 64 32 39 66 36  7dd5f346109d29f6
1a1a0 33 36 34 61 37 62 62 38 64 62 0d 0a 0d 0a 71 75  364a7bb8db....qu
1a1b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a1c0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b  ELECT ALL col2 +
1a1d0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   + col0 * - col2
1a1e0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1a1f0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d  b0..----..-34..-
1a200 37 32 31 36 0d 0a 2d 37 35 39 0d 0a 0d 0a 71 75  7216..-759....qu
1a210 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a220 45 4c 45 43 54 20 28 20 63 6f 6c 31 20 29 20 2b  ELECT ( col1 ) +
1a230 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
1a240 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1a250 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36  0..----..-54..-6
1a260 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49  7..23....query I
1a270 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a280 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20   - tab1.col1 AS 
1a290 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
1a2a0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1a2b0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
1a2c0 67 20 74 6f 20 62 32 33 34 37 39 38 64 34 37 30  g to b234798d470
1a2d0 36 33 31 34 62 61 31 34 65 61 61 64 35 33 39 64  6314ba14eaad539d
1a2e0 30 61 61 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  0aa88....onlyif 
1a2f0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1a300 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1a310 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1a320 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1a330 61 62 65 6c 2d 37 32 32 0d 0a 53 45 4c 45 43 54  abel-722..SELECT
1a340 20 38 39 20 2a 20 63 6f 6c 30 20 44 49 56 20 63   89 * col0 DIV c
1a350 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
1a360 2d 2d 2d 0d 0a 38 39 0d 0a 38 39 0d 0a 38 39 0d  ---..89..89..89.
1a370 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1a380 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1a390 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a3a0 74 20 6c 61 62 65 6c 2d 37 32 32 0d 0a 53 45 4c  t label-722..SEL
1a3b0 45 43 54 20 38 39 20 2a 20 63 6f 6c 30 20 2f 20  ECT 89 * col0 / 
1a3c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
1a3d0 2d 2d 2d 2d 0d 0a 38 39 0d 0a 38 39 0d 0a 38 39  ----..89..89..89
1a3e0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1a3f0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1a400 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1a410 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1a420 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a430 37 32 33 0d 0a 53 45 4c 45 43 54 20 2b 20 35 34  723..SELECT + 54
1a440 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   DIV - cor0.col2
1a450 20 2b 20 2b 20 33 38 20 2a 20 2b 20 63 6f 6c 31   + + 38 * + col1
1a460 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1a470 0a 2d 2d 2d 2d 0d 0a 33 32 36 37 0d 0a 33 34 35  .----..3267..345
1a480 38 0d 0a 33 36 33 32 0d 0a 0d 0a 73 6b 69 70 69  8..3632....skipi
1a490 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1a4a0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1a4b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a4c0 37 32 33 0d 0a 53 45 4c 45 43 54 20 2b 20 35 34  723..SELECT + 54
1a4d0 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   / - cor0.col2 +
1a4e0 20 2b 20 33 38 20 2a 20 2b 20 63 6f 6c 31 20 46   + 38 * + col1 F
1a4f0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
1a500 2d 2d 2d 0d 0a 33 32 36 37 0d 0a 33 34 35 38 0d  ---..3267..3458.
1a510 0a 33 36 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .3632....query I
1a520 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a530 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + - col1 * + co
1a540 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 37 30 20 2d  r0.col2 * - 70 -
1a550 20 36 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53   63 FROM tab1 AS
1a560 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 38   cor0..----..398
1a570 33 37 0d 0a 38 37 32 39 37 0d 0a 39 38 32 31 37  37..87297..98217
1a580 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a590 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1a5a0 49 4e 43 54 20 2b 20 28 20 63 6f 6c 31 20 29 20  INCT + ( col1 ) 
1a5b0 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  - - col1 FROM ta
1a5c0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
1a5d0 31 38 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71 75  18..34..62....qu
1a5e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a5f0 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63  ELECT col2 * - c
1a600 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 + - col0 AS 
1a610 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1a620 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1a630 33 32 38 0d 0a 2d 31 34 30 37 0d 0a 2d 36 33 34  328..-1407..-634
1a640 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1a650 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1a660 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1a670 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1a680 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1a690 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a6a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1a6b0 39 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  91 col1 FROM tab
1a6c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1a6d0 0a 2d 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-91....query I 
1a6e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a6f0 39 38 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 32  98 * - tab2.col2
1a700 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1a710 0d 0a 2d 32 35 34 38 0d 0a 2d 32 36 34 36 0d 0a  ..-2548..-2646..
1a720 2d 33 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -3724....query I
1a730 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a740 20 2d 20 35 39 20 41 53 20 63 6f 6c 31 20 46 52   - 59 AS col1 FR
1a750 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
1a760 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
1a770 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1a780 20 31 65 36 35 33 37 63 39 32 32 66 61 39 35 33   1e6537c922fa953
1a790 65 30 66 64 32 66 35 39 34 33 30 38 30 33 37 30  e0fd2f5943080370
1a7a0 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
1a7b0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1a7c0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1a7d0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1a7e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1a7f0 2d 37 33 30 0d 0a 53 45 4c 45 43 54 20 32 33 20  -730..SELECT 23 
1a800 44 49 56 20 31 33 20 46 52 4f 4d 20 74 61 62 31  DIV 13 FROM tab1
1a810 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
1a820 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1a830 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1a840 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a850 74 20 6c 61 62 65 6c 2d 37 33 30 0d 0a 53 45 4c  t label-730..SEL
1a860 45 43 54 20 32 33 20 2f 20 31 33 20 46 52 4f 4d  ECT 23 / 13 FROM
1a870 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab1..----..1..
1a880 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..1....query I 
1a890 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a8a0 41 4c 4c 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 33  ALL - col1 - - 3
1a8b0 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  8 AS col0 FROM t
1a8c0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a  ab2..----..-21..
1a8d0 32 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49  21..7....query I
1a8e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a8f0 20 2d 20 2d 20 36 39 20 2a 20 63 6f 6c 31 20 46   - - 69 * col1 F
1a900 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
1a910 2d 2d 2d 0d 0a 31 37 39 34 0d 0a 36 39 30 0d 0a  ---..1794..690..
1a920 38 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  897....onlyif my
1a930 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
1a940 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
1a950 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
1a960 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
1a970 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a980 37 33 33 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41  733..SELECT - CA
1a990 53 54 28 20 2d 20 63 6f 6c 32 20 41 53 20 53 49  ST( - col2 AS SI
1a9a0 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46  GNED ) AS col0 F
1a9b0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1a9c0 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69  1..33..82....ski
1a9d0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1a9e0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1a9f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1aa00 6c 2d 37 33 33 0d 0a 53 45 4c 45 43 54 20 2d 20  l-733..SELECT - 
1aa10 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 41 53  CAST ( - col2 AS
1aa20 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
1aa30 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
1aa40 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d  --..1..33..82...
1aa50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1aa60 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
1aa70 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  * - col1 + col0 
1aa80 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1aa90 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  1 cor0..----..16
1aaa0 34 0d 0a 32 34 39 0d 0a 36 37 39 0d 0a 0d 0a 71  4..249..679....q
1aab0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1aac0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 36 34 20  SELECT ALL - 64 
1aad0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1aae0 30 2c 20 74 61 62 32 20 63 6f 72 30 2c 20 74 61  0, tab2 cor0, ta
1aaf0 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
1ab00 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
1ab10 69 6e 67 20 74 6f 20 31 30 30 63 36 32 35 65 34  ing to 100c625e4
1ab20 35 37 31 35 63 32 30 33 36 38 35 35 31 39 38 39  5715c20368551989
1ab30 35 31 34 62 61 36 34 0d 0a 0d 0a 71 75 65 72 79  514ba64....query
1ab40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ab50 43 54 20 2b 20 33 34 20 46 52 4f 4d 20 74 61 62  CT + 34 FROM tab
1ab60 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  1, tab1 AS cor0.
1ab70 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
1ab80 68 61 73 68 69 6e 67 20 74 6f 20 31 31 34 36 64  hashing to 1146d
1ab90 31 35 39 66 30 62 39 62 34 33 37 38 61 38 62 37  159f0b9b4378a8b7
1aba0 33 38 62 39 36 33 66 37 30 33 39 0d 0a 0d 0a 6f  38b963f7039....o
1abb0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1abc0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1abd0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1abe0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1abf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ac00 74 20 6c 61 62 65 6c 2d 37 33 37 0d 0a 53 45 4c  t label-737..SEL
1ac10 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 43  ECT - col2 * - C
1ac20 41 53 54 28 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  AST( col2 + - co
1ac30 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  l2 AS SIGNED ) A
1ac40 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
1ac50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
1ac60 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
1ac70 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1ac80 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1ac90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 33 37  owsort label-737
1aca0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
1acb0 2a 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 32 20  * - CAST ( col2 
1acc0 2b 20 2d 20 63 6f 6c 32 20 41 53 20 49 4e 54 45  + - col2 AS INTE
1acd0 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52  GER ) AS col1 FR
1ace0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
1acf0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
1ad00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ad10 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20  SELECT + - col0 
1ad20 2a 20 35 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  * 50 AS col1 FRO
1ad30 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
1ad40 2d 0d 0a 2d 31 35 30 0d 0a 2d 33 32 30 30 0d 0a  -..-150..-3200..
1ad50 2d 34 30 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -4000....query I
1ad60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ad70 20 41 4c 4c 20 2d 20 2b 20 36 32 20 2b 20 2d 20   ALL - + 62 + - 
1ad80 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53  col1 * - col0 AS
1ad90 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1ada0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 31  cor0..----..1281
1adb0 0d 0a 31 35 35 0d 0a 34 35 34 30 0d 0a 0d 0a 71  ..155..4540....q
1adc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1add0 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 30 20  SELECT - ( col0 
1ade0 29 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 32 20 2b  ) + - ( + col2 +
1adf0 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   + col1 ) FROM t
1ae00 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1ae10 2d 0d 0a 2d 31 33 34 0d 0a 2d 31 36 33 0d 0a 2d  -..-134..-163..-
1ae20 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  65....query I ro
1ae30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1ae40 4c 20 2b 20 39 37 20 2d 20 63 6f 6c 30 20 46 52  L + 97 - col0 FR
1ae50 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1ae60 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 31 39 0d 0a 39  .----..18..19..9
1ae70 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1ae80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1ae90 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d   - cor0.col1 * -
1aea0 20 28 20 35 36 20 29 20 2b 20 2d 20 63 6f 6c 32   ( 56 ) + - col2
1aeb0 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   * col1 AS col1 
1aec0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1aed0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 36 36 0d 0a  0..----..-2366..
1aee0 31 39 37 38 0d 0a 35 33 33 35 0d 0a 0d 0a 71 75  1978..5335....qu
1aef0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1af00 45 4c 45 43 54 20 39 31 20 2b 20 2b 20 63 6f 6c  ELECT 91 + + col
1af10 31 20 2b 20 2d 20 35 38 20 2a 20 2d 20 63 6f 6c  1 + - 58 * - col
1af20 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
1af30 2d 0d 0a 34 36 37 34 0d 0a 34 36 39 30 0d 0a 35  -..4674..4690..5
1af40 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  28....onlyif mys
1af50 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1af60 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1af70 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1af80 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1af90 6c 2d 37 34 34 0d 0a 53 45 4c 45 43 54 20 2b 20  l-744..SELECT + 
1afa0 63 6f 6c 30 20 44 49 56 20 33 30 20 63 6f 6c 30  col0 DIV 30 col0
1afb0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1afc0 0d 0a 30 0d 0a 32 0d 0a 32 0d 0a 0d 0a 73 6b 69  ..0..2..2....ski
1afd0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1afe0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1aff0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1b000 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1b010 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
1b020 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1b030 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1b040 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 34 0d 0a  sort label-744..
1b050 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20  SELECT + col0 / 
1b060 33 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  30 col0 FROM tab
1b070 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 32  1..----..0..2..2
1b080 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1b090 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1b0a0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1b0b0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1b0c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b0d0 37 34 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  745..SELECT col0
1b0e0 20 2a 20 33 35 20 44 49 56 20 31 36 20 41 53 20   * 35 DIV 16 AS 
1b0f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
1b100 2d 2d 2d 2d 0d 0a 31 34 30 0d 0a 31 37 35 0d 0a  ----..140..175..
1b110 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
1b120 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1b130 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1b140 6f 72 74 20 6c 61 62 65 6c 2d 37 34 35 0d 0a 53  ort label-745..S
1b150 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 33 35 20  ELECT col0 * 35 
1b160 2f 20 31 36 20 41 53 20 63 6f 6c 32 20 46 52 4f  / 16 AS col2 FRO
1b170 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34  M tab1..----..14
1b180 30 0d 0a 31 37 35 0d 0a 36 0d 0a 0d 0a 71 75 65  0..175..6....que
1b190 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b1a0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  LECT - col0 * - 
1b1b0 38 35 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  85 FROM tab2..--
1b1c0 2d 2d 0d 0a 35 39 35 0d 0a 36 36 33 30 0d 0a 36  --..595..6630..6
1b1d0 37 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  715....query I r
1b1e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1b1f0 20 2d 20 31 37 20 2a 20 63 6f 6c 31 20 46 52 4f   - 17 * col1 FRO
1b200 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1b210 2d 2d 2d 2d 0d 0a 2d 31 37 30 0d 0a 2d 32 32 31  ----..-170..-221
1b220 0d 0a 2d 34 34 32 0d 0a 0d 0a 71 75 65 72 79 20  ..-442....query 
1b230 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b240 54 20 41 4c 4c 20 2d 20 2b 20 35 38 20 2a 20 63  T ALL - + 58 * c
1b250 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
1b260 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1b270 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 31 35 36  ---..-1508..-156
1b280 36 0d 0a 2d 32 32 30 34 0d 0a 0d 0a 6f 6e 6c 79  6..-2204....only
1b290 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1b2a0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1b2b0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1b2c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b2d0 74 20 6c 61 62 65 6c 2d 37 34 39 0d 0a 53 45 4c  t label-749..SEL
1b2e0 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 28 20 63  ECT + col0 * ( c
1b2f0 6f 6c 31 20 29 20 44 49 56 20 63 6f 6c 30 20 46  ol1 ) DIV col0 F
1b300 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1b310 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a  ..----..17..31..
1b320 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  59....skipif mys
1b330 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1b340 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1b350 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 39 0d 0a  sort label-749..
1b360 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
1b370 28 20 63 6f 6c 31 20 29 20 2f 20 63 6f 6c 30 20  ( col1 ) / col0 
1b380 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1b390 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d  0..----..17..31.
1b3a0 0a 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .59....onlyif my
1b3b0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
1b3c0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
1b3d0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
1b3e0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
1b3f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b400 37 35 30 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41  750..SELECT + CA
1b410 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
1b420 45 44 20 29 20 2d 20 2d 20 63 6f 6c 32 20 46 52  ED ) - - col2 FR
1b430 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
1b440 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
1b450 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
1b460 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1b470 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1b480 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35 30  owsort label-750
1b490 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20  ..SELECT + CAST 
1b4a0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
1b4b0 52 20 29 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f  R ) - - col2 FRO
1b4c0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
1b4d0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
1b4e0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ULL....skipif po
1b4f0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1b500 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1b510 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1b520 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1b530 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b540 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
1b550 36 38 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 32 20  68 * - ( + col2 
1b560 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  ) col1 FROM tab2
1b570 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1b580 2d 31 37 36 38 0d 0a 2d 31 38 33 36 0d 0a 2d 32  -1768..-1836..-2
1b590 35 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  584....onlyif my
1b5a0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1b5b0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1b5c0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1b5d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1b5e0 65 6c 2d 37 35 32 0d 0a 53 45 4c 45 43 54 20 63  el-752..SELECT c
1b5f0 6f 6c 31 20 2a 20 38 31 20 2d 20 38 30 20 44 49  ol1 * 81 - 80 DI
1b600 56 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52  V + col1 col1 FR
1b610 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
1b620 30 34 37 0d 0a 32 31 30 33 0d 0a 38 30 32 0d 0a  047..2103..802..
1b630 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1b640 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1b650 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1b660 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1b670 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
1b680 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1b690 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1b6a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b6b0 37 35 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  752..SELECT col1
1b6c0 20 2a 20 38 31 20 2d 20 38 30 20 2f 20 2b 20 63   * 81 - 80 / + c
1b6d0 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
1b6e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 37 0d 0a  b1..----..1047..
1b6f0 32 31 30 33 0d 0a 38 30 32 0d 0a 0d 0a 71 75 65  2103..802....que
1b700 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b710 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1b720 36 36 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  66 FROM tab0, ta
1b730 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1b740 0d 0a 2d 36 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-66....onlyif 
1b750 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1b760 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1b770 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1b780 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b790 61 62 65 6c 2d 37 35 34 0d 0a 53 45 4c 45 43 54  abel-754..SELECT
1b7a0 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2d   - tab2.col0 * -
1b7b0 20 43 41 53 54 28 20 38 36 20 41 53 20 53 49 47   CAST( 86 AS SIG
1b7c0 4e 45 44 20 29 20 2d 20 2b 20 63 6f 6c 30 20 44  NED ) - + col0 D
1b7d0 49 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  IV + col0 FROM t
1b7e0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 30 31 0d 0a  ab2..----..601..
1b7f0 36 37 30 37 0d 0a 36 37 39 33 0d 0a 0d 0a 73 6b  6707..6793....sk
1b800 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1b810 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1b820 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1b830 65 6c 2d 37 35 34 0d 0a 53 45 4c 45 43 54 20 2d  el-754..SELECT -
1b840 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2d 20 43   tab2.col0 * - C
1b850 41 53 54 20 28 20 38 36 20 41 53 20 49 4e 54 45  AST ( 86 AS INTE
1b860 47 45 52 20 29 20 2d 20 2b 20 63 6f 6c 30 20 2f  GER ) - + col0 /
1b870 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
1b880 32 0d 0a 2d 2d 2d 2d 0d 0a 36 30 31 0d 0a 36 37  2..----..601..67
1b890 30 37 0d 0a 36 37 39 33 0d 0a 0d 0a 71 75 65 72  07..6793....quer
1b8a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1b8b0 45 43 54 20 2b 20 28 20 34 34 20 2a 20 2b 20 63  ECT + ( 44 * + c
1b8c0 6f 6c 30 20 29 20 2b 20 34 37 20 2b 20 63 6f 6c  ol0 ) + 47 + col
1b8d0 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  0 * - col0 AS co
1b8e0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
1b8f0 2d 2d 0d 0a 2d 32 36 30 35 0d 0a 2d 32 37 31 38  --..-2605..-2718
1b900 0d 0a 33 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..306....query I
1b910 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b920 20 41 4c 4c 20 2d 20 38 30 20 2b 20 2d 20 39 32   ALL - 80 + - 92
1b930 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1b940 0d 0a 2d 31 37 32 0d 0a 2d 31 37 32 0d 0a 2d 31  ..-172..-172..-1
1b950 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  72....query I ro
1b960 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1b970 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 28 20  cor0.col0 * - ( 
1b980 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31  col1 ) FROM tab1
1b990 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1b9a0 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d  1040..640..78...
1b9b0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1b9c0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1b9d0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1b9e0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1b9f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35 38  owsort label-758
1ba00 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20  ..SELECT col2 - 
1ba10 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2d 20  cor0.col2 DIV - 
1ba20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
1ba30 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1ba40 2d 0d 0a 31 0d 0a 33 34 0d 0a 38 32 0d 0a 0d 0a  -..1..34..82....
1ba50 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1ba60 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1ba70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ba80 61 62 65 6c 2d 37 35 38 0d 0a 53 45 4c 45 43 54  abel-758..SELECT
1ba90 20 63 6f 6c 32 20 2d 20 63 6f 72 30 2e 63 6f 6c   col2 - cor0.col
1baa0 32 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  2 / - col0 AS co
1bab0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
1bac0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 34 0d 0a  0..----..1..34..
1bad0 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
1bae0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1baf0 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  tab1.col0 FROM t
1bb00 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 2c 20  ab1, tab2 cor0, 
1bb10 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
1bb20 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
1bb30 73 68 69 6e 67 20 74 6f 20 37 32 39 63 31 65 64  shing to 729c1ed
1bb40 64 61 39 33 33 32 33 39 38 32 39 39 66 33 39 63  da9332398299f39c
1bb50 64 31 37 34 65 64 38 34 30 0d 0a 0d 0a 71 75 65  d174ed840....que
1bb60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1bb70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1bb80 28 20 2d 20 63 6f 6c 30 20 29 20 2b 20 2b 20 63  ( - col0 ) + + c
1bb90 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
1bba0 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32  ---..-54..-67..2
1bbb0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
1bbc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
1bbd0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b   col1 * + col0 +
1bbe0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1bbf0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1bc00 32 30 33 31 0d 0a 2d 33 33 39 34 0d 0a 2d 38 30  2031..-3394..-80
1bc10 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  17....query I ro
1bc20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1bc30 32 30 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  20 * - col0 * co
1bc40 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 + col1 AS col
1bc50 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1bc60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 38 37 37  or0..----..26877
1bc70 0d 0a 34 33 37 31 0d 0a 39 32 30 39 39 0d 0a 0d  ..4371..92099...
1bc80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1bc90 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
1bca0 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52  * col1 * col1 FR
1bcb0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1bcc0 0a 2d 2d 2d 2d 0d 0a 31 33 35 32 30 0d 0a 32 30  .----..13520..20
1bcd0 32 38 0d 0a 36 34 30 30 0d 0a 0d 0a 71 75 65 72  28..6400....quer
1bce0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1bcf0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34  ECT DISTINCT - 4
1bd00 35 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  5 + col0 * - col
1bd10 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1bd20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 30  or0..----..-1270
1bd30 0d 0a 2d 36 32 31 0d 0a 2d 37 39 36 36 0d 0a 0d  ..-621..-7966...
1bd40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1bd50 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
1bd60 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20  + col1 * + col2 
1bd70 2b 20 38 32 20 46 52 4f 4d 20 74 61 62 32 20 41  + 82 FROM tab2 A
1bd80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
1bd90 33 38 0d 0a 36 34 39 0d 0a 39 31 32 0d 0a 0d 0a  38..649..912....
1bda0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1bdb0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
1bdc0 20 2a 20 33 30 20 2d 20 2b 20 63 6f 6c 30 20 46   * 30 - + col0 F
1bdd0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1bde0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 31 0d 0a 37 30  ..----..1061..70
1bdf0 32 0d 0a 38 30 33 0d 0a 0d 0a 71 75 65 72 79 20  2..803....query 
1be00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1be10 54 20 41 4c 4c 20 2d 20 2b 20 28 20 63 6f 6c 30  T ALL - + ( col0
1be20 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30   ) * - cor0.col0
1be30 20 2a 20 37 35 20 41 53 20 63 6f 6c 31 20 46 52   * 75 AS col1 FR
1be40 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1be50 0a 2d 2d 2d 2d 0d 0a 34 33 32 30 30 0d 0a 35 39  .----..43200..59
1be60 34 30 37 35 0d 0a 39 31 38 37 35 0d 0a 0d 0a 71  4075..91875....q
1be70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1be80 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20  SELECT col0 * - 
1be90 63 6f 6c 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  col2 - - cor0.co
1bea0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1beb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32  cor0..----..-162
1bec0 0d 0a 2d 32 30 30 32 0d 0a 2d 32 39 36 34 0d 0a  ..-2002..-2964..
1bed0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bee0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1bef0 43 54 20 35 20 2a 20 2d 20 74 61 62 31 2e 63 6f  CT 5 * - tab1.co
1bf00 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l0 + col1 AS col
1bf10 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
1bf20 2d 0d 0a 2d 33 31 30 0d 0a 2d 33 38 37 0d 0a 31  -..-310..-387..1
1bf30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1bf40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1bf50 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 30 20 29   col2 + ( col0 )
1bf60 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1bf70 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31  b2..----..104..1
1bf80 31 37 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20  17..34....query 
1bf90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1bfa0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 74  T DISTINCT - ( t
1bfb0 61 62 31 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  ab1.col0 * col2 
1bfc0 29 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ) + - col1 AS co
1bfd0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
1bfe0 2d 2d 0d 0a 2d 31 38 38 0d 0a 2d 33 36 35 38 0d  --..-188..-3658.
1bff0 0a 2d 37 36 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-7693....onlyif
1c000 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1c010 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1c020 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1c030 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1c040 6c 61 62 65 6c 2d 37 37 32 0d 0a 53 45 4c 45 43  label-772..SELEC
1c050 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 74  T ALL - col0 * t
1c060 61 62 31 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  ab1.col1 + - col
1c070 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f  2 DIV - col0 FRO
1c080 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
1c090 30 33 39 0d 0a 2d 36 30 0d 0a 2d 36 34 30 0d 0a  039..-60..-640..
1c0a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1c0b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1c0c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c0d0 20 6c 61 62 65 6c 2d 37 37 32 0d 0a 53 45 4c 45   label-772..SELE
1c0e0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
1c0f0 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f  tab1.col1 + - co
1c100 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l2 / - col0 FROM
1c110 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   tab1..----..-10
1c120 33 39 0d 0a 2d 36 30 0d 0a 2d 36 34 30 0d 0a 0d  39..-60..-640...
1c130 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c140 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
1c150 6c 31 20 2b 20 35 30 20 46 52 4f 4d 20 74 61 62  l1 + 50 FROM tab
1c160 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  2, tab2 AS cor0,
1c170 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
1c180 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
1c190 61 73 68 69 6e 67 20 74 6f 20 38 63 36 31 63 35  ashing to 8c61c5
1c1a0 63 33 61 31 61 62 39 33 65 65 65 65 61 64 31 30  c3a1ab93eeeead10
1c1b0 65 31 31 33 63 66 63 61 62 65 0d 0a 0d 0a 6f 6e  e113cfcabe....on
1c1c0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1c1d0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1c1e0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1c1f0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1c200 6f 72 74 20 6c 61 62 65 6c 2d 37 37 34 0d 0a 53  ort label-774..S
1c210 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
1c220 6f 6c 30 20 2a 20 63 6f 6c 32 20 44 49 56 20 63  ol0 * col2 DIV c
1c230 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1c240 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
1c250 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66  33..82....skipif
1c260 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1c270 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1c280 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1c290 37 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  74..SELECT ALL c
1c2a0 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  or0.col0 * col2 
1c2b0 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  / col0 FROM tab0
1c2c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c2d0 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65  1..33..82....que
1c2e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c2f0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
1c300 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 31 20  col1 ) * - col1 
1c310 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1c320 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1c330 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d  .-7396..-8281..-
1c340 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9409....query I 
1c350 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c360 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
1c370 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  * - col2 + col1 
1c380 2b 20 2b 20 28 20 63 6f 6c 32 20 29 20 41 53 20  + + ( col2 ) AS 
1c390 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
1c3a0 2d 2d 2d 2d 0d 0a 32 34 32 0d 0a 33 37 31 35 0d  ----..242..3715.
1c3b0 0a 37 37 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .7789....onlyif 
1c3c0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1c3d0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1c3e0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1c3f0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1c400 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1c410 6c 2d 37 37 37 0d 0a 53 45 4c 45 43 54 20 41 4c  l-777..SELECT AL
1c420 4c 20 2d 20 37 33 20 2a 20 2b 20 74 61 62 31 2e  L - 73 * + tab1.
1c430 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  col0 + col2 * + 
1c440 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49  CAST( col0 AS SI
1c450 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46  GNED ) AS col1 F
1c460 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1c470 2d 31 30 32 34 0d 0a 2d 35 37 0d 0a 31 38 34 30  -1024..-57..1840
1c480 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1c490 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1c4a0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1c4b0 72 74 20 6c 61 62 65 6c 2d 37 37 37 0d 0a 53 45  rt label-777..SE
1c4c0 4c 45 43 54 20 41 4c 4c 20 2d 20 37 33 20 2a 20  LECT ALL - 73 * 
1c4d0 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63 6f  + tab1.col0 + co
1c4e0 6c 32 20 2a 20 2b 20 43 41 53 54 20 28 20 63 6f  l2 * + CAST ( co
1c4f0 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
1c500 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1c510 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 34 0d 0a  1..----..-1024..
1c520 2d 35 37 0d 0a 31 38 34 30 0d 0a 0d 0a 71 75 65  -57..1840....que
1c530 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c540 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1c550 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  + col0 * - col2 
1c560 2b 20 63 6f 6c 32 20 2b 20 31 36 20 46 52 4f 4d  + col2 + 16 FROM
1c570 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1c580 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 37 32 30 30 0d  ---..-18..-7200.
1c590 0a 2d 37 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .-743....query I
1c5a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c5b0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
1c5c0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2d   col2 + + col0 -
1c5d0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b   + cor0.col0 * +
1c5e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1c5f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1c600 33 31 36 30 0d 0a 2d 33 39 37 38 0d 0a 31 34 37  3160..-3978..147
1c610 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c620 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
1c630 2e 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col2 + cor0.col
1c640 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
1c650 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1c660 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d  108..114..192...
1c670 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c680 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
1c690 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63   col0 * + cor0.c
1c6a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
1c6b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30  r0..----..49..60
1c6c0 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a 6f 6e 6c 79  84..6241....only
1c6d0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1c6e0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1c6f0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1c700 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1c710 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1c720 61 62 65 6c 2d 37 38 32 0d 0a 53 45 4c 45 43 54  abel-782..SELECT
1c730 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30   + col1 * - cor0
1c740 2e 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28 20  .col2 * - CAST( 
1c750 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53  col0 * + col2 AS
1c760 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 28 20   SIGNED ) + + ( 
1c770 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  + col1 ) FROM ta
1c780 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1c790 0d 0a 31 35 38 32 32 34 0d 0a 31 39 33 39 33 30  ..158224..193930
1c7a0 39 0d 0a 33 31 31 31 30 31 31 0d 0a 0d 0a 73 6b  9..3111011....sk
1c7b0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1c7c0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1c7d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1c7e0 65 6c 2d 37 38 32 0d 0a 53 45 4c 45 43 54 20 2b  el-782..SELECT +
1c7f0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63   col1 * - cor0.c
1c800 6f 6c 32 20 2a 20 2d 20 43 41 53 54 20 28 20 63  ol2 * - CAST ( c
1c810 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 * + col2 AS 
1c820 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 28 20  INTEGER ) + + ( 
1c830 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  + col1 ) FROM ta
1c840 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1c850 0d 0a 31 35 38 32 32 34 0d 0a 31 39 33 39 33 30  ..158224..193930
1c860 39 0d 0a 33 31 31 31 30 31 31 0d 0a 0d 0a 71 75  9..3111011....qu
1c870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c880 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 38 35  ELECT ALL + + 85
1c890 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
1c8a0 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 38 35 0d 0a 38  .----..85..85..8
1c8b0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
1c8c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1c8d0 30 20 2a 20 63 6f 6c 30 20 2d 20 37 30 20 41 53  0 * col0 - 70 AS
1c8e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1c8f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1c900 36 31 0d 0a 34 30 32 36 0d 0a 36 33 33 30 0d 0a  61..4026..6330..
1c910 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1c920 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1c930 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1c940 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1c950 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38  rowsort label-78
1c960 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  5..SELECT + cor0
1c970 2e 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 2b  .col1 DIV col1 +
1c980 20 36 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53   60 FROM tab2 AS
1c990 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d   cor0..----..61.
1c9a0 0a 36 31 0d 0a 36 31 0d 0a 0d 0a 73 6b 69 70 69  .61..61....skipi
1c9b0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1c9c0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1c9d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1c9e0 37 38 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  785..SELECT + co
1c9f0 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 2b  r0.col1 / col1 +
1ca00 20 36 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53   60 FROM tab2 AS
1ca10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d   cor0..----..61.
1ca20 0a 36 31 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72 79  .61..61....query
1ca30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ca40 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  CT + - col0 + - 
1ca50 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52  col1 + - col2 FR
1ca60 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1ca70 0a 2d 2d 2d 2d 0d 0a 2d 31 33 31 0d 0a 2d 31 38  .----..-131..-18
1ca80 39 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20  9..-83....query 
1ca90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1caa0 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72  T + col1 * - cor
1cab0 30 2e 63 6f 6c 31 20 2d 20 2b 20 28 20 2b 20 63  0.col1 - + ( + c
1cac0 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol1 ) FROM tab0 
1cad0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1cae0 37 34 38 32 0d 0a 2d 38 33 37 32 0d 0a 2d 39 35  7482..-8372..-95
1caf0 30 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  06....onlyif mys
1cb00 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
1cb10 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
1cb20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
1cb30 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
1cb40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1cb50 38 38 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  88..SELECT - CAS
1cb60 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
1cb70 44 20 29 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63  D ) * col0 + + c
1cb80 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
1cb90 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b1..----..NULL..
1cba0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
1cbb0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1cbc0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1cbd0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1cbe0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1cbf0 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
1cc00 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1cc10 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1cc20 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 38 0d  wsort label-788.
1cc30 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28  .SELECT - CAST (
1cc40 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
1cc50 20 29 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   ) * col0 + + co
1cc60 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
1cc70 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  1..----..NULL..N
1cc80 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
1cc90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1cca0 4c 45 43 54 20 41 4c 4c 20 2b 20 33 36 20 2a 20  LECT ALL + 36 * 
1ccb0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
1ccc0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1ccd0 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 32 33 30 34 0d  ----..108..2304.
1cce0 0a 32 38 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .2880....skipif 
1ccf0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1cd00 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1cd10 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1cd20 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1cd30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1cd40 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 33 20 63  t..SELECT + 53 c
1cd50 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1cd60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d   cor0..----..53.
1cd70 0a 35 33 0d 0a 35 33 0d 0a 0d 0a 6f 6e 6c 79 69  .53..53....onlyi
1cd80 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1cd90 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1cda0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1cdb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cdc0 20 6c 61 62 65 6c 2d 37 39 31 0d 0a 53 45 4c 45   label-791..SELE
1cdd0 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63 6f  CT ALL col0 + co
1cde0 6c 31 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f  l1 DIV - cor0.co
1cdf0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
1ce00 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1ce10 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d  --..3..64..80...
1ce20 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1ce30 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1ce40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1ce50 6c 61 62 65 6c 2d 37 39 31 0d 0a 53 45 4c 45 43  label-791..SELEC
1ce60 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63 6f 6c  T ALL col0 + col
1ce70 31 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  1 / - cor0.col2 
1ce80 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1ce90 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1cea0 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b  .3..64..80....sk
1ceb0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1cec0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1ced0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1cee0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1cef0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1cf00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1cf10 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
1cf20 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  1 col0 FROM tab2
1cf30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1cf40 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36  -1343..-217..-46
1cf50 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
1cf60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1cf70 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30 20 2a 20  col1 - + col0 * 
1cf80 34 35 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  45 * col2 FROM t
1cf90 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1cfa0 2d 0d 0a 2d 31 36 34 31 35 30 0d 0a 2d 33 34 35  -..-164150..-345
1cfb0 35 38 37 0d 0a 2d 37 32 36 34 0d 0a 0d 0a 73 6b  587..-7264....sk
1cfc0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1cfd0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1cfe0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1cff0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1d000 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1d010 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1d020 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a   - col0 + col1 *
1d030 20 39 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   92 col0 FROM ta
1d040 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
1d050 32 37 36 0d 0a 32 33 39 35 0d 0a 39 38 34 0d 0a  276..2395..984..
1d060 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d070 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
1d080 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 34 37  cor0.col0 * - 47
1d090 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1d0a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 39 0d 0a 33  r0..----..329..3
1d0b0 36 36 36 0d 0a 33 37 31 33 0d 0a 0d 0a 6f 6e 6c  666..3713....onl
1d0c0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1d0d0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1d0e0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1d0f0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1d100 72 74 20 6c 61 62 65 6c 2d 37 39 36 0d 0a 53 45  rt label-796..SE
1d110 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1d120 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 44 49 56 20  col0 * col1 DIV 
1d130 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
1d140 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1d150 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a  ----..-10..-13..
1d160 2d 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -26....skipif my
1d170 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1d180 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1d190 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 36 0d  wsort label-796.
1d1a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1d1b0 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2f   - col0 * col1 /
1d1c0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
1d1d0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1d1e0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d  .----..-10..-13.
1d1f0 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-26....query I 
1d200 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d210 2d 20 2d 20 63 6f 6c 31 20 2a 20 36 33 20 41 53  - - col1 * 63 AS
1d220 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1d230 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
1d240 34 31 38 0d 0a 35 37 33 33 0d 0a 36 31 31 31 0d  418..5733..6111.
1d250 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d260 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1d270 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d  ol0 * - col2 + -
1d280 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1d290 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1d2a0 33 36 0d 0a 2d 37 33 38 30 0d 0a 2d 38 32 35 0d  36..-7380..-825.
1d2b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d2c0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1d2d0 20 63 6f 6c 32 20 2b 20 39 38 20 2a 20 2b 20 63   col2 + 98 * + c
1d2e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1d2f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 31   cor0..----..231
1d300 39 0d 0a 33 34 32 39 0d 0a 38 36 34 30 0d 0a 0d  9..3429..8640...
1d310 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d320 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1d330 6f 6c 30 20 2a 20 2b 20 36 35 20 2b 20 35 20 2d  ol0 * + 65 + 5 -
1d340 20 63 6f 6c 32 20 2a 20 2d 20 28 20 33 39 20 29   col2 * - ( 39 )
1d350 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
1d360 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1d370 31 31 33 35 33 34 0d 0a 31 32 32 35 35 36 0d 0a  113534..122556..
1d380 33 35 34 32 32 39 0d 0a 0d 0a 71 75 65 72 79 20  354229....query 
1d390 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d3a0 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 63  T ALL - col2 * c
1d3b0 6f 6c 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 + col1 FROM 
1d3c0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1d3d0 0a 2d 31 34 32 37 0d 0a 2d 36 31 37 0d 0a 2d 36  .-1427..-617..-6
1d3e0 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  98....onlyif mys
1d3f0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1d400 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1d410 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1d420 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1d430 6c 2d 38 30 32 0d 0a 53 45 4c 45 43 54 20 44 49  l-802..SELECT DI
1d440 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 44 49  STINCT + col1 DI
1d450 56 20 39 38 20 2b 20 33 39 20 46 52 4f 4d 20 74  V 98 + 39 FROM t
1d460 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1d470 2d 0d 0a 33 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..39....skipif 
1d480 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1d490 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1d4a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30  rowsort label-80
1d4b0 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
1d4c0 43 54 20 2b 20 63 6f 6c 31 20 2f 20 39 38 20 2b  CT + col1 / 98 +
1d4d0 20 33 39 20 46 52 4f 4d 20 74 61 62 30 20 41 53   39 FROM tab0 AS
1d4e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 0d   cor0..----..39.
1d4f0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1d500 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1d510 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1d520 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1d530 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1d540 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d550 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1d560 6f 6c 32 20 2b 20 37 39 20 2a 20 63 6f 6c 31 20  ol2 + 79 * col1 
1d570 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1d580 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
1d590 32 33 0d 0a 32 31 30 38 0d 0a 38 34 37 0d 0a 0d  23..2108..847...
1d5a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d5b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1d5c0 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  or0.col0 * + col
1d5d0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
1d5e0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1d5f0 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38  -1040..-640..-78
1d600 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d610 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1d620 49 4e 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 32  INCT col2 + col2
1d630 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41   + - cor0.col0 A
1d640 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1d650 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1d660 2d 33 33 0d 0a 34 32 0d 0a 37 35 0d 0a 0d 0a 71  -33..42..75....q
1d670 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d680 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1d690 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 34 36  - cor0.col0 + 46
1d6a0 20 2a 20 2d 20 35 33 20 41 53 20 63 6f 6c 31 20   * - 53 AS col1 
1d6b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1d6c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 36 32 0d 0a  0..----..-2462..
1d6d0 2d 32 34 37 33 0d 0a 2d 32 35 32 37 0d 0a 0d 0a  -2473..-2527....
1d6e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d6f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34 31  .SELECT ALL + 41
1d700 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   * - col0 + + co
1d710 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1d720 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 30  cor0..----..-260
1d730 0d 0a 2d 33 31 37 32 0d 0a 2d 33 32 30 31 0d 0a  ..-3172..-3201..
1d740 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d750 74 0d 0a 53 45 4c 45 43 54 20 37 20 2a 20 34 37  t..SELECT 7 * 47
1d760 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1d770 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1d780 0d 0a 33 32 39 0d 0a 33 32 39 0d 0a 33 32 39 0d  ..329..329..329.
1d790 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d7a0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1d7b0 20 2d 20 63 6f 6c 32 20 2a 20 28 20 63 6f 72 30   - col2 * ( cor0
1d7c0 2e 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 30  .col1 ) + + col0
1d7d0 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
1d7e0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1d7f0 0a 31 34 31 33 0d 0a 34 36 36 36 0d 0a 37 36 34  .1413..4666..764
1d800 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1d810 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1d820 20 33 36 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20   36 + + col1 AS 
1d830 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1d840 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
1d850 32 0d 0a 31 32 37 0d 0a 31 33 33 0d 0a 0d 0a 71  2..127..133....q
1d860 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d870 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 38 20 2a  SELECT ALL + 8 *
1d880 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b   + cor0.col1 + +
1d890 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
1d8a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1d8b0 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 32 30 30 0d  .----..137..200.
1d8c0 0a 32 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49  .262....query II
1d8d0 49 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f  IIIIIIIIIIIII ro
1d8e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1d8f0 4c 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 41 53  L * FROM tab2 AS
1d900 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
1d910 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
1d920 6f 72 31 2c 20 74 61 62 31 2c 20 74 61 62 31 20  or1, tab1, tab1 
1d930 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor2..----..3
1d940 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69  645 values hashi
1d950 6e 67 20 74 6f 20 37 39 62 36 61 65 30 39 36 37  ng to 79b6ae0967
1d960 38 35 61 61 65 63 65 61 39 63 31 34 32 38 65 34  85aaecea9c1428e4
1d970 61 34 33 65 35 66 0d 0a 0d 0a 6f 6e 6c 79 69 66  a43e5f....onlyif
1d980 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1d990 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1d9a0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1d9b0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1d9c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1d9d0 65 6c 2d 38 31 33 0d 0a 53 45 4c 45 43 54 20 2d  el-813..SELECT -
1d9e0 20 63 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e 55   col0 * CAST( NU
1d9f0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f  LL AS SIGNED ) /
1da00 20 36 36 20 2d 20 63 6f 6c 32 20 2a 20 34 39 20   66 - col2 * 49 
1da10 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1da20 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
1da30 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
1da40 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1da50 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1da60 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1da70 6c 2d 38 31 33 0d 0a 53 45 4c 45 43 54 20 2d 20  l-813..SELECT - 
1da80 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 4e 55  col0 * CAST ( NU
1da90 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
1daa0 2f 20 36 36 20 2d 20 63 6f 6c 32 20 2a 20 34 39  / 66 - col2 * 49
1dab0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1dac0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1dad0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
1dae0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1daf0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a  ELECT + - col0 *
1db00 20 28 20 2b 20 37 35 20 2b 20 2b 20 63 6f 6c 31   ( + 75 + + col1
1db10 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
1db20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 33  cor0..----..-303
1db30 0d 0a 2d 35 34 34 30 0d 0a 2d 37 30 34 30 0d 0a  ..-5440..-7040..
1db40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1db50 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
1db60 6c 30 20 2d 20 32 37 20 46 52 4f 4d 20 74 61 62  l0 - 27 FROM tab
1db70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1db80 0a 2d 31 30 35 0d 0a 2d 31 30 36 0d 0a 2d 33 34  .-105..-106..-34
1db90 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1dba0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1dbb0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1dbc0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1dbd0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1dbe0 38 31 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  816..SELECT - co
1dbf0 6c 32 20 2a 20 37 36 20 2b 20 2d 20 63 6f 6c 30  l2 * 76 + - col0
1dc00 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 32 20 46   DIV cor0.col2 F
1dc10 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1dc20 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 0d 0a 2d 32  ..----..-111..-2
1dc30 35 30 38 0d 0a 2d 36 32 33 33 0d 0a 0d 0a 73 6b  508..-6233....sk
1dc40 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1dc50 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1dc60 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1dc70 65 6c 2d 38 31 36 0d 0a 53 45 4c 45 43 54 20 2d  el-816..SELECT -
1dc80 20 63 6f 6c 32 20 2a 20 37 36 20 2b 20 2d 20 63   col2 * 76 + - c
1dc90 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f 6c 32 20  ol0 / cor0.col2 
1dca0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1dcb0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 0d 0a 2d  0..----..-111..-
1dcc0 32 35 30 38 0d 0a 2d 36 32 33 33 0d 0a 0d 0a 71  2508..-6233....q
1dcd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1dce0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20  SELECT + col1 * 
1dcf0 2b 20 35 38 20 2b 20 2b 20 74 61 62 30 2e 63 6f  + 58 + + tab0.co
1dd00 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
1dd10 2d 2d 0d 0a 35 30 31 32 0d 0a 35 33 36 37 0d 0a  --..5012..5367..
1dd20 35 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5661....query I 
1dd30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1dd40 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  - cor0.col2 * co
1dd50 6c 31 20 2a 20 32 35 20 41 53 20 63 6f 6c 31 20  l1 * 25 AS col1 
1dd60 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1dd70 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 35 30 0d  0..----..-16150.
1dd80 0a 2d 32 30 39 32 35 0d 0a 2d 33 38 33 35 30 0d  .-20925..-38350.
1dd90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1dda0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
1ddb0 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  or0.col2 * cor0.
1ddc0 63 6f 6c 32 20 2d 20 2d 20 28 20 2b 20 63 6f 6c  col2 - - ( + col
1ddd0 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  0 ) FROM tab2 AS
1dde0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
1ddf0 36 35 0d 0a 2d 35 39 38 0d 0a 2d 37 32 32 0d 0a  65..-598..-722..
1de00 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1de10 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1de20 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1de30 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1de40 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1de50 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32 30 0d 0a  sort label-820..
1de60 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1de70 2b 20 63 6f 6c 31 20 2a 20 2b 20 37 37 20 2b 20  + col1 * + 77 + 
1de80 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20  + col2 * col2 * 
1de90 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45  CAST( NULL AS DE
1dea0 43 49 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62  CIMAL ) FROM tab
1deb0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1dec0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
1ded0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1dee0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1def0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32  rowsort label-82
1df00 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
1df10 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 37 37  CT + col1 * + 77
1df20 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   + + col2 * col2
1df30 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   * CAST ( NULL A
1df40 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61  S REAL ) FROM ta
1df50 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1df60 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
1df70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1df80 54 20 63 6f 6c 30 20 2b 20 2d 20 31 35 20 41 53  T col0 + - 15 AS
1df90 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
1dfa0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 34 39 0d 0a  .----..-12..49..
1dfb0 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  65....query I ro
1dfc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1dfd0 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  col2 * + col2 * 
1dfe0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
1dff0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
1e000 2d 2d 2d 0d 0a 32 36 31 33 36 0d 0a 33 35 0d 0a  ---..26136..35..
1e010 35 39 38 34 33 36 0d 0a 0d 0a 71 75 65 72 79 20  598436....query 
1e020 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e030 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
1e040 2a 20 2d 20 33 37 20 2b 20 63 6f 6c 30 20 46 52  * - 37 + col0 FR
1e050 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1e060 0a 2d 2d 2d 2d 0d 0a 2d 33 30 36 0d 0a 2d 34 30  .----..-306..-40
1e070 31 0d 0a 2d 39 35 39 0d 0a 0d 0a 6f 6e 6c 79 69  1..-959....onlyi
1e080 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1e090 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1e0a0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1e0b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e0c0 20 6c 61 62 65 6c 2d 38 32 34 0d 0a 53 45 4c 45   label-824..SELE
1e0d0 43 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  CT ( - cor0.col2
1e0e0 20 29 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20   ) DIV - col0 + 
1e0f0 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  6 AS col0 FROM t
1e100 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1e110 2d 0d 0a 36 0d 0a 36 0d 0a 39 0d 0a 0d 0a 73 6b  -..6..6..9....sk
1e120 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1e130 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1e140 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1e150 65 6c 2d 38 32 34 0d 0a 53 45 4c 45 43 54 20 28  el-824..SELECT (
1e160 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2f   - cor0.col2 ) /
1e170 20 2d 20 63 6f 6c 30 20 2b 20 36 20 41 53 20 63   - col0 + 6 AS c
1e180 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
1e190 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 0d 0a   cor0..----..6..
1e1a0 36 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6..9....query I 
1e1b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e1c0 41 4c 4c 20 2d 20 2d 20 28 20 63 6f 6c 32 20 29  ALL - - ( col2 )
1e1d0 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 28 20   * + col1 + - ( 
1e1e0 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31  - col1 ) AS col1
1e1f0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1e200 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a  r0..----..1261..
1e210 31 34 33 30 0d 0a 35 38 30 0d 0a 0d 0a 71 75 65  1430..580....que
1e220 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e230 4c 45 43 54 20 41 4c 4c 20 2d 20 37 34 20 2a 20  LECT ALL - 74 * 
1e240 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f  + cor0.col1 * co
1e250 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1e260 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 33  cor0..----..-213
1e270 38 36 0d 0a 2d 32 35 37 35 39 34 0d 0a 2d 37 31  86..-257594..-71
1e280 31 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  114....query I r
1e290 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1e2a0 20 28 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29   ( ( cor0.col1 )
1e2b0 20 29 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c   ) * col1 AS col
1e2c0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1e2d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d  or0..----..-100.
1e2e0 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 71  .-169..-676....q
1e2f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e300 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1e310 2d 20 2b 20 39 38 20 2a 20 2d 20 63 6f 6c 31 20  - + 98 * - col1 
1e320 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
1e330 2d 2d 2d 2d 0d 0a 31 32 37 34 0d 0a 32 35 34 38  ----..1274..2548
1e340 0d 0a 39 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..980....onlyif 
1e350 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1e360 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1e370 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1e380 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1e390 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1e3a0 6c 2d 38 32 39 0d 0a 53 45 4c 45 43 54 20 41 4c  l-829..SELECT AL
1e3b0 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  L col0 * col0 + 
1e3c0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45  CAST( NULL AS DE
1e3d0 43 49 4d 41 4c 20 29 20 63 6f 6c 30 20 46 52 4f  CIMAL ) col0 FRO
1e3e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1e3f0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
1e400 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
1e410 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1e420 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1e430 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1e440 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1e450 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
1e460 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1e470 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e480 74 20 6c 61 62 65 6c 2d 38 32 39 0d 0a 53 45 4c  t label-829..SEL
1e490 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63  ECT ALL col0 * c
1e4a0 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ol0 + CAST ( NUL
1e4b0 4c 20 41 53 20 52 45 41 4c 20 29 20 63 6f 6c 30  L AS REAL ) col0
1e4c0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1e4d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1e4e0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
1e4f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e500 45 4c 45 43 54 20 41 4c 4c 20 31 33 20 2a 20 63  ELECT ALL 13 * c
1e510 6f 6c 32 20 2a 20 2b 20 38 20 2b 20 2b 20 63 6f  ol2 * + 8 + + co
1e520 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
1e530 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 36  cor0..----..1006
1e540 34 0d 0a 35 36 31 39 0d 0a 35 39 39 32 0d 0a 0d  4..5619..5992...
1e550 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1e560 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1e570 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1e580 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1e590 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1e5a0 6f 72 74 20 6c 61 62 65 6c 2d 38 33 31 0d 0a 53  ort label-831..S
1e5b0 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20  ELECT ALL CAST( 
1e5c0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
1e5d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c   col0 FROM tab1,
1e5e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
1e5f0 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
1e600 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
1e610 68 69 6e 67 20 74 6f 20 31 36 62 65 38 38 36 38  hing to 16be8868
1e620 61 31 65 36 66 34 65 38 38 35 30 35 30 39 66 39  a1e6f4e8850509f9
1e630 33 32 37 61 66 65 39 30 0d 0a 0d 0a 73 6b 69 70  327afe90....skip
1e640 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1e650 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1e660 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1e670 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1e680 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
1e690 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1e6a0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1e6b0 6f 72 74 20 6c 61 62 65 6c 2d 38 33 31 0d 0a 53  ort label-831..S
1e6c0 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28  ELECT ALL CAST (
1e6d0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
1e6e0 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   ) col0 FROM tab
1e6f0 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  1, tab0 AS cor0,
1e700 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
1e710 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
1e720 61 73 68 69 6e 67 20 74 6f 20 31 36 62 65 38 38  ashing to 16be88
1e730 36 38 61 31 65 36 66 34 65 38 38 35 30 35 30 39  68a1e6f4e8850509
1e740 66 39 33 32 37 61 66 65 39 30 0d 0a 0d 0a 71 75  f9327afe90....qu
1e750 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e760 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 31 20 29  ELECT - ( col1 )
1e770 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
1e780 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1e790 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
1e7a0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1e7b0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1e7c0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1e7d0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1e7e0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1e7f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e800 54 20 41 4c 4c 20 35 39 20 63 6f 6c 31 20 46 52  T ALL 59 col1 FR
1e810 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab2..----..5
1e820 39 0d 0a 35 39 0d 0a 35 39 0d 0a 0d 0a 71 75 65  9..59..59....que
1e830 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e840 4c 45 43 54 20 2d 20 39 30 20 2b 20 2d 20 28 20  LECT - 90 + - ( 
1e850 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 29 20 46 52  - cor1.col1 ) FR
1e860 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  OM tab0 AS cor0 
1e870 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20  CROSS JOIN tab0 
1e880 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
1e890 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1e8a0 74 6f 20 37 38 37 34 61 61 66 65 38 35 64 32 39  to 7874aafe85d29
1e8b0 32 62 65 36 65 38 33 62 64 61 33 34 38 61 64 31  2be6e83bda348ad1
1e8c0 38 61 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  8a8....query I r
1e8d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1e8e0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63   col2 * + cor0.c
1e8f0 6f 6c 32 20 2b 20 2d 20 38 37 20 41 53 20 63 6f  ol2 + - 87 AS co
1e900 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
1e910 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 36 0d 0a  0..----..-1176..
1e920 2d 36 38 31 31 0d 0a 2d 38 38 0d 0a 0d 0a 6f 6e  -6811..-88....on
1e930 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1e940 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1e950 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1e960 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1e970 6f 72 74 20 6c 61 62 65 6c 2d 38 33 36 0d 0a 53  ort label-836..S
1e980 45 4c 45 43 54 20 2b 20 33 39 20 44 49 56 20 2d  ELECT + 39 DIV -
1e990 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
1e9a0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1e9b0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
1e9c0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1e9d0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1e9e0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1e9f0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1ea00 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
1ea10 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1ea20 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1ea30 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 36  owsort label-836
1ea40 0d 0a 53 45 4c 45 43 54 20 2b 20 33 39 20 2f 20  ..SELECT + 39 / 
1ea50 2d 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  - col2 col1 FROM
1ea60 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1ea70 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
1ea80 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1ea90 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1eaa0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1eab0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1eac0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1ead0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1eae0 20 2b 20 35 30 20 63 6f 6c 30 20 46 52 4f 4d 20   + 50 col0 FROM 
1eaf0 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f  tab1 AS cor0 CRO
1eb00 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20  SS JOIN tab0 AS 
1eb10 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
1eb20 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1eb30 64 65 61 32 64 31 62 37 34 65 30 63 64 66 36 37  dea2d1b74e0cdf67
1eb40 38 30 36 61 66 38 63 34 31 37 33 32 34 66 35 32  806af8c417324f52
1eb50 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1eb60 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1eb70 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1eb80 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1eb90 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1eba0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 38  owsort label-838
1ebb0 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63  ..SELECT + ( - c
1ebc0 6f 6c 31 20 2b 20 2b 20 43 41 53 54 28 20 38 31  ol1 + + CAST( 81
1ebd0 20 41 53 20 53 49 47 4e 45 44 20 29 20 29 20 41   AS SIGNED ) ) A
1ebe0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1ebf0 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 35 30 0d 0a  ..----..22..50..
1ec00 36 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  64....skipif mys
1ec10 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1ec20 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1ec30 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 38 0d 0a  sort label-838..
1ec40 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63 6f 6c  SELECT + ( - col
1ec50 31 20 2b 20 2b 20 43 41 53 54 20 28 20 38 31 20  1 + + CAST ( 81 
1ec60 41 53 20 49 4e 54 45 47 45 52 20 29 20 29 20 41  AS INTEGER ) ) A
1ec70 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1ec80 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 35 30 0d 0a  ..----..22..50..
1ec90 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
1eca0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1ecb0 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 32 20 2a 20  col2 * ( col2 * 
1ecc0 2d 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  - col0 ) FROM ta
1ecd0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1ece0 0d 0a 32 30 37 39 33 36 0d 0a 37 33 37 32 38 30  ..207936..737280
1ecf0 0d 0a 38 37 34 38 0d 0a 0d 0a 71 75 65 72 79 20  ..8748....query 
1ed00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ed10 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20  T cor0.col1 * + 
1ed20 33 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  32 AS col2 FROM 
1ed30 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1ed40 2d 2d 0d 0a 32 37 35 32 0d 0a 32 39 31 32 0d 0a  --..2752..2912..
1ed50 33 31 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3104....query I 
1ed60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ed70 31 35 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  15 + - col1 FROM
1ed80 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1ed90 0d 0a 2d 37 31 0d 0a 2d 37 36 0d 0a 2d 38 32 0d  ..-71..-76..-82.
1eda0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1edb0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
1edc0 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e  * col0 + - cor0.
1edd0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1ede0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
1edf0 0d 0a 36 30 32 35 0d 0a 36 32 32 34 0d 0a 0d 0a  ..6025..6224....
1ee00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ee10 0a 53 45 4c 45 43 54 20 28 20 63 6f 72 30 2e 63  .SELECT ( cor0.c
1ee20 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 2c  ol0 ) FROM tab1,
1ee30 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
1ee40 61 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab0 AS cor1, tab
1ee50 31 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  1 AS cor2..----.
1ee60 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69  .81 values hashi
1ee70 6e 67 20 74 6f 20 32 33 30 34 66 63 63 31 34 30  ng to 2304fcc140
1ee80 65 39 35 35 65 62 32 64 31 65 65 32 38 61 62 31  e955eb2d1ee28ab1
1ee90 65 65 61 39 39 34 0d 0a 0d 0a 71 75 65 72 79 20  eea994....query 
1eea0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1eeb0 54 20 41 4c 4c 20 2d 20 34 31 20 41 53 20 63 6f  T ALL - 41 AS co
1eec0 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
1eed0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1eee0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
1eef0 6e 67 20 74 6f 20 34 62 61 30 63 31 30 32 30 39  ng to 4ba0c10209
1ef00 31 66 39 63 62 63 39 66 65 39 34 33 39 62 30 34  1f9cbc9fe9439b04
1ef10 35 38 34 65 37 30 0d 0a 0d 0a 71 75 65 72 79 20  584e70....query 
1ef20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ef30 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
1ef40 63 6f 6c 31 20 2b 20 2d 20 31 39 20 2a 20 63 6f  col1 + - 19 * co
1ef50 72 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r1.col0 AS col0 
1ef60 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
1ef70 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
1ef80 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
1ef90 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1efa0 20 30 62 32 35 38 39 39 65 34 35 33 36 34 61 39   0b25899e45364a9
1efb0 66 32 34 65 39 34 62 36 31 64 32 31 36 31 66 64  f24e94b61d2161fd
1efc0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1efd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1efe0 54 49 4e 43 54 20 2d 20 31 34 20 2a 20 2b 20 63  TINCT - 14 * + c
1eff0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol0 * + col0 FRO
1f000 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  M tab2..----..-6
1f010 38 36 0d 0a 2d 38 35 31 37 36 0d 0a 2d 38 37 33  86..-85176..-873
1f020 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
1f030 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1f040 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 * col2 FROM ta
1f050 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33  b0..----..-1..-3
1f060 33 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20  3..-82....query 
1f070 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f080 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  T cor0.col2 + + 
1f090 63 6f 6c 32 20 2a 20 33 35 20 46 52 4f 4d 20 74  col2 * 35 FROM t
1f0a0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1f0b0 2d 0d 0a 31 39 34 34 0d 0a 32 30 35 32 0d 0a 33  -..1944..2052..3
1f0c0 34 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  456....query I r
1f0d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1f0e0 20 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   2 AS col1 FROM 
1f0f0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
1f100 0a 2d 32 0d 0a 2d 32 0d 0a 2d 32 0d 0a 0d 0a 71  .-2..-2..-2....q
1f110 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f120 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 72 30 2e  SELECT - ( cor0.
1f130 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46  col1 ) AS col1 F
1f140 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41  ROM tab0, tab2 A
1f150 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
1f160 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1f170 6f 20 63 63 61 61 35 64 64 33 33 38 38 64 39 65  o ccaa5dd3388d9e
1f180 65 30 66 65 61 36 37 36 66 61 33 35 32 39 39 66  e0fea676fa35299f
1f190 65 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  e5....skipif pos
1f1a0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1f1b0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1f1c0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1f1d0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
1f1e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f1f0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
1f200 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 63  - ( + col1 ) + c
1f210 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 2d  ol0 * - col0 - -
1f220 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 63   col2 * - col0 c
1f230 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1f240 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
1f250 39 31 31 0d 0a 2d 37 36 34 34 0d 0a 35 30 35 0d  911..-7644..505.
1f260 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f270 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1f280 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  NCT + col2 * + c
1f290 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63  ol1 * col2 + + c
1f2a0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol0 * + col0 AS 
1f2b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
1f2c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  S cor0..----..22
1f2d0 36 34 38 0d 0a 33 30 37 38 39 0d 0a 34 35 39 36  648..30789..4596
1f2e0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1f2f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1f300 54 49 4e 43 54 20 34 35 20 2a 20 63 6f 72 30 2e  TINCT 45 * cor0.
1f310 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
1f320 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1f330 2d 2d 0d 0a 33 38 37 30 0d 0a 34 30 39 35 0d 0a  --..3870..4095..
1f340 34 33 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4365....query I 
1f350 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f360 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e  - col1 + + cor0.
1f370 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
1f380 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
1f390 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
1f3a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1f3b0 2d 20 63 6f 6c 32 20 2d 20 2b 20 36 39 20 41 53  - col2 - + 69 AS
1f3c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1f3d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1f3e0 31 30 37 0d 0a 2d 39 35 0d 0a 2d 39 36 0d 0a 0d  107..-95..-96...
1f3f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f400 0d 0a 53 45 4c 45 43 54 20 2d 20 34 34 20 2b 20  ..SELECT - 44 + 
1f410 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  - cor0.col0 FROM
1f420 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
1f430 6f 72 30 2c 20 74 61 62 30 20 63 6f 72 31 0d 0a  or0, tab0 cor1..
1f440 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
1f450 68 61 73 68 69 6e 67 20 74 6f 20 64 32 61 36 38  hashing to d2a68
1f460 31 62 61 62 32 39 39 34 30 31 66 61 31 66 34 62  1bab299401fa1f4b
1f470 36 37 62 62 65 38 39 33 38 64 38 0d 0a 0d 0a 71  67bbe8938d8....q
1f480 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f490 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
1f4a0 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  0 * + col1 + + c
1f4b0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
1f4c0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1f4d0 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32 34 38 0d 0a  ---..1360..248..
1f4e0 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4661....query I 
1f4f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f500 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ALL + col1 * - c
1f510 6f 6c 32 20 2b 20 2b 20 34 20 2a 20 2b 20 63 6f  ol2 + + 4 * + co
1f520 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l1 * + cor0.col2
1f530 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1f540 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 33 38 36 0d  r0..----..22386.
1f550 0a 32 39 31 0d 0a 38 35 31 34 0d 0a 0d 0a 71 75  .291..8514....qu
1f560 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f570 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30  ELECT ALL - cor0
1f580 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b  .col0 * - col2 +
1f590 20 32 20 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   2 - + col0 FROM
1f5a0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1f5b0 2d 2d 2d 0d 0a 32 0d 0a 37 32 31 31 0d 0a 37 37  ---..2..7211..77
1f5c0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
1f5d0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1f5e0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1f5f0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1f600 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1f610 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f620 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1f630 20 2d 20 33 30 20 63 6f 6c 32 20 46 52 4f 4d 20   - 30 col2 FROM 
1f640 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1f650 2d 2d 0d 0a 33 30 0d 0a 0d 0a 71 75 65 72 79 20  --..30....query 
1f660 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f670 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72  T - + col0 * cor
1f680 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  0.col0 + - col0 
1f690 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1f6a0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1f6b0 0a 2d 31 32 36 30 0d 0a 2d 36 30 30 0d 0a 2d 38  .-1260..-600..-8
1f6c0 30 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  010....query I r
1f6d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1f6e0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 63   cor0.col1 + + c
1f6f0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 * + col2 FRO
1f700 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1f710 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a 37 30 36 0d 0a  ----..-62..706..
1f720 37 32 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7207....query I 
1f730 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f740 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63  ( - col0 ) * + c
1f750 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol0 + col1 * col
1f760 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  0 * + col0 FROM 
1f770 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1f780 0a 32 32 35 0d 0a 33 36 38 36 34 0d 0a 37 36 38  .225..36864..768
1f790 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  00....skipif pos
1f7a0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1f7b0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1f7c0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1f7d0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
1f7e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f7f0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 34  SELECT ALL + ( 4
1f800 34 20 29 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20  4 ) * col1 col2 
1f810 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1f820 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 38 34 0d 0a 34  0..----..3784..4
1f830 30 30 34 0d 0a 34 32 36 38 0d 0a 0d 0a 6f 6e 6c  004..4268....onl
1f840 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
1f850 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
1f860 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
1f870 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
1f880 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1f890 6c 61 62 65 6c 2d 38 36 35 0d 0a 53 45 4c 45 43  label-865..SELEC
1f8a0 54 20 43 41 53 54 28 20 2d 20 28 20 2b 20 63 6f  T CAST( - ( + co
1f8b0 6c 32 20 29 20 41 53 20 53 49 47 4e 45 44 20 29  l2 ) AS SIGNED )
1f8c0 20 2a 20 2d 20 36 33 20 41 53 20 63 6f 6c 31 20   * - 63 AS col1 
1f8d0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1f8e0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 39 0d 0a 35  0..----..2079..5
1f8f0 31 36 36 0d 0a 36 33 0d 0a 0d 0a 73 6b 69 70 69  166..63....skipi
1f900 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1f910 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1f920 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1f930 38 36 35 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  865..SELECT CAST
1f940 20 28 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20   ( - ( + col2 ) 
1f950 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d  AS INTEGER ) * -
1f960 20 36 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   63 AS col1 FROM
1f970 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1f980 2d 2d 2d 0d 0a 32 30 37 39 0d 0a 35 31 36 36 0d  ---..2079..5166.
1f990 0a 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .63....query I r
1f9a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1f9b0 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31  ISTINCT + - col1
1f9c0 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   * - col2 + - co
1f9d0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1f9e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 35  cor0..----..1475
1f9f0 0d 0a 36 32 39 0d 0a 38 30 36 0d 0a 0d 0a 73 6b  ..629..806....sk
1fa00 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1fa10 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1fa20 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1fa30 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1fa40 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1fa50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1fa60 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31  ISTINCT + + col1
1fa70 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46   * + col0 col0 F
1fa80 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1fa90 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34  ..----..1040..64
1faa0 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  0..78....query I
1fab0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fac0 20 41 4c 4c 20 2b 20 34 30 20 41 53 20 63 6f 6c   ALL + 40 AS col
1fad0 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
1fae0 0d 0a 2d 2d 2d 2d 0d 0a 34 30 0d 0a 34 30 0d 0a  ..----..40..40..
1faf0 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  40....onlyif mys
1fb00 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1fb10 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1fb20 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1fb30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1fb40 6c 2d 38 36 39 0d 0a 53 45 4c 45 43 54 20 41 4c  l-869..SELECT AL
1fb50 4c 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20 63  L + col0 DIV - c
1fb60 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or0.col0 AS col1
1fb70 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1fb80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
1fb90 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..-1....skipif m
1fba0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1fbb0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1fbc0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 39  owsort label-869
1fbd0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
1fbe0 6f 6c 30 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 / - cor0.col
1fbf0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
1fc00 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1fc10 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d  -..-1..-1..-1...
1fc20 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1fc30 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1fc40 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1fc50 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1fc60 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1fc70 6f 72 74 20 6c 61 62 65 6c 2d 38 37 30 0d 0a 53  ort label-870..S
1fc80 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 63 6f  ELECT - CAST( co
1fc90 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l1 AS SIGNED ) *
1fca0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 31   + cor0.col1 + 1
1fcb0 36 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  6 * col1 AS col1
1fcc0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1fcd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 30 0d 0a  r0..----..-260..
1fce0 33 39 0d 0a 36 30 0d 0a 0d 0a 73 6b 69 70 69 66  39..60....skipif
1fcf0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1fd00 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1fd10 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1fd20 37 30 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  70..SELECT - CAS
1fd30 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  T ( col1 AS INTE
1fd40 47 45 52 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63  GER ) * + cor0.c
1fd50 6f 6c 31 20 2b 20 31 36 20 2a 20 63 6f 6c 31 20  ol1 + 16 * col1 
1fd60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1fd70 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1fd80 0a 2d 32 36 30 0d 0a 33 39 0d 0a 36 30 0d 0a 0d  .-260..39..60...
1fd90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1fda0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1fdb0 54 20 33 35 20 2b 20 2b 20 36 39 20 2a 20 63 6f  T 35 + + 69 * co
1fdc0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
1fdd0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1fde0 2d 2d 0d 0a 35 39 36 39 0d 0a 36 33 31 34 0d 0a  --..5969..6314..
1fdf0 36 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6728....query I 
1fe00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1fe10 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  + - col0 + col2 
1fe20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
1fe30 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1fe40 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 33 0d 0a 33 31  ..----..2913..31
1fe50 38 35 0d 0a 39 31 33 36 0d 0a 0d 0a 71 75 65 72  85..9136....quer
1fe60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1fe70 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1fe80 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol0 * + col0 AS 
1fe90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
1fea0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d  or0..----..1225.
1feb0 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a 71 75  .576..7921....qu
1fec0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1fed0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b  ELECT ALL col0 +
1fee0 20 2b 20 37 36 20 2a 20 2b 20 63 6f 6c 32 20 46   + 76 * + col2 F
1fef0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1ff00 31 31 31 0d 0a 32 35 33 32 0d 0a 36 33 32 31 0d  111..2532..6321.
1ff10 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1ff20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1ff30 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1ff40 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1ff50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1ff60 37 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  75..SELECT ALL c
1ff70 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 2d 20 2d  ol1 DIV col1 - -
1ff80 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
1ff90 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
1ffa0 35 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 73 6b 69  5..36..90....ski
1ffb0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1ffc0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1ffd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1ffe0 6c 2d 38 37 35 0d 0a 53 45 4c 45 43 54 20 41 4c  l-875..SELECT AL
1fff0 4c 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 2d 20  L col1 / col1 - 
20000 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
20010 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
20020 32 35 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 71 75  25..36..90....qu
20030 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20040 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d  ELECT ALL col0 -
20050 20 2b 20 63 6f 6c 30 20 2a 20 31 31 20 41 53 20   + col0 * 11 AS 
20060 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
20070 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a 2d 36 34 30 0d  ----..-30..-640.
20080 0a 2d 38 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-800....query I
20090 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
200a0 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 63 6f   ALL - col0 + co
200b0 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 * col1 FROM t
200c0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
200d0 2d 0d 0a 31 31 36 38 0d 0a 31 34 30 31 0d 0a 35  -..1168..1401..5
200e0 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  06....query I ro
200f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
20100 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f  STINCT col1 * co
20110 6c 30 20 2d 20 28 20 39 34 20 29 20 2a 20 63 6f  l0 - ( 94 ) * co
20120 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
20130 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 32  cor0..----..-222
20140 39 0d 0a 2d 32 33 32 31 0d 0a 32 31 35 38 0d 0a  9..-2321..2158..
20150 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
20160 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
20170 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
20180 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
20190 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 37  rowsort label-87
201a0 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
201b0 43 54 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32  CT + ( cor0.col2
201c0 20 29 20 2b 20 28 20 63 6f 6c 30 20 29 20 44 49   ) + ( col0 ) DI
201d0 56 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  V cor0.col0 FROM
201e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
201f0 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d 0a 38 33 0d 0a  ---..2..34..83..
20200 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
20210 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
20220 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20230 20 6c 61 62 65 6c 2d 38 37 39 0d 0a 53 45 4c 45   label-879..SELE
20240 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20  CT DISTINCT + ( 
20250 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 28 20  cor0.col2 ) + ( 
20260 63 6f 6c 30 20 29 20 2f 20 63 6f 72 30 2e 63 6f  col0 ) / cor0.co
20270 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
20280 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33  cor0..----..2..3
20290 34 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..83....skipif 
202a0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
202b0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
202c0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
202d0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
202e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
202f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
20300 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  l2 * - col0 * + 
20310 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
20320 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
20330 2d 0d 0a 31 33 32 33 0d 0a 31 35 38 31 38 34 0d  -..1323..158184.
20340 0a 32 33 37 31 35 38 0d 0a 0d 0a 73 6b 69 70 69  .237158....skipi
20350 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
20360 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
20370 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
20380 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
20390 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
203a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
203b0 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2d 20 2b 20  INCT + col2 - + 
203c0 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 30 20 46  cor0.col0 col0 F
203d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
203e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32  ..----..-41..-52
203f0 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..20....query I 
20400 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20410 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
20420 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  0 + - col0 * - c
20430 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
20440 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
20450 2d 2d 2d 0d 0a 31 31 39 30 0d 0a 35 35 32 0d 0a  ---..1190..552..
20460 37 38 33 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7832....onlyif m
20470 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
20480 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
20490 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
204a0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
204b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
204c0 2d 38 38 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -883..SELECT ALL
204d0 20 2d 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20   - CAST( + col1 
204e0 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
204f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
20500 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d  ---..-17..-31..-
20510 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  59....skipif mys
20520 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
20530 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
20540 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38 33 0d 0a  sort label-883..
20550 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53  SELECT ALL - CAS
20560 54 20 28 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e  T ( + col1 AS IN
20570 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20  TEGER ) AS col2 
20580 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
20590 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a  .-17..-31..-59..
205a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
205b0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 28 20  t..SELECT - ( ( 
205c0 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 29 20  col2 ) + col0 ) 
205d0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
205e0 0a 2d 31 30 34 0d 0a 2d 31 31 37 0d 0a 2d 33 34  .-104..-117..-34
205f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20600 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
20610 63 6f 72 31 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f  cor1.col2 * + co
20620 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  r0.col0 AS col1 
20630 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
20640 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
20650 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
20660 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
20670 67 20 74 6f 20 35 34 35 32 32 34 34 31 64 62 66  g to 54522441dbf
20680 37 66 62 35 36 65 31 39 61 38 38 38 35 37 32 64  7fb56e19a888572d
20690 31 66 36 65 33 0d 0a 0d 0a 71 75 65 72 79 20 49  1f6e3....query I
206a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
206b0 20 2b 20 2b 20 34 33 20 2b 20 63 6f 72 30 2e 63   + + 43 + cor0.c
206c0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
206d0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
206e0 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 32 32 0d 0a 35  ---..121..122..5
206f0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
20700 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
20710 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 32   - cor0.col2 * 2
20720 35 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  5 FROM tab0 AS c
20730 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 30  or0..----..-2050
20740 0d 0a 2d 32 35 0d 0a 2d 38 32 35 0d 0a 0d 0a 71  ..-25..-825....q
20750 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20760 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20  SELECT + + col2 
20770 2b 20 34 35 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 45 AS col0 FRO
20780 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
20790 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31 34 31 0d 0a  ----..102..141..
207a0 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
207b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
207c0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
207d0 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  + col2 * + col0 
207e0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
207f0 0a 33 33 39 35 0d 0a 36 36 34 31 31 38 0d 0a 36  .3395..664118..6
20800 38 31 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8112....onlyif m
20810 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
20820 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
20830 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
20840 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
20850 62 65 6c 2d 38 39 30 0d 0a 53 45 4c 45 43 54 20  bel-890..SELECT 
20860 2d 20 63 6f 6c 30 20 44 49 56 20 39 34 20 41 53  - col0 DIV 94 AS
20870 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
20880 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
20890 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
208a0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
208b0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
208c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
208d0 39 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  90..SELECT - col
208e0 30 20 2f 20 39 34 20 41 53 20 63 6f 6c 30 20 46  0 / 94 AS col0 F
208f0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
20900 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
20910 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20920 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
20930 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b   + col2 * col2 +
20940 20 31 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   11 AS col0 FROM
20950 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
20960 2d 2d 2d 0d 0a 2d 31 34 33 33 0d 0a 2d 36 36 35  ---..-1433..-665
20970 0d 0a 2d 37 31 38 0d 0a 0d 0a 71 75 65 72 79 20  ..-718....query 
20980 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
20990 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c  T ALL col2 * col
209a0 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 74 61 62  2 * col2 + - tab
209b0 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  1.col0 FROM tab1
209c0 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 34 36 31 0d 0a  ..----..157461..
209d0 31 38 35 31 32 39 0d 0a 38 38 34 36 35 36 0d 0a  185129..884656..
209e0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
209f0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
20a00 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
20a10 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
20a20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39  rowsort label-89
20a30 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  3..SELECT ALL - 
20a40 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col2 * - col2 + 
20a50 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 2b 20  col1 DIV col1 + 
20a60 36 38 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  68 FROM tab0..--
20a70 2d 2d 0d 0a 31 31 35 38 0d 0a 36 37 39 33 0d 0a  --..1158..6793..
20a80 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  70....skipif mys
20a90 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
20aa0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
20ab0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 33 0d 0a  sort label-893..
20ac0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
20ad0 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  2 * - col2 + col
20ae0 31 20 2f 20 63 6f 6c 31 20 2b 20 36 38 20 46 52  1 / col1 + 68 FR
20af0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
20b00 31 35 38 0d 0a 36 37 39 33 0d 0a 37 30 0d 0a 0d  158..6793..70...
20b10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20b20 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
20b30 54 20 2b 20 63 6f 72 31 2e 63 6f 6c 30 20 41 53  T + cor1.col0 AS
20b40 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
20b50 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
20b60 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  IN tab1 AS cor1.
20b70 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30  .----..3..64..80
20b80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20b90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20  ort..SELECT ( - 
20ba0 35 38 20 29 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  58 ) + - col2 * 
20bb0 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30  ( col0 ) AS col0
20bc0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
20bd0 0d 0a 2d 32 32 30 0d 0a 2d 33 37 30 36 0d 0a 2d  ..-220..-3706..-
20be0 37 37 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7738....query I 
20bf0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20c00 63 6f 6c 32 20 2b 20 2b 20 35 34 20 46 52 4f 4d  col2 + + 54 FROM
20c10 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
20c20 2d 2d 2d 0d 0a 38 30 0d 0a 38 31 0d 0a 39 32 0d  ---..80..81..92.
20c30 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
20c40 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
20c50 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
20c60 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
20c70 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
20c80 39 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  97..SELECT ALL -
20c90 20 2d 20 28 20 36 36 20 29 20 2a 20 2b 20 63 6f   - ( 66 ) * + co
20ca0 6c 30 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f  l0 + col0 DIV co
20cb0 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
20cc0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
20cd0 2d 2d 0d 0a 31 35 38 34 0d 0a 32 33 31 30 0d 0a  --..1584..2310..
20ce0 35 38 37 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  5874....skipif m
20cf0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
20d00 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
20d10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 37  owsort label-897
20d20 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
20d30 20 28 20 36 36 20 29 20 2a 20 2b 20 63 6f 6c 30   ( 66 ) * + col0
20d40 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 41   + col0 / col1 A
20d50 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
20d60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20d70 31 35 38 34 0d 0a 32 33 31 30 0d 0a 35 38 37 34  1584..2310..5874
20d80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20d90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
20da0 2b 20 33 31 20 2b 20 2b 20 63 6f 6c 30 20 41 53  + 31 + + col0 AS
20db0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
20dc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 0d  cor0..----..111.
20dd0 0a 33 34 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79  .34..95....query
20de0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20df0 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  CT - cor0.col2 *
20e00 20 2d 20 39 36 20 46 52 4f 4d 20 74 61 62 30 20   - 96 FROM tab0 
20e10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
20e20 31 36 38 0d 0a 37 38 37 32 0d 0a 39 36 0d 0a 0d  168..7872..96...
20e30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20e40 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
20e50 54 20 2b 20 33 32 20 2b 20 2b 20 63 6f 6c 31 20  T + 32 + + col1 
20e60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
20e70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20e80 0a 34 39 0d 0a 36 33 0d 0a 39 31 0d 0a 0d 0a 71  .49..63..91....q
20e90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20ea0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
20eb0 63 6f 6c 32 20 2a 20 37 31 20 2a 20 63 6f 6c 31  col2 * 71 * col1
20ec0 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53   + ( + col0 ) AS
20ed0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
20ee0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
20ef0 30 31 35 32 32 0d 0a 35 32 39 38 39 31 0d 0a 36  01522..529891..6
20f00 39 32 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  922....onlyif my
20f10 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
20f20 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
20f30 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
20f40 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
20f50 65 6c 2d 39 30 32 0d 0a 53 45 4c 45 43 54 20 2d  el-902..SELECT -
20f60 20 33 39 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c   39 + col1 * col
20f70 32 20 44 49 56 20 2b 20 63 6f 6c 32 20 46 52 4f  2 DIV + col2 FRO
20f80 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
20f90 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a  ----..-13..-26..
20fa0 2d 32 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -29....skipif my
20fb0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
20fc0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
20fd0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 32 0d  wsort label-902.
20fe0 0a 53 45 4c 45 43 54 20 2d 20 33 39 20 2b 20 63  .SELECT - 39 + c
20ff0 6f 6c 31 20 2a 20 63 6f 6c 32 20 2f 20 2b 20 63  ol1 * col2 / + c
21000 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
21010 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
21020 0d 0a 2d 32 36 0d 0a 2d 32 39 0d 0a 0d 0a 71 75  ..-26..-29....qu
21030 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21040 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
21050 20 2b 20 2d 20 39 36 20 41 53 20 63 6f 6c 30 20   + - 96 AS col0 
21060 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
21070 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 35  0..----..-10..-5
21080 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..1....query I r
21090 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
210a0 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30   - col1 ) * col0
210b0 20 2b 20 31 31 20 41 53 20 63 6f 6c 30 20 46 52   + 11 AS col0 FR
210c0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
210d0 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 33 0d 0a 2d 33  .----..-2053..-3
210e0 33 38 34 0d 0a 2d 38 30 38 38 0d 0a 0d 0a 6f 6e  384..-8088....on
210f0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
21100 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
21110 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
21120 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
21130 6f 72 74 20 6c 61 62 65 6c 2d 39 30 35 0d 0a 53  ort label-905..S
21140 45 4c 45 43 54 20 2d 20 35 38 20 44 49 56 20 2d  ELECT - 58 DIV -
21150 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
21160 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
21170 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
21180 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
21190 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
211a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
211b0 30 35 0d 0a 53 45 4c 45 43 54 20 2d 20 35 38 20  05..SELECT - 58 
211c0 2f 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  / - col1 FROM ta
211d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
211e0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c  ..0..0..0....onl
211f0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
21200 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
21210 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
21220 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
21230 72 74 20 6c 61 62 65 6c 2d 39 30 36 0d 0a 53 45  rt label-906..SE
21240 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
21250 2a 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20  * col0 DIV col1 
21260 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
21270 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
21280 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d  .-3..-64..-80...
21290 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
212a0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
212b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
212c0 6c 61 62 65 6c 2d 39 30 36 0d 0a 53 45 4c 45 43  label-906..SELEC
212d0 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63  T ALL - col1 * c
212e0 6f 6c 30 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 / col1 AS co
212f0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
21300 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a  cor0..----..-3..
21310 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72  -64..-80....quer
21320 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21330 45 43 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2a  ECT - ( col0 ) *
21340 20 28 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d   ( + col2 ) FROM
21350 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
21360 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d  ---..-35..-7298.
21370 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-792....query I
21380 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21390 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f   DISTINCT - + co
213a0 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46  r0.col0 * col0 F
213b0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
213c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d  ..----..-1225..-
213d0 35 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75  576..-7921....qu
213e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
213f0 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 36 39 20  ELECT col0 + 69 
21400 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  * col0 FROM tab0
21410 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 30 0d 0a 32 34  ..----..1680..24
21420 35 30 0d 0a 36 32 33 30 0d 0a 0d 0a 71 75 65 72  50..6230....quer
21430 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21440 45 43 54 20 41 4c 4c 20 2d 20 31 20 2a 20 63 6f  ECT ALL - 1 * co
21450 6c 32 20 2a 20 2d 20 36 37 20 46 52 4f 4d 20 74  l2 * - 67 FROM t
21460 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
21470 2d 0d 0a 33 36 31 38 0d 0a 33 38 31 39 0d 0a 36  -..3618..3819..6
21480 34 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  432....query I r
21490 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37  owsort..SELECT 7
214a0 34 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  4 FROM tab0, tab
214b0 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  0 AS cor0, tab1 
214c0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
214d0 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
214e0 20 74 6f 20 64 63 32 32 39 37 39 65 36 64 32 36   to dc22979e6d26
214f0 31 37 39 35 62 64 33 63 65 32 39 39 30 66 64 62  1795bd3ce2990fdb
21500 62 66 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  bf82....query I 
21510 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21520 2d 20 32 39 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  - 29 * + cor0.co
21530 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
21540 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
21550 2d 2d 0d 0a 2d 32 34 39 34 0d 0a 2d 32 36 33 39  --..-2494..-2639
21560 0d 0a 2d 32 38 31 33 0d 0a 0d 0a 71 75 65 72 79  ..-2813....query
21570 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
21580 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
21590 32 39 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  29 * - col2 FROM
215a0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
215b0 2d 2d 2d 0d 0a 2d 31 35 36 36 0d 0a 2d 31 36 35  ---..-1566..-165
215c0 33 0d 0a 2d 32 37 38 34 0d 0a 0d 0a 71 75 65 72  3..-2784....quer
215d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
215e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
215f0 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  1 * + col0 + - c
21600 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
21610 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34   cor0..----..204
21620 30 0d 0a 33 33 36 30 0d 0a 38 30 31 30 0d 0a 0d  0..3360..8010...
21630 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21640 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 20 2a  ..SELECT ALL 2 *
21650 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
21660 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
21670 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75  78..48..70....qu
21680 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21690 45 4c 45 43 54 20 41 4c 4c 20 36 38 20 41 53 20  ELECT ALL 68 AS 
216a0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
216b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 38 0d 0a 36  or0..----..68..6
216c0 38 0d 0a 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  8..68....onlyif 
216d0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
216e0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
216f0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
21700 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
21710 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
21720 6c 2d 39 31 37 0d 0a 53 45 4c 45 43 54 20 63 6f  l-917..SELECT co
21730 6c 32 20 2a 20 43 41 53 54 28 20 63 6f 6c 32 20  l2 * CAST( col2 
21740 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f  AS SIGNED ) + co
21750 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
21760 2d 2d 0d 0a 31 34 36 31 0d 0a 37 33 35 0d 0a 37  --..1461..735..7
21770 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  60....skipif mys
21780 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
21790 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
217a0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 37 0d 0a  sort label-917..
217b0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 43 41  SELECT col2 * CA
217c0 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54  ST ( col2 AS INT
217d0 45 47 45 52 20 29 20 2b 20 63 6f 6c 31 20 46 52  EGER ) + col1 FR
217e0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
217f0 34 36 31 0d 0a 37 33 35 0d 0a 37 36 30 0d 0a 0d  461..735..760...
21800 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
21810 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
21820 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
21830 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
21840 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
21850 6f 72 74 20 6c 61 62 65 6c 2d 39 31 38 0d 0a 53  ort label-918..S
21860 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 31 20  ELECT tab2.col1 
21870 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  * + CAST( NULL A
21880 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c  S SIGNED ) + col
21890 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  2 * col0 AS col0
218a0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
218b0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
218c0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
218d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
218e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
218f0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 38 0d 0a  sort label-918..
21900 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 31  SELECT tab2.col1
21910 20 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c   * + CAST ( NULL
21920 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
21930 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS c
21940 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
21950 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
21960 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
21970 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21980 20 2b 20 35 34 20 2b 20 63 6f 6c 32 20 41 53 20   + 54 + col2 AS 
21990 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
219a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
219b0 36 0d 0a 35 35 0d 0a 38 37 0d 0a 0d 0a 71 75 65  6..55..87....que
219c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
219d0 4c 45 43 54 20 2b 20 38 38 20 41 53 20 63 6f 6c  LECT + 88 AS col
219e0 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
219f0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
21a00 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
21a10 67 20 74 6f 20 36 62 65 31 37 62 38 32 65 63 62  g to 6be17b82ecb
21a20 33 65 38 62 32 36 38 66 63 62 34 62 61 36 31 30  3e8b268fcb4ba610
21a30 64 64 62 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ddb37....query I
21a40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21a50 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20   + tab0.col0 AS 
21a60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20  col0 FROM tab2, 
21a70 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f  tab1 AS cor0 CRO
21a80 53 53 20 4a 4f 49 4e 20 74 61 62 30 0d 0a 2d 2d  SS JOIN tab0..--
21a90 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
21aa0 73 68 69 6e 67 20 74 6f 20 39 66 63 31 64 63 64  shing to 9fc1dcd
21ab0 37 36 66 65 61 66 34 33 65 35 63 35 64 63 30 36  76feaf43e5c5dc06
21ac0 30 61 30 32 30 31 34 63 64 0d 0a 0d 0a 71 75 65  0a02014cd....que
21ad0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21ae0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 32  LECT DISTINCT 92
21af0 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * - cor0.col1 F
21b00 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
21b10 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
21b20 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor1..----..-11
21b30 39 36 0d 0a 2d 32 33 39 32 0d 0a 2d 39 32 30 0d  96..-2392..-920.
21b40 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
21b50 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
21b60 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
21b70 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
21b80 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
21b90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21ba0 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  ECT + col0 * - c
21bb0 6f 6c 32 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20  ol2 + col2 col0 
21bc0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
21bd0 0a 2d 31 36 32 0d 0a 2d 32 30 30 32 0d 0a 2d 32  .-162..-2002..-2
21be0 39 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  964....query I r
21bf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
21c00 49 53 54 49 4e 43 54 20 37 36 20 46 52 4f 4d 20  ISTINCT 76 FROM 
21c10 74 61 62 30 2c 20 74 61 62 32 20 63 6f 72 30 0d  tab0, tab2 cor0.
21c20 0a 2d 2d 2d 2d 0d 0a 37 36 0d 0a 0d 0a 71 75 65  .----..76....que
21c30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21c40 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
21c50 63 6f 6c 32 20 2d 20 36 37 20 2a 20 33 36 20 41  col2 - 67 * 36 A
21c60 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
21c70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21c80 2d 32 34 36 36 0d 0a 2d 32 34 36 39 0d 0a 2d 32  -2466..-2469..-2
21c90 35 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  508....query I r
21ca0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
21cb0 20 63 6f 6c 30 20 2b 20 2b 20 34 20 46 52 4f 4d   col0 + + 4 FROM
21cc0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
21cd0 2d 2d 2d 0d 0a 32 38 0d 0a 33 39 0d 0a 39 33 0d  ---..28..39..93.
21ce0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21cf0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
21d00 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 31  NCT - col1 + + 1
21d10 36 20 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  6 - - col1 AS co
21d20 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
21d30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a  cor0..----..16..
21d40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21d50 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
21d60 20 28 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2b   ( - tab0.col0 +
21d70 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20   col0 ) AS col1 
21d80 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
21d90 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
21da0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21db0 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
21dc0 2b 20 2d 20 63 6f 72 31 2e 63 6f 6c 30 20 46 52  + - cor1.col0 FR
21dd0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  OM tab2 AS cor0 
21de0 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20  CROSS JOIN tab0 
21df0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
21e00 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
21e10 74 6f 20 63 65 65 64 35 64 34 37 36 30 37 33 32  to ceed5d4760732
21e20 61 31 39 37 34 31 31 66 31 61 36 63 62 35 63 36  a197411f1a6cb5c6
21e30 35 37 66 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  57f....query I r
21e40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
21e50 6f 6c 32 20 2b 20 32 38 20 2d 20 2b 20 63 6f 6c  ol2 + 28 - + col
21e60 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
21e70 2d 0d 0a 2d 31 33 0d 0a 2d 32 34 0d 0a 34 38 0d  -..-13..-24..48.
21e80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21e90 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
21ea0 30 20 2a 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63  0 * + ( + cor0.c
21eb0 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20 2b 20 32  ol0 ) + col0 + 2
21ec0 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  9 AS col0 FROM t
21ed0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
21ee0 2d 0d 0a 31 32 38 39 0d 0a 36 32 39 0d 0a 38 30  -..1289..629..80
21ef0 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  39....query I ro
21f00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
21f10 6c 30 20 2b 20 33 38 20 46 52 4f 4d 20 74 61 62  l0 + 38 FROM tab
21f20 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
21f30 0a 31 30 32 0d 0a 31 31 38 0d 0a 34 31 0d 0a 0d  .102..118..41...
21f40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21f50 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
21f60 30 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 28 20 63  0 + col1 + - ( c
21f70 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29  ol1 + ( + col0 )
21f80 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
21f90 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
21fa0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
21fb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21fc0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20  SELECT col2 * - 
21fd0 39 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  91 * - col2 AS c
21fe0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
21ff0 2d 2d 2d 0d 0a 36 31 31 38 38 34 0d 0a 39 31 0d  ---..611884..91.
22000 0a 39 39 30 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  .99099....onlyif
22010 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
22020 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
22030 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
22040 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
22050 6c 61 62 65 6c 2d 39 33 35 0d 0a 53 45 4c 45 43  label-935..SELEC
22060 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72  T - col2 + + cor
22070 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20  0.col2 DIV col0 
22080 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
22090 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 35 37 0d 0a  ----..-36..-57..
220a0 2d 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -95....skipif my
220b0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
220c0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
220d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33 35 0d  wsort label-935.
220e0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
220f0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 63   + cor0.col2 / c
22100 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
22110 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d  r0..----..-36..-
22120 35 37 0d 0a 2d 39 35 0d 0a 0d 0a 6f 6e 6c 79 69  57..-95....onlyi
22130 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
22140 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
22150 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
22160 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
22170 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22180 62 65 6c 2d 39 33 36 0d 0a 53 45 4c 45 43 54 20  bel-936..SELECT 
22190 2b 20 63 6f 6c 31 20 2d 20 28 20 74 61 62 32 2e  + col1 - ( tab2.
221a0 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54 28 20 63  col2 + + CAST( c
221b0 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol0 AS SIGNED ) 
221c0 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  ) col0 FROM tab2
221d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 33  ..----..-100..-3
221e0 0d 0a 2d 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-45....skipif 
221f0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
22200 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
22210 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
22220 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
22230 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
22240 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
22250 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22260 20 6c 61 62 65 6c 2d 39 33 36 0d 0a 53 45 4c 45   label-936..SELE
22270 43 54 20 2b 20 63 6f 6c 31 20 2d 20 28 20 74 61  CT + col1 - ( ta
22280 62 32 2e 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54  b2.col2 + + CAST
22290 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   ( col0 AS INTEG
222a0 45 52 20 29 20 29 20 63 6f 6c 30 20 46 52 4f 4d  ER ) ) col0 FROM
222b0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   tab2..----..-10
222c0 30 0d 0a 2d 33 0d 0a 2d 34 35 0d 0a 0d 0a 71 75  0..-3..-45....qu
222d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
222e0 45 4c 45 43 54 20 2b 20 39 36 20 2a 20 2b 20 63  ELECT + 96 * + c
222f0 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 + col2 AS co
22300 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
22310 2d 2d 0d 0a 33 34 32 0d 0a 36 32 30 31 0d 0a 37  --..342..6201..7
22320 37 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  776....query I r
22330 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
22340 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b  ISTINCT - col1 +
22350 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 28   col0 * col1 + (
22360 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62   col0 ) FROM tab
22370 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 35 0d 0a 31  2..----..1405..1
22380 39 33 0d 0a 34 36 32 31 0d 0a 0d 0a 71 75 65 72  93..4621....quer
22390 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
223a0 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ECT - + cor0.col
223b0 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  2 + col0 * col2 
223c0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
223d0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 33 35  0..----..108..35
223e0 39 31 0d 0a 37 35 38 34 0d 0a 0d 0a 71 75 65 72  91..7584....quer
223f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22400 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  ECT cor0.col1 * 
22410 36 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  6 FROM tab1, tab
22420 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  0 AS cor0, tab1 
22430 41 53 20 63 6f 72 31 2c 20 74 61 62 30 2c 20 74  AS cor1, tab0, t
22440 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab0 AS cor2..---
22450 2d 0d 0a 32 34 33 20 76 61 6c 75 65 73 20 68 61  -..243 values ha
22460 73 68 69 6e 67 20 74 6f 20 39 31 39 33 30 35 64  shing to 919305d
22470 63 34 33 36 35 61 30 63 61 39 63 35 37 31 33 32  c4365a0ca9c57132
22480 61 30 33 33 64 32 37 64 33 0d 0a 0d 0a 71 75 65  a033d27d3....que
22490 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
224a0 4c 45 43 54 20 41 4c 4c 20 2b 20 36 38 20 41 53  LECT ALL + 68 AS
224b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
224c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 38 0d 0a  cor0..----..68..
224d0 36 38 0d 0a 36 38 0d 0a 0d 0a 71 75 65 72 79 20  68..68....query 
224e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
224f0 54 20 2b 20 36 20 46 52 4f 4d 20 74 61 62 30 2c  T + 6 FROM tab0,
22500 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
22510 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
22520 73 68 69 6e 67 20 74 6f 20 35 64 31 63 62 39 30  shing to 5d1cb90
22530 65 64 35 38 66 61 37 35 37 33 38 39 35 64 32 66  ed58fa7573895d2f
22540 39 35 62 32 31 31 38 32 31 0d 0a 0d 0a 73 6b 69  95b211821....ski
22550 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
22560 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
22570 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
22580 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
22590 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
225a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
225b0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  col1 + + col2 * 
225c0 2b 20 63 6f 6c 30 20 2a 20 2b 20 38 30 20 63 6f  + col0 * + 80 co
225d0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
225e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 35  cor0..----..1515
225f0 31 0d 0a 31 36 32 32 39 39 0d 0a 32 34 30 31 37  1..162299..24017
22600 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
22610 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
22620 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 32   col2 ) * - col2
22630 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
22640 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
22650 0d 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32  ..2916..3249..92
22660 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
22670 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
22680 2b 20 63 6f 6c 31 20 2a 20 2d 20 35 20 41 53 20  + col1 * - 5 AS 
22690 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
226a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
226b0 35 0d 0a 32 39 35 0d 0a 38 35 0d 0a 0d 0a 71 75  5..295..85....qu
226c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
226d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
226e0 20 28 20 63 6f 6c 30 20 29 20 2a 20 2d 20 63 6f   ( col0 ) * - co
226f0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
22700 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36  tab0..----..-206
22710 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d  4..-3395..-8099.
22720 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22730 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
22740 20 39 31 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20   91 * tab2.col1 
22750 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 2c  FROM tab2, tab0,
22760 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
22770 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
22780 61 73 68 69 6e 67 20 74 6f 20 35 38 36 66 36 33  ashing to 586f63
22790 64 35 64 33 30 65 33 33 37 38 38 65 65 61 30 65  d5d30e33788eea0e
227a0 36 64 30 34 39 35 30 36 64 39 0d 0a 0d 0a 6f 6e  6d049506d9....on
227b0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
227c0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
227d0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
227e0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
227f0 6f 72 74 20 6c 61 62 65 6c 2d 39 34 38 0d 0a 53  ort label-948..S
22800 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44 49 56  ELECT + col0 DIV
22810 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30   + col2 + + cor0
22820 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b  .col1 * + col1 +
22830 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f   - col2 DIV - co
22840 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
22850 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
22860 0a 37 33 39 36 0d 0a 38 32 38 32 0d 0a 39 34 34  .7396..8282..944
22870 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
22880 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
22890 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
228a0 6f 72 74 20 6c 61 62 65 6c 2d 39 34 38 0d 0a 53  ort label-948..S
228b0 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2b  ELECT + col0 / +
228c0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63   col2 + + cor0.c
228d0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d  ol1 * + col1 + -
228e0 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 72 30 2e 63   col2 / - cor0.c
228f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
22900 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39   cor0..----..739
22910 36 0d 0a 38 32 38 32 0d 0a 39 34 34 34 0d 0a 0d  6..8282..9444...
22920 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
22930 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
22940 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
22950 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
22960 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34 39  owsort label-949
22970 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
22980 63 6f 6c 30 20 44 49 56 20 2d 20 34 30 20 41 53  col0 DIV - 40 AS
22990 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
229a0 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 31 39 38  .----..-14..-198
229b0 0d 0a 2d 33 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-30....skipif 
229c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
229d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
229e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34  rowsort label-94
229f0 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  9..SELECT col0 *
22a00 20 63 6f 6c 30 20 2f 20 2d 20 34 30 20 41 53 20   col0 / - 40 AS 
22a10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
22a20 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 31 39 38 0d  ----..-14..-198.
22a30 0a 2d 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-30....query I 
22a40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22a50 33 38 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  38 * col0 FROM t
22a60 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 0d 0a  ab1..----..114..
22a70 32 34 33 32 0d 0a 33 30 34 30 0d 0a 0d 0a 71 75  2432..3040....qu
22a80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22a90 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a  ELECT + + col1 *
22aa0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c   cor0.col1 + col
22ab0 30 20 2b 20 2b 20 38 35 20 2a 20 2b 20 63 6f 6c  0 + + 85 * + col
22ac0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
22ad0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
22ae0 2d 0d 0a 33 32 36 33 0d 0a 33 35 39 38 0d 0a 35  -..3263..3598..5
22af0 37 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  769....query I r
22b00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
22b10 6f 6c 31 20 2b 20 31 33 20 46 52 4f 4d 20 74 61  ol1 + 13 FROM ta
22b20 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
22b30 0d 0a 33 30 0d 0a 34 34 0d 0a 37 32 0d 0a 0d 0a  ..30..44..72....
22b40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22b50 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
22b60 20 2d 20 63 6f 6c 31 20 2b 20 31 20 2d 20 2d 20   - col1 + 1 - - 
22b70 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
22b80 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
22b90 2d 2d 2d 2d 0d 0a 2d 37 33 36 32 0d 0a 2d 38 31  ----..-7362..-81
22ba0 39 38 0d 0a 2d 39 34 30 37 0d 0a 0d 0a 71 75 65  98..-9407....que
22bb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22bc0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 38 34  LECT - col0 + 84
22bd0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
22be0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 34 0d  r0..----..20..4.
22bf0 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .81....query I r
22c00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
22c10 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 28 20 31   cor0.col1 * ( 1
22c20 38 20 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f  8 ) + + col0 FRO
22c30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
22c40 2d 2d 2d 2d 0d 0a 2d 31 35 32 34 0d 0a 2d 31 35  ----..-1524..-15
22c50 34 39 0d 0a 2d 31 37 31 31 0d 0a 0d 0a 71 75 65  49..-1711....que
22c60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22c70 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
22c80 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  + col0 * + col0 
22c90 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
22ca0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 32 0d 0a 36  0..----..1322..6
22cb0 36 32 0d 0a 38 30 31 32 0d 0a 0d 0a 71 75 65 72  62..8012....quer
22cc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22cd0 45 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20 2b 20  ECT ALL - - ( + 
22ce0 39 38 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  98 ) AS col1 FRO
22cf0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43  M tab2 AS cor0 C
22d00 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41  ROSS JOIN tab0 A
22d10 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor1..----..9 
22d20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
22d30 6f 20 66 39 64 65 65 38 63 32 31 31 31 36 66 31  o f9dee8c21116f1
22d40 61 65 64 36 34 61 63 35 31 36 30 65 31 39 30 38  aed64ac5160e1908
22d50 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  09....onlyif mys
22d60 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
22d70 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
22d80 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
22d90 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
22da0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
22db0 35 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 43  58..SELECT + + C
22dc0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
22dd0 49 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 31  IMAL ) FROM tab1
22de0 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
22df0 4f 49 4e 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d  OIN tab0 cor1..-
22e00 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
22e10 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30  shing to cd7a790
22e20 31 65 34 37 63 31 35 31 35 35 34 30 34 61 66 66  1e47c15155404aff
22e30 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73 6b 69  0d216fe0b....ski
22e40 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
22e50 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
22e60 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
22e70 6c 2d 39 35 38 0d 0a 53 45 4c 45 43 54 20 2b 20  l-958..SELECT + 
22e80 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
22e90 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62   REAL ) FROM tab
22ea0 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  1 AS cor0 CROSS 
22eb0 4a 4f 49 4e 20 74 61 62 30 20 63 6f 72 31 0d 0a  JOIN tab0 cor1..
22ec0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
22ed0 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39  ashing to cd7a79
22ee0 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61 66  01e47c15155404af
22ef0 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 71 75  f0d216fe0b....qu
22f00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22f10 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
22f20 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a  .col0 * - col2 *
22f30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
22f40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
22f50 31 31 34 30 37 36 0d 0a 2d 35 31 30 33 0d 0a 2d  114076..-5103..-
22f60 35 32 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  52728....query I
22f70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22f80 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b   DISTINCT col0 +
22f90 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
22fa0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
22fb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a  cor0..----..29..
22fc0 37 34 0d 0a 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  74..93....onlyif
22fd0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
22fe0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
22ff0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
23000 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
23010 6c 61 62 65 6c 2d 39 36 31 0d 0a 53 45 4c 45 43  label-961..SELEC
23020 54 20 2b 20 2d 20 34 34 20 2b 20 2b 20 63 6f 6c  T + - 44 + + col
23030 32 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f  2 DIV col1 AS co
23040 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
23050 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a 2d 34  0..----..-42..-4
23060 34 0d 0a 2d 34 34 0d 0a 0d 0a 73 6b 69 70 69 66  4..-44....skipif
23070 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
23080 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
23090 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
230a0 36 31 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 34  61..SELECT + - 4
230b0 34 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c  4 + + col2 / col
230c0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
230d0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
230e0 2d 34 32 0d 0a 2d 34 34 0d 0a 2d 34 34 0d 0a 0d  -42..-44..-44...
230f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23100 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28  ..SELECT ALL - (
23110 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20 41   col2 ) * col2 A
23120 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
23130 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23140 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d 36 37 32 34  -1..-1089..-6724
23150 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23160 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 38 20 2b  ort..SELECT 28 +
23170 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
23180 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
23190 30 36 0d 0a 31 30 37 0d 0a 33 35 0d 0a 0d 0a 71  06..107..35....q
231a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
231b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
231c0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20  + col2 * col2 + 
231d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
231e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 39 0d  or0..----..2919.
231f0 0a 33 33 31 33 0d 0a 39 32 39 36 0d 0a 0d 0a 6f  .3313..9296....o
23200 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
23210 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
23220 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
23230 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
23240 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36 35 0d 0a  sort label-965..
23250 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
23260 63 6f 6c 31 20 44 49 56 20 2b 20 33 35 20 2b 20  col1 DIV + 35 + 
23270 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  - col2 AS col2 F
23280 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
23290 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37  ..----..-54..-57
232a0 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-96....skipif 
232b0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
232c0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
232d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36  rowsort label-96
232e0 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
232f0 43 54 20 63 6f 6c 31 20 2f 20 2b 20 33 35 20 2b  CT col1 / + 35 +
23300 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
23310 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
23320 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35  0..----..-54..-5
23330 37 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20  7..-96....query 
23340 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23350 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 63  T ALL col2 * + c
23360 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ol1 + cor0.col1 
23370 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
23380 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 33 0d 0a 36  0..----..1593..6
23390 36 33 0d 0a 38 36 38 0d 0a 0d 0a 71 75 65 72 79  63..868....query
233a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
233b0 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20  CT ALL - - col1 
233c0 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  - - cor0.col0 FR
233d0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
233e0 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36 0d  --..137..38..96.
233f0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
23400 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
23410 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
23420 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
23430 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
23440 36 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  68..SELECT - col
23450 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 2d 20 35  2 DIV - col0 - 5
23460 38 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  8 FROM tab1 cor0
23470 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 0d 0a 2d 35 37  ..----..-40..-57
23480 0d 0a 2d 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-58....skipif 
23490 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
234a0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
234b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36  rowsort label-96
234c0 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  8..SELECT - col2
234d0 20 2f 20 2d 20 63 6f 6c 30 20 2d 20 35 38 20 46   / - col0 - 58 F
234e0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
234f0 2d 2d 2d 0d 0a 2d 34 30 0d 0a 2d 35 37 0d 0a 2d  ---..-40..-57..-
23500 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
23510 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
23520 4c 20 2b 20 63 6f 6c 30 20 2b 20 36 32 20 46 52  L + col0 + 62 FR
23530 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
23540 0a 2d 2d 2d 2d 0d 0a 31 35 31 0d 0a 38 36 0d 0a  .----..151..86..
23550 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
23560 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
23570 74 61 62 31 2e 63 6f 6c 32 20 2b 20 31 32 20 41  tab1.col2 + 12 A
23580 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
23590 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 36 36 0d  ..----..108..66.
235a0 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .69....query I r
235b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
235c0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
235d0 20 2b 20 33 37 20 46 52 4f 4d 20 74 61 62 30 20   + 37 FROM tab0 
235e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
235f0 34 35 0d 0a 33 36 0d 0a 34 0d 0a 0d 0a 71 75 65  45..36..4....que
23600 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23610 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
23620 2b 20 2d 20 35 30 20 46 52 4f 4d 20 74 61 62 31  + - 50 FROM tab1
23630 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23640 2d 34 37 0d 0a 31 34 0d 0a 33 30 0d 0a 0d 0a 71  -47..14..30....q
23650 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23660 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
23670 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  - col0 * - col1 
23680 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  * - col1 + col1 
23690 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
236a0 2d 2d 2d 2d 0d 0a 2d 32 32 38 31 34 0d 0a 2d 32  ----..-22814..-2
236b0 37 31 34 35 39 0d 0a 2d 36 36 39 36 0d 0a 0d 0a  71459..-6696....
236c0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
236d0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
236e0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
236f0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
23700 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
23710 72 74 20 6c 61 62 65 6c 2d 39 37 34 0d 0a 53 45  rt label-974..SE
23720 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 43 41  LECT + col2 * CA
23730 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e  ST( col1 AS SIGN
23740 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63  ED ) FROM tab2 c
23750 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d  or0..----..1534.
23760 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 73 6b 69  .646..837....ski
23770 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
23780 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
23790 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
237a0 6c 2d 39 37 34 0d 0a 53 45 4c 45 43 54 20 2b 20  l-974..SELECT + 
237b0 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 63 6f  col2 * CAST ( co
237c0 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
237d0 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
237e0 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d  ----..1534..646.
237f0 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .837....query I 
23800 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23810 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 38 34 20  ALL col1 * + 84 
23820 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
23830 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
23840 0a 31 34 32 38 0d 0a 32 36 30 34 0d 0a 34 39 35  .1428..2604..495
23850 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
23860 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
23870 30 20 2a 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20  0 * col2 - col2 
23880 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
23890 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 33 35  1..----..108..35
238a0 39 31 0d 0a 37 35 38 34 0d 0a 0d 0a 71 75 65 72  91..7584....quer
238b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
238c0 45 43 54 20 2b 20 28 20 63 6f 6c 32 20 2a 20 63  ECT + ( col2 * c
238d0 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol2 ) AS col2 FR
238e0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
238f0 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d  916..3249..9216.
23900 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23910 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 63  rt..SELECT ( + c
23920 6f 6c 31 20 29 20 2a 20 2d 20 74 61 62 30 2e 63  ol1 ) * - tab0.c
23930 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
23940 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38  ---..-7396..-828
23950 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72  1..-9409....quer
23960 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23970 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 28 20 63  ECT + col0 * ( c
23980 6f 6c 31 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f  ol1 ) + col2 FRO
23990 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
239a0 38 31 0d 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d  81..244..4628...
239b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
239c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
239d0 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2a 20 2d  T - ( col0 ) * -
239e0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46   col0 * - col2 F
239f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
23a00 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 33 34 37 32 0d  ..----..-233472.
23a10 0a 2d 34 38 36 0d 0a 2d 36 31 34 34 30 30 0d 0a  .-486..-614400..
23a20 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
23a30 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
23a40 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
23a50 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
23a60 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
23a70 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38 31 0d 0a  sort label-981..
23a80 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
23a90 2b 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 2d  + + ( col2 ) * -
23aa0 20 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54 28 20   col0 + + CAST( 
23ab0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
23ac0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
23ad0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
23ae0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
23af0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
23b00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23b10 20 6c 61 62 65 6c 2d 39 38 31 0d 0a 53 45 4c 45   label-981..SELE
23b20 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
23b30 28 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c  ( col2 ) * - col
23b40 30 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  0 + + CAST ( NUL
23b50 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
23b60 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
23b70 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
23b80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23b90 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f  .SELECT ALL ( co
23ba0 6c 31 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l1 ) + col2 FROM
23bb0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
23bc0 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d  ..109..67..80...
23bd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23be0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
23bf0 20 34 38 20 46 52 4f 4d 20 74 61 62 30 20 41 53   48 FROM tab0 AS
23c00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38   cor0..----..-48
23c10 0d 0a 2d 34 38 0d 0a 2d 34 38 0d 0a 0d 0a 71 75  ..-48..-48....qu
23c20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23c30 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 38 36  ELECT ALL + - 86
23c40 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
23c50 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
23c60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d  or0..----..2838.
23c70 0a 37 30 35 32 0d 0a 38 36 0d 0a 0d 0a 71 75 65  .7052..86....que
23c80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23c90 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
23ca0 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  - cor0.col0 AS c
23cb0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
23cc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a  r0..----..-162..
23cd0 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a  -3648..-7680....
23ce0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
23cf0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
23d00 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
23d10 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
23d20 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38 36 0d  wsort label-986.
23d30 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
23d40 20 2b 20 2b 20 36 39 20 44 49 56 20 63 6f 72 30   + + 69 DIV cor0
23d50 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20  .col2 col2 FROM 
23d60 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
23d70 2d 2d 0d 0a 30 0d 0a 32 0d 0a 36 39 0d 0a 0d 0a  --..0..2..69....
23d80 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
23d90 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
23da0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
23db0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
23dc0 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
23dd0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
23de0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
23df0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38  rowsort label-98
23e00 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
23e10 43 54 20 2b 20 2b 20 36 39 20 2f 20 63 6f 72 30  CT + + 69 / cor0
23e20 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20  .col2 col2 FROM 
23e30 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
23e40 2d 2d 0d 0a 30 0d 0a 32 0d 0a 36 39 0d 0a 0d 0a  --..0..2..69....
23e50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23e60 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 31 20 29  .SELECT ( col1 )
23e70 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
23e80 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
23e90 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32  0..----..1343..2
23ea0 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72  17..4602....quer
23eb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23ec0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
23ed0 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  2 * cor0.col2 + 
23ee0 2b 20 28 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  + ( - col1 * + c
23ef0 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol1 ) AS col1 FR
23f00 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
23f10 2d 2d 0d 0a 32 32 34 30 0d 0a 33 31 34 39 0d 0a  --..2240..3149..
23f20 39 30 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9047....query I 
23f30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23f40 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
23f50 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  + + cor0.col1 FR
23f60 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
23f70 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .----..0....quer
23f80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23f90 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
23fa0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
23fb0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  ol1 * + col2 AS 
23fc0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
23fd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
23fe0 36 31 32 0d 0a 2d 37 32 35 0d 0a 2d 38 34 34 0d  612..-725..-844.
23ff0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
24000 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
24010 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
24020 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
24030 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
24040 39 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34  91..SELECT ALL 4
24050 31 20 2b 20 39 39 20 44 49 56 20 63 6f 6c 30 20  1 + 99 DIV col0 
24060 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
24070 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
24080 31 30 36 0d 0a 31 32 32 0d 0a 37 37 0d 0a 0d 0a  106..122..77....
24090 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
240a0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
240b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
240c0 61 62 65 6c 2d 39 39 31 0d 0a 53 45 4c 45 43 54  abel-991..SELECT
240d0 20 41 4c 4c 20 34 31 20 2b 20 39 39 20 2f 20 63   ALL 41 + 99 / c
240e0 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol0 + col0 AS co
240f0 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
24100 2d 2d 0d 0a 31 30 36 0d 0a 31 32 32 0d 0a 37 37  --..106..122..77
24110 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24120 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
24130 63 6f 6c 30 20 2b 20 36 30 20 41 53 20 63 6f 6c  col0 + 60 AS col
24140 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
24150 2d 0d 0a 31 33 38 0d 0a 31 33 39 0d 0a 36 37 0d  -..138..139..67.
24160 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24170 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d  rt..SELECT - ( -
24180 20 63 6f 6c 30 20 29 20 2d 20 2d 20 63 6f 6c 30   col0 ) - - col0
24190 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
241a0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 31  b1..----..128..1
241b0 36 30 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49  60..6....query I
241c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
241d0 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 30 20 2a   ALL tab2.col0 *
241e0 20 2b 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d   + ( col0 ) FROM
241f0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d   tab2..----..49.
24200 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a 71  .6084..6241....q
24210 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24220 53 45 4c 45 43 54 20 2d 20 35 35 20 2a 20 63 6f  SELECT - 55 * co
24230 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
24240 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
24250 2d 2d 0d 0a 2d 31 33 32 30 0d 0a 2d 31 39 32 35  --..-1320..-1925
24260 0d 0a 2d 34 38 39 35 0d 0a 0d 0a 71 75 65 72 79  ..-4895....query
24270 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24280 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
24290 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
242a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
242b0 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -..0....skipif p
242c0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
242d0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
242e0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
242f0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
24300 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24310 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
24320 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52  + + col1 col2 FR
24330 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
24340 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a  .----..118..34..
24350 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
24360 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
24370 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 2b  + ( + col1 ) * +
24380 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
24390 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
243a0 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39 34  7396..-8281..-94
243b0 30 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  09....skipif pos
243c0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
243d0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
243e0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
243f0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
24400 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24410 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c  SELECT + ( + col
24420 30 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20  0 + - tab2.col2 
24430 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  ) col2 FROM tab2
24440 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34 31 0d  ..----..-20..41.
24450 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .52....query I r
24460 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
24470 20 36 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   60 FROM tab0, t
24480 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
24490 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
244a0 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
244b0 6e 67 20 74 6f 20 31 61 30 62 32 39 66 38 65 36  ng to 1a0b29f8e6
244c0 66 38 32 63 35 34 36 32 33 61 36 36 35 62 61 34  f82c54623a665ba4
244d0 61 66 38 66 64 31 0d 0a 0d 0a 71 75 65 72 79 20  af8fd1....query 
244e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
244f0 54 20 41 4c 4c 20 2d 20 32 34 20 41 53 20 63 6f  T ALL - 24 AS co
24500 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
24510 2d 2d 0d 0a 2d 32 34 0d 0a 2d 32 34 0d 0a 2d 32  --..-24..-24..-2
24520 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
24530 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
24540 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
24550 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
24560 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
24570 2d 31 30 30 32 0d 0a 53 45 4c 45 43 54 20 2b 20  -1002..SELECT + 
24580 32 30 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 43 41  20 * col2 + - CA
24590 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ST( col2 AS SIGN
245a0 45 44 20 29 20 44 49 56 20 2d 20 63 6f 6c 30 20  ED ) DIV - col0 
245b0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
245c0 0a 31 30 39 38 0d 0a 31 31 34 30 0d 0a 31 39 32  .1098..1140..192
245d0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
245e0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
245f0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
24600 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 32 0d 0a  ort label-1002..
24610 53 45 4c 45 43 54 20 2b 20 32 30 20 2a 20 63 6f  SELECT + 20 * co
24620 6c 32 20 2b 20 2d 20 43 41 53 54 20 28 20 63 6f  l2 + - CAST ( co
24630 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l2 AS INTEGER ) 
24640 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  / - col0 FROM ta
24650 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 38 0d 0a  b1..----..1098..
24660 31 31 34 30 0d 0a 31 39 32 31 0d 0a 0d 0a 71 75  1140..1921....qu
24670 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24680 45 4c 45 43 54 20 2d 20 36 34 20 41 53 20 63 6f  ELECT - 64 AS co
24690 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l0 FROM tab1, ta
246a0 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b0 AS cor0, tab1
246b0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
246c0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
246d0 67 20 74 6f 20 31 30 30 63 36 32 35 65 34 35 37  g to 100c625e457
246e0 31 35 63 32 30 33 36 38 35 35 31 39 38 39 35 31  15c2036855198951
246f0 34 62 61 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  4ba64....query I
24700 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24710 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
24720 20 2a 20 36 34 20 2d 20 2d 20 38 33 20 2a 20 63   * 64 - - 83 * c
24730 6f 6c 30 20 2a 20 2d 20 35 37 20 46 52 4f 4d 20  ol0 * - 57 FROM 
24740 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 36  tab1..----..-176
24750 34 39 0d 0a 2d 33 30 36 34 33 32 0d 0a 2d 33 38  49..-306432..-38
24760 34 36 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4624....query I 
24770 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24780 41 4c 4c 20 2b 20 2b 20 28 20 34 30 20 29 20 2a  ALL + + ( 40 ) *
24790 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 31   + col0 - + col1
247a0 20 2a 20 2d 20 38 20 2a 20 2d 20 63 6f 6c 31 20   * - 8 * - col1 
247b0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
247c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 37 32 38 0d  0..----..-24728.
247d0 0a 2d 37 34 30 38 0d 0a 38 34 38 0d 0a 0d 0a 6f  .-7408..848....o
247e0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
247f0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
24800 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
24810 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
24820 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24830 74 20 6c 61 62 65 6c 2d 31 30 30 36 0d 0a 53 45  t label-1006..SE
24840 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41  LECT DISTINCT CA
24850 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
24860 45 44 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  ED ) * + col2 * 
24870 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
24880 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24890 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
248a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
248b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
248c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30  owsort label-100
248d0 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
248e0 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  CT CAST ( NULL A
248f0 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20  S INTEGER ) * + 
24900 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52  col2 * - col2 FR
24910 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
24920 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
24930 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24940 53 45 4c 45 43 54 20 28 20 2b 20 33 38 20 29 20  SELECT ( + 38 ) 
24950 2a 20 63 6f 6c 31 20 2d 20 2d 20 38 37 20 41 53  * col1 - - 87 AS
24960 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
24970 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
24980 32 36 35 0d 0a 32 33 32 39 0d 0a 37 33 33 0d 0a  265..2329..733..
24990 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
249a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
249b0 28 20 34 34 20 29 20 46 52 4f 4d 20 74 61 62 30  ( 44 ) FROM tab0
249c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34   cor0..----..-44
249d0 0d 0a 2d 34 34 0d 0a 2d 34 34 0d 0a 0d 0a 6f 6e  ..-44..-44....on
249e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
249f0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
24a00 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
24a10 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
24a20 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 39 0d 0a  ort label-1009..
24a30 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
24a40 6f 6c 31 20 2a 20 63 6f 6c 30 20 44 49 56 20 63  ol1 * col0 DIV c
24a50 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
24a60 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
24a70 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a  ---..7..78..79..
24a80 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
24a90 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
24aa0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24ab0 20 6c 61 62 65 6c 2d 31 30 30 39 0d 0a 53 45 4c   label-1009..SEL
24ac0 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31  ECT ALL + + col1
24ad0 20 2a 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 41   * col0 / col1 A
24ae0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
24af0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24b00 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65  7..78..79....que
24b10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24b20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
24b30 6c 30 20 2a 20 2d 20 32 35 20 2b 20 63 6f 6c 32  l0 * - 25 + col2
24b40 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
24b50 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
24b60 0d 0a 2d 31 34 38 0d 0a 2d 31 39 32 34 0d 0a 2d  ..-148..-1924..-
24b70 31 39 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1937....query I 
24b80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24b90 44 49 53 54 49 4e 43 54 20 2b 20 37 33 20 2b 20  DISTINCT + 73 + 
24ba0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  + cor0.col2 * co
24bb0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
24bc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 31  cor0..----..1321
24bd0 0d 0a 31 34 37 37 0d 0a 36 34 33 0d 0a 0d 0a 71  ..1477..643....q
24be0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24bf0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 32  SELECT ALL - - 2
24c00 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
24c10 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
24c20 32 32 0d 0a 32 32 0d 0a 32 32 0d 0a 0d 0a 71 75  22..22..22....qu
24c30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24c40 45 4c 45 43 54 20 2d 20 34 30 20 2a 20 2d 20 63  ELECT - 40 * - c
24c50 6f 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 6c 32 20  or0.col2 - col2 
24c60 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
24c70 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 34 0d 0a 31  0..----..1014..1
24c80 30 35 33 0d 0a 31 34 38 32 0d 0a 0d 0a 6f 6e 6c  053..1482....onl
24c90 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
24ca0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
24cb0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
24cc0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
24cd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
24ce0 6c 61 62 65 6c 2d 31 30 31 34 0d 0a 53 45 4c 45  label-1014..SELE
24cf0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20  CT ALL col2 + - 
24d00 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
24d10 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
24d20 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
24d30 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
24d40 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
24d50 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
24d60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
24d70 2d 31 30 31 34 0d 0a 53 45 4c 45 43 54 20 41 4c  -1014..SELECT AL
24d80 4c 20 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54 20  L col2 + - CAST 
24d90 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
24da0 52 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  R ) FROM tab0..-
24db0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
24dc0 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .NULL....onlyif 
24dd0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
24de0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
24df0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
24e00 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
24e10 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
24e20 6c 2d 31 30 31 35 0d 0a 53 45 4c 45 43 54 20 41  l-1015..SELECT A
24e30 4c 4c 20 63 6f 6c 31 20 2d 20 43 41 53 54 28 20  LL col1 - CAST( 
24e40 2b 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 53  + tab2.col1 AS S
24e50 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
24e60 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  2..----..0..0..0
24e70 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
24e80 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
24e90 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
24ea0 72 74 20 6c 61 62 65 6c 2d 31 30 31 35 0d 0a 53  rt label-1015..S
24eb0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2d  ELECT ALL col1 -
24ec0 20 43 41 53 54 20 28 20 2b 20 74 61 62 32 2e 63   CAST ( + tab2.c
24ed0 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
24ee0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
24ef0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
24f00 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
24f10 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
24f20 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
24f30 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
24f40 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
24f50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37 20  wsort..SELECT 7 
24f60 2a 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  * col0 col1 FROM
24f70 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d   tab1..----..21.
24f80 0a 34 34 38 0d 0a 35 36 30 0d 0a 0d 0a 71 75 65  .448..560....que
24f90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24fa0 4c 45 43 54 20 41 4c 4c 20 36 31 20 46 52 4f 4d  LECT ALL 61 FROM
24fb0 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
24fc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
24fd0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30  ues hashing to 0
24fe0 37 31 34 39 39 30 35 61 37 32 62 64 38 37 35 35  7149905a72bd8755
24ff0 33 33 38 31 66 33 34 64 31 39 65 64 32 39 30 0d  3381f34d19ed290.
25000 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25010 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
25020 32 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  2 + col1 * col1 
25030 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
25040 2d 2d 2d 2d 0d 0a 37 33 36 33 0d 0a 38 31 39 39  ----..7363..8199
25050 0d 0a 39 34 30 38 0d 0a 0d 0a 71 75 65 72 79 20  ..9408....query 
25060 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25070 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20 63  T DISTINCT ( - c
25080 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41  ol1 ) * + col0 A
25090 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
250a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
250b0 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38  -1040..-640..-78
250c0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
250d0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
250e0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
250f0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
25100 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25110 31 30 32 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  1020..SELECT DIS
25120 54 49 4e 43 54 20 2d 20 28 20 2d 20 63 6f 6c 30  TINCT - ( - col0
25130 20 29 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20   ) DIV - col0 + 
25140 2b 20 28 20 32 33 20 29 20 41 53 20 63 6f 6c 32  + ( 23 ) AS col2
25150 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
25160 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 0d 0a 73 6b 69  .----..22....ski
25170 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
25180 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
25190 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
251a0 6c 2d 31 30 32 30 0d 0a 53 45 4c 45 43 54 20 44  l-1020..SELECT D
251b0 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20 63 6f  ISTINCT - ( - co
251c0 6c 30 20 29 20 2f 20 2d 20 63 6f 6c 30 20 2b 20  l0 ) / - col0 + 
251d0 2b 20 28 20 32 33 20 29 20 41 53 20 63 6f 6c 32  + ( 23 ) AS col2
251e0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
251f0 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 0d 0a 71 75 65  .----..22....que
25200 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
25210 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
25220 30 20 2a 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20  0 * col2 - col1 
25230 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  * col2 AS col1 F
25240 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
25250 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d 32 30 34 36  ---..-164..-2046
25260 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-62....query I
25270 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25280 20 2d 20 63 6f 6c 31 20 2b 20 38 38 20 41 53 20   - col1 + 88 AS 
25290 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
252a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39  S cor0..----..29
252b0 0d 0a 35 37 0d 0a 37 31 0d 0a 0d 0a 6f 6e 6c 79  ..57..71....only
252c0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
252d0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
252e0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
252f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25300 74 20 6c 61 62 65 6c 2d 31 30 32 33 0d 0a 53 45  t label-1023..SE
25310 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
25320 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  - col2 * - col0 
25330 44 49 56 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  DIV col0 + + col
25340 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  2 + + col1 * + c
25350 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
25360 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
25370 2d 2d 2d 0d 0a 37 34 36 32 0d 0a 38 34 34 35 0d  ---..7462..8445.
25380 0a 39 34 31 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .9411....skipif 
25390 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
253a0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
253b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
253c0 32 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  23..SELECT DISTI
253d0 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d  NCT + - col2 * -
253e0 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2b 20 2b   col0 / col0 + +
253f0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a   col2 + + col1 *
25400 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
25410 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
25420 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 36 32 0d 0a 38  0..----..7462..8
25430 34 34 35 0d 0a 39 34 31 31 0d 0a 0d 0a 73 6b 69  445..9411....ski
25440 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
25450 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
25460 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
25470 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
25480 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
25490 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
254a0 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  + col2 + + col0 
254b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
254c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
254d0 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65  1..36..57....que
254e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
254f0 4c 45 43 54 20 41 4c 4c 20 31 30 20 2a 20 2b 20  LECT ALL 10 * + 
25500 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
25510 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30  S cor0..----..70
25520 0d 0a 37 38 30 0d 0a 37 39 30 0d 0a 0d 0a 6f 6e  ..780..790....on
25530 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
25540 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
25550 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
25560 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
25570 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 36 0d 0a  ort label-1026..
25580 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
25590 30 2e 63 6f 6c 32 20 2b 20 38 37 20 44 49 56 20  0.col2 + 87 DIV 
255a0 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  - col0 + + col2 
255b0 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  * + col2 * col1 
255c0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
255d0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 39 30 33 0d  0..----..119903.
255e0 0a 33 32 35 34 36 0d 0a 37 35 38 34 31 0d 0a 0d  .32546..75841...
255f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
25600 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
25610 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
25620 6c 61 62 65 6c 2d 31 30 32 36 0d 0a 53 45 4c 45  label-1026..SELE
25630 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f  CT ALL + cor0.co
25640 6c 32 20 2b 20 38 37 20 2f 20 2d 20 63 6f 6c 30  l2 + 87 / - col0
25650 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   + + col2 * + co
25660 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 * col1 FROM t
25670 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
25680 2d 0d 0a 31 31 39 39 30 33 0d 0a 33 32 35 34 36  -..119903..32546
25690 0d 0a 37 35 38 34 31 0d 0a 0d 0a 71 75 65 72 79  ..75841....query
256a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
256b0 43 54 20 63 6f 6c 30 20 2b 20 32 38 20 46 52 4f  CT col0 + 28 FRO
256c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
256d0 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a 35 32 0d 0a 36  ----..117..52..6
256e0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
256f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
25700 20 2d 20 2d 20 35 38 20 2d 20 2b 20 35 32 20 41   - - 58 - + 52 A
25710 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
25720 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25730 36 0d 0a 36 0d 0a 36 0d 0a 0d 0a 6f 6e 6c 79 69  6..6..6....onlyi
25740 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
25750 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
25760 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
25770 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
25780 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25790 62 65 6c 2d 31 30 32 39 0d 0a 53 45 4c 45 43 54  bel-1029..SELECT
257a0 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 28 20 63 6f   + - col0 * ( co
257b0 6c 30 20 29 20 2b 20 43 41 53 54 28 20 4e 55 4c  l0 ) + CAST( NUL
257c0 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
257d0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
257e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
257f0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
25800 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
25810 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
25820 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25830 74 20 6c 61 62 65 6c 2d 31 30 32 39 0d 0a 53 45  t label-1029..SE
25840 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  LECT + - col0 * 
25850 28 20 63 6f 6c 30 20 29 20 2b 20 43 41 53 54 20  ( col0 ) + CAST 
25860 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
25870 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  R ) AS col1 FROM
25880 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
25890 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
258a0 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .NULL....onlyif 
258b0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
258c0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
258d0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
258e0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
258f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
25900 6c 2d 31 30 33 30 0d 0a 53 45 4c 45 43 54 20 2d  l-1030..SELECT -
25910 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
25920 49 47 4e 45 44 20 29 20 63 6f 6c 30 20 46 52 4f  IGNED ) col0 FRO
25930 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
25940 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
25950 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
25960 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31 35  cd7a7901e47c1515
25970 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30 62  5404aff0d216fe0b
25980 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
25990 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
259a0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
259b0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
259c0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
259d0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
259e0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
259f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
25a00 6c 2d 31 30 33 30 0d 0a 53 45 4c 45 43 54 20 2d  l-1030..SELECT -
25a10 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
25a20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 30 20 46  INTEGER ) col0 F
25a30 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
25a40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
25a50 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
25a60 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35  o cd7a7901e47c15
25a70 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65  155404aff0d216fe
25a80 30 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  0b....query I ro
25a90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
25aa0 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2b 20  col0 + + col0 + 
25ab0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52  col2 * - col2 FR
25ac0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
25ad0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 31 0d 0a 2d 36  .----..-1041..-6
25ae0 35 34 36 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72 79  546..69....query
25af0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25b00 43 54 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 31  CT col2 + ( col1
25b10 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41   ) * cor0.col2 A
25b20 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
25b30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25b40 32 38 37 31 0d 0a 37 35 34 34 0d 0a 39 38 0d 0a  2871..7544..98..
25b50 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
25b60 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
25b70 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
25b80 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
25b90 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
25ba0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 33 0d  sort label-1033.
25bb0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 43 41 53 54  .SELECT + + CAST
25bc0 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ( + col2 AS SIGN
25bd0 45 44 20 29 20 2a 20 2b 20 63 6f 6c 32 20 46 52  ED ) * + col2 FR
25be0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
25bf0 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37 36  .----..1444..676
25c00 0d 0a 37 32 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..729....skipif 
25c10 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
25c20 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
25c30 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
25c40 33 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 43  33..SELECT + + C
25c50 41 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20  AST ( + col2 AS 
25c60 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f  INTEGER ) * + co
25c70 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
25c80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34  cor0..----..1444
25c90 0d 0a 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a 6f 6e  ..676..729....on
25ca0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
25cb0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
25cc0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
25cd0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
25ce0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 34 0d 0a  ort label-1034..
25cf0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 44 49  SELECT + col2 DI
25d00 56 20 32 39 20 46 52 4f 4d 20 74 61 62 30 20 41  V 29 FROM tab0 A
25d10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
25d20 0a 31 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..2....skipif 
25d30 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
25d40 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
25d50 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
25d60 33 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  34..SELECT + col
25d70 32 20 2f 20 32 39 20 46 52 4f 4d 20 74 61 62 30  2 / 29 FROM tab0
25d80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25d90 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79  0..1..2....query
25da0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25db0 43 54 20 2d 20 2d 20 39 39 20 2a 20 2d 20 63 6f  CT - - 99 * - co
25dc0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
25dd0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
25de0 2d 2d 0d 0a 2d 36 39 33 0d 0a 2d 37 37 32 32 0d  --..-693..-7722.
25df0 0a 2d 37 38 32 31 0d 0a 0d 0a 71 75 65 72 79 20  .-7821....query 
25e00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25e10 54 20 2b 20 2b 20 37 30 20 2a 20 34 37 20 41 53  T + + 70 * 47 AS
25e20 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
25e30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
25e40 32 39 30 0d 0a 33 32 39 30 0d 0a 33 32 39 30 0d  290..3290..3290.
25e50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25e60 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 20 46  rt..SELECT - 4 F
25e70 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41  ROM tab1, tab2 A
25e80 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  S cor0, tab1 AS 
25e90 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
25ea0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
25eb0 20 33 39 65 64 32 33 34 37 35 34 31 32 63 33 63   39ed23475412c3c
25ec0 62 62 61 30 32 65 63 64 64 32 64 37 30 31 38 65  bba02ecdd2d7018e
25ed0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
25ee0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 36  sort..SELECT - 6
25ef0 38 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  8 FROM tab1, tab
25f00 32 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  2 cor0, tab2 AS 
25f10 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
25f20 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
25f30 20 36 66 62 62 61 37 64 62 35 62 63 63 62 35 33   6fbba7db5bccb53
25f40 33 61 33 35 61 61 35 31 32 35 61 32 33 31 66 38  3a35aa5125a231f8
25f50 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
25f60 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
25f70 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
25f80 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
25f90 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
25fa0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
25fb0 33 39 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28  39..SELECT CAST(
25fc0 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
25fd0 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d   ) * - col2 FROM
25fe0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
25ff0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
26000 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
26010 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
26020 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
26030 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
26040 33 39 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20  39..SELECT CAST 
26050 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29  ( NULL AS REAL )
26060 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
26070 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
26080 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
26090 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
260a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
260b0 4c 4c 20 2d 20 31 31 20 2b 20 63 6f 6c 31 20 2a  LL - 11 + col1 *
260c0 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29   - ( cor0.col2 )
260d0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
260e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 34 35 0d  r0..----..-1545.
260f0 0a 2d 36 35 37 0d 0a 2d 38 34 38 0d 0a 0d 0a 6f  .-657..-848....o
26100 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
26110 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
26120 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
26130 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
26140 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26150 74 20 6c 61 62 65 6c 2d 31 30 34 31 0d 0a 53 45  t label-1041..SE
26160 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
26170 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20  - col0 * col2 + 
26180 2b 20 43 41 53 54 28 20 2d 20 28 20 2d 20 63 6f  + CAST( - ( - co
26190 6c 30 20 29 20 41 53 20 53 49 47 4e 45 44 20 29  l0 ) AS SIGNED )
261a0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
261b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 30 39 0d  r0..----..-7209.
261c0 0a 2d 37 36 38 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .-768..0....skip
261d0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
261e0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
261f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
26200 2d 31 30 34 31 0d 0a 53 45 4c 45 43 54 20 44 49  -1041..SELECT DI
26210 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20  STINCT + - col0 
26220 2a 20 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54 20  * col2 + + CAST 
26230 28 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20 41  ( - ( - col0 ) A
26240 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
26250 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
26260 2d 2d 2d 0d 0a 2d 37 32 30 39 0d 0a 2d 37 36 38  ---..-7209..-768
26270 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
26280 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
26290 20 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 2b 20   ( - col1 ) + + 
262a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
262b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39  S cor0..----..29
262c0 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 6f 6e 6c 79  ..74..93....only
262d0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
262e0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
262f0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
26300 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26310 74 20 6c 61 62 65 6c 2d 31 30 34 33 0d 0a 53 45  t label-1043..SE
26320 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49 56 20  LECT - col1 DIV 
26330 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  - col0 + + col0 
26340 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + + col0 FROM ta
26350 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
26360 0d 0a 31 35 36 0d 0a 31 35 38 0d 0a 31 38 0d 0a  ..156..158..18..
26370 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
26380 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
26390 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
263a0 20 6c 61 62 65 6c 2d 31 30 34 33 0d 0a 53 45 4c   label-1043..SEL
263b0 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63  ECT - col1 / - c
263c0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b  ol0 + + col0 + +
263d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
263e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
263f0 35 36 0d 0a 31 35 38 0d 0a 31 38 0d 0a 0d 0a 73  56..158..18....s
26400 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
26410 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
26420 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
26430 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
26440 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
26450 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26460 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  ALL col2 + - col
26470 31 20 2a 20 2d 20 34 33 20 2d 20 63 6f 72 30 2e  1 * - 43 - cor0.
26480 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col0 col1 FROM t
26490 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
264a0 2d 0d 0a 31 31 36 39 0d 0a 34 32 33 0d 0a 35 37  -..1169..423..57
264b0 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  5....skipif post
264c0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
264d0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
264e0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
264f0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
26500 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26510 45 4c 45 43 54 20 2d 20 2b 20 33 37 20 2a 20 2d  ELECT - + 37 * -
26520 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c   cor0.col2 + col
26530 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  2 col0 FROM tab0
26540 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26550 31 32 35 34 0d 0a 33 31 31 36 0d 0a 33 38 0d 0a  1254..3116..38..
26560 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
26570 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
26580 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
26590 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
265a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
265b0 34 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  46..SELECT + col
265c0 32 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 33 35 20  2 * + col2 - 35 
265d0 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  DIV - col0 AS co
265e0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
265f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 32 37  cor0..----..2927
26600 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a  ..3249..9216....
26610 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
26620 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
26630 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26640 61 62 65 6c 2d 31 30 34 36 0d 0a 53 45 4c 45 43  abel-1046..SELEC
26650 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T + col2 * + col
26660 32 20 2d 20 33 35 20 2f 20 2d 20 63 6f 6c 30 20  2 - 35 / - col0 
26670 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
26680 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
26690 0a 32 39 32 37 0d 0a 33 32 34 39 0d 0a 39 32 31  .2927..3249..921
266a0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
266b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
266c0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 72   cor0.col0 * cor
266d0 30 2e 63 6f 6c 30 20 2d 20 36 36 20 46 52 4f 4d  0.col0 - 66 FROM
266e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
266f0 2d 2d 2d 0d 0a 2d 34 31 36 32 0d 0a 2d 36 34 36  ---..-4162..-646
26700 36 0d 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72 79 20  6..-75....query 
26710 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26720 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  T col0 + - col2 
26730 2a 20 38 33 20 41 53 20 63 6f 6c 30 20 46 52 4f  * 83 AS col0 FRO
26740 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
26750 2d 2d 2d 2d 0d 0a 2d 32 30 38 30 0d 0a 2d 32 32  ----..-2080..-22
26760 33 34 0d 0a 2d 33 30 37 35 0d 0a 0d 0a 71 75 65  34..-3075....que
26770 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26780 4c 45 43 54 20 2d 20 2d 20 32 36 20 2b 20 2b 20  LECT - - 26 + + 
26790 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
267a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
267b0 36 0d 0a 32 39 0d 0a 39 30 0d 0a 0d 0a 73 6b 69  6..29..90....ski
267c0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
267d0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
267e0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
267f0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
26800 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
26810 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
26820 2b 20 63 6f 6c 31 20 2a 20 2b 20 32 30 20 2b 20  + col1 * + 20 + 
26830 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 63 6f 6c 32  col0 * col0 col2
26840 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
26850 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 39 36 0d 0a  r0..----..4296..
26860 35 32 39 0d 0a 36 36 36 30 0d 0a 0d 0a 71 75 65  529..6660....que
26870 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26880 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
26890 63 6f 6c 30 20 2a 20 2b 20 28 20 2d 20 63 6f 6c  col0 * + ( - col
268a0 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  0 ) FROM tab2 AS
268b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d   cor0..----..49.
268c0 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a 6f  .6084..6241....o
268d0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
268e0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
268f0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
26900 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
26910 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26920 74 20 6c 61 62 65 6c 2d 31 30 35 32 0d 0a 53 45  t label-1052..SE
26930 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
26940 63 6f 6c 32 20 2b 20 43 41 53 54 28 20 4e 55 4c  col2 + CAST( NUL
26950 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 63 6f  L AS SIGNED ) co
26960 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
26970 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
26980 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
26990 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
269a0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
269b0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
269c0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
269d0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
269e0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
269f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
26a00 6c 2d 31 30 35 32 0d 0a 53 45 4c 45 43 54 20 44  l-1052..SELECT D
26a10 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
26a20 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
26a30 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 31 20 46  INTEGER ) col1 F
26a40 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
26a50 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
26a60 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
26a70 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
26a80 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
26a90 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
26aa0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
26ab0 72 74 20 6c 61 62 65 6c 2d 31 30 35 33 0d 0a 53  rt label-1053..S
26ac0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2d  ELECT + - col1 -
26ad0 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53   CAST( col0 AS S
26ae0 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20  IGNED ) AS col1 
26af0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
26b00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d  0..----..-110..-
26b10 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 73 6b 69  132..-180....ski
26b20 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
26b30 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
26b40 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
26b50 6c 2d 31 30 35 33 0d 0a 53 45 4c 45 43 54 20 2b  l-1053..SELECT +
26b60 20 2d 20 63 6f 6c 31 20 2d 20 43 41 53 54 20 28   - col1 - CAST (
26b70 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
26b80 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
26b90 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
26ba0 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 33 32 0d 0a  --..-110..-132..
26bb0 2d 31 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -180....onlyif m
26bc0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
26bd0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
26be0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
26bf0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
26c00 62 65 6c 2d 31 30 35 34 0d 0a 53 45 4c 45 43 54  bel-1054..SELECT
26c10 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
26c20 20 2a 20 2b 20 37 30 20 2b 20 2b 20 34 33 20 44   * + 70 + + 43 D
26c30 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  IV col2 FROM tab
26c40 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37  1 cor0..----..37
26c50 38 30 0d 0a 33 39 39 30 0d 0a 36 37 32 30 0d 0a  80..3990..6720..
26c60 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
26c70 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
26c80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26c90 20 6c 61 62 65 6c 2d 31 30 35 34 0d 0a 53 45 4c   label-1054..SEL
26ca0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
26cb0 6f 6c 32 20 2a 20 2b 20 37 30 20 2b 20 2b 20 34  ol2 * + 70 + + 4
26cc0 33 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  3 / col2 FROM ta
26cd0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  b1 cor0..----..3
26ce0 37 38 30 0d 0a 33 39 39 30 0d 0a 36 37 32 30 0d  780..3990..6720.
26cf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26d00 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
26d10 32 20 2d 20 39 34 20 2a 20 38 34 20 41 53 20 63  2 - 94 * 84 AS c
26d20 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
26d30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 39   cor0..----..-79
26d40 35 30 0d 0a 2d 37 39 35 33 0d 0a 2d 37 39 39 32  50..-7953..-7992
26d50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26d60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 34 20 2a  ort..SELECT 54 *
26d70 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
26d80 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 34  OM tab0..----..4
26d90 36 34 34 0d 0a 34 39 31 34 0d 0a 35 32 33 38 0d  644..4914..5238.
26da0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26db0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
26dc0 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  0.col2 * + col0 
26dd0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
26de0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26df0 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31  ..----..165..371
26e00 32 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79  2..7760....query
26e10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26e20 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
26e30 63 6f 6c 30 20 2b 20 36 34 20 2a 20 2d 20 28 20  col0 + 64 * - ( 
26e40 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46  col2 ) AS col2 F
26e50 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
26e60 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 33 36 0d 0a 2d  ..----..-2136..-
26e70 35 33 33 37 0d 0a 2d 39 39 0d 0a 0d 0a 71 75 65  5337..-99....que
26e80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26e90 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 33 33  LECT - col0 * 33
26ea0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
26eb0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
26ec0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 34 0d 0a 2d  0..----..-224..-
26ed0 32 34 39 36 0d 0a 2d 32 35 32 38 0d 0a 0d 0a 6f  2496..-2528....o
26ee0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
26ef0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
26f00 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
26f10 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
26f20 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 36 30 0d  sort label-1060.
26f30 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
26f40 6c 31 20 44 49 56 20 2b 20 32 31 20 2b 20 63 6f  l1 DIV + 21 + co
26f50 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
26f60 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
26f70 2d 2d 0d 0a 31 37 0d 0a 33 30 0d 0a 35 37 0d 0a  --..17..30..57..
26f80 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
26f90 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
26fa0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26fb0 20 6c 61 62 65 6c 2d 31 30 36 30 0d 0a 53 45 4c   label-1060..SEL
26fc0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2f  ECT ALL - col1 /
26fd0 20 2b 20 32 31 20 2b 20 63 6f 6c 31 20 41 53 20   + 21 + col1 AS 
26fe0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
26ff0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
27000 0d 0a 33 30 0d 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79  ..30..57....only
27010 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
27020 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
27030 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
27040 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27050 74 20 6c 61 62 65 6c 2d 31 30 36 31 0d 0a 53 45  t label-1061..SE
27060 4c 45 43 54 20 63 6f 6c 30 20 44 49 56 20 2b 20  LECT col0 DIV + 
27070 74 61 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  tab1.col0 AS col
27080 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
27090 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b  -..1..1..1....sk
270a0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
270b0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
270c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
270d0 65 6c 2d 31 30 36 31 0d 0a 53 45 4c 45 43 54 20  el-1061..SELECT 
270e0 63 6f 6c 30 20 2f 20 2b 20 74 61 62 31 2e 63 6f  col0 / + tab1.co
270f0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
27100 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  tab1..----..1..1
27110 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..1....query I r
27120 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
27130 20 39 35 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20   95 * - col1 AS 
27140 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
27150 2d 2d 2d 2d 0d 0a 38 31 37 30 0d 0a 38 36 34 35  ----..8170..8645
27160 0d 0a 39 32 31 35 0d 0a 0d 0a 71 75 65 72 79 20  ..9215....query 
27170 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27180 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 28  T ALL - col1 + (
27190 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 29 20 2d   + tab2.col2 ) -
271a0 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
271b0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
271c0 0a 2d 37 0d 0a 32 33 0d 0a 35 39 0d 0a 0d 0a 71  .-7..23..59....q
271d0 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
271e0 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
271f0 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30  LECT * FROM tab0
27200 2c 20 74 61 62 32 20 63 6f 72 30 2c 20 74 61 62  , tab2 cor0, tab
27210 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32 2c  1 AS cor1, tab2,
27220 20 74 61 62 30 20 63 6f 72 32 0d 0a 2d 2d 2d 2d   tab0 cor2..----
27230 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61  ..3645 values ha
27240 73 68 69 6e 67 20 74 6f 20 35 61 63 62 36 39 63  shing to 5acb69c
27250 64 65 37 31 32 30 38 66 65 35 38 30 65 31 30 62  de71208fe580e10b
27260 38 62 36 36 39 34 32 38 65 0d 0a 0d 0a 71 75 65  8b669428e....que
27270 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27280 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 28 20 63  LECT ALL + ( ( c
27290 6f 6c 32 20 29 20 29 20 2a 20 36 39 20 41 53 20  ol2 ) ) * 69 AS 
272a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
272b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37  S cor0..----..37
272c0 32 36 0d 0a 33 39 33 33 0d 0a 36 36 32 34 0d 0a  26..3933..6624..
272d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
272e0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
272f0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
27300 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
27310 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
27320 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 36 36 0d  sort label-1066.
27330 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
27340 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
27350 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 2a  IGNED ) + col0 *
27360 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46   + col2 * col0 F
27370 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
27380 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
27390 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
273a0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
273b0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
273c0 72 74 20 6c 61 62 65 6c 2d 31 30 36 36 0d 0a 53  rt label-1066..S
273d0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 43  ELECT - col2 + C
273e0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
273f0 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 30 20 2a  TEGER ) + col0 *
27400 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46   + col2 * col0 F
27410 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
27420 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
27430 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27440 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
27450 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  l0 * + col0 * + 
27460 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
27470 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
27480 2d 32 36 32 31 34 34 0d 0a 2d 32 37 0d 0a 2d 35  -262144..-27..-5
27490 31 32 30 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  12000....query I
274a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
274b0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d   + cor0.col2 * -
274c0 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f   col1 * col2 FRO
274d0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
274e0 2d 2d 2d 2d 0d 0a 2d 36 31 31 38 38 34 0d 0a 2d  ----..-611884..-
274f0 39 33 36 35 34 0d 0a 2d 39 37 0d 0a 0d 0a 71 75  93654..-97....qu
27500 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27510 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
27520 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a   col1 + - col1 *
27530 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
27540 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
27550 0a 2d 31 33 36 30 0d 0a 2d 32 34 38 0d 0a 2d 34  .-1360..-248..-4
27560 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  661....query I r
27570 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33  owsort..SELECT 3
27580 35 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20  5 + + tab0.col2 
27590 2b 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63  + tab0.col1 AS c
275a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol2 FROM tab0, t
275b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
275c0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
275d0 69 6e 67 20 74 6f 20 34 33 32 65 31 63 36 30 63  ing to 432e1c60c
275e0 30 64 36 34 31 31 39 62 39 35 36 61 61 31 62 65  0d64119b956aa1be
275f0 32 32 66 61 61 34 33 0d 0a 0d 0a 71 75 65 72 79  22faa43....query
27600 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27610 43 54 20 31 32 20 2b 20 74 61 62 30 2e 63 6f 6c  CT 12 + tab0.col
27620 30 20 2a 20 36 37 20 46 52 4f 4d 20 74 61 62 30  0 * 67 FROM tab0
27630 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
27640 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
27650 61 73 68 69 6e 67 20 74 6f 20 64 38 32 37 35 64  ashing to d8275d
27660 38 35 33 33 39 31 31 63 63 38 35 62 61 33 36 38  8533911cc85ba368
27670 33 35 63 31 34 31 39 62 32 32 0d 0a 0d 0a 6f 6e  35c1419b22....on
27680 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
27690 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
276a0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
276b0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
276c0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 32 0d 0a  ort label-1072..
276d0 53 45 4c 45 43 54 20 2d 20 34 34 20 44 49 56 20  SELECT - 44 DIV 
276e0 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
276f0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
27700 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
27710 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
27720 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27730 74 20 6c 61 62 65 6c 2d 31 30 37 32 0d 0a 53 45  t label-1072..SE
27740 4c 45 43 54 20 2d 20 34 34 20 2f 20 2d 20 63 6f  LECT - 44 / - co
27750 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
27760 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
27770 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27780 53 45 4c 45 43 54 20 2b 20 36 36 20 46 52 4f 4d  SELECT + 66 FROM
27790 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62   tab0, tab1, tab
277a0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
277b0 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
277c0 6e 67 20 74 6f 20 38 39 37 62 36 31 32 32 61 63  ng to 897b6122ac
277d0 39 38 33 34 30 62 37 38 39 30 35 66 33 39 64 38  98340b78905f39d8
277e0 31 38 39 37 66 63 0d 0a 0d 0a 71 75 65 72 79 20  1897fc....query 
277f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27800 54 20 63 6f 72 32 2e 63 6f 6c 32 20 41 53 20 63  T cor2.col2 AS c
27810 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
27820 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab1 AS cor0, tab
27830 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32 20  0 AS cor1, tab2 
27840 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor2..----..8
27850 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
27860 20 74 6f 20 63 34 65 36 62 31 66 31 64 32 38 65   to c4e6b1f1d28e
27870 37 33 31 36 36 34 61 31 35 61 36 66 37 63 64 61  731664a15a6f7cda
27880 34 64 61 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4da9....query I 
27890 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
278a0 41 4c 4c 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  ALL col1 + - col
278b0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
278c0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
278d0 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d 0a 0d 0a  -19..-62..24....
278e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
278f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
27900 20 2b 20 2b 20 34 33 20 41 53 20 63 6f 6c 32 20   + + 43 AS col2 
27910 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
27920 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
27930 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
27940 0a 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .43....query I r
27950 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
27960 4c 4c 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 30 20  LL + - ( - col0 
27970 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
27980 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
27990 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a  -..7..78..79....
279a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
279b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
279c0 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  l1 + - col2 * - 
279d0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
279e0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
279f0 2d 2d 2d 2d 0d 0a 31 33 36 0d 0a 33 36 33 38 0d  ----..136..3638.
27a00 0a 37 36 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .7667....query I
27a10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27a20 20 2b 20 28 20 2d 20 28 20 2d 20 63 6f 6c 32 20   + ( - ( - col2 
27a30 29 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ) ) AS col0 FROM
27a40 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
27a50 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a  ..26..27..38....
27a60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27a70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
27a80 20 28 20 37 37 20 29 20 41 53 20 63 6f 6c 31 20   ( 77 ) AS col1 
27a90 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
27aa0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 37 0d 0a 0d 0a 6f  0..----..77....o
27ab0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
27ac0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
27ad0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
27ae0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
27af0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 31 0d  sort label-1081.
27b00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
27b10 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56   + cor0.col1 DIV
27b20 20 32 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   20 AS col1 FROM
27b30 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
27b40 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a  ---..0..1..2....
27b50 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
27b60 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
27b70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
27b80 61 62 65 6c 2d 31 30 38 31 0d 0a 53 45 4c 45 43  abel-1081..SELEC
27b90 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72  T DISTINCT + cor
27ba0 30 2e 63 6f 6c 31 20 2f 20 32 30 20 41 53 20 63  0.col1 / 20 AS c
27bb0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
27bc0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
27bd0 31 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..2....query I 
27be0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27bf0 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 35 31 20  ALL - col2 + 51 
27c00 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  + - col1 * - col
27c10 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
27c20 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 0d 0a  ab1..----..124..
27c30 36 37 33 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79  673..94....query
27c40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27c50 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 35 39  CT + col0 - - 59
27c60 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
27c70 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 31  b2..----..137..1
27c80 33 38 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20  38..66....query 
27c90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27ca0 54 20 2d 20 63 6f 6c 30 20 2a 20 32 34 20 46 52  T - col0 * 24 FR
27cb0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
27cc0 31 36 38 0d 0a 2d 31 38 37 32 0d 0a 2d 31 38 39  168..-1872..-189
27cd0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
27ce0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
27cf0 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 36 36 20 2b   + col1 + + 66 +
27d00 20 2b 20 35 37 20 2a 20 63 6f 6c 30 20 2a 20 74   + 57 * col0 * t
27d10 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ab2.col1 FROM ta
27d20 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 36 36 0d  b2..----..12466.
27d30 0a 32 36 32 34 33 39 0d 0a 37 36 36 33 34 0d 0a  .262439..76634..
27d40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27d50 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
27d60 20 2d 20 34 32 20 46 52 4f 4d 20 74 61 62 31 0d   - 42 FROM tab1.
27d70 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 32 39 0d  .----..-16..-29.
27d80 0a 2d 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-32....query I 
27d90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27da0 41 4c 4c 20 28 20 33 32 20 29 20 41 53 20 63 6f  ALL ( 32 ) AS co
27db0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
27dc0 2d 2d 0d 0a 33 32 0d 0a 33 32 0d 0a 33 32 0d 0a  --..32..32..32..
27dd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27de0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
27df0 37 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  73 AS col0 FROM 
27e00 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 0d 0a  tab0..----..73..
27e10 37 33 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20  73..73....query 
27e20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27e30 54 20 44 49 53 54 49 4e 43 54 20 34 33 20 2a 20  T DISTINCT 43 * 
27e40 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
27e50 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 32 0d 0a 2d  ..----..-1032..-
27e60 31 35 30 35 0d 0a 2d 33 38 32 37 0d 0a 0d 0a 71  1505..-3827....q
27e70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27e80 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
27e90 2b 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2b 20 63  + col1 * - ( + c
27ea0 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol1 ) AS col1 FR
27eb0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
27ec0 32 38 39 0d 0a 2d 33 34 38 31 0d 0a 2d 39 36 31  289..-3481..-961
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 37 38 20 2b  ort..SELECT 78 +
27ef0 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f   - tab0.col2 FRO
27f00 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  M tab0..----..-4
27f10 0d 0a 34 35 0d 0a 37 37 0d 0a 0d 0a 6f 6e 6c 79  ..45..77....only
27f20 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
27f30 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
27f40 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
27f50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27f60 74 20 6c 61 62 65 6c 2d 31 30 39 32 0d 0a 53 45  t label-1092..SE
27f70 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
27f80 6c 31 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63  l1 DIV col2 AS c
27f90 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
27fa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
27fb0 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
27fc0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
27fd0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
27fe0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39  owsort label-109
27ff0 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  2..SELECT ALL co
28000 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 41  r0.col1 / col2 A
28010 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
28020 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28030 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
28040 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
28050 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
28060 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
28070 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
28080 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
28090 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
280a0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 63 6f  col0 * + col2 co
280b0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
280c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d  cor0..----..162.
280d0 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71  .3648..7680....q
280e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
280f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28100 2d 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  - col1 * cor0.co
28110 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30  l0 + col2 * col0
28120 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41   + + cor0.col2 A
28130 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
28140 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28150 2d 31 0d 0a 2d 32 35 34 38 0d 0a 31 36 39 37 0d  -1..-2548..1697.
28160 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28170 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
28180 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 28  NCT + col1 + - (
28190 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   + col2 ) AS col
281a0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
281b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39  or0..----..53..9
281c0 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..96....query I 
281d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
281e0 44 49 53 54 49 4e 43 54 20 2d 20 32 20 46 52 4f  DISTINCT - 2 FRO
281f0 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74 61  M tab0, tab2, ta
28200 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
28210 0d 0a 2d 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-2....query I 
28220 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28230 41 4c 4c 20 28 20 2b 20 63 6f 6c 32 20 29 20 2d  ALL ( + col2 ) -
28240 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46   + col0 * col1 F
28250 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
28260 2d 31 33 30 35 0d 0a 2d 31 39 30 0d 0a 2d 34 35  -1305..-190..-45
28270 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
28280 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
28290 4c 20 35 36 20 2b 20 74 61 62 31 2e 63 6f 6c 31  L 56 + tab1.col1
282a0 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + + col2 FROM t
282b0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 0d 0a  ab1..----..123..
282c0 31 33 36 0d 0a 31 36 35 0d 0a 0d 0a 71 75 65 72  136..165....quer
282d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
282e0 45 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20  ECT + tab0.col1 
282f0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
28300 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
28310 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
28320 35 38 35 61 34 31 61 35 32 63 30 63 36 63 30 64  585a41a52c0c6c0d
28330 36 39 37 62 35 64 33 39 32 36 35 62 37 34 64 63  697b5d39265b74dc
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 41 4c 4c 20  ort..SELECT ALL 
28360 2d 20 31 34 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 14 AS col0 FRO
28370 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
28380 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
28390 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
283a0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
283b0 32 62 66 30 65 32 34 32 30 64 32 32 63 64 35 38  2bf0e2420d22cd58
283c0 64 37 65 65 33 62 33 30 38 32 37 61 66 63 63 0d  d7ee3b30827afcc.
283d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
283e0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
283f0 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  1 * + cor0.col0 
28400 2b 20 35 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63  + 5 + - col2 * c
28410 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
28420 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31   cor0..----..-61
28430 35 0d 0a 33 30 37 33 0d 0a 37 30 32 0d 0a 0d 0a  5..3073..702....
28440 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28450 0a 53 45 4c 45 43 54 20 2b 20 36 38 20 2b 20 2d  .SELECT + 68 + -
28460 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2a   col1 * + col1 *
28470 20 2d 20 28 20 63 6f 6c 30 20 2a 20 39 31 20 29   - ( col0 * 91 )
28480 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   - - cor0.col1 *
28490 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
284a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
284b0 0a 2d 2d 2d 2d 0d 0a 31 32 33 31 36 33 36 0d 0a  .----..1231636..
284c0 31 38 36 30 32 30 0d 0a 35 38 33 30 33 38 0d 0a  186020..583038..
284d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
284e0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 38 38  t..SELECT - - 88
284f0 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 31 20 2a 20   + col2 * - 1 * 
28500 2b 20 33 35 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  + 35 + col1 FROM
28510 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
28520 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 37 36 33  ---..-1225..-763
28530 0d 0a 2d 38 32 36 0d 0a 0d 0a 71 75 65 72 79 20  ..-826....query 
28540 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28550 54 20 37 35 20 2a 20 2b 20 63 6f 6c 31 20 41 53  T 75 * + col1 AS
28560 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
28570 0a 2d 2d 2d 2d 0d 0a 36 34 35 30 0d 0a 36 38 32  .----..6450..682
28580 35 0d 0a 37 32 37 35 0d 0a 0d 0a 73 6b 69 70 69  5..7275....skipi
28590 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
285a0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
285b0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
285c0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
285d0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
285e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
285f0 2d 20 33 31 20 2b 20 2b 20 63 6f 6c 30 20 2b 20  - 31 + + col0 + 
28600 37 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  71 col2 FROM tab
28610 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 32  1..----..104..12
28620 30 0d 0a 34 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  0..43....onlyif 
28630 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
28640 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
28650 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
28660 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
28670 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28680 6c 2d 31 31 30 36 0d 0a 53 45 4c 45 43 54 20 2b  l-1106..SELECT +
28690 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d   - cor0.col0 + -
286a0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
286b0 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20  IGNED ) AS col1 
286c0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
286d0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
286e0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
286f0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
28700 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
28710 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28720 6c 2d 31 31 30 36 0d 0a 53 45 4c 45 43 54 20 2b  l-1106..SELECT +
28730 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d   - cor0.col0 + -
28740 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
28750 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
28760 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
28770 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
28780 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
28790 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
287a0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
287b0 6f 6c 31 20 2d 20 31 33 20 2a 20 2d 20 63 6f 6c  ol1 - 13 * - col
287c0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
287d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 38 0d 0a  or0..----..238..
287e0 34 33 34 0d 0a 38 32 36 0d 0a 0d 0a 6f 6e 6c 79  434..826....only
287f0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
28800 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
28810 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
28820 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
28830 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28840 61 62 65 6c 2d 31 31 30 38 0d 0a 53 45 4c 45 43  abel-1108..SELEC
28850 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
28860 2a 20 43 41 53 54 28 20 2d 20 39 37 20 41 53 20  * CAST( - 97 AS 
28870 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c  SIGNED ) + - col
28880 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
28890 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
288a0 2d 0d 0a 2d 31 36 38 37 0d 0a 2d 33 30 33 34 0d  -..-1687..-3034.
288b0 0a 2d 35 37 34 39 0d 0a 0d 0a 73 6b 69 70 69 66  .-5749....skipif
288c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
288d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
288e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
288f0 31 30 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  108..SELECT DIST
28900 49 4e 43 54 20 63 6f 6c 31 20 2a 20 43 41 53 54  INCT col1 * CAST
28910 20 28 20 2d 20 39 37 20 41 53 20 49 4e 54 45 47   ( - 97 AS INTEG
28920 45 52 20 29 20 2b 20 2d 20 63 6f 6c 32 20 41 53  ER ) + - col2 AS
28930 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
28940 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
28950 31 36 38 37 0d 0a 2d 33 30 33 34 0d 0a 2d 35 37  1687..-3034..-57
28960 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  49....query I ro
28970 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
28980 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20  STINCT + col2 * 
28990 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
289a0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
289b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37  or0..----..35..7
289c0 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72  298..792....quer
289d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
289e0 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30  ECT ALL - + cor0
289f0 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20  .col0 * col2 AS 
28a00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
28a10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d  or0..----..-189.
28a20 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d  .-2028..-3002...
28a30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28a40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
28a50 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63  ol1 * + col2 * c
28a60 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
28a70 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
28a80 2d 2d 2d 0d 0a 2d 33 36 34 38 30 0d 0a 2d 34 32  ---..-36480..-42
28a90 31 32 0d 0a 2d 39 39 38 34 30 0d 0a 0d 0a 71 75  12..-99840....qu
28aa0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28ab0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
28ac0 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * + col0 AS col
28ad0 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
28ae0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d  ..----..-1343..-
28af0 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75  217..-4602....qu
28b00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28b10 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a  ELECT - - col0 *
28b20 20 2d 20 34 36 20 41 53 20 63 6f 6c 32 20 46 52   - 46 AS col2 FR
28b30 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
28b40 0a 2d 2d 2d 2d 0d 0a 2d 33 32 32 0d 0a 2d 33 35  .----..-322..-35
28b50 38 38 0d 0a 2d 33 36 33 34 0d 0a 0d 0a 6f 6e 6c  88..-3634....onl
28b60 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
28b70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
28b80 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
28b90 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
28ba0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
28bb0 6c 61 62 65 6c 2d 31 31 31 34 0d 0a 53 45 4c 45  label-1114..SELE
28bc0 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e  CT ALL - - cor0.
28bd0 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 33 35 20  col1 + CAST( 35 
28be0 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
28bf0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
28c00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 35 0d 0a 34 38  r0..----..45..48
28c10 0d 0a 36 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..61....skipif m
28c20 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
28c30 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
28c40 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31  owsort label-111
28c50 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  4..SELECT ALL - 
28c60 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 43 41  - cor0.col1 + CA
28c70 53 54 20 28 20 33 35 20 41 53 20 49 4e 54 45 47  ST ( 35 AS INTEG
28c80 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ER ) AS col2 FRO
28c90 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
28ca0 2d 0d 0a 34 35 0d 0a 34 38 0d 0a 36 31 0d 0a 0d  -..45..48..61...
28cb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28cc0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
28cd0 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 33 32 20  T - col2 + - 32 
28ce0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
28cf0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
28d00 0a 2d 35 38 0d 0a 2d 35 39 0d 0a 2d 37 30 0d 0a  .-58..-59..-70..
28d10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28d20 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
28d30 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c   col1 + cor0.col
28d40 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  0 + + cor0.col2 
28d50 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
28d60 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 31 0d 0a 33 34  0..----..221..34
28d70 35 0d 0a 37 33 33 0d 0a 0d 0a 71 75 65 72 79 20  5..733....query 
28d80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28d90 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 31 2e  T DISTINCT cor1.
28da0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
28db0 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
28dc0 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
28dd0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31  r1..----..17..31
28de0 0d 0a 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..59....onlyif m
28df0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
28e00 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
28e10 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
28e20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
28e30 62 65 6c 2d 31 31 31 38 0d 0a 53 45 4c 45 43 54  bel-1118..SELECT
28e40 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56   + cor0.col0 DIV
28e50 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31   + col2 + + col1
28e60 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
28e70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 38  r0..----..132..8
28e80 36 0d 0a 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  6..92....skipif 
28e90 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
28ea0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
28eb0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
28ec0 31 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  18..SELECT + cor
28ed0 30 2e 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 32 20  0.col0 / + col2 
28ee0 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
28ef0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
28f00 0d 0a 31 33 32 0d 0a 38 36 0d 0a 39 32 0d 0a 0d  ..132..86..92...
28f10 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
28f20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
28f30 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
28f40 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
28f50 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31  owsort label-111
28f60 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  9..SELECT col1 +
28f70 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 44   - col0 * col1 D
28f80 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  IV col1 FROM tab
28f90 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a  0..----..2..62..
28fa0 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  62....skipif mys
28fb0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
28fc0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
28fd0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31 39 0d  sort label-1119.
28fe0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d  .SELECT col1 + -
28ff0 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2f 20 63   col0 * col1 / c
29000 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
29010 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a  ---..2..62..62..
29020 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29030 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
29040 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30  CT col2 * - col0
29050 20 2b 20 2b 20 31 39 20 2b 20 2b 20 63 6f 6c 30   + + 19 + + col0
29060 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
29070 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
29080 0d 0a 2d 37 31 39 30 0d 0a 2d 37 34 39 0d 0a 31  ..-7190..-749..1
29090 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
290a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
290b0 6f 6c 31 20 2d 20 2b 20 39 38 20 41 53 20 63 6f  ol1 - + 98 AS co
290c0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
290d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 0d  cor0..----..-72.
290e0 0a 2d 38 35 0d 0a 2d 38 38 0d 0a 0d 0a 71 75 65  .-85..-88....que
290f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29100 4c 45 43 54 20 63 6f 6c 31 20 2d 20 38 34 20 46  LECT col1 - 84 F
29110 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
29120 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 32 0d 0a 37  ..----..13..2..7
29130 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29140 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
29150 20 2a 20 38 37 20 2b 20 63 6f 6c 30 20 41 53 20   * 87 + col0 AS 
29160 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
29170 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 35  S cor0..----..75
29180 30 36 0d 0a 38 30 30 36 0d 0a 38 34 37 34 0d 0a  06..8006..8474..
29190 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
291a0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
291b0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
291c0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
291d0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
291e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
291f0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
29200 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20  .col2 col1 FROM 
29210 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
29220 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a  --..54..57..96..
29230 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29240 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
29250 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col0 + + cor0.co
29260 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
29270 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
29280 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38  --..110..132..18
29290 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
292a0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
292b0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
292c0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
292d0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
292e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
292f0 45 4c 45 43 54 20 2b 20 32 38 20 2b 20 2b 20 38  ELECT + 28 + + 8
29300 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0 col1 FROM tab0
29310 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29320 31 30 38 0d 0a 31 30 38 0d 0a 31 30 38 0d 0a 0d  108..108..108...
29330 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29340 0d 0a 53 45 4c 45 43 54 20 2b 20 39 38 20 2b 20  ..SELECT + 98 + 
29350 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  + cor0.col2 FROM
29360 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
29370 2d 2d 2d 0d 0a 31 32 34 0d 0a 31 32 35 0d 0a 31  ---..124..125..1
29380 33 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  36....onlyif mys
29390 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
293a0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
293b0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
293c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
293d0 6c 2d 31 31 32 38 0d 0a 53 45 4c 45 43 54 20 41  l-1128..SELECT A
293e0 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  LL + - col1 + co
293f0 6c 30 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63  l0 DIV col0 AS c
29400 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
29410 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
29420 0d 0a 2d 32 35 0d 0a 2d 39 0d 0a 0d 0a 73 6b 69  ..-25..-9....ski
29430 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
29440 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
29450 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
29460 6c 2d 31 31 32 38 0d 0a 53 45 4c 45 43 54 20 41  l-1128..SELECT A
29470 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  LL + - col1 + co
29480 6c 30 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 / col0 AS col
29490 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
294a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a  or0..----..-12..
294b0 2d 32 35 0d 0a 2d 39 0d 0a 0d 0a 6f 6e 6c 79 69  -25..-9....onlyi
294c0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
294d0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
294e0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
294f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29500 20 6c 61 62 65 6c 2d 31 31 32 39 0d 0a 53 45 4c   label-1129..SEL
29510 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
29520 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63  ol2 * col0 + + c
29530 6f 6c 31 20 44 49 56 20 2b 20 28 20 2b 20 63 6f  ol1 DIV + ( + co
29540 6c 31 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d  l1 + col1 ) FROM
29550 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
29560 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d  ..-162..-3648..-
29570 37 36 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7680....skipif m
29580 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
29590 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
295a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32  owsort label-112
295b0 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
295c0 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30  CT - col2 * col0
295d0 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 28 20   + + col1 / + ( 
295e0 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 29 20  + col1 + col1 ) 
295f0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
29600 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34  ----..-162..-364
29610 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 73 6b 69 70  8..-7680....skip
29620 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
29630 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
29640 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
29650 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
29660 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
29670 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
29680 54 49 4e 43 54 20 2d 20 34 33 20 2a 20 31 36 20  TINCT - 43 * 16 
29690 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
296a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
296b0 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
296c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
296d0 53 54 49 4e 43 54 20 2b 20 2d 20 28 20 2d 20 63  STINCT + - ( - c
296e0 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 30 20 41  ol0 ) + - col0 A
296f0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
29700 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29710 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
29720 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d  sort..SELECT ( -
29730 20 35 33 20 29 20 46 52 4f 4d 20 74 61 62 32 20   53 ) FROM tab2 
29740 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d  cor0..----..-53.
29750 0a 2d 35 33 0d 0a 2d 35 33 0d 0a 0d 0a 71 75 65  .-53..-53....que
29760 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29770 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
29780 63 6f 6c 32 20 2a 20 2d 20 36 36 20 2a 20 2d 20  col2 * - 66 * - 
29790 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
297a0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
297b0 2d 2d 2d 2d 0d 0a 2d 31 39 32 34 35 36 0d 0a 2d  ----..-192456..-
297c0 32 31 34 34 33 34 0d 0a 2d 36 30 38 32 35 36 0d  214434..-608256.
297d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
297e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
297f0 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  ol2 + col1 + + c
29800 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
29810 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36   tab1..----..106
29820 0d 0a 31 32 32 0d 0a 37 37 0d 0a 0d 0a 71 75 65  ..122..77....que
29830 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29840 4c 45 43 54 20 41 4c 4c 20 2d 20 35 32 20 41 53  LECT ALL - 52 AS
29850 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c   col0 FROM tab2,
29860 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
29870 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
29880 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
29890 68 69 6e 67 20 74 6f 20 65 38 61 35 63 62 31 30  hing to e8a5cb10
298a0 63 30 39 37 33 61 37 38 35 35 34 66 33 34 34 64  c0973a78554f344d
298b0 34 66 36 65 37 65 37 34 0d 0a 0d 0a 71 75 65 72  4f6e7e74....quer
298c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
298d0 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  ECT col2 + col2 
298e0 2b 20 34 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 40 AS col0 FRO
298f0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab0..----..10
29900 36 0d 0a 32 30 34 0d 0a 34 32 0d 0a 0d 0a 6f 6e  6..204..42....on
29910 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
29920 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
29930 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
29940 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
29950 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29960 20 6c 61 62 65 6c 2d 31 31 33 37 0d 0a 53 45 4c   label-1137..SEL
29970 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
29980 31 20 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c 30  1 + CAST( + col0
29990 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 34 38 20 41   + - col0 * 48 A
299a0 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
299b0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
299c0 2d 2d 0d 0a 2d 32 39 38 0d 0a 2d 33 36 30 37 0d  --..-298..-3607.
299d0 0a 2d 33 36 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  .-3696....skipif
299e0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
299f0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
29a00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
29a10 31 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  137..SELECT DIST
29a20 49 4e 43 54 20 63 6f 6c 31 20 2b 20 43 41 53 54  INCT col1 + CAST
29a30 20 28 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   ( + col0 + - co
29a40 6c 30 20 2a 20 34 38 20 41 53 20 49 4e 54 45 47  l0 * 48 AS INTEG
29a50 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ER ) AS col2 FRO
29a60 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
29a70 39 38 0d 0a 2d 33 36 30 37 0d 0a 2d 33 36 39 36  98..-3607..-3696
29a80 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
29a90 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
29aa0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
29ab0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
29ac0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29ad0 31 31 33 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  1138..SELECT + -
29ae0 20 63 6f 6c 31 20 44 49 56 20 2d 20 32 36 20 63   col1 DIV - 26 c
29af0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
29b00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
29b10 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  0..1....skipif p
29b20 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
29b30 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
29b40 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
29b50 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
29b60 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
29b70 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
29b80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
29b90 6c 61 62 65 6c 2d 31 31 33 38 0d 0a 53 45 4c 45  label-1138..SELE
29ba0 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 2d 20  CT + - col1 / - 
29bb0 32 36 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  26 col0 FROM tab
29bc0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
29bd0 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .0..0..1....skip
29be0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
29bf0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
29c00 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
29c10 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
29c20 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
29c30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
29c40 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20 2b   - tab2.col0 + +
29c50 20 37 38 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   78 col2 FROM ta
29c60 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d  b2..----..-1..0.
29c70 0a 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .71....query I r
29c80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31  owsort..SELECT 1
29c90 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  9 AS col0 FROM t
29ca0 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
29cb0 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  0, tab1 AS cor1.
29cc0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
29cd0 20 68 61 73 68 69 6e 67 20 74 6f 20 38 36 63 35   hashing to 86c5
29ce0 33 65 38 35 36 37 61 31 37 63 38 64 39 31 66 63  3e8567a17c8d91fc
29cf0 35 61 66 66 31 31 39 65 30 34 39 38 0d 0a 0d 0a  5aff119e0498....
29d00 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
29d10 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
29d20 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
29d30 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
29d40 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
29d50 72 74 20 6c 61 62 65 6c 2d 31 31 34 31 0d 0a 53  rt label-1141..S
29d60 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a  ELECT ALL col1 *
29d70 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
29d80 49 47 4e 45 44 20 29 20 2f 20 28 20 2b 20 74 61  IGNED ) / ( + ta
29d90 62 31 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 29  b1.col0 * col1 )
29da0 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 30   + - col0 / col0
29db0 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + + col2 AS col
29dc0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
29dd0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
29de0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
29df0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
29e00 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
29e10 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 31  wsort label-1141
29e20 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
29e30 31 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  1 * CAST ( NULL 
29e40 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20 28  AS INTEGER ) / (
29e50 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 63   + tab1.col0 * c
29e60 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2f  ol1 ) + - col0 /
29e70 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41   col0 + + col2 A
29e80 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
29e90 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
29ea0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
29eb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29ec0 45 43 54 20 2d 20 2b 20 28 20 2b 20 63 6f 6c 30  ECT - + ( + col0
29ed0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
29ee0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
29ef0 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a  .-24..-35..-89..
29f00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29f10 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
29f20 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  CT + col1 + col0
29f30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
29f40 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  2 cor0..----..13
29f50 36 30 0d 0a 32 34 38 0d 0a 34 36 36 31 0d 0a 0d  60..248..4661...
29f60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29f70 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
29f80 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b  ol1 * - col2 + +
29f90 20 34 34 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20   44 * cor0.col1 
29fa0 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
29fb0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
29fc0 31 34 30 0d 0a 2d 32 38 36 0d 0a 2d 36 38 39 0d  140..-286..-689.
29fd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29fe0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
29ff0 4e 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  NCT col1 + + col
2a000 30 20 2a 20 2b 20 35 20 2b 20 2b 20 63 6f 72 30  0 * + 5 + + cor0
2a010 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46  .col2 * + col0 F
2a020 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2a030 0d 0a 2d 2d 2d 2d 0d 0a 32 30 33 0d 0a 33 39 37  ..----..203..397
2a040 38 0d 0a 38 30 39 33 0d 0a 0d 0a 71 75 65 72 79  8..8093....query
2a050 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2a060 43 54 20 41 4c 4c 20 2b 20 2b 20 34 34 20 2d 20  CT ALL + + 44 - 
2a070 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  + col0 * - col0 
2a080 2a 20 2d 20 28 20 63 6f 6c 30 20 29 20 41 53 20  * - ( col0 ) AS 
2a090 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
2a0a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 39 0d  or0..----..-299.
2a0b0 0a 2d 34 37 34 35 30 38 0d 0a 2d 34 39 32 39 39  .-474508..-49299
2a0c0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
2a0d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
2a0e0 20 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d   ( - col1 ) FROM
2a0f0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2a100 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d  ---..-17..-31..-
2a110 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  59....query I ro
2a120 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2a130 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
2a140 63 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 32 20  col2 + - ( col2 
2a150 2b 20 63 6f 6c 32 20 29 20 2a 20 2b 20 39 32 20  + col2 ) * + 92 
2a160 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2a170 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 35 32 0d  0..----..-12852.
2a180 0a 2d 31 33 37 33 37 0d 0a 2d 32 36 38 38 30 0d  .-13737..-26880.
2a190 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a1a0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
2a1b0 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20  * col0 + col2 * 
2a1c0 33 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  34 AS col0 FROM 
2a1d0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 39 36 38  tab2..----..6968
2a1e0 0d 0a 37 35 33 33 0d 0a 39 36 37 0d 0a 0d 0a 6f  ..7533..967....o
2a1f0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2a200 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2a210 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2a220 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2a230 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a240 74 20 6c 61 62 65 6c 2d 31 31 35 30 0d 0a 53 45  t label-1150..SE
2a250 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c  LECT + CAST( NUL
2a260 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2f  L AS DECIMAL ) /
2a270 20 74 61 62 30 2e 63 6f 6c 31 20 2d 20 2d 20 63   tab0.col1 - - c
2a280 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
2a290 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
2a2a0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
2a2b0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2a2c0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2a2d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2a2e0 35 30 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  50..SELECT + CAS
2a2f0 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c  T ( NULL AS REAL
2a300 20 29 20 2f 20 74 61 62 30 2e 63 6f 6c 31 20 2d   ) / tab0.col1 -
2a310 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
2a320 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
2a330 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
2a340 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a350 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2a360 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 72 30  cor0.col2 + cor0
2a370 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2a  .col0 * + col1 *
2a380 20 2d 20 31 32 20 46 52 4f 4d 20 74 61 62 32 20   - 12 FROM tab2 
2a390 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31  cor0..----..-161
2a3a0 35 34 0d 0a 2d 32 36 33 31 0d 0a 2d 35 35 32 35  54..-2631..-5525
2a3b0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2a3c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 34 20  sort..SELECT 84 
2a3d0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2a3e0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 34  0 cor0..----..84
2a3f0 0d 0a 38 34 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72  ..84..84....quer
2a400 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a410 45 43 54 20 41 4c 4c 20 2d 20 35 31 20 2a 20 2b  ECT ALL - 51 * +
2a420 20 63 6f 6c 31 20 2b 20 2b 20 35 32 20 41 53 20   col1 + + 52 AS 
2a430 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
2a440 2d 2d 2d 2d 0d 0a 2d 34 33 33 34 0d 0a 2d 34 35  ----..-4334..-45
2a450 38 39 0d 0a 2d 34 38 39 35 0d 0a 0d 0a 71 75 65  89..-4895....que
2a460 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a470 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
2a480 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  * - col1 + col0 
2a490 2a 20 31 32 20 46 52 4f 4d 20 74 61 62 30 20 41  * 12 FROM tab0 A
2a4a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
2a4b0 35 35 30 0d 0a 2d 36 33 39 34 0d 0a 33 32 33 0d  550..-6394..323.
2a4c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a4d0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2a4e0 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2b  NCT + + col1 + +
2a4f0 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2d 20 2b   col2 * col2 - +
2a500 20 32 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20   22 * col1 FROM 
2a510 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2a520 2d 2d 0d 0a 2d 32 30 33 36 0d 0a 2d 37 31 37 0d  --..-2036..-717.
2a530 0a 34 38 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .4813....query I
2a540 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a550 20 2d 20 39 37 20 2a 20 2d 20 63 6f 6c 30 20 2a   - 97 * - col0 *
2a560 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
2a570 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
2a580 30 30 38 38 30 0d 0a 36 32 30 38 30 0d 0a 37 35  00880..62080..75
2a590 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  66....query I ro
2a5a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2a5b0 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 2b 20 74  ( - col1 ) * + t
2a5c0 61 62 31 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  ab1.col1 * col0 
2a5d0 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
2a5e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 34 30 0d  b1..----..13440.
2a5f0 0a 32 30 32 35 0d 0a 36 33 33 36 0d 0a 0d 0a 71  .2025..6336....q
2a600 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2a610 53 45 4c 45 43 54 20 41 4c 4c 20 34 31 20 2b 20  SELECT ALL 41 + 
2a620 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col1 * - col1 * 
2a630 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col0 + + col2 AS
2a640 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
2a650 0a 2d 2d 2d 2d 0d 0a 2d 32 32 37 35 32 0d 0a 2d  .----..-22752..-
2a660 32 37 31 34 35 31 0d 0a 2d 36 36 35 39 0d 0a 0d  271451..-6659...
2a670 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a680 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 74  ..SELECT - ( + t
2a690 61 62 30 2e 63 6f 6c 32 20 29 20 2a 20 63 6f 6c  ab0.col2 ) * col
2a6a0 30 20 2a 20 39 32 20 46 52 4f 4d 20 74 61 62 30  0 * 92 FROM tab0
2a6b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 32 30 0d 0a 2d  ..----..-3220..-
2a6c0 36 37 31 34 31 36 0d 0a 2d 37 32 38 36 34 0d 0a  671416..-72864..
2a6d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2a6e0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2a6f0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2a700 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2a710 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2a720 36 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  60..SELECT DISTI
2a730 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  NCT + cor0.col0 
2a740 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c  + col0 DIV - col
2a750 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  1 col0 FROM tab2
2a760 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a770 37 0d 0a 37 35 0d 0a 37 37 0d 0a 0d 0a 73 6b 69  7..75..77....ski
2a780 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2a790 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2a7a0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2a7b0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2a7c0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
2a7d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2a7e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2a7f0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 30 0d  sort label-1160.
2a800 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2a810 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63   + cor0.col0 + c
2a820 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 63 6f 6c  ol0 / - col1 col
2a830 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
2a840 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 35  or0..----..7..75
2a850 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..77....query I 
2a860 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a870 41 4c 4c 20 2b 20 34 30 20 2b 20 2d 20 63 6f 6c  ALL + 40 + - col
2a880 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2a890 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
2a8a0 2d 34 36 0d 0a 2d 35 31 0d 0a 2d 35 37 0d 0a 0d  -46..-51..-57...
2a8b0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2a8c0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2a8d0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2a8e0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2a8f0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2a900 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 32 0d 0a  ort label-1162..
2a910 53 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c  SELECT CAST( NUL
2a920 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  L AS SIGNED ) * 
2a930 33 35 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  35 FROM tab2..--
2a940 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2a950 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2a960 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2a970 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2a980 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36  owsort label-116
2a990 32 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  2..SELECT CAST (
2a9a0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
2a9b0 20 29 20 2a 20 33 35 20 46 52 4f 4d 20 74 61 62   ) * 35 FROM tab
2a9c0 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  2..----..NULL..N
2a9d0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
2a9e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a9f0 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  LECT col0 * + co
2aa00 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l0 * + col1 FROM
2aa10 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38   tab0..----..118
2aa20 38 32 35 0d 0a 34 39 35 33 36 0d 0a 37 32 30 38  825..49536..7208
2aa30 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  11....query I ro
2aa40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2aa50 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
2aa60 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f  + ( - col1 ) FRO
2aa70 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  M tab0..----..20
2aa80 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d 0a  64..3395..8099..
2aa90 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2aaa0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2aab0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2aac0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2aad0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2aae0 36 35 0d 0a 53 45 4c 45 43 54 20 2b 20 38 30 20  65..SELECT + 80 
2aaf0 44 49 56 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  DIV col2 + col0 
2ab00 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2ab10 30 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 36 35 0d 0a  0..----..4..65..
2ab20 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  80....skipif mys
2ab30 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2ab40 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2ab50 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 35 0d  sort label-1165.
2ab60 0a 53 45 4c 45 43 54 20 2b 20 38 30 20 2f 20 63  .SELECT + 80 / c
2ab70 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 + col0 FROM 
2ab80 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2ab90 2d 2d 0d 0a 34 0d 0a 36 35 0d 0a 38 30 0d 0a 0d  --..4..65..80...
2aba0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2abb0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
2abc0 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  col1 + col1 * co
2abd0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
2abe0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30  cor0..----..1360
2abf0 0d 0a 32 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 71  ..248..4661....q
2ac00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2ac10 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2ac20 39 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  94 AS col2 FROM 
2ac30 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
2ac40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 34 0d 0a 0d 0a  r0..----..94....
2ac50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ac60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2b 20  .SELECT ALL ( + 
2ac70 63 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d  cor0.col1 ) FROM
2ac80 20 74 61 62 32 2c 20 74 61 62 32 20 63 6f 72 30   tab2, tab2 cor0
2ac90 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
2aca0 20 68 61 73 68 69 6e 67 20 74 6f 20 63 36 31 64   hashing to c61d
2acb0 32 37 61 30 30 32 32 65 36 64 30 32 32 33 37 31  27a0022e6d022371
2acc0 64 63 35 38 38 31 39 61 62 32 37 32 0d 0a 0d 0a  dc58819ab272....
2acd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ace0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2acf0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 32   cor0.col0 * - 2
2ad00 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2ad10 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2ad20 2d 0d 0a 2d 31 33 34 34 0d 0a 2d 31 36 38 30 0d  -..-1344..-1680.
2ad30 0a 2d 36 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-63....onlyif m
2ad40 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2ad50 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2ad60 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2ad70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2ad80 62 65 6c 2d 31 31 37 30 0d 0a 53 45 4c 45 43 54  bel-1170..SELECT
2ad90 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 39 37   + - col2 DIV 97
2ada0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2adb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
2adc0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
2add0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2ade0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2adf0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37 30 0d 0a  ort label-1170..
2ae00 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
2ae10 2f 20 39 37 20 46 52 4f 4d 20 74 61 62 31 20 41  / 97 FROM tab1 A
2ae20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
2ae30 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
2ae40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ae50 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f   ALL - + cor0.co
2ae60 6c 30 20 2a 20 2d 20 33 20 46 52 4f 4d 20 74 61  l0 * - 3 FROM ta
2ae70 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2ae80 0d 0a 32 31 0d 0a 32 33 34 0d 0a 32 33 37 0d 0a  ..21..234..237..
2ae90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2aea0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2aeb0 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 31 36  CT - - col1 + 16
2aec0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2aed0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31  r0..----..102..1
2aee0 30 37 0d 0a 31 31 33 0d 0a 0d 0a 71 75 65 72 79  07..113....query
2aef0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2af00 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
2af10 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  ( col0 ) FROM ta
2af20 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2af30 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34 30 30 0d 0a  ..-4096..-6400..
2af40 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -9....query I ro
2af50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2af60 36 36 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  66 * - col0 + co
2af70 6c 32 20 2a 20 2b 20 33 34 20 2a 20 2b 20 30 20  l2 * + 34 * + 0 
2af80 2b 20 63 6f 6c 30 20 2a 20 2d 20 37 38 20 41 53  + col0 * - 78 AS
2af90 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
2afa0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2afb0 31 30 30 38 0d 0a 2d 31 31 32 33 32 0d 0a 2d 31  1008..-11232..-1
2afc0 31 33 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1376....query I 
2afd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2afe0 41 4c 4c 20 2d 20 2b 20 38 36 20 2b 20 2d 20 63  ALL - + 86 + - c
2aff0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 36  ol0 * + col2 * 6
2b000 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2b010 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 30 0d  r0..----..-1220.
2b020 0a 2d 31 32 32 35 34 0d 0a 2d 31 38 30 39 38 0d  .-12254..-18098.
2b030 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b040 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2b050 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   - cor0.col0 * c
2b060 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
2b070 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
2b080 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
2b090 20 68 61 73 68 69 6e 67 20 74 6f 20 39 62 62 35   hashing to 9bb5
2b0a0 30 39 36 66 63 64 31 37 65 33 66 31 33 31 31 35  096fcd17e3f13115
2b0b0 32 65 37 61 36 37 61 35 33 33 38 66 0d 0a 0d 0a  2e7a67a5338f....
2b0c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b0d0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 36 33 20 2d  .SELECT - - 63 -
2b0e0 20 32 33 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63   23 * col1 * + c
2b0f0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
2b100 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2b110 2d 2d 2d 0d 0a 2d 31 30 35 37 38 33 0d 0a 2d 33  ---..-105783..-3
2b120 30 38 32 36 0d 0a 2d 34 39 32 38 0d 0a 0d 0a 6f  0826..-4928....o
2b130 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2b140 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2b150 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2b160 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2b170 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b180 74 20 6c 61 62 65 6c 2d 31 31 37 38 0d 0a 53 45  t label-1178..SE
2b190 4c 45 43 54 20 2d 20 2b 20 43 41 53 54 28 20 4e  LECT - + CAST( N
2b1a0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
2b1b0 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  / col1 AS col0 F
2b1c0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
2b1d0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
2b1e0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
2b1f0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2b200 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2b210 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2b220 37 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 43  78..SELECT - + C
2b230 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
2b240 54 45 47 45 52 20 29 20 2f 20 63 6f 6c 31 20 41  TEGER ) / col1 A
2b250 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
2b260 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
2b270 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
2b280 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b290 0d 0a 53 45 4c 45 43 54 20 28 20 33 37 20 29 20  ..SELECT ( 37 ) 
2b2a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2b2b0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 0d 0a 33 37 0d  0..----..37..37.
2b2c0 0a 33 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .37....onlyif my
2b2d0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2b2e0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2b2f0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2b300 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2b310 65 6c 2d 31 31 38 30 0d 0a 53 45 4c 45 43 54 20  el-1180..SELECT 
2b320 2b 20 63 6f 6c 30 20 44 49 56 20 33 35 20 41 53  + col0 DIV 35 AS
2b330 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2b340 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
2b350 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..2....skipif my
2b360 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2b370 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2b380 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 30  wsort label-1180
2b390 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
2b3a0 2f 20 33 35 20 41 53 20 63 6f 6c 31 20 46 52 4f  / 35 AS col1 FRO
2b3b0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
2b3c0 2d 0d 0a 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a 71 75  -..0..1..2....qu
2b3d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b3e0 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20  ELECT cor0.col2 
2b3f0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2b400 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  2, tab2 AS cor0 
2b410 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c  CROSS JOIN tab0,
2b420 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
2b430 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33 20 76  or1..----..243 v
2b440 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2b450 20 33 64 63 64 38 36 33 34 39 33 61 63 31 36 63   3dcd863493ac16c
2b460 65 35 39 34 63 36 32 64 34 61 63 38 62 30 34 31  e594c62d4ac8b041
2b470 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
2b480 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2b490 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2b4a0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2b4b0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2b4c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b4d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2b4e0 20 63 6f 6c 30 20 2a 20 2b 20 28 20 63 6f 6c 30   col0 * + ( col0
2b4f0 20 29 20 2b 20 2d 20 32 35 20 63 6f 6c 32 20 46   ) + - 25 col2 F
2b500 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2b510 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 30 0d 0a 35 35  ..----..1200..55
2b520 31 0d 0a 37 38 39 36 0d 0a 0d 0a 71 75 65 72 79  1..7896....query
2b530 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b540 43 54 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f  CT + ( - cor0.co
2b550 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
2b560 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
2b570 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37  -..-86..-91..-97
2b580 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2b590 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2b5a0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2b5b0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2b5c0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2b5d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38  owsort label-118
2b5e0 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
2b5f0 43 54 20 2d 20 2b 20 43 41 53 54 28 20 4e 55 4c  CT - + CAST( NUL
2b600 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f 20  L AS SIGNED ) / 
2b610 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
2b620 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b630 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2b640 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2b650 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2b660 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38  owsort label-118
2b670 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
2b680 43 54 20 2d 20 2b 20 43 41 53 54 20 28 20 4e 55  CT - + CAST ( NU
2b690 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
2b6a0 2f 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  / + col0 FROM ta
2b6b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2b6c0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
2b6d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b6e0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
2b6f0 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  or0.col0 + col2 
2b700 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
2b710 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a 35 31  ----..-7..16..51
2b720 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b730 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2b740 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c 31  cor0.col0 - col1
2b750 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   * + col1 * - co
2b760 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2b770 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 34 30  cor0..----..2440
2b780 39 32 0d 0a 36 37 39 31 33 31 0d 0a 39 34 34 34  92..679131..9444
2b790 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2b7a0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2b7b0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2b7c0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2b7d0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2b7e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38  owsort label-118
2b7f0 37 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54  7..SELECT + CAST
2b800 28 20 2d 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  ( - col0 AS SIGN
2b810 45 44 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  ED ) * col0 FROM
2b820 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2b830 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37 36  ---..-1225..-576
2b840 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 73 6b 69 70 69  ..-7921....skipi
2b850 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2b860 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2b870 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2b880 31 31 38 37 0d 0a 53 45 4c 45 43 54 20 2b 20 43  1187..SELECT + C
2b890 41 53 54 20 28 20 2d 20 63 6f 6c 30 20 41 53 20  AST ( - col0 AS 
2b8a0 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30  INTEGER ) * col0
2b8b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2b8c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d  r0..----..-1225.
2b8d0 0a 2d 35 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a  .-576..-7921....
2b8e0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
2b8f0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
2b900 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
2b910 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
2b920 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
2b930 72 74 20 6c 61 62 65 6c 2d 31 31 38 38 0d 0a 53  rt label-1188..S
2b940 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c  ELECT CAST( NULL
2b950 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f 20 2b   AS SIGNED ) / +
2b960 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
2b970 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
2b980 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
2b990 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
2b9a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2b9b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2b9c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2b9d0 6c 2d 31 31 38 38 0d 0a 53 45 4c 45 43 54 20 43  l-1188..SELECT C
2b9e0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
2b9f0 54 45 47 45 52 20 29 20 2f 20 2b 20 63 6f 72 30  TEGER ) / + cor0
2ba00 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
2ba10 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
2ba20 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2ba30 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
2ba40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ba50 41 4c 4c 20 33 31 20 41 53 20 63 6f 6c 31 20 46  ALL 31 AS col1 F
2ba60 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2ba70 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a 33 31 0d 0a  ..----..31..31..
2ba80 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
2ba90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
2baa0 62 30 2e 63 6f 6c 31 20 2b 20 2d 20 34 36 20 41  b0.col1 + - 46 A
2bab0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2bac0 0d 0a 2d 2d 2d 2d 0d 0a 34 30 0d 0a 34 35 0d 0a  ..----..40..45..
2bad0 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  51....query I ro
2bae0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2baf0 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 38 31 20 46  l2 + col2 * 81 F
2bb00 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2bb10 0d 0a 2d 2d 2d 2d 0d 0a 32 37 30 36 0d 0a 36 37  ..----..2706..67
2bb20 32 34 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20  24..82....query 
2bb30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bb40 54 20 41 4c 4c 20 2d 20 33 33 20 41 53 20 63 6f  T ALL - 33 AS co
2bb50 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l1 FROM tab1, ta
2bb60 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2bb70 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2bb80 6e 67 20 74 6f 20 38 30 33 35 63 36 36 35 61 37  ng to 8035c665a7
2bb90 35 64 32 32 62 65 35 39 32 32 62 65 31 61 34 65  5d22be5922be1a4e
2bba0 35 37 34 65 30 33 0d 0a 0d 0a 71 75 65 72 79 20  574e03....query 
2bbb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bbc0 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  T + - cor0.col1 
2bbd0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2bbe0 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  2 AS cor0 CROSS 
2bbf0 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72  JOIN tab0 AS cor
2bc00 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
2bc10 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 63 61  s hashing to cca
2bc20 61 35 64 64 33 33 38 38 64 39 65 65 30 66 65 61  a5dd3388d9ee0fea
2bc30 36 37 36 66 61 33 35 32 39 39 66 65 35 0d 0a 0d  676fa35299fe5...
2bc40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2bc50 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
2bc60 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or1.col1 FROM ta
2bc70 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
2bc80 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
2bc90 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
2bca0 68 61 73 68 69 6e 67 20 74 6f 20 37 35 39 39 62  hashing to 7599b
2bcb0 34 38 30 31 32 35 64 65 35 32 31 65 66 65 64 37  480125de521efed7
2bcc0 31 62 35 62 32 34 31 33 63 37 64 0d 0a 0d 0a 71  1b5b2413c7d....q
2bcd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2bce0 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 32  SELECT tab2.col2
2bcf0 20 2b 20 2d 20 38 33 20 46 52 4f 4d 20 74 61 62   + - 83 FROM tab
2bd00 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a 2d 35  2..----..-45..-5
2bd10 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20  6..-57....query 
2bd20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bd30 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
2bd40 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 35 32 20  2 * + col1 + 52 
2bd50 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52  * col2 * col0 FR
2bd60 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2bd70 2d 2d 0d 0a 31 30 33 39 32 32 0d 0a 31 35 35 34  --..103922..1554
2bd80 35 38 0d 0a 38 39 39 31 0d 0a 0d 0a 71 75 65 72  58..8991....quer
2bd90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2bda0 45 43 54 20 41 4c 4c 20 2d 20 2d 20 39 30 20 2b  ECT ALL - - 90 +
2bdb0 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 33 33 20 46   + col1 * + 33 F
2bdc0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2bdd0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 33 0d 0a 32 30  ..----..1113..20
2bde0 33 37 0d 0a 36 35 31 0d 0a 0d 0a 71 75 65 72 79  37..651....query
2bdf0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2be00 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2d 20  CT ALL - col0 - 
2be10 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
2be20 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2be30 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31 37 36  ----..-121..-176
2be40 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-57....query I
2be50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2be60 20 2b 20 38 37 20 2b 20 2b 20 63 6f 72 30 2e 63   + 87 + + cor0.c
2be70 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2be80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35   cor0..----..165
2be90 0d 0a 31 36 36 0d 0a 39 34 0d 0a 0d 0a 71 75 65  ..166..94....que
2bea0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2beb0 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 72  LECT ALL + + cor
2bec0 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  0.col2 + - col0 
2bed0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2bee0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36 0d  0..----..-7..16.
2bef0 0a 35 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .51....skipif po
2bf00 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2bf10 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2bf20 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2bf30 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2bf40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2bf50 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2bf60 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a   ( cor0.col2 ) *
2bf70 20 35 38 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   58 col2 FROM ta
2bf80 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2bf90 0d 0a 31 35 30 38 0d 0a 31 35 36 36 0d 0a 32 32  ..1508..1566..22
2bfa0 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  04....query I ro
2bfb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2bfc0 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col0 + col0 * - 
2bfd0 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63  col1 * col1 AS c
2bfe0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
2bff0 2d 2d 2d 0d 0a 2d 32 32 39 31 30 0d 0a 2d 32 37  ---..-22910..-27
2c000 31 35 39 36 0d 0a 2d 36 37 33 34 0d 0a 0d 0a 71  1596..-6734....q
2c010 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c020 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2c030 2d 20 35 37 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  - 57 + cor0.col0
2c040 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2c050 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 30 0d 0a 32  r0..----..-50..2
2c060 31 0d 0a 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49  1..22....query I
2c070 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c080 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a   - col0 * col1 *
2c090 20 38 39 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f   89 + + col2 FRO
2c0a0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2c0b0 2d 2d 2d 2d 0d 0a 2d 35 36 39 30 33 0d 0a 2d 36  ----..-56903..-6
2c0c0 38 38 38 0d 0a 2d 39 32 34 36 34 0d 0a 0d 0a 71  888..-92464....q
2c0d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c0e0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 35 39 20  SELECT ALL + 59 
2c0f0 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * + col0 FROM ta
2c100 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
2c110 34 31 36 0d 0a 32 30 36 35 0d 0a 35 32 35 31 0d  416..2065..5251.
2c120 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c130 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2c140 20 36 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f   60 + col2 AS co
2c150 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
2c160 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 0d 0a 31 31  0..----..114..11
2c170 37 0d 0a 31 35 36 0d 0a 0d 0a 71 75 65 72 79 20  7..156....query 
2c180 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c190 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2a  T ALL + + col2 *
2c1a0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   + col0 * - col0
2c1b0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41   + col0 * col0 A
2c1c0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2c1d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c1e0 2d 31 32 37 34 0d 0a 2d 31 35 32 31 30 30 0d 0a  -1274..-152100..
2c1f0 2d 32 33 30 39 31 37 0d 0a 0d 0a 71 75 65 72 79  -230917....query
2c200 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c210 43 54 20 41 4c 4c 20 38 37 20 46 52 4f 4d 20 74  CT ALL 87 FROM t
2c220 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
2c230 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
2c240 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 61 30  s hashing to fa0
2c250 63 64 64 38 36 34 38 33 38 34 34 63 64 61 33 62  cdd86483844cda3b
2c260 62 38 30 36 65 30 33 32 64 35 63 36 34 0d 0a 0d  b806e032d5c64...
2c270 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c280 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34  ..SELECT ALL + 4
2c290 34 20 2a 20 2b 20 35 31 20 46 52 4f 4d 20 74 61  4 * + 51 FROM ta
2c2a0 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b1 AS cor0 CROSS
2c2b0 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f   JOIN tab2 AS co
2c2c0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
2c2d0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 38  es hashing to c8
2c2e0 30 65 35 61 38 39 63 30 39 34 35 63 61 32 38 37  0e5a89c0945ca287
2c2f0 66 65 37 37 36 64 33 36 34 35 66 30 32 65 0d 0a  fe776d3645f02e..
2c300 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c310 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2c320 2b 20 39 35 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 95 AS col0 FRO
2c330 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43  M tab2 AS cor0 C
2c340 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 63  ROSS JOIN tab1 c
2c350 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
2c360 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31  ues hashing to 1
2c370 63 37 39 33 34 64 62 30 36 33 32 63 31 32 33 33  c7934db0632c1233
2c380 33 32 63 34 33 66 31 37 62 36 36 31 64 36 63 0d  32c43f17b661d6c.
2c390 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2c3a0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2c3b0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2c3c0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2c3d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2c3e0 32 31 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  211..SELECT ALL 
2c3f0 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 28 20 2b  + col1 DIV + ( +
2c400 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 29 20 41   col1 * col1 ) A
2c410 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2c420 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c430 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
2c440 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2c450 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2c460 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2c470 31 32 31 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1211..SELECT ALL
2c480 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 28 20 2b 20   + col1 / + ( + 
2c490 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 29 20 41 53  col1 * col1 ) AS
2c4a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2c4b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2c4c0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
2c4d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c4e0 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 33 32  T cor0.col1 * 32
2c4f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2c500 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 38 0d 0a  r0..----..1888..
2c510 35 34 34 0d 0a 39 39 32 0d 0a 0d 0a 71 75 65 72  544..992....quer
2c520 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c530 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62  ECT DISTINCT tab
2c540 31 2e 63 6f 6c 31 20 2b 20 2d 20 74 61 62 31 2e  1.col1 + - tab1.
2c550 63 6f 6c 30 20 2a 20 32 34 20 2b 20 2d 20 28 20  col0 * 24 + - ( 
2c560 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  + col2 ) FROM ta
2c570 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a  b1..----..-100..
2c580 2d 31 35 38 33 0d 0a 2d 32 30 30 33 0d 0a 0d 0a  -1583..-2003....
2c590 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2c5a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
2c5b0 2d 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 32 20  - col0 ) * col2 
2c5c0 2d 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20  - - ( cor0.col2 
2c5d0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
2c5e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d  or0..----..-108.
2c5f0 0a 2d 33 35 39 31 0d 0a 2d 37 35 38 34 0d 0a 0d  .-3591..-7584...
2c600 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2c610 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2c620 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2c630 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2c640 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31  owsort label-121
2c650 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
2c660 43 54 20 28 20 63 6f 6c 32 20 29 20 44 49 56 20  CT ( col2 ) DIV 
2c670 63 6f 6c 31 20 2d 20 28 20 63 6f 6c 32 20 29 20  col1 - ( col2 ) 
2c680 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  * cor0.col1 FROM
2c690 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2c6a0 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36  ---..-2838..-746
2c6b0 32 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  2..-97....skipif
2c6c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2c6d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2c6e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2c6f0 32 31 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  215..SELECT DIST
2c700 49 4e 43 54 20 28 20 63 6f 6c 32 20 29 20 2f 20  INCT ( col2 ) / 
2c710 63 6f 6c 31 20 2d 20 28 20 63 6f 6c 32 20 29 20  col1 - ( col2 ) 
2c720 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  * cor0.col1 FROM
2c730 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2c740 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36  ---..-2838..-746
2c750 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20  2..-97....query 
2c760 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c770 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72  T - col1 * + cor
2c780 30 2e 63 6f 6c 31 20 2d 20 63 6f 72 30 2e 63 6f  0.col1 - cor0.co
2c790 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
2c7a0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2c7b0 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 38 32 0d 0a  --..-110..-182..
2c7c0 2d 37 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -702....query I 
2c7d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c7e0 41 4c 4c 20 2b 20 35 39 20 2b 20 63 6f 6c 30 20  ALL + 59 + col0 
2c7f0 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * + col0 FROM ta
2c800 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
2c810 32 38 34 0d 0a 36 33 35 0d 0a 37 39 38 30 0d 0a  284..635..7980..
2c820 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c830 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
2c840 20 2d 20 31 35 20 46 52 4f 4d 20 74 61 62 30 20   - 15 FROM tab0 
2c850 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
2c860 30 0d 0a 37 34 0d 0a 39 0d 0a 0d 0a 71 75 65 72  0..74..9....quer
2c870 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c880 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
2c890 20 34 38 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c   48 + col0 * col
2c8a0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
2c8b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2c8c0 2d 0d 0a 2d 33 39 0d 0a 34 30 34 38 0d 0a 36 33  -..-39..4048..63
2c8d0 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  52....query I ro
2c8e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2c8f0 2b 20 31 32 20 2b 20 28 20 2d 20 63 6f 6c 31 20  + 12 + ( - col1 
2c900 2a 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  * col2 ) FROM ta
2c910 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2c920 0d 0a 2d 31 35 32 32 0d 0a 2d 36 33 34 0d 0a 2d  ..-1522..-634..-
2c930 38 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  825....query I r
2c940 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2c950 20 28 20 2b 20 63 6f 6c 32 20 29 20 2d 20 2b 20   ( + col2 ) - + 
2c960 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col2 * col1 FROM
2c970 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2c980 2d 2d 2d 0d 0a 2d 31 33 34 34 0d 0a 2d 31 34 35  ---..-1344..-145
2c990 38 0d 0a 2d 36 32 37 0d 0a 0d 0a 6f 6e 6c 79 69  8..-627....onlyi
2c9a0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2c9b0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2c9c0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2c9d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c9e0 20 6c 61 62 65 6c 2d 31 32 32 32 0d 0a 53 45 4c   label-1222..SEL
2c9f0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 44  ECT ALL + col0 D
2ca00 49 56 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20  IV - ( + col2 ) 
2ca10 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2ca20 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2ca30 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  .-1..0..0....ski
2ca40 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2ca50 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2ca60 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2ca70 6c 2d 31 32 32 32 0d 0a 53 45 4c 45 43 54 20 41  l-1222..SELECT A
2ca80 4c 4c 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 28 20  LL + col0 / - ( 
2ca90 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31  + col2 ) AS col1
2caa0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2cab0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d  r0..----..-1..0.
2cac0 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .0....skipif pos
2cad0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2cae0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2caf0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2cb00 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2cb10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2cb20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2cb30 2b 20 63 6f 6c 31 20 2d 20 32 34 20 2a 20 2d 20  + col1 - 24 * - 
2cb40 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46  cor0.col2 col1 F
2cb50 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2cb60 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 32 30 35  ..----..121..205
2cb70 39 0d 0a 38 37 38 0d 0a 0d 0a 71 75 65 72 79 20  9..878....query 
2cb80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2cb90 54 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 74 61 62  T + col0 - - tab
2cba0 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  0.col2 * + col1 
2cbb0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2cbc0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38  0..----..132..28
2cbd0 36 32 0d 0a 37 35 35 31 0d 0a 0d 0a 71 75 65 72  62..7551....quer
2cbe0 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49  y IIIIIIIIIIIIII
2cbf0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2cc00 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62  T ALL * FROM tab
2cc10 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  2 AS cor0 CROSS 
2cc20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61 62 31 20  JOIN tab1, tab1 
2cc30 41 53 20 63 6f 72 31 2c 20 74 61 62 30 2c 20 74  AS cor1, tab0, t
2cc40 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab2 AS cor2..---
2cc50 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68  -..3645 values h
2cc60 61 73 68 69 6e 67 20 74 6f 20 37 37 33 62 62 39  ashing to 773bb9
2cc70 31 36 65 34 36 33 65 62 63 30 37 35 64 37 30 31  16e463ebc075d701
2cc80 31 30 38 35 33 32 62 61 64 62 0d 0a 0d 0a 71 75  108532badb....qu
2cc90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2cca0 45 4c 45 43 54 20 2b 20 37 33 20 2b 20 2b 20 34  ELECT + 73 + + 4
2ccb0 31 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20  1 + - tab2.col0 
2ccc0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2ccd0 0a 31 30 37 0d 0a 33 35 0d 0a 33 36 0d 0a 0d 0a  .107..35..36....
2cce0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ccf0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2cd00 6c 32 20 2b 20 33 20 2a 20 2b 20 63 6f 6c 31 20  l2 + 3 * + col1 
2cd10 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2cd20 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 0d 0a 32 39  0..----..291..29
2cd30 32 0d 0a 33 35 35 0d 0a 0d 0a 71 75 65 72 79 20  2..355....query 
2cd40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2cd50 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 33 20  T DISTINCT + 53 
2cd60 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2cd70 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
2cd80 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 0d 0a 71 75 65  .----..53....que
2cd90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2cda0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2cdb0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col0 + - col0 * 
2cdc0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
2cdd0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2cde0 2d 2d 2d 2d 0d 0a 2d 31 36 35 0d 0a 2d 33 37 31  ----..-165..-371
2cdf0 32 0d 0a 2d 37 37 36 30 0d 0a 0d 0a 71 75 65 72  2..-7760....quer
2ce00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ce10 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c  ECT ALL cor0.col
2ce20 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
2ce30 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  2 AS cor0, tab2 
2ce40 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
2ce50 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
2ce60 20 74 6f 20 31 65 31 66 31 30 39 35 33 65 62 38   to 1e1f10953eb8
2ce70 65 66 66 65 39 62 32 30 65 37 34 36 66 38 61 37  effe9b20e746f8a7
2ce80 66 64 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  fd83....onlyif m
2ce90 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
2cea0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
2ceb0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
2cec0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
2ced0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2cee0 2d 31 32 33 31 0d 0a 53 45 4c 45 43 54 20 41 4c  -1231..SELECT AL
2cef0 4c 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  L - CAST( NULL A
2cf00 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 74  S SIGNED ) * - t
2cf10 61 62 31 2e 63 6f 6c 30 20 2b 20 2b 20 74 61 62  ab1.col0 + + tab
2cf20 31 2e 63 6f 6c 30 20 2a 20 2d 20 38 34 20 46 52  1.col0 * - 84 FR
2cf30 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
2cf40 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
2cf50 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2cf60 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2cf70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cf80 74 20 6c 61 62 65 6c 2d 31 32 33 31 0d 0a 53 45  t label-1231..SE
2cf90 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20  LECT ALL - CAST 
2cfa0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
2cfb0 52 20 29 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c  R ) * - tab1.col
2cfc0 30 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  0 + + tab1.col0 
2cfd0 2a 20 2d 20 38 34 20 46 52 4f 4d 20 74 61 62 31  * - 84 FROM tab1
2cfe0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
2cff0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
2d000 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d010 45 43 54 20 2b 20 2d 20 39 39 20 2b 20 63 6f 72  ECT + - 99 + cor
2d020 30 2e 63 6f 6c 30 20 2a 20 28 20 35 39 20 29 20  0.col0 * ( 59 ) 
2d030 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
2d040 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2d050 0d 0a 31 32 31 36 37 37 0d 0a 32 30 30 32 30 36  ..121677..200206
2d060 0d 0a 34 37 37 37 34 32 0d 0a 0d 0a 73 6b 69 70  ..477742....skip
2d070 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2d080 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2d090 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2d0a0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2d0b0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2d0c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 33 20  sort..SELECT 33 
2d0d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
2d0e0 2d 2d 2d 2d 0d 0a 33 33 0d 0a 33 33 0d 0a 33 33  ----..33..33..33
2d0f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d100 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2d110 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  col0 + cor0.col2
2d120 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2d130 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2d140 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a  ..104..117..34..
2d150 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d160 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
2d170 20 2b 20 63 6f 6c 31 20 2a 20 38 37 20 41 53 20   + col1 * 87 AS 
2d180 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
2d190 2d 2d 2d 2d 0d 0a 31 31 36 38 34 31 0d 0a 31 38  ----..116841..18
2d1a0 38 37 39 0d 0a 34 30 30 33 37 34 0d 0a 0d 0a 71  879..400374....q
2d1b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2d1c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2d1d0 32 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  27 AS col2 FROM 
2d1e0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a  tab2..----..27..
2d1f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d200 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2d210 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  CT + - col1 + co
2d220 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  r0.col0 AS col1 
2d230 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2d240 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34  0..----..-23..54
2d250 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..67....query I 
2d260 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d270 2b 20 36 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  + 62 * + cor0.co
2d280 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 + col2 FROM t
2d290 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2d2a0 2d 0d 0a 31 35 32 31 0d 0a 32 31 37 31 0d 0a 35  -..1521..2171..5
2d2b0 36 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  600....query I r
2d2c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2d2d0 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30  ISTINCT + - col0
2d2e0 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 28 20   * + col1 - + ( 
2d2f0 2b 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c  + col1 ) * + col
2d300 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2d310 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 30  or0..----..-1280
2d320 34 0d 0a 2d 31 36 33 38 30 0d 0a 2d 39 34 36 30  4..-16380..-9460
2d330 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d340 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2d350 6c 30 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  l0 - cor0.col0 *
2d360 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
2d370 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2d380 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 39  0..----..182..19
2d390 35 30 0d 0a 32 39 32 33 0d 0a 0d 0a 71 75 65 72  50..2923....quer
2d3a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d3b0 45 43 54 20 2d 20 34 20 2b 20 2b 20 63 6f 6c 31  ECT - 4 + + col1
2d3c0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2d3d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2d3e0 0d 0a 38 32 0d 0a 38 37 0d 0a 39 33 0d 0a 0d 0a  ..82..87..93....
2d3f0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2d400 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2d410 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2d420 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2d430 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2d440 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d450 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63   - tab2.col1 * c
2d460 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c  ol0 + + col2 col
2d470 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
2d480 2d 0d 0a 2d 31 33 30 35 0d 0a 2d 31 39 30 0d 0a  -..-1305..-190..
2d490 2d 34 35 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -4576....query I
2d4a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d4b0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b   DISTINCT col2 +
2d4c0 20 28 20 2d 20 63 6f 6c 30 20 29 20 41 53 20 63   ( - col0 ) AS c
2d4d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
2d4e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d  r0..----..-34..-
2d4f0 37 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7..9....query I 
2d500 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d510 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b  ALL + - col1 + +
2d520 20 37 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   76 AS col2 FROM
2d530 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2d540 2d 2d 2d 0d 0a 31 37 0d 0a 34 35 0d 0a 35 39 0d  ---..17..45..59.
2d550 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d560 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2d570 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 34 39 20   cor0.col0 + 49 
2d580 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2d590 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2d5a0 0a 31 32 37 0d 0a 31 32 38 0d 0a 35 36 0d 0a 0d  .127..128..56...
2d5b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d5c0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
2d5d0 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  or0.col1 * - col
2d5e0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2d5f0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2d600 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39  -..2838..7462..9
2d610 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2d620 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37  sort..SELECT + 7
2d630 35 20 2b 20 2d 20 32 33 20 2a 20 63 6f 6c 31 20  5 + - 23 * col1 
2d640 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2d650 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2d660 0a 2d 31 32 38 32 0d 0a 2d 33 31 36 0d 0a 2d 36  .-1282..-316..-6
2d670 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
2d680 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2d690 53 54 49 4e 43 54 20 33 34 20 41 53 20 63 6f 6c  STINCT 34 AS col
2d6a0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2d6b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a 0d  or0..----..34...
2d6c0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2d6d0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2d6e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d6f0 0a 53 45 4c 45 43 54 20 39 32 20 2b 20 63 6f 6c  .SELECT 92 + col
2d700 32 20 2a 20 63 6f 6c 30 20 2a 20 43 41 53 54 20  2 * col0 * CAST 
2d710 28 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29  ( col2 AS REAL )
2d720 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2d730 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2d740 0d 0a 31 31 34 31 36 38 0d 0a 35 31 39 35 0d 0a  ..114168..5195..
2d750 35 32 38 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  52820....query I
2d760 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d770 20 2b 20 37 31 20 2a 20 32 35 20 46 52 4f 4d 20   + 71 * 25 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 31 37 37 35 0d 0a 31 37 37 35 0d 0a  --..1775..1775..
2d7a0 31 37 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1775....query I 
2d7b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d7c0 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  - + cor0.col0 + 
2d7d0 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  + col0 * - col2 
2d7e0 2a 20 2b 20 32 20 41 53 20 63 6f 6c 32 20 46 52  * + 2 AS col2 FR
2d7f0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2d800 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 0d 0a 2d 31 34  .----..-105..-14
2d810 36 38 35 0d 0a 2d 31 36 30 38 0d 0a 0d 0a 71 75  685..-1608....qu
2d820 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d830 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  ELECT + - cor0.c
2d840 6f 6c 32 20 2a 20 39 31 20 41 53 20 63 6f 6c 30  ol2 * 91 AS col0
2d850 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2d860 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 30 33 0d  r0..----..-3003.
2d870 0a 2d 37 34 36 32 0d 0a 2d 39 31 0d 0a 0d 0a 6f  .-7462..-91....o
2d880 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2d890 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2d8a0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2d8b0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2d8c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d8d0 74 20 6c 61 62 65 6c 2d 31 32 35 33 0d 0a 53 45  t label-1253..SE
2d8e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2d8f0 43 41 53 54 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  CAST( - cor0.col
2d900 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  2 AS SIGNED ) FR
2d910 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2d920 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39  .----..54..57..9
2d930 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
2d940 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2d950 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2d960 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 33 0d 0a  ort label-1253..
2d970 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2d980 2d 20 43 41 53 54 20 28 20 2d 20 63 6f 72 30 2e  - CAST ( - cor0.
2d990 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
2d9a0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
2d9b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  or0..----..54..5
2d9c0 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  7..96....query I
2d9d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d9e0 20 2d 20 35 37 20 2b 20 28 20 2b 20 63 6f 6c 32   - 57 + ( + col2
2d9f0 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31   ) * - cor0.col1
2da00 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2da10 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2da20 0d 0a 2d 31 35 34 0d 0a 2d 32 38 39 35 0d 0a 2d  ..-154..-2895..-
2da30 37 35 31 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7519....onlyif m
2da40 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2da50 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2da60 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2da70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2da80 62 65 6c 2d 31 32 35 35 0d 0a 53 45 4c 45 43 54  bel-1255..SELECT
2da90 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41 53   CAST( + col1 AS
2daa0 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 63 6f   SIGNED ) + + co
2dab0 6c 32 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63  l2 DIV col2 AS c
2dac0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2dad0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d   cor0..----..87.
2dae0 0a 39 32 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69  .92..98....skipi
2daf0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2db00 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2db10 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2db20 31 32 35 35 0d 0a 53 45 4c 45 43 54 20 43 41 53  1255..SELECT CAS
2db30 54 20 28 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e  T ( + col1 AS IN
2db40 54 45 47 45 52 20 29 20 2b 20 2b 20 63 6f 6c 32  TEGER ) + + col2
2db50 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   / col2 AS col2 
2db60 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2db70 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 39 32 0d  0..----..87..92.
2db80 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .98....query I r
2db90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2dba0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a  ISTINCT - col2 *
2dbb0 20 32 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   22 AS col2 FROM
2dbc0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   tab1..----..-11
2dbd0 38 38 0d 0a 2d 31 32 35 34 0d 0a 2d 32 31 31 32  88..-1254..-2112
2dbe0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2dbf0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
2dc00 62 32 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31  b2.col2 + - col1
2dc10 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31   * col1 * - col1
2dc20 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2dc30 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34 30 35  b2..----..205405
2dc40 0d 0a 32 39 38 31 38 0d 0a 34 39 35 31 0d 0a 0d  ..29818..4951...
2dc50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2dc60 0d 0a 53 45 4c 45 43 54 20 2d 20 34 30 20 2a 20  ..SELECT - 40 * 
2dc70 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e  - col0 * - cor0.
2dc80 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
2dc90 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
2dca0 2d 0d 0a 2d 31 39 36 30 0d 0a 2d 32 34 33 33 36  -..-1960..-24336
2dcb0 30 0d 0a 2d 32 34 39 36 34 30 0d 0a 0d 0a 71 75  0..-249640....qu
2dcc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2dcd0 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b  ELECT - col0 * +
2dce0 20 35 37 20 2d 20 28 20 63 6f 6c 30 20 2b 20 63   57 - ( col0 + c
2dcf0 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 41 53 20  ol1 ) * col2 AS 
2dd00 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
2dd10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 38  or0..----..-1348
2dd20 38 0d 0a 2d 31 37 33 37 0d 0a 2d 37 38 36 36 0d  8..-1737..-7866.
2dd30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2dd40 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
2dd50 31 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 41  1 + ( - col0 ) A
2dd60 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2dd70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2dd80 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d 39 36 0d 0a  -137..-38..-96..
2dd90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2dda0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2ddb0 2d 20 63 6f 6c 31 20 2b 20 35 35 20 46 52 4f 4d  - col1 + 55 FROM
2ddc0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2ddd0 2d 2d 2d 0d 0a 2d 33 31 0d 0a 2d 33 36 0d 0a 2d  ---..-31..-36..-
2dde0 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  42....query I ro
2ddf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2de00 36 39 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  69 FROM tab2, ta
2de10 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2de20 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2de30 6e 67 20 74 6f 20 38 35 64 39 62 39 30 61 30 33  ng to 85d9b90a03
2de40 62 39 64 65 66 31 36 31 38 39 31 62 31 33 30 38  b9def161891b1308
2de50 35 32 37 31 66 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  5271f7....onlyif
2de60 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2de70 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2de80 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2de90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2dea0 6c 61 62 65 6c 2d 31 32 36 33 0d 0a 53 45 4c 45  label-1263..SELE
2deb0 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 28 20  CT + col0 DIV ( 
2dec0 63 6f 6c 32 20 29 20 63 6f 6c 31 20 46 52 4f 4d  col2 ) col1 FROM
2ded0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab1..----..0..
2dee0 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  0..1....skipif p
2def0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2df00 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2df10 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2df20 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2df30 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2df40 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2df50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2df60 6c 61 62 65 6c 2d 31 32 36 33 0d 0a 53 45 4c 45  label-1263..SELE
2df70 43 54 20 2b 20 63 6f 6c 30 20 2f 20 28 20 63 6f  CT + col0 / ( co
2df80 6c 32 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 ) col1 FROM t
2df90 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab1..----..0..0.
2dfa0 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
2dfb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2dfc0 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2b 20  col2 + - col1 + 
2dfd0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
2dfe0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
2dff0 30 0d 0a 33 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72  0..3..45....quer
2e000 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e010 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 28  ECT ALL col2 + (
2e020 20 2d 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f   - col1 ) * - co
2e030 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2e040 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 0d  cor0..----..157.
2e050 0a 32 36 35 0d 0a 37 33 30 0d 0a 0d 0a 71 75 65  .265..730....que
2e060 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e070 4c 45 43 54 20 2b 20 28 20 2d 20 63 6f 6c 30 20  LECT + ( - col0 
2e080 29 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  ) * col2 + - col
2e090 31 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 - col2 FROM ta
2e0a0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2e0b0 0d 0a 2d 32 31 31 33 0d 0a 2d 32 34 37 0d 0a 2d  ..-2113..-247..-
2e0c0 33 30 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3057....onlyif m
2e0d0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2e0e0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2e0f0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2e100 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2e110 62 65 6c 2d 31 32 36 37 0d 0a 53 45 4c 45 43 54  bel-1267..SELECT
2e120 20 41 4c 4c 20 2d 20 2b 20 28 20 63 6f 6c 30 20   ALL - + ( col0 
2e130 29 20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20  ) DIV + col0 AS 
2e140 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2e150 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2e160 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70  ..-1..-1....skip
2e170 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2e180 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2e190 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2e1a0 2d 31 32 36 37 0d 0a 53 45 4c 45 43 54 20 41 4c  -1267..SELECT AL
2e1b0 4c 20 2d 20 2b 20 28 20 63 6f 6c 30 20 29 20 2f  L - + ( col0 ) /
2e1c0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
2e1d0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2e1e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  0..----..-1..-1.
2e1f0 0a 2d 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .-1....onlyif my
2e200 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2e210 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2e220 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2e230 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2e240 65 6c 2d 31 32 36 38 0d 0a 53 45 4c 45 43 54 20  el-1268..SELECT 
2e250 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20 28 20 63  - col0 DIV - ( c
2e260 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
2e270 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab2..----..0
2e280 0d 0a 31 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..1..4....skipif
2e290 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2e2a0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2e2b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2e2c0 32 36 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  268..SELECT - co
2e2d0 6c 30 20 2f 20 2d 20 28 20 63 6f 6c 31 20 29 20  l0 / - ( col1 ) 
2e2e0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2e2f0 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34  2..----..0..1..4
2e300 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2e310 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2e320 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  l0 + - col1 + - 
2e330 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col0 * col2 FROM
2e340 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39   tab1..----..-19
2e350 31 0d 0a 2d 33 37 32 32 0d 0a 2d 37 37 37 33 0d  1..-3722..-7773.
2e360 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e370 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
2e380 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e  0.col0 * - cor0.
2e390 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col1 + - cor0.co
2e3a0 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  l0 * cor0.col0 *
2e3b0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
2e3c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2e3d0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 37 35 34 0d 0a  .----..-104754..
2e3e0 2d 31 33 30 32 0d 0a 2d 33 35 34 33 35 34 0d 0a  -1302..-354354..
2e3f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e400 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 39 20 41  t..SELECT - 49 A
2e410 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2e420 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
2e430 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
2e440 61 73 68 69 6e 67 20 74 6f 20 30 31 62 31 66 61  ashing to 01b1fa
2e450 32 32 66 65 65 38 37 32 61 37 62 61 36 34 66 39  22fee872a7ba64f9
2e460 30 64 36 30 34 36 66 66 61 65 0d 0a 0d 0a 71 75  0d6046ffae....qu
2e470 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e480 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 35 20 2a  ELECT ALL + 95 *
2e490 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f   tab0.col0 AS co
2e4a0 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
2e4b0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2e4c0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2e4d0 6e 67 20 74 6f 20 62 31 39 64 36 33 35 32 30 33  ng to b19d635203
2e4e0 35 34 63 61 36 65 61 33 34 62 34 30 39 35 36 39  54ca6ea34b409569
2e4f0 38 31 30 66 66 34 0d 0a 0d 0a 71 75 65 72 79 20  810ff4....query 
2e500 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e510 54 20 2d 20 38 20 2b 20 2d 20 63 6f 6c 31 20 2a  T - 8 + - col1 *
2e520 20 34 33 20 2a 20 28 20 63 6f 6c 31 20 29 20 41   43 * ( col1 ) A
2e530 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2e540 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e550 2d 33 31 38 30 33 36 0d 0a 2d 33 35 36 30 39 31  -318036..-356091
2e560 0d 0a 2d 34 30 34 35 39 35 0d 0a 0d 0a 73 6b 69  ..-404595....ski
2e570 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2e580 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2e590 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2e5a0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2e5b0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2e5c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37 34  wsort..SELECT 74
2e5d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
2e5e0 0a 2d 2d 2d 2d 0d 0a 37 34 0d 0a 37 34 0d 0a 37  .----..74..74..7
2e5f0 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  4....skipif post
2e600 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2e610 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2e620 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2e630 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2e640 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e650 45 4c 45 43 54 20 2d 20 35 36 20 2b 20 63 6f 6c  ELECT - 56 + col
2e660 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0 col2 FROM tab1
2e670 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 32 34 0d  ..----..-53..24.
2e680 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .8....query I ro
2e690 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
2e6a0 32 38 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52  28 ) + + col1 FR
2e6b0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34  OM tab2..----..4
2e6c0 35 0d 0a 35 39 0d 0a 38 37 0d 0a 0d 0a 71 75 65  5..59..87....que
2e6d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e6e0 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  LECT col0 + - co
2e6f0 6c 32 20 2a 20 39 36 20 46 52 4f 4d 20 74 61 62  l2 * 96 FROM tab
2e700 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  1 cor0..----..-5
2e710 31 38 31 0d 0a 2d 35 34 30 38 0d 0a 2d 39 31 33  181..-5408..-913
2e720 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2e730 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2e740 20 36 37 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20   67 * col2 FROM 
2e750 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 31 31  tab0..----..2211
2e760 0d 0a 35 34 39 34 0d 0a 36 37 0d 0a 0d 0a 71 75  ..5494..67....qu
2e770 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e780 45 4c 45 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f  ELECT ALL ( + co
2e790 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 29 20 2a 20  l2 + + col1 ) * 
2e7a0 2b 20 28 20 2b 20 33 31 20 2b 20 2b 20 63 6f 6c  + ( + 31 + + col
2e7b0 31 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  1 ) FROM tab1..-
2e7c0 2d 2d 2d 0d 0a 32 37 34 37 0d 0a 34 35 36 30 0d  ---..2747..4560.
2e7d0 0a 34 37 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .4796....query I
2e7e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e7f0 20 2b 20 38 36 20 2a 20 2b 20 63 6f 6c 30 20 46   + 86 * + col0 F
2e800 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
2e810 2d 2d 2d 0d 0a 32 35 38 0d 0a 35 35 30 34 0d 0a  ---..258..5504..
2e820 36 38 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6880....query I 
2e830 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e840 2b 20 63 6f 6c 31 20 2d 20 74 61 62 30 2e 63 6f  + col1 - tab0.co
2e850 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
2e860 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
2e870 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
2e880 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2e890 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2e8a0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2e8b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2e8c0 65 6c 2d 31 32 38 32 0d 0a 53 45 4c 45 43 54 20  el-1282..SELECT 
2e8d0 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c  + col0 DIV + col
2e8e0 30 20 2d 20 28 20 74 61 62 32 2e 63 6f 6c 32 20  0 - ( tab2.col2 
2e8f0 29 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ) * + col1 AS co
2e900 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
2e910 2d 2d 0d 0a 2d 31 35 33 33 0d 0a 2d 36 34 35 0d  --..-1533..-645.
2e920 0a 2d 38 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-836....skipif 
2e930 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2e940 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2e950 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2e960 38 32 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  82..SELECT + col
2e970 30 20 2f 20 2b 20 63 6f 6c 30 20 2d 20 28 20 74  0 / + col0 - ( t
2e980 61 62 32 2e 63 6f 6c 32 20 29 20 2a 20 2b 20 63  ab2.col2 ) * + c
2e990 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
2e9a0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   tab2..----..-15
2e9b0 33 33 0d 0a 2d 36 34 35 0d 0a 2d 38 33 36 0d 0a  33..-645..-836..
2e9c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e9d0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2e9e0 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col1 * - col1 + 
2e9f0 2d 20 63 6f 6c 30 20 2a 20 34 37 20 46 52 4f 4d  - col0 * 47 FROM
2ea00 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39   tab0..----..409
2ea10 38 0d 0a 36 32 36 38 0d 0a 37 37 36 34 0d 0a 0d  8..6268..7764...
2ea20 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2ea30 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2ea40 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2ea50 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2ea60 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38  owsort label-128
2ea70 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  4..SELECT ALL - 
2ea80 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20  + cor0.col0 DIV 
2ea90 2b 20 39 20 46 52 4f 4d 20 74 61 62 31 20 41 53  + 9 FROM tab1 AS
2eaa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d   cor0..----..-7.
2eab0 0a 2d 38 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-8..0....skipif
2eac0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2ead0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2eae0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2eaf0 32 38 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  284..SELECT ALL 
2eb00 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20  - + cor0.col0 / 
2eb10 2b 20 39 20 46 52 4f 4d 20 74 61 62 31 20 41 53  + 9 FROM tab1 AS
2eb20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d   cor0..----..-7.
2eb30 0a 2d 38 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  .-8..0....query 
2eb40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2eb50 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c  T ALL col2 * col
2eb60 30 20 2a 20 36 32 20 41 53 20 63 6f 6c 31 20 46  0 * 62 AS col1 F
2eb70 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
2eb80 31 31 37 31 38 0d 0a 31 32 35 37 33 36 0d 0a 31  11718..125736..1
2eb90 38 36 31 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  86124....query I
2eba0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ebb0 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   + + col1 + col0
2ebc0 20 2a 20 2b 20 39 33 20 41 53 20 63 6f 6c 32 20   * + 93 AS col2 
2ebd0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2ebe0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 35 0d 0a 35 39  0..----..305..59
2ebf0 36 32 0d 0a 37 34 35 33 0d 0a 0d 0a 71 75 65 72  62..7453....quer
2ec00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ec10 45 43 54 20 31 30 20 2b 20 63 6f 72 30 2e 63 6f  ECT 10 + cor0.co
2ec20 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
2ec30 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2ec40 2d 2d 0d 0a 31 31 0d 0a 34 33 0d 0a 39 32 0d 0a  --..11..43..92..
2ec50 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2ec60 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2ec70 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2ec80 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2ec90 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2eca0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ecb0 43 54 20 31 35 20 2b 20 63 6f 6c 30 20 63 6f 6c  CT 15 + col0 col
2ecc0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
2ecd0 2d 0d 0a 31 30 34 0d 0a 33 39 0d 0a 35 30 0d 0a  -..104..39..50..
2ece0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2ecf0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2ed00 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2ed10 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2ed20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2ed30 38 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  89..SELECT + cor
2ed40 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e  0.col2 DIV cor0.
2ed50 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
2ed60 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61  M tab0, tab1, ta
2ed70 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2ed80 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
2ed90 69 6e 67 20 74 6f 20 65 33 35 36 61 36 62 32 31  ing to e356a6b21
2eda0 37 36 31 32 61 35 34 37 62 36 36 39 66 61 38 30  7612a547b669fa80
2edb0 65 31 35 64 39 62 34 0d 0a 0d 0a 73 6b 69 70 69  e15d9b4....skipi
2edc0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2edd0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2ede0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2edf0 31 32 38 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63  1289..SELECT + c
2ee00 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f 72 30 2e  or0.col2 / cor0.
2ee10 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
2ee20 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61  M tab0, tab1, ta
2ee30 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2ee40 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
2ee50 69 6e 67 20 74 6f 20 65 33 35 36 61 36 62 32 31  ing to e356a6b21
2ee60 37 36 31 32 61 35 34 37 62 36 36 39 66 61 38 30  7612a547b669fa80
2ee70 65 31 35 64 39 62 34 0d 0a 0d 0a 71 75 65 72 79  e15d9b4....query
2ee80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ee90 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
2eea0 6c 31 20 2b 20 2b 20 28 20 63 6f 6c 31 20 29 20  l1 + + ( col1 ) 
2eeb0 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72  * - col2 + - cor
2eec0 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
2eed0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
2eee0 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37 30 0d  48..-1404..-570.
2eef0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2ef00 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2ef10 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2ef20 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2ef30 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2ef40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ef50 45 43 54 20 2b 20 35 33 20 2d 20 2d 20 37 20 63  ECT + 53 - - 7 c
2ef60 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol0 FROM tab1, t
2ef70 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2ef80 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
2ef90 69 6e 67 20 74 6f 20 61 39 37 35 36 31 65 31 37  ing to a97561e17
2efa0 65 63 61 61 36 31 38 32 32 37 63 37 35 61 35 37  ecaa618227c75a57
2efb0 62 32 36 38 66 33 33 0d 0a 0d 0a 71 75 65 72 79  b268f33....query
2efc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2efd0 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20  CT ALL - + col0 
2efe0 2a 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  * + ( + cor0.col
2eff0 32 20 29 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63  2 ) + + col1 + c
2f000 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
2f010 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32   cor0..----..-62
2f020 30 0d 0a 2d 37 31 31 36 0d 0a 31 35 39 0d 0a 0d  0..-7116..159...
2f030 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2f040 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2f050 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2f060 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2f070 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2f080 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 33 0d 0a  ort label-1293..
2f090 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20  SELECT col2 + - 
2f0a0 43 41 53 54 28 20 33 39 20 41 53 20 53 49 47 4e  CAST( 39 AS SIGN
2f0b0 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  ED ) AS col1 FRO
2f0c0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
2f0d0 2d 0d 0a 31 35 0d 0a 31 38 0d 0a 35 37 0d 0a 0d  -..15..18..57...
2f0e0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2f0f0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2f100 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2f110 6c 61 62 65 6c 2d 31 32 39 33 0d 0a 53 45 4c 45  label-1293..SELE
2f120 43 54 20 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54  CT col2 + - CAST
2f130 20 28 20 33 39 20 41 53 20 49 4e 54 45 47 45 52   ( 39 AS INTEGER
2f140 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
2f150 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2f160 0a 31 35 0d 0a 31 38 0d 0a 35 37 0d 0a 0d 0a 71  .15..18..57....q
2f170 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2f180 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72  SELECT ALL - cor
2f190 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e  0.col0 * - cor0.
2f1a0 63 6f 6c 30 20 2d 20 2d 20 38 36 20 41 53 20 63  col0 - - 86 AS c
2f1b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2f1c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31   cor0..----..131
2f1d0 31 0d 0a 36 36 32 0d 0a 38 30 30 37 0d 0a 0d 0a  1..662..8007....
2f1e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f1f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2f200 6c 30 20 2b 20 2b 20 37 31 20 41 53 20 63 6f 6c  l0 + + 71 AS col
2f210 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2f220 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 0d 0a  or0..----..135..
2f230 31 35 31 0d 0a 37 34 0d 0a 0d 0a 71 75 65 72 79  151..74....query
2f240 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f250 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  CT - - cor0.col2
2f260 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   * col1 AS col0 
2f270 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2f280 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32  ----..2838..7462
2f290 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
2f2a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2f2b0 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 32  ALL + col0 * + 2
2f2c0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2f2d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2f2e0 2d 0d 0a 31 39 35 38 0d 0a 35 32 38 0d 0a 37 37  -..1958..528..77
2f2f0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2f300 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2f310 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c   cor0.col0 * col
2f320 30 20 2a 20 38 36 20 2d 20 2d 20 63 6f 6c 31 20  0 * 86 - - col1 
2f330 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2f340 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2f350 0a 33 35 32 32 36 36 0d 0a 35 35 30 34 31 33 0d  .352266..550413.
2f360 0a 38 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .800....skipif p
2f370 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2f380 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2f390 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2f3a0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2f3b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f3c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2f3d0 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 37 33  T cor0.col0 * 73
2f3e0 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   + + col2 * - co
2f3f0 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c 30  l2 * + col0 col0
2f400 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2f410 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 33 38 34  r0..----..-24384
2f420 0d 0a 2d 35 39 31 39 33 39 0d 0a 32 35 32 30 0d  ..-591939..2520.
2f430 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f440 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
2f450 6f 6c 31 20 2a 20 2b 20 39 36 20 41 53 20 63 6f  ol1 * + 96 AS co
2f460 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2f470 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34  cor0..----..-124
2f480 38 0d 0a 2d 32 34 39 36 0d 0a 2d 39 36 30 0d 0a  8..-2496..-960..
2f490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f4a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2f4b0 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  CT - col0 + - co
2f4c0 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30  r0.col0 * - col0
2f4d0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2f4e0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2f4f0 0d 0a 34 30 33 32 0d 0a 36 0d 0a 36 33 32 30 0d  ..4032..6..6320.
2f500 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f510 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2f520 20 63 6f 6c 32 20 2a 20 32 35 20 2d 20 63 6f 6c   col2 * 25 - col
2f530 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2f540 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 37 0d  or0..----..1347.
2f550 0a 31 33 36 31 0d 0a 32 33 32 30 0d 0a 0d 0a 71  .1361..2320....q
2f560 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2f570 53 45 4c 45 43 54 20 28 20 63 6f 6c 31 20 2b 20  SELECT ( col1 + 
2f580 63 6f 6c 30 20 29 20 2a 20 2d 20 38 35 20 46 52  col0 ) * - 85 FR
2f590 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
2f5a0 31 31 36 34 35 0d 0a 2d 33 32 33 30 0d 0a 2d 38  11645..-3230..-8
2f5b0 31 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  160....query I r
2f5c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2f5d0 20 35 34 20 2b 20 2b 20 34 37 20 2a 20 63 6f 6c   54 + + 47 * col
2f5e0 32 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20  2 + tab2.col0 * 
2f5f0 74 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  tab2.col0 FROM t
2f600 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 34 0d  ab2..----..1264.
2f610 0a 37 32 35 32 0d 0a 37 39 37 33 0d 0a 0d 0a 71  .7252..7973....q
2f620 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2f630 53 45 4c 45 43 54 20 38 39 20 2b 20 2d 20 33 36  SELECT 89 + - 36
2f640 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2f650 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 33  r0..----..53..53
2f660 0d 0a 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..53....onlyif m
2f670 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
2f680 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
2f690 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
2f6a0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
2f6b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2f6c0 2d 31 33 30 36 0d 0a 53 45 4c 45 43 54 20 43 41  -1306..SELECT CA
2f6d0 53 54 28 20 2b 20 63 6f 6c 31 20 41 53 20 53 49  ST( + col1 AS SI
2f6e0 47 4e 45 44 20 29 20 2a 20 63 6f 6c 31 20 46 52  GNED ) * col1 FR
2f6f0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab0..----..7
2f700 33 39 36 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d  396..8281..9409.
2f710 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2f720 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2f730 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f740 74 20 6c 61 62 65 6c 2d 31 33 30 36 0d 0a 53 45  t label-1306..SE
2f750 4c 45 43 54 20 43 41 53 54 20 28 20 2b 20 63 6f  LECT CAST ( + co
2f760 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
2f770 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  * col1 FROM tab0
2f780 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32  ..----..7396..82
2f790 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a 71 75 65 72  81..9409....quer
2f7a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2f7b0 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63  ECT - col2 + - c
2f7c0 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63  ol2 - - col0 * c
2f7d0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  or0.col1 AS col1
2f7e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2f7f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a 35  r0..----..-30..5
2f800 32 36 0d 0a 38 34 38 0d 0a 0d 0a 71 75 65 72 79  26..848....query
2f810 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f820 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
2f830 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 31 20  col2 ) * + col1 
2f840 2a 20 2d 20 34 31 20 2b 20 2b 20 34 31 20 46 52  * - 41 + + 41 FR
2f850 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2f860 0a 2d 2d 2d 2d 0d 0a 31 31 36 33 39 39 0d 0a 33  .----..116399..3
2f870 30 35 39 38 33 0d 0a 34 30 31 38 0d 0a 0d 0a 73  05983..4018....s
2f880 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2f890 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2f8a0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2f8b0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2f8c0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2f8d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2f8e0 63 6f 6c 32 20 2a 20 2d 20 35 32 20 2b 20 63 6f  col2 * - 52 + co
2f8f0 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
2f900 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
2f910 33 32 36 0d 0a 2d 31 33 37 37 0d 0a 2d 31 39 33  326..-1377..-193
2f920 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2f930 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d  sort..SELECT ( -
2f940 20 39 33 20 29 20 2a 20 63 6f 6c 32 20 41 53 20   93 ) * col2 AS 
2f950 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2f960 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
2f970 30 36 39 0d 0a 2d 37 36 32 36 0d 0a 2d 39 33 0d  069..-7626..-93.
2f980 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2f990 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2f9a0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2f9b0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2f9c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2f9d0 33 31 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  311..SELECT - co
2f9e0 72 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30  r0.col2 DIV col0
2f9f0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
2fa00 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 30 0d  .----..-3..0..0.
2fa10 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2fa20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2fa30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fa40 74 20 6c 61 62 65 6c 2d 31 33 31 31 0d 0a 53 45  t label-1311..SE
2fa50 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  LECT - cor0.col2
2fa60 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
2fa70 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  2 cor0..----..-3
2fa80 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..0..0....onlyif
2fa90 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2faa0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2fab0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2fac0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2fad0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2fae0 65 6c 2d 31 33 31 32 0d 0a 53 45 4c 45 43 54 20  el-1312..SELECT 
2faf0 44 49 53 54 49 4e 43 54 20 2d 20 36 39 20 2a 20  DISTINCT - 69 * 
2fb00 63 6f 6c 30 20 2f 20 2d 20 43 41 53 54 28 20 4e  col0 / - CAST( N
2fb10 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
2fb20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + - col2 * - col
2fb30 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2fb40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2fb50 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2fb60 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2fb70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fb80 74 20 6c 61 62 65 6c 2d 31 33 31 32 0d 0a 53 45  t label-1312..SE
2fb90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2fba0 36 39 20 2a 20 63 6f 6c 30 20 2f 20 2d 20 43 41  69 * col0 / - CA
2fbb0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
2fbc0 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c 32 20  EGER ) + - col2 
2fbd0 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
2fbe0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2fbf0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
2fc00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2fc10 54 20 44 49 53 54 49 4e 43 54 20 38 39 20 41 53  T DISTINCT 89 AS
2fc20 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c   col1 FROM tab0,
2fc30 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
2fc40 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
2fc50 2d 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -..89....query I
2fc60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2fc70 20 41 4c 4c 20 2d 20 38 35 20 2a 20 63 6f 6c 31   ALL - 85 * col1
2fc80 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2fc90 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
2fca0 37 33 31 30 0d 0a 2d 37 37 33 35 0d 0a 2d 38 32  7310..-7735..-82
2fcb0 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  45....query I ro
2fcc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2fcd0 2d 20 33 37 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  - 37 * col1 FROM
2fce0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2fcf0 2d 2d 2d 0d 0a 2d 33 31 38 32 0d 0a 2d 33 33 36  ---..-3182..-336
2fd00 37 0d 0a 2d 33 35 38 39 0d 0a 0d 0a 6f 6e 6c 79  7..-3589....only
2fd10 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2fd20 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2fd30 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2fd40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fd50 74 20 6c 61 62 65 6c 2d 31 33 31 36 0d 0a 53 45  t label-1316..SE
2fd60 4c 45 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 31  LECT + tab0.col1
2fd70 20 44 49 56 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   DIV col1 + - co
2fd80 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
2fd90 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d  tab0..----..-32.
2fda0 0a 2d 38 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  .-81..0....skipi
2fdb0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2fdc0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2fdd0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2fde0 31 33 31 36 0d 0a 53 45 4c 45 43 54 20 2b 20 74  1316..SELECT + t
2fdf0 61 62 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 31 20  ab0.col1 / col1 
2fe00 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  + - col2 AS col0
2fe10 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2fe20 0d 0a 2d 33 32 0d 0a 2d 38 31 0d 0a 30 0d 0a 0d  ..-32..-81..0...
2fe30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fe40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
2fe50 32 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c  2 + - col0 - col
2fe60 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  0 * + col1 FROM 
2fe70 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 38  tab2..----..-138
2fe80 34 0d 0a 2d 31 39 37 0d 0a 2d 34 36 35 34 0d 0a  4..-197..-4654..
2fe90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fea0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
2feb0 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20 2d 20 63   tab1.col2 + - c
2fec0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
2fed0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33   tab1..----..123
2fee0 35 0d 0a 31 33 37 38 0d 0a 35 36 30 0d 0a 0d 0a  5..1378..560....
2fef0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ff00 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
2ff10 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45  l2 FROM tab1 WHE
2ff20 52 45 20 28 20 4e 55 4c 4c 20 29 20 42 45 54 57  RE ( NULL ) BETW
2ff30 45 45 4e 20 28 20 2b 20 63 6f 6c 32 20 2a 20 63  EEN ( + col2 * c
2ff40 6f 6c 30 20 2f 20 2b 20 63 6f 6c 31 20 29 20 41  ol0 / + col1 ) A
2ff50 4e 44 20 2d 20 63 6f 6c 32 0d 0a 2d 2d 2d 2d 0d  ND - col2..----.
2ff60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2ff70 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
2ff80 6f 6c 32 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c  ol2 + - tab2.col
2ff90 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  2 + col2 * + col
2ffa0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2ffb0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d  ab2..----..1534.
2ffc0 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65  .646..837....que
2ffd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ffe0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2fff0 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f  col2 * col2 * co
30000 6c 30 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  l0 + col1 + - co
30010 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
30020 2d 2d 0d 0a 32 30 37 38 38 39 0d 0a 37 33 37 31  --..207889..7371
30030 39 37 0d 0a 38 37 32 30 0d 0a 0d 0a 73 6b 69 70  97..8720....skip
30040 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
30050 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
30060 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
30070 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
30080 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
30090 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
300a0 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63  TINCT - col2 * c
300b0 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
300c0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d  b2..----..-1534.
300d0 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 6f  .-646..-837....o
300e0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
300f0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
30100 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
30110 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
30120 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 33 0d  sort label-1323.
30130 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 44 49 56  .SELECT col1 DIV
30140 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b 20 2b   col0 + col0 + +
30150 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
30160 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
30170 31 33 0d 0a 31 33 34 0d 0a 31 38 31 0d 0a 0d 0a  13..134..181....
30180 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
30190 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
301a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
301b0 61 62 65 6c 2d 31 33 32 33 0d 0a 53 45 4c 45 43  abel-1323..SELEC
301c0 54 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 2b 20  T col1 / col0 + 
301d0 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 41 53  col0 + + col1 AS
301e0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
301f0 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31 33 34 0d  .----..113..134.
30200 0a 31 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .181....onlyif m
30210 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
30220 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
30230 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
30240 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
30250 62 65 6c 2d 31 33 32 34 0d 0a 53 45 4c 45 43 54  bel-1324..SELECT
30260 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30   + col2 DIV col0
30270 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
30280 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
30290 0a 31 0d 0a 33 34 0d 0a 38 32 0d 0a 0d 0a 73 6b  .1..34..82....sk
302a0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
302b0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
302c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
302d0 65 6c 2d 31 33 32 34 0d 0a 53 45 4c 45 43 54 20  el-1324..SELECT 
302e0 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 2b 20  + col2 / col0 + 
302f0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
30300 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab0..----..1.
30310 0a 33 34 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79  .34..82....query
30320 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30330 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20  CT ALL col0 * + 
30340 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31  tab2.col1 * col1
30350 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
30360 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38 33 31 0d  b2..----..22831.
30370 0a 32 37 31 35 31 38 0d 0a 36 37 32 37 0d 0a 0d  .271518..6727...
30380 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30390 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62  ..SELECT ALL tab
303a0 31 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  1.col1 * - col2 
303b0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
303c0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a  1..----..-1248..
303d0 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71  -1404..-570....q
303e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
303f0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
30400 30 20 2f 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20  0 / col1 - col1 
30410 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20  FROM tab1 WHERE 
30420 4e 55 4c 4c 20 49 4e 20 28 20 2b 20 63 6f 6c 32  NULL IN ( + col2
30430 20 2a 20 2d 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d   * - col2 )..---
30440 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  -....onlyif mysq
30450 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
30460 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
30470 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
30480 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30490 2d 31 33 32 38 0d 0a 53 45 4c 45 43 54 20 2b 20  -1328..SELECT + 
304a0 63 6f 6c 31 20 44 49 56 20 2b 20 74 61 62 30 2e  col1 DIV + tab0.
304b0 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col1 + col0 FROM
304c0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d   tab0..----..25.
304d0 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69  .36..90....skipi
304e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
304f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
30500 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
30510 31 33 32 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63  1328..SELECT + c
30520 6f 6c 31 20 2f 20 2b 20 74 61 62 30 2e 63 6f 6c  ol1 / + tab0.col
30530 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 + col0 FROM ta
30540 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 36  b0..----..25..36
30550 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..90....query I 
30560 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30570 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20  ALL tab2.col2 * 
30580 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52  - col2 * col1 FR
30590 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
305a0 32 32 35 39 39 0d 0a 2d 32 34 35 34 38 0d 0a 2d  22599..-24548..-
305b0 33 39 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  39884....query I
305c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
305d0 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   ALL col2 * col1
305e0 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 46   * - tab0.col2 F
305f0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
30600 2d 36 31 31 38 38 34 0d 0a 2d 39 33 36 35 34 0d  -611884..-93654.
30610 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-97....skipif p
30620 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
30630 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
30640 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
30650 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
30660 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30670 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
30680 54 20 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f  T col0 + tab1.co
30690 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 30  l2 * - col0 col0
306a0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
306b0 0d 0a 2d 31 35 39 0d 0a 2d 33 35 38 34 0d 0a 2d  ..-159..-3584..-
306c0 37 36 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7600....query I 
306d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
306e0 44 49 53 54 49 4e 43 54 20 2b 20 33 39 20 2a 20  DISTINCT + 39 * 
306f0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  - cor0.col2 AS c
30700 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
30710 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
30720 38 37 0d 0a 2d 33 31 39 38 0d 0a 2d 33 39 0d 0a  87..-3198..-39..
30730 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30740 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
30750 2b 20 35 34 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 54 AS col0 FRO
30760 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
30770 2d 0d 0a 2d 35 34 0d 0a 2d 35 34 0d 0a 2d 35 34  -..-54..-54..-54
30780 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30790 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
307a0 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  INCT - cor0.col0
307b0 20 2d 20 2d 20 39 36 20 46 52 4f 4d 20 74 61 62   - - 96 FROM tab
307c0 31 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  1, tab2 cor0..--
307d0 2d 2d 0d 0a 31 37 0d 0a 31 38 0d 0a 38 39 0d 0a  --..17..18..89..
307e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
307f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  t..SELECT - cor0
30800 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a  .col2 + + col2 *
30810 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 28 20 63 6f   + col0 + + ( co
30820 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l0 ) AS col2 FRO
30830 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
30840 2d 2d 2d 2d 0d 0a 36 39 0d 0a 37 33 30 35 0d 0a  ----..69..7305..
30850 37 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  783....query I r
30860 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
30870 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b  LL col2 * col2 +
30880 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f   + ( col1 ) + co
30890 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  r0.col2 AS col0 
308a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
308b0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 39 39 0d 0a 37  0..----..1499..7
308c0 36 31 0d 0a 37 38 37 0d 0a 0d 0a 6f 6e 6c 79 69  61..787....onlyi
308d0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
308e0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
308f0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
30900 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30910 20 6c 61 62 65 6c 2d 31 33 33 37 0d 0a 53 45 4c   label-1337..SEL
30920 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
30930 30 20 2a 20 63 6f 6c 31 20 44 49 56 20 2b 20 63  0 * col1 DIV + c
30940 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
30950 2d 2d 2d 0d 0a 33 33 39 35 0d 0a 36 32 0d 0a 39  ---..3395..62..9
30960 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
30970 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
30980 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
30990 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 37 0d 0a  ort label-1337..
309a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
309b0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2f 20 2b 20  col0 * col1 / + 
309c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
309d0 2d 2d 2d 2d 0d 0a 33 33 39 35 0d 0a 36 32 0d 0a  ----..3395..62..
309e0 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
309f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
30a00 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f  STINCT col1 * co
30a10 6c 30 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2b  l0 + tab2.col0 +
30a20 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20   col2 * col1 AS 
30a30 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
30a40 2d 2d 2d 2d 0d 0a 31 30 36 31 0d 0a 32 30 36 38  ----..1061..2068
30a50 0d 0a 36 32 31 34 0d 0a 0d 0a 71 75 65 72 79 20  ..6214....query 
30a60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30a70 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 63  T ALL - col0 + c
30a80 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63  ol1 * col2 + - c
30a90 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol2 * col2 AS co
30aa0 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
30ab0 2d 2d 0d 0a 2d 31 35 31 35 0d 0a 2d 32 37 34 33  --..-1515..-2743
30ac0 0d 0a 2d 38 30 34 38 0d 0a 0d 0a 71 75 65 72 79  ..-8048....query
30ad0 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
30ae0 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20  LECT ALL * FROM 
30af0 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20 63  tab0 WHERE NOT c
30b00 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  ol2 + col0 * - c
30b10 6f 6c 31 20 2b 20 63 6f 6c 30 20 4e 4f 54 20 42  ol1 + col0 NOT B
30b20 45 54 57 45 45 4e 20 2d 20 63 6f 6c 31 20 2a 20  ETWEEN - col1 * 
30b30 2b 20 63 6f 6c 32 20 41 4e 44 20 4e 55 4c 4c 0d  + col2 AND NULL.
30b40 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
30b50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30b60 20 44 49 53 54 49 4e 43 54 20 2d 20 37 31 20 46   DISTINCT - 71 F
30b70 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
30b80 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31 0d 0a 0d 0a 6f  ..----..-71....o
30b90 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
30ba0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
30bb0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
30bc0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
30bd0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34 32 0d  sort label-1342.
30be0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
30bf0 20 2a 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f   * - col0 DIV co
30c00 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
30c10 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d  tab1..----..-10.
30c20 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 73 6b 69  .-13..-26....ski
30c30 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
30c40 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
30c50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
30c60 6c 2d 31 33 34 32 0d 0a 53 45 4c 45 43 54 20 41  l-1342..SELECT A
30c70 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30  LL col1 * - col0
30c80 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   / col0 AS col1 
30c90 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
30ca0 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a  .-10..-13..-26..
30cb0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
30cc0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
30cd0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
30ce0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
30cf0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
30d00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30d10 43 54 20 41 4c 4c 20 2b 20 74 61 62 32 2e 63 6f  CT ALL + tab2.co
30d20 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32  l1 + col1 + col2
30d30 20 2a 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f   * col0 col1 FRO
30d40 4d 20 74 61 62 32 20 57 48 45 52 45 20 63 6f 6c  M tab2 WHERE col
30d50 31 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20  1 + col0 - col2 
30d60 2a 20 63 6f 6c 31 20 3e 20 4e 55 4c 4c 0d 0a 2d  * col1 > NULL..-
30d70 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
30d80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
30d90 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  LL - col0 + - co
30da0 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
30db0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
30dc0 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d 39 36 0d  .-137..-38..-96.
30dd0 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
30de0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
30df0 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  TINCT * FROM tab
30e00 30 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20  0 AS cor0 WHERE 
30e10 4e 4f 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  NOT - col2 + col
30e20 32 20 49 4e 20 28 20 63 6f 6c 32 20 2a 20 2b 20  2 IN ( col2 * + 
30e30 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 39 20  col2 )..----..9 
30e40 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
30e50 6f 20 33 38 61 31 36 37 33 65 32 65 30 39 64 36  o 38a1673e2e09d6
30e60 39 34 63 38 63 65 63 34 35 63 37 39 37 30 33 34  94c8cec45c797034
30e70 61 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  a7....query I ro
30e80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
30e90 6c 30 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30  l0 * + tab1.col0
30ea0 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
30eb0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
30ec0 0a 32 36 32 31 34 34 0d 0a 32 37 0d 0a 35 31 32  .262144..27..512
30ed0 30 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  000....query I r
30ee0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
30ef0 4c 4c 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2b  LL + tab0.col1 +
30f00 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
30f10 57 48 45 52 45 20 4e 4f 54 20 28 20 4e 55 4c 4c  WHERE NOT ( NULL
30f20 20 29 20 3e 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d   ) >= NULL..----
30f30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30f40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
30f50 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45   FROM tab0 WHERE
30f60 20 28 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   ( col1 * + col2
30f70 20 29 20 4e 4f 54 20 42 45 54 57 45 45 4e 20 2b   ) NOT BETWEEN +
30f80 20 63 6f 6c 32 20 41 4e 44 20 4e 55 4c 4c 0d 0a   col2 AND NULL..
30f90 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
30fa0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30fb0 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 41 53  DISTINCT col1 AS
30fc0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
30fd0 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20  WHERE NULL IN ( 
30fe0 2d 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a  - col1 )..----..
30ff0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31000 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
31010 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2b  CT + tab0.col2 +
31020 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f   col0 * col2 FRO
31030 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36  M tab0..----..36
31040 0d 0a 37 33 38 30 0d 0a 38 32 35 0d 0a 0d 0a 73  ..7380..825....s
31050 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
31060 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
31070 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
31080 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
31090 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
310a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
310b0 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  + col2 + + col2 
310c0 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  + + col2 col2 FR
310d0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
310e0 34 36 0d 0a 33 0d 0a 39 39 0d 0a 0d 0a 71 75 65  46..3..99....que
310f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31100 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  LECT + col0 + - 
31110 63 6f 6c 32 20 2a 20 2d 20 74 61 62 32 2e 63 6f  col2 * - tab2.co
31120 6c 31 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 31  l1 * + tab2.col1
31130 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
31140 62 32 20 57 48 45 52 45 20 4e 4f 54 20 28 20 4e  b2 WHERE NOT ( N
31150 55 4c 4c 20 29 20 4e 4f 54 20 49 4e 20 28 20 63  ULL ) NOT IN ( c
31160 6f 6c 32 20 2a 20 63 6f 6c 31 20 29 0d 0a 2d 2d  ol2 * col1 )..--
31170 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  --....query III 
31180 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31190 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  ALL * FROM tab0 
311a0 57 48 45 52 45 20 28 20 4e 55 4c 4c 20 29 20 49  WHERE ( NULL ) I
311b0 4e 20 28 20 2d 20 63 6f 6c 32 20 29 0d 0a 2d 2d  N ( - col2 )..--
311c0 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
311d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
311e0 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63 6f 6c 31  col0 + tab2.col1
311f0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
31200 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d  b2..----..-19..-
31210 36 32 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20  62..24....query 
31220 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31230 54 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2d 20  T + tab0.col2 - 
31240 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
31250 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  M tab0..----..-5
31260 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e  3..-9..-96....on
31270 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
31280 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
31290 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
312a0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
312b0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35 36 0d 0a  ort label-1356..
312c0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
312d0 44 49 56 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c  DIV col0 - - col
312e0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
312f0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31  ab1..----..11..1
31300 34 0d 0a 32 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..27....skipif 
31310 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
31320 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
31330 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
31340 35 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  56..SELECT ALL c
31350 6f 6c 30 20 2f 20 63 6f 6c 30 20 2d 20 2d 20 63  ol0 / col0 - - c
31360 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
31370 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d   tab1..----..11.
31380 0a 31 34 0d 0a 32 37 0d 0a 0d 0a 6f 6e 6c 79 69  .14..27....onlyi
31390 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
313a0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
313b0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
313c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
313d0 20 6c 61 62 65 6c 2d 31 33 35 37 0d 0a 53 45 4c   label-1357..SEL
313e0 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 74 61 62  ECT + col0 + tab
313f0 30 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30 20  0.col0 - - col0 
31400 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  DIV col0 FROM ta
31410 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 39 0d 0a 34  b0..----..179..4
31420 39 0d 0a 37 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  9..71....skipif 
31430 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
31440 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
31450 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
31460 35 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  57..SELECT + col
31470 30 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2d 20  0 + tab0.col0 - 
31480 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 46 52  - col0 / col0 FR
31490 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
314a0 37 39 0d 0a 34 39 0d 0a 37 31 0d 0a 0d 0a 71 75  79..49..71....qu
314b0 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
314c0 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
314d0 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 28 20  ab2 WHERE NOT ( 
314e0 4e 55 4c 4c 20 29 20 3e 20 63 6f 6c 31 0d 0a 2d  NULL ) > col1..-
314f0 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
31500 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
31510 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29   + ( cor0.col1 )
31520 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
31530 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39  .----..86..91..9
31540 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
31550 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 31 20  sort..SELECT 41 
31560 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
31570 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
31580 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 39 35 0d  ..----..137..95.
31590 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .98....query I r
315a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
315b0 49 53 54 49 4e 43 54 20 2b 20 37 20 2a 20 2d 20  ISTINCT + 7 * - 
315c0 36 39 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  69 + col2 AS col
315d0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
315e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 35 0d  or0..----..-445.
315f0 0a 2d 34 35 36 0d 0a 2d 34 35 37 0d 0a 0d 0a 71  .-456..-457....q
31600 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31610 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31620 2b 20 35 36 20 2b 20 28 20 63 6f 6c 32 20 29 20  + 56 + ( col2 ) 
31630 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  + + col0 AS col0
31640 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
31650 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 32 32 37 0d  .----..113..227.
31660 0a 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .92....onlyif my
31670 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
31680 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
31690 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
316a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
316b0 65 6c 2d 31 33 36 33 0d 0a 53 45 4c 45 43 54 20  el-1363..SELECT 
316c0 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ALL + tab1.col0 
316d0 44 49 56 20 2d 20 37 34 20 41 53 20 63 6f 6c 31  DIV - 74 AS col1
316e0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
316f0 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  ..-1..0..0....sk
31700 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
31710 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
31720 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
31730 65 6c 2d 31 33 36 33 0d 0a 53 45 4c 45 43 54 20  el-1363..SELECT 
31740 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ALL + tab1.col0 
31750 2f 20 2d 20 37 34 20 41 53 20 63 6f 6c 31 20 46  / - 74 AS col1 F
31760 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
31770 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  -1..0..0....quer
31780 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31790 45 43 54 20 41 4c 4c 20 34 31 20 2a 20 2d 20 63  ECT ALL 41 * - c
317a0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  or0.col1 AS col1
317b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
317c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 36 0d  r0..----..-1066.
317d0 0a 2d 34 31 30 0d 0a 2d 35 33 33 0d 0a 0d 0a 71  .-410..-533....q
317e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
317f0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72  SELECT ALL - cor
31800 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  0.col0 + - col2 
31810 2a 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  * - col0 * + col
31820 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
31830 0d 0a 2d 2d 2d 2d 0d 0a 33 33 36 30 0d 0a 36 36  ..----..3360..66
31840 34 30 32 39 0d 0a 36 38 30 38 38 0d 0a 0d 0a 73  4029..68088....s
31850 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
31860 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
31870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31880 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28  ELECT ALL CAST (
31890 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29 20   col2 AS REAL ) 
318a0 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  + + col1 AS col0
318b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
318c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36  r0..----..109..6
318d0 37 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  7..80....query I
318e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
318f0 20 41 4c 4c 20 2d 20 28 20 2d 20 74 61 62 30 2e   ALL - ( - tab0.
31900 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 29 20  col0 * + col0 ) 
31910 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
31920 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35  0..----..1225..5
31930 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a 71 75 65 72  76..7921....quer
31940 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31950 45 43 54 20 38 39 20 41 53 20 63 6f 6c 31 20 46  ECT 89 AS col1 F
31960 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20  ROM tab1, tab0, 
31970 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
31980 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
31990 73 68 69 6e 67 20 74 6f 20 38 36 30 64 35 35 65  shing to 860d55e
319a0 62 36 37 38 35 39 37 32 34 36 37 32 31 38 61 39  b6785972467218a9
319b0 63 33 62 61 64 62 35 61 64 0d 0a 0d 0a 71 75 65  c3badb5ad....que
319c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
319d0 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  LECT col2 * + co
319e0 6c 31 20 2a 20 2b 20 33 31 20 41 53 20 63 6f 6c  l1 * + 31 AS col
319f0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
31a00 2d 0d 0a 32 30 30 32 36 0d 0a 32 35 39 34 37 0d  -..20026..25947.
31a10 0a 34 37 35 35 34 0d 0a 0d 0a 71 75 65 72 79 20  .47554....query 
31a20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31a30 54 20 44 49 53 54 49 4e 43 54 20 36 33 20 2b 20  T DISTINCT 63 + 
31a40 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
31a50 0d 0a 2d 2d 2d 2d 0d 0a 31 34 39 0d 0a 31 35 34  ..----..149..154
31a60 0d 0a 31 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..160....query I
31a70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31a80 20 2d 20 36 20 41 53 20 63 6f 6c 32 20 46 52 4f   - 6 AS col2 FRO
31a90 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61  M tab1, tab0, ta
31aa0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
31ab0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
31ac0 69 6e 67 20 74 6f 20 38 62 65 38 39 31 30 35 30  ing to 8be891050
31ad0 37 39 30 38 65 36 33 35 33 64 30 32 61 35 34 35  7908e6353d02a545
31ae0 62 37 34 38 32 35 32 0d 0a 0d 0a 71 75 65 72 79  b748252....query
31af0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31b00 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32  CT col0 * + col2
31b10 20 2b 20 28 20 2b 20 39 37 20 29 20 46 52 4f 4d   + ( + 97 ) FROM
31b20 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
31b30 0d 0a 32 31 32 35 0d 0a 32 38 36 0d 0a 33 30 39  ..2125..286..309
31b40 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
31b50 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
31b60 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
31b70 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
31b80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
31b90 2d 31 33 37 33 0d 0a 53 45 4c 45 43 54 20 44 49  -1373..SELECT DI
31ba0 53 54 49 4e 43 54 20 63 6f 6c 30 20 44 49 56 20  STINCT col0 DIV 
31bb0 2b 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e  + col0 + - tab1.
31bc0 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 2d 20  col0 * col0 * - 
31bd0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
31be0 2d 2d 2d 2d 0d 0a 32 33 33 34 37 33 0d 0a 34 38  ----..233473..48
31bf0 37 0d 0a 36 31 34 34 30 31 0d 0a 0d 0a 73 6b 69  7..614401....ski
31c00 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
31c10 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
31c20 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
31c30 6c 2d 31 33 37 33 0d 0a 53 45 4c 45 43 54 20 44  l-1373..SELECT D
31c40 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2f 20 2b  ISTINCT col0 / +
31c50 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e 63   col0 + - tab1.c
31c60 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63  ol0 * col0 * - c
31c70 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
31c80 2d 2d 2d 0d 0a 32 33 33 34 37 33 0d 0a 34 38 37  ---..233473..487
31c90 0d 0a 36 31 34 34 30 31 0d 0a 0d 0a 73 6b 69 70  ..614401....skip
31ca0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
31cb0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
31cc0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
31cd0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
31ce0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
31cf0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 37 20  sort..SELECT 67 
31d00 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  + col1 + - col1 
31d10 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
31d20 2d 2d 2d 2d 0d 0a 36 37 0d 0a 36 37 0d 0a 36 37  ----..67..67..67
31d30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
31d40 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
31d50 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
31d60 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
31d70 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
31d80 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37  owsort label-137
31d90 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  5..SELECT ALL - 
31da0 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 63 6f 6c  col1 * CAST( col
31db0 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  2 AS SIGNED ) AS
31dc0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
31dd0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
31de0 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37  1248..-1404..-57
31df0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
31e00 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
31e10 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
31e20 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 35 0d 0a  ort label-1375..
31e30 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
31e40 31 20 2a 20 43 41 53 54 20 28 20 63 6f 6c 32 20  1 * CAST ( col2 
31e50 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
31e60 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
31e70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
31e80 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37 30  248..-1404..-570
31e90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31ea0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
31eb0 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  INCT + col2 + + 
31ec0 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63  col2 * col1 AS c
31ed0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
31ee0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 34 0d 0a  r0..----..1344..
31ef0 31 34 35 38 0d 0a 36 32 37 0d 0a 0d 0a 71 75 65  1458..627....que
31f00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31f10 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c  LECT ALL - + col
31f20 32 20 2b 20 2b 20 39 37 20 41 53 20 63 6f 6c 31  2 + + 97 AS col1
31f30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
31f40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 39 0d 0a 37 30  r0..----..59..70
31f50 0d 0a 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..71....query I 
31f60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31f70 63 6f 6c 32 20 2a 20 28 20 63 6f 72 30 2e 63 6f  col2 * ( cor0.co
31f80 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63  l0 ) FROM tab0 c
31f90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37  or0..----..35..7
31fa0 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72  298..792....quer
31fb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31fc0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
31fd0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b  ol2 * + col0 + +
31fe0 20 32 35 20 46 52 4f 4d 20 74 61 62 30 20 41 53   25 FROM tab0 AS
31ff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
32000 0d 0a 2d 37 32 37 33 0d 0a 2d 37 36 37 0d 0a 0d  ..-7273..-767...
32010 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
32020 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
32030 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
32040 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
32050 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
32060 6f 72 74 20 6c 61 62 65 6c 2d 31 33 38 30 0d 0a  ort label-1380..
32070 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
32080 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  * + CAST( NULL A
32090 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
320a0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
320b0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
320c0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
320d0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
320e0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
320f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 38  owsort label-138
32100 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  0..SELECT ALL co
32110 6c 31 20 2a 20 2b 20 43 41 53 54 20 28 20 4e 55  l1 * + CAST ( NU
32120 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
32130 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
32140 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
32150 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ULL..NULL....onl
32160 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
32170 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
32180 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
32190 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
321a0 72 74 20 6c 61 62 65 6c 2d 31 33 38 31 0d 0a 53  rt label-1381..S
321b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
321c0 6f 6c 31 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b  ol1 + col2 DIV +
321d0 20 39 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   93 AS col1 FROM
321e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
321f0 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d  ---..86..91..97.
32200 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
32210 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
32220 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32230 74 20 6c 61 62 65 6c 2d 31 33 38 31 0d 0a 53 45  t label-1381..SE
32240 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
32250 6c 31 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 39 33  l1 + col2 / + 93
32260 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
32270 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
32280 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a  ..86..91..97....
32290 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
322a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
322b0 6c 32 20 2b 20 2d 20 38 30 20 41 53 20 63 6f 6c  l2 + - 80 AS col
322c0 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
322d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37 0d 0a 2d 37 39  ..----..-47..-79
322e0 0d 0a 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..2....onlyif my
322f0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
32300 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
32310 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
32320 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
32330 65 6c 2d 31 33 38 33 0d 0a 53 45 4c 45 43 54 20  el-1383..SELECT 
32340 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 43 41 53  + - col0 DIV CAS
32350 54 28 20 2d 20 63 6f 6c 32 20 41 53 20 53 49 47  T( - col2 AS SIG
32360 4e 45 44 20 29 20 2b 20 63 6f 6c 31 20 63 6f 6c  NED ) + col1 col
32370 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
32380 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a  or0..----..132..
32390 38 36 0d 0a 39 32 0d 0a 0d 0a 73 6b 69 70 69 66  86..92....skipif
323a0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
323b0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
323c0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
323d0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
323e0 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
323f0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
32400 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32410 74 20 6c 61 62 65 6c 2d 31 33 38 33 0d 0a 53 45  t label-1383..SE
32420 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2f 20  LECT + - col0 / 
32430 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 41 53  CAST ( - col2 AS
32440 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c   INTEGER ) + col
32450 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  1 col0 FROM tab0
32460 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32470 31 33 32 0d 0a 38 36 0d 0a 39 32 0d 0a 0d 0a 71  132..86..92....q
32480 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32490 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
324a0 6c 32 20 2a 20 2b 20 33 33 20 46 52 4f 4d 20 74  l2 * + 33 FROM t
324b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
324c0 2d 0d 0a 31 37 38 32 0d 0a 31 38 38 31 0d 0a 33  -..1782..1881..3
324d0 31 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  168....query I r
324e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
324f0 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30  ISTINCT - - col0
32500 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20   * + ( - col1 ) 
32510 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  + - col2 AS col1
32520 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
32530 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 36 0d 0a 2d 31  .----..-1136..-1
32540 33 32 0d 0a 2d 36 39 37 0d 0a 0d 0a 71 75 65 72  32..-697....quer
32550 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32560 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ECT + cor0.col1 
32570 2a 20 2d 20 32 30 20 41 53 20 63 6f 6c 32 20 46  * - 20 AS col2 F
32580 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
32590 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32 30 0d 0a 2d  ..----..-1720..-
325a0 31 38 32 30 0d 0a 2d 31 39 34 30 0d 0a 0d 0a 71  1820..-1940....q
325b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
325c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
325d0 2d 20 63 6f 6c 32 20 2a 20 33 36 20 41 53 20 63  - col2 * 36 AS c
325e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
325f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
32600 38 38 0d 0a 2d 32 39 35 32 0d 0a 2d 33 36 0d 0a  88..-2952..-36..
32610 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32620 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
32630 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 28 20 2d 20  r0.col2 * + ( - 
32640 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46  col1 ) AS col0 F
32650 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
32660 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d  ..----..-1534..-
32670 36 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 6f 6e 6c  646..-837....onl
32680 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
32690 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
326a0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
326b0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
326c0 72 74 20 6c 61 62 65 6c 2d 31 33 38 39 0d 0a 53  rt label-1389..S
326d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
326e0 20 63 6f 6c 30 20 44 49 56 20 2d 20 28 20 63 6f   col0 DIV - ( co
326f0 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74  r0.col2 ) FROM t
32700 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
32710 2d 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -..-1..0....skip
32720 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
32730 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
32740 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
32750 2d 31 33 38 39 0d 0a 53 45 4c 45 43 54 20 44 49  -1389..SELECT DI
32760 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2f 20  STINCT + col0 / 
32770 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  - ( cor0.col2 ) 
32780 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
32790 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a  0..----..-1..0..
327a0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
327b0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
327c0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
327d0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
327e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
327f0 39 30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  90..SELECT col2 
32800 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20  + cor0.col2 * - 
32810 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 46 52  col1 DIV col1 FR
32820 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
32830 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
32840 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
32850 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
32860 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32870 20 6c 61 62 65 6c 2d 31 33 39 30 0d 0a 53 45 4c   label-1390..SEL
32880 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e  ECT col2 + cor0.
32890 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2f 20  col2 * - col1 / 
328a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
328b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
328c0 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
328d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
328e0 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20 37 34   ALL col2 * - 74
328f0 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
32900 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
32910 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 36 35  or0..----..-1865
32920 0d 0a 2d 31 39 36 37 0d 0a 2d 32 37 39 35 0d 0a  ..-1967..-2795..
32930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32940 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
32950 43 54 20 2b 20 37 30 20 41 53 20 63 6f 6c 30 20  CT + 70 AS col0 
32960 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
32970 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .70....query I r
32980 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
32990 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
329a0 20 2b 20 28 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   + ( col1 + + co
329b0 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  l1 ) FROM tab2..
329c0 2d 2d 2d 2d 0d 0a 2d 32 36 38 36 0d 0a 2d 34 33  ----..-2686..-43
329d0 34 0d 0a 2d 39 32 30 34 0d 0a 0d 0a 71 75 65 72  4..-9204....quer
329e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
329f0 45 43 54 20 2d 20 28 20 36 20 2b 20 2b 20 63 6f  ECT - ( 6 + + co
32a00 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  l2 ) FROM tab2..
32a10 2d 2d 2d 2d 0d 0a 2d 33 32 0d 0a 2d 33 33 0d 0a  ----..-32..-33..
32a20 2d 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -44....query I r
32a30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39  owsort..SELECT 9
32a40 37 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  7 * col0 FROM ta
32a50 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  b2 cor0..----..6
32a60 37 39 0d 0a 37 35 36 36 0d 0a 37 36 36 33 0d 0a  79..7566..7663..
32a70 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
32a80 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
32a90 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
32aa0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
32ab0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
32ac0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32ad0 43 54 20 34 34 20 63 6f 6c 32 20 46 52 4f 4d 20  CT 44 col2 FROM 
32ae0 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f  tab1, tab2 AS co
32af0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
32b00 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 62  es hashing to ab
32b10 32 62 63 32 62 39 66 38 62 61 61 33 30 30 64 66  2bc2b9f8baa300df
32b20 37 37 35 35 65 35 39 38 30 61 33 31 39 64 0d 0a  7755e5980a319d..
32b30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32b40 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20  t..SELECT - ( + 
32b50 63 6f 72 30 2e 63 6f 6c 31 20 29 20 41 53 20 63  cor0.col1 ) AS c
32b60 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
32b70 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
32b80 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
32b90 20 74 6f 20 63 63 61 61 35 64 64 33 33 38 38 64   to ccaa5dd3388d
32ba0 39 65 65 30 66 65 61 36 37 36 66 61 33 35 32 39  9ee0fea676fa3529
32bb0 39 66 65 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9fe5....query I 
32bc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32bd0 38 39 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  89 * - cor0.col0
32be0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
32bf0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 33 0d 0a  r0..----..-623..
32c00 2d 36 39 34 32 0d 0a 2d 37 30 33 31 0d 0a 0d 0a  -6942..-7031....
32c10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32c20 0a 53 45 4c 45 43 54 20 2d 20 32 33 20 2a 20 2d  .SELECT - 23 * -
32c30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
32c40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
32c50 38 38 36 0d 0a 32 33 0d 0a 37 35 39 0d 0a 0d 0a  886..23..759....
32c60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32c70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
32c80 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   - col1 + + col1
32c90 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
32ca0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  2 cor0..----..14
32cb0 37 35 0d 0a 36 32 39 0d 0a 38 30 36 0d 0a 0d 0a  75..629..806....
32cc0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
32cd0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
32ce0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
32cf0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
32d00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30 31  wsort label-1401
32d10 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
32d20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 32 20  col1 DIV + col2 
32d30 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
32d40 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
32d50 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
32d60 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
32d70 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
32d80 72 74 20 6c 61 62 65 6c 2d 31 34 30 31 0d 0a 53  rt label-1401..S
32d90 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
32da0 31 20 2f 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  1 / + col2 FROM 
32db0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
32dc0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
32dd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32de0 53 45 4c 45 43 54 20 2d 20 2d 20 37 33 20 2b 20  SELECT - - 73 + 
32df0 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  + col0 * - col2 
32e00 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
32e10 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
32e20 0a 2d 31 31 36 0d 0a 2d 31 39 35 35 0d 0a 2d 32  .-116..-1955..-2
32e30 39 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  929....onlyif my
32e40 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
32e50 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
32e60 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
32e70 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
32e80 65 6c 2d 31 34 30 33 0d 0a 53 45 4c 45 43 54 20  el-1403..SELECT 
32e90 28 20 2d 20 63 6f 6c 30 20 29 20 44 49 56 20 2b  ( - col0 ) DIV +
32ea0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
32eb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
32ec0 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69  1..-1..-1....ski
32ed0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
32ee0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
32ef0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
32f00 6c 2d 31 34 30 33 0d 0a 53 45 4c 45 43 54 20 28  l-1403..SELECT (
32f10 20 2d 20 63 6f 6c 30 20 29 20 2f 20 2b 20 63 6f   - col0 ) / + co
32f20 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
32f30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
32f40 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66  -1..-1....skipif
32f50 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
32f60 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
32f70 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
32f80 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
32f90 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
32fa0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
32fb0 20 32 35 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   25 col2 FROM ta
32fc0 62 30 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  b0, tab0 cor0..-
32fd0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
32fe0 73 68 69 6e 67 20 74 6f 20 34 30 61 63 38 66 64  shing to 40ac8fd
32ff0 30 30 30 62 32 65 34 39 33 31 37 61 65 64 32 34  000b2e49317aed24
33000 31 31 30 37 37 38 33 39 65 0d 0a 0d 0a 73 6b 69  11077839e....ski
33010 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
33020 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
33030 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
33040 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
33050 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
33060 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
33070 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30  tab1.col0 + col0
33080 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   ) col2 FROM tab
33090 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36  1..----..128..16
330a0 30 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..6....query I 
330b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
330c0 41 4c 4c 20 2b 20 37 38 20 2a 20 63 6f 6c 30 20  ALL + 78 * col0 
330d0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
330e0 0a 35 34 36 0d 0a 36 30 38 34 0d 0a 36 31 36 32  .546..6084..6162
330f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
33100 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
33110 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
33120 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
33130 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
33140 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33150 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  LECT + col1 + co
33160 6c 32 20 2a 20 63 6f 6c 30 20 63 6f 6c 30 20 46  l2 * col0 col0 F
33170 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
33180 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 37 33 38  ..----..132..738
33190 39 0d 0a 38 37 38 0d 0a 0d 0a 73 6b 69 70 69 66  9..878....skipif
331a0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
331b0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
331c0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
331d0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
331e0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
331f0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
33200 30 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52  0 + col2 col1 FR
33210 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
33220 2d 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34  --..104..117..34
33230 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33240 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
33250 49 4e 43 54 20 2d 20 34 38 20 2b 20 74 61 62 31  INCT - 48 + tab1
33260 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20  .col1 * col0 AS 
33270 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
33280 2d 2d 2d 2d 0d 0a 33 30 0d 0a 35 39 32 0d 0a 39  ----..30..592..9
33290 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
332a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
332b0 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  L col2 + col2 * 
332c0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
332d0 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 33 37 30  ..----..216..370
332e0 35 0d 0a 37 37 37 36 0d 0a 0d 0a 71 75 65 72 79  5..7776....query
332f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33300 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20  CT DISTINCT + ( 
33310 2d 20 63 6f 6c 32 20 2b 20 2b 20 31 36 20 29 20  - col2 + + 16 ) 
33320 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
33330 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31  2..----..-10..-1
33340 31 0d 0a 2d 32 32 0d 0a 0d 0a 71 75 65 72 79 20  1..-22....query 
33350 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33360 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 36 32 20  T + col0 + + 62 
33370 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
33380 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
33390 0a 31 32 36 0d 0a 31 34 32 0d 0a 36 35 0d 0a 0d  .126..142..65...
333a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
333b0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
333c0 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 37 20 46  * + col0 * + 7 F
333d0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
333e0 2d 34 30 33 32 0d 0a 2d 35 35 34 34 37 0d 0a 2d  -4032..-55447..-
333f0 38 35 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8575....query I 
33400 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33410 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
33420 30 20 2a 20 36 36 20 2b 20 2d 20 63 6f 6c 32 20  0 * 66 + - col2 
33430 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
33440 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 39 0d 0a 2d  0..----..-489..-
33450 35 31 37 34 0d 0a 2d 35 32 35 32 0d 0a 0d 0a 71  5174..-5252....q
33460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33470 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
33480 2b 20 28 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  + ( col1 + - col
33490 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  0 ) FROM tab0 AS
334a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38   cor0..----..148
334b0 0d 0a 31 35 39 0d 0a 39 33 0d 0a 0d 0a 71 75 65  ..159..93....que
334c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
334d0 4c 45 43 54 20 2d 20 2b 20 38 31 20 41 53 20 63  LECT - + 81 AS c
334e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
334f0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
33500 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
33510 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
33520 73 68 69 6e 67 20 74 6f 20 32 30 35 62 33 66 66  shing to 205b3ff
33530 32 64 37 62 31 38 31 37 63 39 38 64 37 39 38 30  2d7b1817c98d7980
33540 62 38 63 31 37 65 36 63 31 0d 0a 0d 0a 71 75 65  b8c17e6c1....que
33550 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33560 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  LECT col1 + - co
33570 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l1 + + col0 FROM
33580 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
33590 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d  ---..24..35..89.
335a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
335b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
335c0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b   col2 * + col1 +
335d0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 41   col0 * - col1 A
335e0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
335f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33600 2d 37 30 0d 0a 31 33 32 36 0d 0a 32 30 38 0d 0a  -70..1326..208..
33610 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33620 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
33630 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   + - col2 * col2
33640 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
33650 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
33660 0a 2d 32 38 36 35 0d 0a 2d 33 32 35 36 0d 0a 2d  .-2865..-3256..-
33670 39 32 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  9200....onlyif m
33680 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
33690 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
336a0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
336b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
336c0 62 65 6c 2d 31 34 32 30 0d 0a 53 45 4c 45 43 54  bel-1420..SELECT
336d0 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 44 49 56 20   ALL - col0 DIV 
336e0 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  col0 - col0 FROM
336f0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
33700 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 33 36 0d 0a 2d  ---..-25..-36..-
33710 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  90....skipif mys
33720 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
33730 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
33740 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32 30 0d  sort label-1420.
33750 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
33760 6c 30 20 2f 20 63 6f 6c 30 20 2d 20 63 6f 6c 30  l0 / col0 - col0
33770 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
33780 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d  r0..----..-25..-
33790 33 36 0d 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72 79  36..-90....query
337a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
337b0 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20  CT ALL + + col1 
337c0 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  * col1 + - col1 
337d0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
337e0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a 36 35  0..----..156..65
337f0 30 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49  0..90....query I
33800 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33810 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 31   ALL + cor0.col1
33820 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
33830 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
33840 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30  or0..----..-1040
33850 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71  ..-640..-78....q
33860 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33870 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f  SELECT col2 * co
33880 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30  r0.col2 + + cor0
33890 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
338a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
338b0 0a 2d 2d 2d 2d 0d 0a 32 39 31 39 0d 0a 33 33 31  .----..2919..331
338c0 33 0d 0a 39 32 39 36 0d 0a 0d 0a 71 75 65 72 79  3..9296....query
338d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
338e0 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20  CT ALL col0 * + 
338f0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col1 + + col1 * 
33900 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
33910 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
33920 31 32 38 30 34 0d 0a 31 36 33 38 30 0d 0a 39 34  12804..16380..94
33930 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
33940 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
33950 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20  STINCT + col0 * 
33960 63 6f 6c 31 20 2b 20 74 61 62 32 2e 63 6f 6c 32  col1 + tab2.col2
33970 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
33980 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d 0a  b2..----..1381..
33990 32 34 34 0d 0a 34 36 32 38 0d 0a 0d 0a 6f 6e 6c  244..4628....onl
339a0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
339b0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
339c0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
339d0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
339e0 72 74 20 6c 61 62 65 6c 2d 31 34 32 36 0d 0a 53  rt label-1426..S
339f0 45 4c 45 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c  ELECT - tab0.col
33a00 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  0 * col0 + col1 
33a10 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  DIV + col1 FROM 
33a20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32  tab0..----..-122
33a30 34 0d 0a 2d 35 37 35 0d 0a 2d 37 39 32 30 0d 0a  4..-575..-7920..
33a40 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
33a50 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
33a60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33a70 20 6c 61 62 65 6c 2d 31 34 32 36 0d 0a 53 45 4c   label-1426..SEL
33a80 45 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20  ECT - tab0.col0 
33a90 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2f 20  * col0 + col1 / 
33aa0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
33ab0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 34 0d 0a 2d  ..----..-1224..-
33ac0 35 37 35 0d 0a 2d 37 39 32 30 0d 0a 0d 0a 71 75  575..-7920....qu
33ad0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33ae0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
33af0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d  ol2 + - col0 * -
33b00 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
33b10 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d 0a 33 33 39  .----..2097..339
33b20 36 0d 0a 38 31 38 31 0d 0a 0d 0a 71 75 65 72 79  6..8181....query
33b30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33b40 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
33b50 6c 31 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  l1 + col2 + col0
33b60 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
33b70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a 31  r0..----..111..1
33b80 36 33 0d 0a 33 31 0d 0a 0d 0a 71 75 65 72 79 20  63..31....query 
33b90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33ba0 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  T - cor0.col0 + 
33bb0 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
33bc0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
33bd0 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a  ---..-137..-38..
33be0 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -96....query I r
33bf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
33c00 6f 6c 31 20 2a 20 63 6f 6c 31 20 2d 20 2b 20 63  ol1 * col1 - + c
33c10 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
33c20 2d 2d 2d 0d 0a 32 35 31 0d 0a 33 34 35 35 0d 0a  ---..251..3455..
33c30 39 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  934....query I r
33c40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
33c50 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 41   + col0 - col0 A
33c60 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
33c70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33c80 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
33c90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33ca0 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  CT - - col1 * co
33cb0 72 30 2e 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 46  r0.col1 - col2 F
33cc0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
33cd0 0d 0a 2d 2d 2d 2d 0d 0a 37 33 36 33 0d 0a 38 31  ..----..7363..81
33ce0 39 39 0d 0a 39 34 30 38 0d 0a 0d 0a 71 75 65 72  99..9408....quer
33cf0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33d00 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ECT col2 * - col
33d10 30 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  0 * col1 + + col
33d20 31 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  1 + col1 AS col1
33d30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
33d40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 35 33  r0..----..-11953
33d50 34 0d 0a 2d 35 31 30 30 30 0d 0a 2d 35 37 39 37  4..-51000..-5797
33d60 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
33d70 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
33d80 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
33d90 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
33da0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
33db0 31 34 33 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1434..SELECT ALL
33dc0 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20 2b   col0 DIV col1 +
33dd0 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20 63   - tab2.col1 + c
33de0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
33df0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
33e00 31 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1..4....skipif m
33e10 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
33e20 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
33e30 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33  owsort label-143
33e40 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  4..SELECT ALL co
33e50 6c 30 20 2f 20 63 6f 6c 31 20 2b 20 2d 20 74 61  l0 / col1 + - ta
33e60 62 32 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41  b2.col1 + col1 A
33e70 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
33e80 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34 0d  ..----..0..1..4.
33e90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33ea0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
33eb0 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 74 61 62  ol0 + col1 * tab
33ec0 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  0.col2 * + col2 
33ed0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
33ee0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 36 31  0..----..132..61
33ef0 31 39 37 33 0d 0a 39 33 36 37 38 0d 0a 0d 0a 71  1973..93678....q
33f00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33f10 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
33f20 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  or0.col2 * col1 
33f30 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
33f40 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a  0..----..-2838..
33f50 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b  -7462..-97....sk
33f60 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
33f70 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
33f80 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
33f90 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
33fa0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
33fb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
33fc0 6f 6c 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 - - cor0.col
33fd0 30 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20  0 * + col1 col2 
33fe0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
33ff0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32  0..----..1381..2
34000 34 34 0d 0a 34 36 32 38 0d 0a 0d 0a 71 75 65 72  44..4628....quer
34010 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34020 45 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20  ECT - cor1.col1 
34030 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
34040 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  1 AS cor0 CROSS 
34050 4a 4f 49 4e 20 74 61 62 30 20 63 6f 72 31 0d 0a  JOIN tab0 cor1..
34060 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
34070 61 73 68 69 6e 67 20 74 6f 20 35 38 65 64 34 36  ashing to 58ed46
34080 37 61 39 61 33 33 32 65 34 64 37 62 66 61 61 39  7a9a332e4d7bfaa9
34090 61 62 64 62 62 64 30 36 33 66 0d 0a 0d 0a 71 75  abdbbd063f....qu
340a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
340b0 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2d 20 63  ELECT + col1 - c
340c0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol2 * + col0 FRO
340d0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
340e0 2d 2d 2d 2d 0d 0a 2d 37 30 36 0d 0a 2d 37 32 30  ----..-706..-720
340f0 37 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  7..62....query I
34100 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34110 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2d   - col2 * col1 -
34120 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46   col1 * - col1 F
34130 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
34140 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 37 0d 0a 31 32  ..----..-357..12
34150 34 0d 0a 31 39 34 37 0d 0a 0d 0a 6f 6e 6c 79 69  4..1947....onlyi
34160 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
34170 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
34180 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
34190 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
341a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
341b0 62 65 6c 2d 31 34 34 31 0d 0a 53 45 4c 45 43 54  bel-1441..SELECT
341c0 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
341d0 6c 32 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c  l2 + + CAST( NUL
341e0 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2a  L AS DECIMAL ) *
341f0 20 2b 20 37 30 20 46 52 4f 4d 20 74 61 62 31 20   + 70 FROM tab1 
34200 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
34210 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
34220 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
34230 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
34240 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34 31  wsort label-1441
34250 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
34260 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 43  T + + col2 + + C
34270 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45  AST ( NULL AS RE
34280 41 4c 20 29 20 2a 20 2b 20 37 30 20 46 52 4f 4d  AL ) * + 70 FROM
34290 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
342a0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
342b0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
342c0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
342d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
342e0 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 43  ECT + - col2 * C
342f0 41 53 54 20 28 20 2b 20 63 6f 6c 31 20 41 53 20  AST ( + col1 AS 
34300 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30  REAL ) FROM tab0
34310 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34320 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39  -2838..-7462..-9
34330 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
34340 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
34350 32 20 2b 20 36 38 20 2a 20 63 6f 6c 32 20 46 52  2 + 68 * col2 FR
34360 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
34370 0a 2d 2d 2d 2d 0d 0a 32 32 37 37 0d 0a 35 36 35  .----..2277..565
34380 38 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49  8..69....query I
34390 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
343a0 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2d 20   ALL - col1 * - 
343b0 63 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c 30  col1 + tab1.col0
343c0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
343d0 0d 0a 31 36 34 0d 0a 32 34 39 0d 0a 36 37 39 0d  ..164..249..679.
343e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
343f0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
34400 2a 20 2b 20 36 32 20 2a 20 2d 20 74 61 62 31 2e  * + 62 * - tab1.
34410 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
34420 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab1..----..-3
34430 35 33 34 30 0d 0a 2d 37 37 33 37 36 0d 0a 2d 38  5340..-77376..-8
34440 37 30 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7048....query I 
34450 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34460 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
34470 63 6f 6c 32 20 2b 20 2b 20 36 37 20 41 53 20 63  col2 + + 67 AS c
34480 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
34490 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d   cor0..----..29.
344a0 0a 34 30 0d 0a 34 31 0d 0a 0d 0a 71 75 65 72 79  .40..41....query
344b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
344c0 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 72 30 2e  CT ALL + + cor0.
344d0 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col0 * col0 FROM
344e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
344f0 2d 2d 2d 0d 0a 34 30 39 36 0d 0a 36 34 30 30 0d  ---..4096..6400.
34500 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .9....query I ro
34510 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
34520 4c 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  L + - col1 + col
34530 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  0 + + col2 * col
34540 32 20 2a 20 2b 20 28 20 2d 20 39 31 20 29 20 46  2 * + ( - 91 ) F
34550 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
34560 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 31 33 34 32 0d  ..----..-131342.
34570 0a 2d 36 31 34 39 37 0d 0a 2d 36 36 33 36 33 0d  .-61497..-66363.
34580 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34590 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
345a0 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  NCT col0 + col1 
345b0 2b 20 2b 20 36 37 20 41 53 20 63 6f 6c 31 20 46  + + 67 AS col1 F
345c0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
345d0 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 36 33 0d 0a 32  ---..105..163..2
345e0 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  04....query I ro
345f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
34600 4c 20 2d 20 63 6f 6c 30 20 2a 20 32 20 41 53 20  L - col0 * 2 AS 
34610 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
34620 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
34630 37 38 0d 0a 2d 34 38 0d 0a 2d 37 30 0d 0a 0d 0a  78..-48..-70....
34640 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
34650 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
34660 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
34670 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
34680 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
34690 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
346a0 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
346b0 6c 30 20 2a 20 37 33 20 63 6f 6c 31 20 46 52 4f  l0 * 73 col1 FRO
346c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
346d0 2d 2d 2d 2d 0d 0a 31 37 35 32 0d 0a 32 35 35 35  ----..1752..2555
346e0 0d 0a 36 34 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  ..6497....skipif
346f0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
34700 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
34710 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
34720 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
34730 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
34740 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
34750 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   + col2 + - col2
34760 20 2a 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f   * col0 col2 FRO
34770 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
34780 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 32 30 30  ----..-162..-200
34790 32 0d 0a 2d 32 39 36 34 0d 0a 0d 0a 71 75 65 72  2..-2964....quer
347a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
347b0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63  ECT ALL + cor0.c
347c0 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  ol0 + col2 + - c
347d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
347e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d   cor0..----..54.
347f0 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  .57..96....query
34800 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34810 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e  CT ALL - - cor0.
34820 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63  col2 + col2 AS c
34830 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
34840 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d   cor0..----..52.
34850 0a 35 34 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79  .54..76....query
34860 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34870 43 54 20 2b 20 63 6f 6c 31 20 2b 20 35 31 20 2a  CT + col1 + 51 *
34880 20 2b 20 63 6f 6c 32 20 2a 20 38 35 20 46 52 4f   + col2 * 85 FRO
34890 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
348a0 2d 2d 2d 2d 0d 0a 31 31 32 37 36 39 0d 0a 31 31  ----..112769..11
348b0 37 30 37 36 0d 0a 31 36 34 37 34 37 0d 0a 0d 0a  7076..164747....
348c0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
348d0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
348e0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
348f0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
34900 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
34910 72 74 20 6c 61 62 65 6c 2d 31 34 35 36 0d 0a 53  rt label-1456..S
34920 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
34930 28 20 32 32 20 41 53 20 53 49 47 4e 45 44 20 29  ( 22 AS SIGNED )
34940 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
34950 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
34960 2d 0d 0a 31 32 39 38 0d 0a 33 37 34 0d 0a 36 38  -..1298..374..68
34970 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
34980 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
34990 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
349a0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 36 0d 0a  ort label-1456..
349b0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53  SELECT ALL - CAS
349c0 54 20 28 20 32 32 20 41 53 20 49 4e 54 45 47 45  T ( 22 AS INTEGE
349d0 52 20 29 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  R ) * - col1 FRO
349e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
349f0 2d 2d 2d 2d 0d 0a 31 32 39 38 0d 0a 33 37 34 0d  ----..1298..374.
34a00 0a 36 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .682....query I 
34a10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34a20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20  - col2 + col0 * 
34a30 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
34a40 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
34a50 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a 34 30 33  ..----..-45..403
34a60 39 0d 0a 36 33 30 34 0d 0a 0d 0a 71 75 65 72 79  9..6304....query
34a70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34a80 43 54 20 2d 20 35 20 2a 20 2b 20 32 36 20 2a 20  CT - 5 * + 26 * 
34a90 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
34aa0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
34ab0 2d 32 32 31 30 0d 0a 2d 34 30 33 30 0d 0a 2d 37  -2210..-4030..-7
34ac0 36 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  670....query I r
34ad0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
34ae0 20 34 32 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f   42 + - col2 FRO
34af0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
34b00 2d 2d 2d 2d 0d 0a 2d 36 38 0d 0a 2d 36 39 0d 0a  ----..-68..-69..
34b10 2d 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -80....onlyif my
34b20 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
34b30 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
34b40 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
34b50 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
34b60 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
34b70 31 34 36 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1460..SELECT ALL
34b80 20 2d 20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20   - - CAST( col1 
34b90 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20  AS SIGNED ) * - 
34ba0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
34bb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
34bc0 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d  838..-7462..-97.
34bd0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
34be0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
34bf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34c00 74 20 6c 61 62 65 6c 2d 31 34 36 30 0d 0a 53 45  t label-1460..SE
34c10 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 43 41 53  LECT ALL - - CAS
34c20 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  T ( col1 AS INTE
34c30 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46  GER ) * - col2 F
34c40 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
34c50 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d  ..----..-2838..-
34c60 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69  7462..-97....ski
34c70 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
34c80 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
34c90 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
34ca0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
34cb0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
34cc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
34cd0 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31  r0.col0 * - col1
34ce0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
34cf0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
34d00 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30  2064..-3395..-80
34d10 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
34d20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
34d30 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f  STINCT + cor0.co
34d40 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  l0 + + col0 * - 
34d50 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
34d60 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
34d70 2d 2d 2d 2d 0d 0a 2d 34 30 33 32 0d 0a 2d 36 0d  ----..-4032..-6.
34d80 0a 2d 36 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20  .-6320....query 
34d90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34da0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
34db0 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  + col0 * cor0.co
34dc0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
34dd0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
34de0 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31 32 0d 0a 37  --..165..3712..7
34df0 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  760....query I r
34e00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
34e10 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2b  ISTINCT col0 + +
34e20 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f   col1 * col2 FRO
34e30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
34e40 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36 32 0d  ----..132..2862.
34e50 0a 37 35 35 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .7551....onlyif 
34e60 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
34e70 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
34e80 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
34e90 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
34ea0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
34eb0 6c 2d 31 34 36 35 0d 0a 53 45 4c 45 43 54 20 43  l-1465..SELECT C
34ec0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
34ed0 4e 45 44 20 29 20 2d 20 63 6f 6c 30 20 2a 20 63  NED ) - col0 * c
34ee0 6f 6c 30 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c  ol0 * + tab1.col
34ef0 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
34f00 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
34f10 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
34f20 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
34f30 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
34f40 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 35  wsort label-1465
34f50 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20  ..SELECT CAST ( 
34f60 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
34f70 29 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  ) - col0 * col0 
34f80 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 46 52  * + tab1.col2 FR
34f90 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
34fa0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
34fb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34fc0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
34fd0 4e 43 54 20 2d 20 37 35 20 2a 20 2b 20 63 6f 72  NCT - 75 * + cor
34fe0 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  0.col1 + - col0 
34ff0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
35000 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  0 cor0..----..-6
35010 34 37 34 0d 0a 2d 36 39 31 34 0d 0a 2d 37 33 31  474..-6914..-731
35020 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
35030 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
35040 54 49 4e 43 54 20 2b 20 39 30 20 2b 20 63 6f 6c  TINCT + 90 + col
35050 32 20 2a 20 32 33 20 46 52 4f 4d 20 74 61 62 31  2 * 23 FROM tab1
35060 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35070 31 33 33 32 0d 0a 31 34 30 31 0d 0a 32 32 39 38  1332..1401..2298
35080 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35090 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 30  ort..SELECT + 40
350a0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
350b0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
350c0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
350d0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
350e0 74 6f 20 65 34 64 31 30 66 37 64 36 63 33 34 61  to e4d10f7d6c34a
350f0 32 38 31 66 35 32 34 65 34 35 65 38 32 65 62 64  281f524e45e82ebd
35100 32 61 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  2a0....query I r
35110 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
35120 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a   + col0 * col1 *
35130 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 46 52   + ( - col0 ) FR
35140 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
35150 2d 2d 0d 0a 2d 32 33 34 0d 0a 2d 34 30 39 36 30  --..-234..-40960
35160 0d 0a 2d 38 33 32 30 30 0d 0a 0d 0a 71 75 65 72  ..-83200....quer
35170 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35180 45 43 54 20 41 4c 4c 20 2b 20 39 34 20 2b 20 2d  ECT ALL + 94 + -
35190 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
351a0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
351b0 0a 31 32 0d 0a 36 31 0d 0a 39 33 0d 0a 0d 0a 6f  .12..61..93....o
351c0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
351d0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
351e0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
351f0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
35200 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35210 74 20 6c 61 62 65 6c 2d 31 34 37 31 0d 0a 53 45  t label-1471..SE
35220 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
35230 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 43 41 53  ( + col1 ) * CAS
35240 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
35250 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  D ) FROM tab0 AS
35260 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
35270 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
35280 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
35290 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
352a0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 31 0d 0a  ort label-1471..
352b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
352c0 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 43  + ( + col1 ) * C
352d0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
352e0 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
352f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
35300 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
35310 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35320 20 41 4c 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f   ALL + + cor0.co
35330 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l0 + - col1 FROM
35340 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
35350 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34 0d 0a 36 37  ---..-23..54..67
35360 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
35370 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
35380 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
35390 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
353a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
353b0 31 34 37 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  1473..SELECT DIS
353c0 54 49 4e 43 54 20 2b 20 28 20 2d 20 63 6f 6c 30  TINCT + ( - col0
353d0 20 29 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53   ) DIV - col1 AS
353e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
353f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
35400 0d 0a 31 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..1..4....skipif
35410 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
35420 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
35430 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
35440 34 37 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  473..SELECT DIST
35450 49 4e 43 54 20 2b 20 28 20 2d 20 63 6f 6c 30 20  INCT + ( - col0 
35460 29 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ) / - col1 AS co
35470 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
35480 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
35490 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..4....query I r
354a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
354b0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63   + col2 * cor0.c
354c0 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 + col1 AS co
354d0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
354e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d  cor0..----..132.
354f0 0a 37 33 38 39 0d 0a 38 37 38 0d 0a 0d 0a 71 75  .7389..878....qu
35500 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35510 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
35520 20 2b 20 39 34 20 2b 20 2b 20 63 6f 72 30 2e 63   + 94 + + cor0.c
35530 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
35540 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
35550 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 36 33 0d 0a 2d  ---..-35..-63..-
35560 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  77....query I ro
35570 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
35580 53 54 49 4e 43 54 20 38 35 20 41 53 20 63 6f 6c  STINCT 85 AS col
35590 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
355a0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
355b0 0a 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .85....onlyif my
355c0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
355d0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
355e0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
355f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
35600 65 6c 2d 31 34 37 37 0d 0a 53 45 4c 45 43 54 20  el-1477..SELECT 
35610 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72  + + col1 + - cor
35620 30 2e 63 6f 6c 32 20 2a 20 38 32 20 44 49 56 20  0.col2 * 82 DIV 
35630 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
35640 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35650 2d 31 34 35 30 0d 0a 2d 36 33 0d 0a 2d 38 35 0d  -1450..-63..-85.
35660 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
35670 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
35680 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35690 74 20 6c 61 62 65 6c 2d 31 34 37 37 0d 0a 53 45  t label-1477..SE
356a0 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  LECT + + col1 + 
356b0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 38 32  - cor0.col2 * 82
356c0 20 2f 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   / + col0 FROM t
356d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
356e0 2d 0d 0a 2d 31 34 35 30 0d 0a 2d 36 33 0d 0a 2d  -..-1450..-63..-
356f0 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
35700 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
35710 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20  l0 * ( - col2 ) 
35720 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
35730 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
35740 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39  .-35..-7298..-79
35750 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
35760 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
35770 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   - col1 * + col1
35780 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 63 6f   + + col2 - + co
35790 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
357a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30  cor0..----..-100
357b0 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a  ..-169..-676....
357c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
357d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
357e0 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col2 * cor0.col1
357f0 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46   + - cor0.col0 F
35800 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
35810 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 36 0d 0a 35 36  ..----..1456..56
35820 37 0d 0a 38 33 30 0d 0a 0d 0a 71 75 65 72 79 20  7..830....query 
35830 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35840 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72  T DISTINCT + cor
35850 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  0.col1 * + col1 
35860 2b 20 63 6f 6c 31 20 2b 20 2b 20 36 36 20 41 53  + col1 + + 66 AS
35870 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
35880 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 38  cor0..----..1058
35890 0d 0a 33 36 30 36 0d 0a 33 37 32 0d 0a 0d 0a 71  ..3606..372....q
358a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
358b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
358c0 2d 20 2b 20 36 31 20 2a 20 28 20 2b 20 63 6f 6c  - + 61 * ( + col
358d0 30 20 2a 20 28 20 2d 20 63 6f 6c 31 20 29 20 29  0 * ( - col1 ) )
358e0 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41   + + cor0.col0 A
358f0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
35900 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35910 33 39 31 30 34 0d 0a 34 37 36 31 0d 0a 36 33 35  39104..4761..635
35920 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
35930 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
35940 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col1 * + col1 + 
35950 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
35960 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
35970 2d 0d 0a 33 32 37 0d 0a 33 35 30 37 0d 0a 39 38  -..327..3507..98
35980 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  8....skipif post
35990 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
359a0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
359b0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
359c0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
359d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
359e0 45 4c 45 43 54 20 2b 20 2d 20 31 38 20 2b 20 2b  ELECT + - 18 + +
359f0 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 63 6f 6c   col0 * col0 col
35a00 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
35a10 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 37 0d 0a 35 35  ..----..1207..55
35a20 38 0d 0a 37 39 30 33 0d 0a 0d 0a 71 75 65 72 79  8..7903....query
35a30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35a40 43 54 20 2d 20 30 20 46 52 4f 4d 20 74 61 62 31  CT - 0 FROM tab1
35a50 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
35a60 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
35a70 61 73 68 69 6e 67 20 74 6f 20 38 62 37 35 31 33  ashing to 8b7513
35a80 36 62 32 62 35 31 63 37 37 33 34 35 63 30 33 38  6b2b51c77345c038
35a90 30 34 65 63 31 63 64 61 35 63 0d 0a 0d 0a 71 75  04ec1cda5c....qu
35aa0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35ab0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
35ac0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d  ol1 + + col0 * -
35ad0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
35ae0 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 38 0d 0a 2d 34  .----..-1128..-4
35af0 39 30 0d 0a 2d 37 38 33 30 0d 0a 0d 0a 71 75 65  90..-7830....que
35b00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35b10 4c 45 43 54 20 2d 20 31 30 20 2b 20 38 37 20 2a  LECT - 10 + 87 *
35b20 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
35b30 0a 2d 2d 2d 2d 0d 0a 37 34 37 32 0d 0a 37 39 30  .----..7472..790
35b40 37 0d 0a 38 34 32 39 0d 0a 0d 0a 6f 6e 6c 79 69  7..8429....onlyi
35b50 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
35b60 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
35b70 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
35b80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35b90 20 6c 61 62 65 6c 2d 31 34 38 38 0d 0a 53 45 4c   label-1488..SEL
35ba0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
35bb0 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 2b 20 74  ol1 DIV col2 + t
35bc0 61 62 30 2e 63 6f 6c 32 20 2a 20 2b 20 35 31 20  ab0.col2 * + 51 
35bd0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
35be0 0a 2d 34 36 0d 0a 31 36 38 31 0d 0a 34 31 38 31  .-46..1681..4181
35bf0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
35c00 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
35c10 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
35c20 72 74 20 6c 61 62 65 6c 2d 31 34 38 38 0d 0a 53  rt label-1488..S
35c30 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
35c40 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 2b 20 74   col1 / col2 + t
35c50 61 62 30 2e 63 6f 6c 32 20 2a 20 2b 20 35 31 20  ab0.col2 * + 51 
35c60 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
35c70 0a 2d 34 36 0d 0a 31 36 38 31 0d 0a 34 31 38 31  .-46..1681..4181
35c80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35c90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
35ca0 2d 20 63 6f 6c 31 20 2b 20 2b 20 30 20 41 53 20  - col1 + + 0 AS 
35cb0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
35cc0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
35cd0 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 73  6..-91..-97....s
35ce0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
35cf0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
35d00 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
35d10 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
35d20 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
35d30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35d40 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
35d50 2b 20 2b 20 31 33 20 63 6f 6c 31 20 46 52 4f 4d  + + 13 col1 FROM
35d60 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
35d70 2d 2d 2d 0d 0a 32 33 0d 0a 32 36 0d 0a 33 39 0d  ---..23..26..39.
35d80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35d90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
35da0 20 39 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c   92 + + cor0.col
35db0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
35dc0 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
35dd0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
35de0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 34 37  s hashing to 147
35df0 65 37 35 37 63 65 62 39 35 37 35 65 31 33 65 30  e757ceb9575e13e0
35e00 64 38 37 35 33 65 65 32 36 30 32 31 33 0d 0a 0d  d8753ee260213...
35e10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35e20 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
35e30 38 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  85 AS col0 FROM 
35e40 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 30  tab0..----..2040
35e50 0d 0a 32 39 37 35 0d 0a 37 35 36 35 0d 0a 0d 0a  ..2975..7565....
35e60 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
35e70 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
35e80 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
35e90 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
35ea0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 33  wsort label-1493
35eb0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 35 20  ..SELECT ALL 25 
35ec0 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  DIV col1 FROM ta
35ed0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b0..----..0..0..
35ee0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
35ef0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
35f00 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
35f10 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 33 0d 0a  ort label-1493..
35f20 53 45 4c 45 43 54 20 41 4c 4c 20 32 35 20 2f 20  SELECT ALL 25 / 
35f30 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
35f40 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
35f50 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
35f60 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
35f70 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
35f80 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
35f90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39  owsort label-149
35fa0 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
35fb0 43 54 20 74 61 62 30 2e 63 6f 6c 32 20 44 49 56  CT tab0.col2 DIV
35fc0 20 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c   col2 + tab0.col
35fd0 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
35fe0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 37 0d 0a  b0..----..7397..
35ff0 38 32 38 32 0d 0a 39 34 31 30 0d 0a 0d 0a 73 6b  8282..9410....sk
36000 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
36010 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
36020 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
36030 65 6c 2d 31 34 39 34 0d 0a 53 45 4c 45 43 54 20  el-1494..SELECT 
36040 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e 63 6f  DISTINCT tab0.co
36050 6c 32 20 2f 20 63 6f 6c 32 20 2b 20 74 61 62 30  l2 / col2 + tab0
36060 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f  .col1 * col1 FRO
36070 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  M tab0..----..73
36080 39 37 0d 0a 38 32 38 32 0d 0a 39 34 31 30 0d 0a  97..8282..9410..
36090 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
360a0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  t..SELECT - cor0
360b0 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20  .col0 FROM tab0 
360c0 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
360d0 49 4e 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  IN tab1, tab2 AS
360e0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
360f0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
36100 6f 20 63 33 65 62 66 31 36 39 35 63 61 37 34 35  o c3ebf1695ca745
36110 36 37 62 64 63 31 37 33 64 62 65 31 35 31 38 36  67bdc173dbe15186
36120 61 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  a8....query I ro
36130 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
36140 63 6f 6c 30 20 2b 20 35 39 20 2a 20 63 6f 72 30  col0 + 59 * cor0
36150 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20  .col0 FROM tab0 
36160 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
36170 34 34 30 0d 0a 32 31 30 30 0d 0a 35 33 34 30 0d  440..2100..5340.
36180 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
36190 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
361a0 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  NCT + cor0.col0 
361b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
361c0 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  1 AS cor0 CROSS 
361d0 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 31 20  JOIN tab2, tab1 
361e0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor1..----..3
361f0 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72  ..64..80....quer
36200 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36210 45 43 54 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a  ECT + ( col2 ) *
36220 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
36230 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
36240 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d  ----..189..2028.
36250 0a 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .3002....query I
36260 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36270 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
36280 20 2a 20 31 38 20 41 53 20 63 6f 6c 31 20 46 52   * 18 AS col1 FR
36290 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
362a0 31 36 30 32 0d 0a 2d 34 33 32 0d 0a 2d 36 33 30  1602..-432..-630
362b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
362c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
362d0 35 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  53 AS col1 FROM 
362e0 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62 30  tab2, tab1, tab0
362f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36300 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
36310 67 20 74 6f 20 32 38 37 36 34 31 38 35 38 37 63  g to 2876418587c
36320 37 37 61 31 38 32 64 38 38 64 62 32 39 30 37 62  77a182d88db2907b
36330 30 61 35 31 61 0d 0a 0d 0a 73 6b 69 70 69 66 20  0a51a....skipif 
36340 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
36350 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
36360 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
36370 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
36380 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36390 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
363a0 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  CT + col0 * col1
363b0 20 2b 20 63 6f 6c 30 20 2a 20 28 20 2d 20 63 6f   + col0 * ( - co
363c0 6c 31 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 ) col1 FROM t
363d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
363e0 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -..0....skipif p
363f0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
36400 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
36410 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
36420 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
36430 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36440 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
36450 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  + col2 col1 FROM
36460 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
36470 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37  ..1248..1404..57
36480 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
36490 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
364a0 31 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 32 20 46  1 * col1 * - 2 F
364b0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
364c0 2d 31 34 37 39 32 0d 0a 2d 31 36 35 36 32 0d 0a  -14792..-16562..
364d0 2d 31 38 38 31 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  -18818....onlyif
364e0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
364f0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
36500 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
36510 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
36520 6c 61 62 65 6c 2d 31 35 30 34 0d 0a 53 45 4c 45  label-1504..SELE
36530 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  CT - col1 * - co
36540 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20  l2 + - col2 DIV 
36550 2b 20 31 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  + 11 + + cor0.co
36560 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
36570 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
36580 2d 2d 0d 0a 31 33 33 36 0d 0a 31 34 35 34 0d 0a  --..1336..1454..
36590 36 32 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  622....skipif my
365a0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
365b0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
365c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 34  wsort label-1504
365d0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
365e0 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  * - col2 + - col
365f0 32 20 2f 20 2b 20 31 31 20 2b 20 2b 20 63 6f 72  2 / + 11 + + cor
36600 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  0.col2 AS col2 F
36610 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
36620 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 36 0d 0a 31 34  ..----..1336..14
36630 35 34 0d 0a 36 32 32 0d 0a 0d 0a 71 75 65 72 79  54..622....query
36640 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36650 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  CT - + cor0.col1
36660 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20   * - ( + col2 ) 
36670 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  + cor0.col2 * + 
36680 28 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 72  ( col0 ) + - cor
36690 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52  0.col2 * col0 FR
366a0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
366b0 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36  .----..1534..646
366c0 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..837....query I
366d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
366e0 20 63 6f 6c 31 20 2b 20 38 37 20 2b 20 2b 20 63   col1 + 87 + + c
366f0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
36700 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
36710 2d 2d 2d 0d 0a 31 32 35 0d 0a 31 38 33 0d 0a 32  ---..125..183..2
36720 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  24....query I ro
36730 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
36740 2d 20 63 6f 6c 31 20 2a 20 39 37 20 2b 20 31 37  - col1 * 97 + 17
36750 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
36760 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 38 0d 0a  r0..----..1278..
36770 32 35 33 39 0d 0a 39 38 37 0d 0a 0d 0a 6f 6e 6c  2539..987....onl
36780 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
36790 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
367a0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
367b0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
367c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
367d0 6c 61 62 65 6c 2d 31 35 30 38 0d 0a 53 45 4c 45  label-1508..SELE
367e0 43 54 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54  CT col1 * - CAST
367f0 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
36800 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
36810 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
36820 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
36830 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
36840 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
36850 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
36860 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30  owsort label-150
36870 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  8..SELECT col1 *
36880 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
36890 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
368a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
368b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
368c0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
368d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
368e0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
368f0 2b 20 31 37 20 46 52 4f 4d 20 74 61 62 31 20 63  + 17 FROM tab1 c
36900 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 0d 0a  or0..----..-37..
36910 2d 34 30 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69 70  -40..-79....skip
36920 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
36930 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
36940 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
36950 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
36960 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
36970 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
36980 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63   - col1 + cor0.c
36990 6f 6c 32 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20  ol2 + col1 col0 
369a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
369b0 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d  0..----..54..57.
369c0 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .96....query I r
369d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
369e0 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32  ISTINCT - + col2
369f0 20 2d 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d   - ( col2 ) FROM
36a00 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
36a10 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d 32 0d 0a 2d  ---..-164..-2..-
36a20 36 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  66....skipif pos
36a30 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
36a40 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
36a50 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
36a60 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
36a70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36a80 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20  SELECT + col2 - 
36a90 28 20 35 38 20 29 20 63 6f 6c 30 20 46 52 4f 4d  ( 58 ) col0 FROM
36aa0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
36ab0 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 34 0d 0a 33 38 0d  ---..-1..-4..38.
36ac0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
36ad0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
36ae0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
36af0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
36b00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
36b10 35 31 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  513..SELECT ALL 
36b20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30 20  col1 DIV + col0 
36b30 2b 20 38 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  + 80 * cor0.col1
36b40 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
36b50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a  r0..----..1360..
36b60 32 34 38 34 0d 0a 34 37 32 30 0d 0a 0d 0a 73 6b  2484..4720....sk
36b70 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
36b80 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
36b90 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
36ba0 65 6c 2d 31 35 31 33 0d 0a 53 45 4c 45 43 54 20  el-1513..SELECT 
36bb0 41 4c 4c 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c  ALL col1 / + col
36bc0 30 20 2b 20 38 30 20 2a 20 63 6f 72 30 2e 63 6f  0 + 80 * cor0.co
36bd0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
36be0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30  cor0..----..1360
36bf0 0d 0a 32 34 38 34 0d 0a 34 37 32 30 0d 0a 0d 0a  ..2484..4720....
36c00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36c10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
36c20 20 63 6f 6c 32 20 2b 20 2b 20 37 31 20 46 52 4f   col2 + + 71 FRO
36c30 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab0..----..10
36c40 34 0d 0a 31 35 33 0d 0a 37 32 0d 0a 0d 0a 71 75  4..153..72....qu
36c50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36c60 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 30 2e 63  ELECT ALL tab0.c
36c70 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 31  ol1 * - col0 + 1
36c80 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
36c90 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 33 31  ab0..----..-2031
36ca0 0d 0a 2d 33 33 39 34 0d 0a 2d 38 30 31 37 0d 0a  ..-3394..-8017..
36cb0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
36cc0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
36cd0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
36ce0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
36cf0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
36d00 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 31 36 0d  sort label-1516.
36d10 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
36d20 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
36d30 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 31   SIGNED ) + col1
36d40 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
36d50 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
36d60 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
36d70 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
36d80 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
36d90 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
36da0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
36db0 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
36dc0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
36dd0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
36de0 72 74 20 6c 61 62 65 6c 2d 31 35 31 36 0d 0a 53  rt label-1516..S
36df0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b  ELECT - col2 + +
36e00 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
36e10 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 31  INTEGER ) + col1
36e20 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
36e30 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
36e40 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
36e50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36e60 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30  CT col0 + + col0
36e70 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
36e80 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
36e90 0a 31 35 0d 0a 36 39 0d 0a 39 36 0d 0a 0d 0a 6f  .15..69..96....o
36ea0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
36eb0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
36ec0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
36ed0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
36ee0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 31 38 0d  sort label-1518.
36ef0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
36f00 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f   + col0 DIV - co
36f10 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
36f20 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
36f30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
36f40 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
36f50 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
36f60 72 74 20 6c 61 62 65 6c 2d 31 35 31 38 0d 0a 53  rt label-1518..S
36f70 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
36f80 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 72 30 2e 63   col0 / - cor0.c
36f90 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
36fa0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a  r0..----..-1....
36fb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36fc0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32  .SELECT + + col2
36fd0 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   - - col2 * col2
36fe0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
36ff0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
37000 0d 0a 31 34 38 32 0d 0a 37 30 32 0d 0a 37 35 36  ..1482..702..756
37010 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37020 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
37030 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  INCT + cor0.col0
37040 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31   * col2 * - col1
37050 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
37060 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
37070 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
37080 36 34 31 36 0d 0a 2d 34 32 30 39 0d 0a 2d 39 39  6416..-4209..-99
37090 37 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  760....onlyif my
370a0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
370b0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
370c0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
370d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
370e0 65 6c 2d 31 35 32 31 0d 0a 53 45 4c 45 43 54 20  el-1521..SELECT 
370f0 41 4c 4c 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d  ALL + col2 DIV -
37100 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
37110 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
37120 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
37130 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
37140 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
37150 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37160 62 65 6c 2d 31 35 32 31 0d 0a 53 45 4c 45 43 54  bel-1521..SELECT
37170 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2f 20 2d 20   ALL + col2 / - 
37180 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
37190 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
371a0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
371b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
371c0 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 33  ELECT - col0 * 3
371d0 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  5 AS col2 FROM t
371e0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
371f0 2d 0d 0a 2d 32 34 35 0d 0a 2d 32 37 33 30 0d 0a  -..-245..-2730..
37200 2d 32 37 36 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  -2765....skipif 
37210 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
37220 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
37230 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
37240 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
37250 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37260 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
37270 6c 31 20 2b 20 28 20 63 6f 6c 31 20 29 20 63 6f  l1 + ( col1 ) co
37280 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
37290 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d  cor0..----..172.
372a0 0a 31 38 32 0d 0a 31 39 34 0d 0a 0d 0a 71 75 65  .182..194....que
372b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
372c0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
372d0 2b 20 34 39 20 46 52 4f 4d 20 74 61 62 32 20 63  + 49 FROM tab2 c
372e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a  or0..----..-49..
372f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37300 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
37310 6c 32 20 2a 20 28 20 63 6f 6c 32 20 29 20 41 53  l2 * ( col2 ) AS
37320 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
37330 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
37340 0d 0a 31 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a  ..1089..6724....
37350 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37360 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
37370 2e 63 6f 6c 31 20 2a 20 2d 20 35 31 20 41 53 20  .col1 * - 51 AS 
37380 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
37390 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
373a0 33 32 36 0d 0a 2d 35 31 30 0d 0a 2d 36 36 33 0d  326..-510..-663.
373b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
373c0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
373d0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
373e0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
373f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
37400 35 32 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  527..SELECT - + 
37410 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  col2 * col0 + co
37420 6c 32 20 44 49 56 20 2b 20 28 20 33 36 20 29 20  l2 DIV + ( 36 ) 
37430 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
37440 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37  0..----..-35..-7
37450 32 39 36 0d 0a 2d 37 39 32 0d 0a 0d 0a 73 6b 69  296..-792....ski
37460 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
37470 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
37480 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
37490 6c 2d 31 35 32 37 0d 0a 53 45 4c 45 43 54 20 2d  l-1527..SELECT -
374a0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b   + col2 * col0 +
374b0 20 63 6f 6c 32 20 2f 20 2b 20 28 20 33 36 20 29   col2 / + ( 36 )
374c0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
374d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d  r0..----..-35..-
374e0 37 32 39 36 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75  7296..-792....qu
374f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37500 45 4c 45 43 54 20 41 4c 4c 20 2d 20 39 37 20 2a  ELECT ALL - 97 *
37510 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
37520 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
37530 0a 32 33 32 38 0d 0a 33 33 39 35 0d 0a 38 36 33  .2328..3395..863
37540 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  3....skipif post
37550 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
37560 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
37570 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
37580 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
37590 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
375a0 45 4c 45 43 54 20 2d 20 28 20 2b 20 32 34 20 29  ELECT - ( + 24 )
375b0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
375c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
375d0 32 34 0d 0a 2d 32 34 0d 0a 2d 32 34 0d 0a 0d 0a  24..-24..-24....
375e0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
375f0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
37600 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
37610 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
37620 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 30  wsort label-1530
37630 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 35  ..SELECT ALL + 5
37640 33 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  3 * cor0.col2 + 
37650 63 6f 6c 32 20 2b 20 43 41 53 54 28 20 63 6f 6c  col2 + CAST( col
37660 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 44 49  0 AS SIGNED ) DI
37670 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  V - cor0.col0 AS
37680 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
37690 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
376a0 39 31 35 0d 0a 33 30 37 37 0d 0a 35 31 38 33 0d  915..3077..5183.
376b0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
376c0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
376d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
376e0 74 20 6c 61 62 65 6c 2d 31 35 33 30 0d 0a 53 45  t label-1530..SE
376f0 4c 45 43 54 20 41 4c 4c 20 2b 20 35 33 20 2a 20  LECT ALL + 53 * 
37700 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32  cor0.col2 + col2
37710 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41   + CAST ( col0 A
37720 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2d 20  S INTEGER ) / - 
37730 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
37740 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
37750 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 35 0d  or0..----..2915.
37760 0a 33 30 37 37 0d 0a 35 31 38 33 0d 0a 0d 0a 71  .3077..5183....q
37770 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37780 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 28 20  SELECT col2 + ( 
37790 74 61 62 30 2e 63 6f 6c 30 20 29 20 2b 20 2b 20  tab0.col0 ) + + 
377a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
377b0 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a 31 34 33 0d 0a  ----..133..143..
377c0 32 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  262....onlyif my
377d0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
377e0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
377f0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
37800 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
37810 65 6c 2d 31 35 33 32 0d 0a 53 45 4c 45 43 54 20  el-1532..SELECT 
37820 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 44 49  DISTINCT col2 DI
37830 56 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20  V - col1 - col1 
37840 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
37850 0a 2d 31 35 0d 0a 2d 32 30 0d 0a 2d 32 38 0d 0a  .-15..-20..-28..
37860 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
37870 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
37880 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37890 20 6c 61 62 65 6c 2d 31 35 33 32 0d 0a 53 45 4c   label-1532..SEL
378a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
378b0 32 20 2f 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c  2 / - col1 - col
378c0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
378d0 2d 0d 0a 2d 31 35 0d 0a 2d 32 30 0d 0a 2d 32 38  -..-15..-20..-28
378e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
378f0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
37900 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
37910 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
37920 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
37930 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37940 4c 45 43 54 20 63 6f 6c 32 20 2d 20 63 6f 6c 32  LECT col2 - col2
37950 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
37960 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
37970 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
37980 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
37990 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
379a0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
379b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
379c0 33 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  34..SELECT col2 
379d0 44 49 56 20 63 6f 6c 30 20 2b 20 2b 20 31 31 20  DIV col0 + + 11 
379e0 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2b 20  - tab0.col1 * + 
379f0 28 20 34 39 20 29 20 46 52 4f 4d 20 74 61 62 30  ( 49 ) FROM tab0
37a00 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 30 32 0d 0a 2d  ..----..-4202..-
37a10 34 34 34 38 0d 0a 2d 34 37 34 32 0d 0a 0d 0a 73  4448..-4742....s
37a20 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
37a30 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
37a40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37a50 62 65 6c 2d 31 35 33 34 0d 0a 53 45 4c 45 43 54  bel-1534..SELECT
37a60 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 2b 20 2b   col2 / col0 + +
37a70 20 31 31 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20   11 - tab0.col1 
37a80 2a 20 2b 20 28 20 34 39 20 29 20 46 52 4f 4d 20  * + ( 49 ) FROM 
37a90 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 30  tab0..----..-420
37aa0 32 0d 0a 2d 34 34 34 38 0d 0a 2d 34 37 34 32 0d  2..-4448..-4742.
37ab0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37ac0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
37ad0 4e 43 54 20 2d 20 35 39 20 2a 20 63 6f 6c 32 20  NCT - 59 * col2 
37ae0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
37af0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
37b00 0a 2d 31 35 33 34 0d 0a 2d 31 35 39 33 0d 0a 2d  .-1534..-1593..-
37b10 32 32 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2242....query I 
37b20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37b30 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2d 20 63  ALL - - col0 - c
37b40 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
37b50 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
37b60 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
37b70 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
37b80 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
37b90 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
37ba0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
37bb0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
37bc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
37bd0 53 54 49 4e 43 54 20 2b 20 2d 20 32 35 20 63 6f  STINCT + - 25 co
37be0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
37bf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d  cor0..----..-25.
37c00 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
37c10 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
37c20 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
37c30 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
37c40 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
37c50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37c60 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 32  ECT DISTINCT - 2
37c70 34 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  4 col0 FROM tab2
37c80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37c90 2d 32 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -24....skipif po
37ca0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
37cb0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
37cc0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
37cd0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
37ce0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37cf0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
37d00 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c 30  l1 + + col2 col0
37d10 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
37d20 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38  .----..55..58..8
37d30 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
37d40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
37d50 54 49 4e 43 54 20 2b 20 33 20 2a 20 2b 20 63 6f  TINCT + 3 * + co
37d60 6c 30 20 2b 20 28 20 32 36 20 29 20 2a 20 63 6f  l0 + ( 26 ) * co
37d70 6c 30 20 2a 20 34 36 20 41 53 20 63 6f 6c 31 20  l0 * 46 AS col1 
37d80 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
37d90 30 0d 0a 2d 2d 2d 2d 0d 0a 38 33 39 33 0d 0a 39  0..----..8393..9
37da0 33 35 32 32 0d 0a 39 34 37 32 31 0d 0a 0d 0a 71  3522..94721....q
37db0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37dc0 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20 74  SELECT ALL ( - t
37dd0 61 62 32 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20  ab2.col2 ) FROM 
37de0 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
37df0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
37e00 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 62  es hashing to 7b
37e10 35 39 33 38 31 32 34 32 35 33 37 39 38 34 32 36  5938124253798426
37e20 66 62 66 30 39 63 31 38 65 31 66 64 37 35 0d 0a  fbf09c18e1fd75..
37e30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37e40 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
37e50 43 54 20 33 36 20 2d 20 2d 20 63 6f 6c 30 20 2a  CT 36 - - col0 *
37e60 20 37 34 20 46 52 4f 4d 20 74 61 62 32 20 41 53   74 FROM tab2 AS
37e70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 34   cor0..----..554
37e80 0d 0a 35 38 30 38 0d 0a 35 38 38 32 0d 0a 0d 0a  ..5808..5882....
37e90 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
37ea0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
37eb0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
37ec0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
37ed0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
37ee0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37ef0 20 2d 20 36 30 20 63 6f 6c 30 20 46 52 4f 4d 20   - 60 col0 FROM 
37f00 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 30 0d  tab0..----..-60.
37f10 0a 2d 36 30 0d 0a 2d 36 30 0d 0a 0d 0a 71 75 65  .-60..-60....que
37f20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37f30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
37f40 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 31 35  l1 * - col1 * 15
37f50 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
37f60 0d 0a 2d 31 30 31 34 30 0d 0a 2d 31 35 30 30 0d  ..-10140..-1500.
37f70 0a 2d 32 35 33 35 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-2535....onlyif
37f80 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
37f90 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
37fa0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
37fb0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
37fc0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
37fd0 65 6c 2d 31 35 34 35 0d 0a 53 45 4c 45 43 54 20  el-1545..SELECT 
37fe0 2d 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  - + CAST( NULL A
37ff0 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
38000 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
38010 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 63 6f 72  SS JOIN tab0 cor
38020 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
38030 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37  s hashing to cd7
38040 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34 30  a7901e47c1515540
38050 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d  4aff0d216fe0b...
38060 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
38070 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
38080 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
38090 6c 61 62 65 6c 2d 31 35 34 35 0d 0a 53 45 4c 45  label-1545..SELE
380a0 43 54 20 2d 20 2b 20 43 41 53 54 20 28 20 4e 55  CT - + CAST ( NU
380b0 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
380c0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
380d0 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
380e0 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  0 cor1..----..9 
380f0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
38100 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35  o cd7a7901e47c15
38110 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65  155404aff0d216fe
38120 30 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  0b....query I ro
38130 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
38140 34 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  41 FROM tab1, ta
38150 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b1 AS cor0, tab2
38160 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
38170 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
38180 67 20 74 6f 20 34 37 62 39 65 66 39 37 32 38 33  g to 47b9ef97283
38190 39 34 32 38 66 34 66 37 31 64 39 66 35 62 30 39  9428f4f71d9f5b09
381a0 34 34 65 64 66 0d 0a 0d 0a 71 75 65 72 79 20 49  44edf....query I
381b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
381c0 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   - + col0 + - co
381d0 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  l1 * + col1 * + 
381e0 36 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  65 AS col1 FROM 
381f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
38200 2d 2d 0d 0a 2d 34 38 30 37 36 34 0d 0a 2d 35 33  --..-480764..-53
38210 38 33 35 34 0d 0a 2d 36 31 31 36 32 30 0d 0a 0d  8354..-611620...
38220 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38230 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
38240 54 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20  T col0 - - col2 
38250 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
38260 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37  0..----..121..17
38270 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  6..57....query I
38280 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38290 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
382a0 6c 31 20 2b 20 39 20 41 53 20 63 6f 6c 31 20 46  l1 + 9 AS col1 F
382b0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
382c0 2d 2d 2d 0d 0a 32 36 0d 0a 34 30 0d 0a 36 38 0d  ---..26..40..68.
382d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
382e0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
382f0 4e 43 54 20 2b 20 2b 20 35 38 20 2a 20 2b 20 63  NCT + + 58 * + c
38300 6f 6c 31 20 2b 20 63 6f 6c 32 20 2d 20 33 30 20  ol1 + col2 - 30 
38310 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  * + cor0.col1 FR
38320 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
38330 0a 2d 2d 2d 2d 0d 0a 31 36 37 38 0d 0a 35 31 34  .----..1678..514
38340 0d 0a 38 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..895....onlyif 
38350 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
38360 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
38370 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
38380 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
38390 61 62 65 6c 2d 31 35 35 31 0d 0a 53 45 4c 45 43  abel-1551..SELEC
383a0 54 20 41 4c 4c 20 2d 20 36 30 20 2b 20 34 37 20  T ALL - 60 + 47 
383b0 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f  DIV cor0.col0 co
383c0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
383d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d  cor0..----..-54.
383e0 0a 2d 36 30 0d 0a 2d 36 30 0d 0a 0d 0a 73 6b 69  .-60..-60....ski
383f0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
38400 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
38410 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
38420 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
38430 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
38440 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
38450 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
38460 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 31 0d  sort label-1551.
38470 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 36 30  .SELECT ALL - 60
38480 20 2b 20 34 37 20 2f 20 63 6f 72 30 2e 63 6f 6c   + 47 / cor0.col
38490 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  0 col1 FROM tab2
384a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
384b0 2d 35 34 0d 0a 2d 36 30 0d 0a 2d 36 30 0d 0a 0d  -54..-60..-60...
384c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
384d0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
384e0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
384f0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
38500 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35  owsort label-155
38510 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
38520 43 54 20 2d 20 2b 20 33 36 20 44 49 56 20 63 6f  CT - + 36 DIV co
38530 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
38540 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
38550 2d 2d 0d 0a 2d 31 32 0d 0a 30 0d 0a 0d 0a 73 6b  --..-12..0....sk
38560 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
38570 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
38580 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
38590 65 6c 2d 31 35 35 32 0d 0a 53 45 4c 45 43 54 20  el-1552..SELECT 
385a0 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 33 36 20  DISTINCT - + 36 
385b0 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  / col0 AS col1 F
385c0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
385d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 30 0d 0a  ..----..-12..0..
385e0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
385f0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
38600 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
38610 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
38620 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
38630 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 33 0d  sort label-1553.
38640 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
38650 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  l2 * col2 * col2
38660 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
38670 20 44 45 43 49 4d 41 4c 20 29 20 46 52 4f 4d 20   DECIMAL ) FROM 
38680 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
38690 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
386a0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
386b0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
386c0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
386d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35  owsort label-155
386e0 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  3..SELECT ALL + 
386f0 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f  col2 * col2 * co
38700 6c 32 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  l2 + CAST ( NULL
38710 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20   AS REAL ) FROM 
38720 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
38730 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
38740 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
38750 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
38760 2d 20 2d 20 37 31 20 46 52 4f 4d 20 74 61 62 30  - - 71 FROM tab0
38770 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 31 0d   cor0..----..71.
38780 0a 37 31 0d 0a 37 31 0d 0a 0d 0a 71 75 65 72 79  .71..71....query
38790 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
387a0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
387b0 2b 20 38 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  + 81 * col1 FROM
387c0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
387d0 0d 0a 31 33 33 39 0d 0a 32 34 38 34 0d 0a 34 37  ..1339..2484..47
387e0 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  53....query I ro
387f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
38800 4c 20 36 33 20 2a 20 38 20 2b 20 63 6f 6c 30 20  L 63 * 8 + col0 
38810 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
38820 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
38830 0a 35 32 38 0d 0a 35 33 39 0d 0a 35 39 33 0d 0a  .528..539..593..
38840 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38850 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 35 20 46  t..SELECT - 15 F
38860 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
38870 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
38880 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
38890 6f 20 31 31 37 32 63 39 61 36 32 62 64 61 64 37  o 1172c9a62bdad7
388a0 64 62 30 64 65 66 39 32 30 35 63 30 36 65 65 31  db0def9205c06ee1
388b0 66 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  f2....onlyif mys
388c0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
388d0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
388e0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
388f0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
38900 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
38910 35 35 38 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41  558..SELECT + CA
38920 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
38930 45 44 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  ED ) * + col2 + 
38940 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 30  + cor0.col0 col0
38950 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
38960 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
38970 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
38980 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
38990 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
389a0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
389b0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
389c0 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
389d0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
389e0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
389f0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 38  wsort label-1558
38a00 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20  ..SELECT + CAST 
38a10 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
38a20 52 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b  R ) * + col2 + +
38a30 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 30 20   cor0.col0 col0 
38a40 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
38a50 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
38a60 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ULL..NULL....onl
38a70 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
38a80 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
38a90 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
38aa0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
38ab0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
38ac0 6c 61 62 65 6c 2d 31 35 35 39 0d 0a 53 45 4c 45  label-1559..SELE
38ad0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20  CT ALL + col1 + 
38ae0 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
38af0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
38b00 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b0..----..NULL..
38b10 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
38b20 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
38b30 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
38b40 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
38b50 65 6c 2d 31 35 35 39 0d 0a 53 45 4c 45 43 54 20  el-1559..SELECT 
38b60 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 43  ALL + col1 + - C
38b70 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
38b80 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
38b90 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
38ba0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
38bb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38bc0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
38bd0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  + col2 * col1 + 
38be0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
38bf0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
38c00 2d 2d 2d 2d 0d 0a 31 35 39 33 0d 0a 36 36 33 0d  ----..1593..663.
38c10 0a 38 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .868....query I 
38c20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
38c30 41 4c 4c 20 2b 20 2b 20 28 20 63 6f 6c 30 20 29  ALL + + ( col0 )
38c40 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30   + col1 * + col0
38c50 20 46 52 4f