sqllogictest
Hex Artifact Content
Not logged in

Artifact 7458733ae7d324303607245b0058b7d7c18df388:


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 2d 20 31 31 20  rt..SELECT - 11 
02e0: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
02f0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
0300: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 32 32 0d  ..----..-10..22.
0310: 0a 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .71....query I r
0320: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
0330: 49 53 54 49 4e 43 54 20 2b 20 35 37 20 2a 20 63  ISTINCT + 57 * c
0340: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
0350: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31   cor0..----..171
0360: 0d 0a 33 36 34 38 0d 0a 34 35 36 30 0d 0a 0d 0a  ..3648..4560....
0370: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
0380: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
0390: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
03a0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
03b0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
03c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
03d0: 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 36 35   DISTINCT - - 65
03e0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
03f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  AS cor0..----..6
0400: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
0410: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
0420: 20 63 6f 6c 31 20 2b 20 2b 20 28 20 2b 20 74 61   col1 + + ( + ta
0430: 62 30 2e 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 31  b0.col1 ) * col1
0440: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
0450: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 38 32 0d 0a  b0..----..7482..
0460: 38 33 37 32 0d 0a 39 35 30 36 0d 0a 0d 0a 71 75  8372..9506....qu
0470: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0480: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
0490: 6f 6c 30 20 2b 20 35 36 20 41 53 20 63 6f 6c 31  ol0 + 56 AS col1
04a0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
04b0: 0d 0a 31 32 30 0d 0a 31 33 36 0d 0a 35 39 0d 0a  ..120..136..59..
04c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
04d0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35 35  t..SELECT ALL 55
04e0: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 20   FROM tab1 cor0 
04f0: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20  CROSS JOIN tab2 
0500: 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
0510: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
0520: 74 6f 20 31 36 32 36 62 64 33 30 30 38 61 62 64  to 1626bd3008abd
0530: 39 66 31 38 63 63 38 38 63 64 65 63 66 37 62 36  9f18cc88cdecf7b6
0540: 34 64 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  4d0....query I r
0550: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
0560: 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 63   col1 * col2 + c
0570: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  ol2 * - col0 FRO
0580: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
0590: 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32 30 34 36 0d  ----..164..2046.
05a0: 0a 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .62....onlyif my
05b0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
05c0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
05d0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
05e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
05f0: 65 6c 2d 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63  el-7..SELECT + c
0600: 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 46 52 4f  ol1 DIV col0 FRO
0610: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
0620: 2d 0d 0a 31 0d 0a 32 0d 0a 33 0d 0a 0d 0a 73 6b  -..1..2..3....sk
0630: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
0640: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
0650: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
0660: 65 6c 2d 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63  el-7..SELECT + c
0670: 6f 6c 31 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 / col0 FROM 
0680: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
0690: 0a 31 0d 0a 32 0d 0a 33 0d 0a 0d 0a 6f 6e 6c 79  .1..2..3....only
06a0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
06b0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
06c0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
06d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
06e0: 74 20 6c 61 62 65 6c 2d 38 0d 0a 53 45 4c 45 43  t label-8..SELEC
06f0: 54 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20  T cor0.col1 DIV 
0700: 28 20 2b 20 39 35 20 29 20 2b 20 63 6f 6c 31 20  ( + 95 ) + col1 
0710: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
0720: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
0730: 0a 38 36 0d 0a 39 31 0d 0a 39 38 0d 0a 0d 0a 73  .86..91..98....s
0740: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
0750: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
0760: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
0770: 62 65 6c 2d 38 0d 0a 53 45 4c 45 43 54 20 63 6f  bel-8..SELECT co
0780: 72 30 2e 63 6f 6c 31 20 2f 20 28 20 2b 20 39 35  r0.col1 / ( + 95
0790: 20 29 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   ) + col1 AS col
07a0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
07b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39  or0..----..86..9
07c0: 31 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  1..98....query I
07d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
07e0: 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   - + cor0.col0 +
07f0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 38   - cor0.col0 * 8
0800: 36 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  6 * col2 AS col2
0810: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
0820: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 33 35  r0..----..-13935
0830: 0d 0a 2d 33 31 33 37 39 32 0d 0a 2d 36 36 30 35  ..-313792..-6605
0840: 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
0850: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
0860: 53 54 49 4e 43 54 20 2b 20 2d 20 39 39 20 2b 20  STINCT + - 99 + 
0870: 38 35 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  85 + col2 AS col
0880: 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
0890: 0d 0a 2d 2d 2d 2d 0d 0a 34 30 0d 0a 34 33 0d 0a  ..----..40..43..
08a0: 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
08b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
08c0: 6c 32 20 2b 20 2b 20 28 20 63 6f 6c 32 20 29 20  l2 + + ( col2 ) 
08d0: 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  * + col2 AS col0
08e0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
08f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 32 0d 0a  r0..----..1482..
0900: 37 30 32 0d 0a 37 35 36 0d 0a 0d 0a 71 75 65 72  702..756....quer
0910: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0920: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
0930: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a   col1 * + col2 *
0940: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
0950: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
0960: 36 33 30 34 0d 0a 33 36 35 30 37 0d 0a 35 37 36  6304..36507..576
0970: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
0980: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
0990: 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a   - col2 + col2 *
09a0: 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46   + col1 * col2 F
09b0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
09c0: 0d 0a 2d 2d 2d 2d 0d 0a 32 32 35 37 32 0d 0a 32  ..----..22572..2
09d0: 34 35 31 30 0d 0a 33 39 38 35 38 0d 0a 0d 0a 71  4510..39858....q
09e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
09f0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
0a00: 2d 20 38 39 20 46 52 4f 4d 20 74 61 62 31 20 63  - 89 FROM tab1 c
0a10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 39 0d 0a  or0..----..-89..
0a20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0a30: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28 20  t..SELECT + - ( 
0a40: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 41 53  - cor0.col1 ) AS
0a50: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
0a60: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
0a70: 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65  7..31..59....que
0a80: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0a90: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 38  LECT DISTINCT 98
0aa0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
0ab0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b1 cor0..----..9
0ac0: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
0ad0: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
0ae0: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
0af0: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
0b00: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
0b10: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37  rowsort label-17
0b20: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
0b30: 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  T CAST( NULL AS 
0b40: 53 49 47 4e 45 44 20 29 20 2f 20 2b 20 36 33 20  SIGNED ) / + 63 
0b50: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20  + col0 * col1 + 
0b60: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
0b70: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
0b80: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
0b90: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
0ba0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
0bb0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 0d 0a 53  sort label-17..S
0bc0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43  ELECT DISTINCT C
0bd0: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
0be0: 54 45 47 45 52 20 29 20 2f 20 2b 20 36 33 20 2b  TEGER ) / + 63 +
0bf0: 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63   col0 * col1 + c
0c00: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
0c10: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
0c20: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  L....skipif post
0c30: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
0c40: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
0c50: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
0c60: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
0c70: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0c80: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
0c90: 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   + + col2 * - co
0ca0: 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l0 + - cor0.col1
0cb0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
0cc0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
0cd0: 32 30 30 39 0d 0a 2d 32 31 33 0d 0a 2d 32 39 34  2009..-213..-294
0ce0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
0cf0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
0d00: 20 63 6f 72 31 2e 63 6f 6c 30 20 41 53 20 63 6f   cor1.col0 AS co
0d10: 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
0d20: 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b0 AS cor0, tab2
0d30: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
0d40: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
0d50: 67 20 74 6f 20 31 65 31 66 31 30 39 35 33 65 62  g to 1e1f10953eb
0d60: 38 65 66 66 65 39 62 32 30 65 37 34 36 66 38 61  8effe9b20e746f8a
0d70: 37 66 64 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49  7fd83....query I
0d80: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0d90: 20 41 4c 4c 20 2b 20 33 32 20 2d 20 2b 20 63 6f   ALL + 32 - + co
0da0: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
0db0: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
0dc0: 0a 31 39 0d 0a 32 32 0d 0a 36 0d 0a 0d 0a 71 75  .19..22..6....qu
0dd0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0de0: 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c  ELECT col2 + col
0df0: 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  1 + - col2 FROM 
0e00: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
0e10: 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a  --..86..91..97..
0e20: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
0e30: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
0e40: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
0e50: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
0e60: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
0e70: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0e80: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
0e90: 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 63 6f 6c 31  col1 + col0 col1
0ea0: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
0eb0: 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a  .----..-24..19..
0ec0: 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
0ed0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
0ee0: 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  b1.col1 AS col2 
0ef0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
0f00: 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
0f10: 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
0f20: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 36 36  s hashing to 366
0f30: 65 63 35 33 39 61 66 30 66 33 37 62 64 31 35 31  ec539af0f37bd151
0f40: 39 62 63 35 36 38 66 33 64 36 37 37 35 0d 0a 0d  9bc568f3d6775...
0f50: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0f60: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
0f70: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  + cor0.col2 * co
0f80: 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
0f90: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
0fa0: 0a 31 33 36 35 0d 0a 35 39 38 0d 0a 37 32 32 0d  .1365..598..722.
0fb0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
0fc0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
0fd0: 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  0 * + cor0.col1 
0fe0: 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
0ff0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1000: 2d 32 33 34 0d 0a 2d 34 30 39 36 30 0d 0a 2d 38  -234..-40960..-8
1010: 33 32 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  3200....skipif p
1020: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1030: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1040: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1050: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1060: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1070: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1080: 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  T + col1 + col0 
1090: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
10a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
10b0: 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71  0..132..180....q
10c0: 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
10d0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46  ..SELECT ALL * F
10e0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
10f0: 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20   WHERE NOT NULL 
1100: 4e 4f 54 20 42 45 54 57 45 45 4e 20 2d 20 63 6f  NOT BETWEEN - co
1110: 6c 31 20 2b 20 63 6f 6c 30 20 41 4e 44 20 4e 55  l1 + col0 AND NU
1120: 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72  LL..----....quer
1130: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1140: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b  ECT ALL col1 * +
1150: 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
1160: 74 61 62 31 20 41 53 20 63 6f 72 30 20 57 48 45  tab1 AS cor0 WHE
1170: 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c 3e 20 4e  RE NOT NULL <> N
1180: 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ULL..----....que
1190: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11a0: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  LECT + col2 + - 
11b0: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col2 * col0 FROM
11c0: 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20   tab1 WHERE NOT 
11d0: 28 20 4e 55 4c 4c 20 29 20 42 45 54 57 45 45 4e  ( NULL ) BETWEEN
11e0: 20 2d 20 63 6f 6c 30 20 41 4e 44 20 63 6f 6c 32   - col0 AND col2
11f0: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
1200: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1210: 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  T - col2 * col0 
1220: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
1230: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 30 39 0d 0a 2d  ..----..-7209..-
1240: 37 36 38 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  768..0....onlyif
1250: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1260: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1270: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1280: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1290: 6c 61 62 65 6c 2d 33 31 0d 0a 53 45 4c 45 43 54  label-31..SELECT
12a0: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
12b0: 20 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20 63   DIV + col2 AS c
12c0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
12d0: 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ---..0....skipif
12e0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
12f0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1300: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
1310: 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
1320: 43 54 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f  CT + col1 / + co
1330: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
1340: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  tab1..----..0...
1350: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1360: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
1370: 31 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  1 - - col2 FROM 
1380: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1390: 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a  --..55..58..85..
13a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13b0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
13c0: 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63  col2 + col1 AS c
13d0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
13e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33  r0..----..-21..3
13f0: 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3..4....query I 
1400: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1410: 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63  ALL + col2 + + c
1420: 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 * col0 FROM 
1430: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1440: 2d 2d 0d 0a 34 31 35 33 0d 0a 36 33 0d 0a 36 34  --..4153..63..64
1450: 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
1460: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1470: 4c 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  L col2 + - col1 
1480: 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
1490: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
14a0: 0d 0a 31 35 36 30 0d 0a 36 38 34 0d 0a 38 36 34  ..1560..684..864
14b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
14c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
14d0: 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  - - col0 * + col
14e0: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
14f0: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
1500: 34 39 0d 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a  49..6084..6241..
1510: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1520: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1530: 43 54 20 63 6f 6c 30 20 2a 20 2d 20 74 61 62 30  CT col0 * - tab0
1540: 2e 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20  .col1 - col0 AS 
1550: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
1560: 2d 2d 2d 2d 0d 0a 2d 32 30 38 38 0d 0a 2d 33 34  ----..-2088..-34
1570: 33 30 0d 0a 2d 38 31 38 38 0d 0a 0d 0a 71 75 65  30..-8188....que
1580: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1590: 4c 45 43 54 20 41 4c 4c 20 35 20 2d 20 2b 20 63  LECT ALL 5 - + c
15a0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
15b0: 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 35 32 0d 0a 2d  ---..-49..-52..-
15c0: 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  91....query I ro
15d0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
15e0: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
15f0: 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63 6f 6c 30  col0 + tab2.col0
1600: 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   * - col1 + col1
1610: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1620: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 35 0d 0a  b2..----..-375..
1630: 2d 34 33 32 38 0d 0a 2d 36 35 37 31 0d 0a 0d 0a  -4328..-6571....
1640: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1650: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b  .SELECT col2 * +
1660: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a   col2 + + col1 *
1670: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
1680: 0a 2d 2d 2d 2d 0d 0a 31 35 36 36 0d 0a 32 30 39  .----..1566..209
1690: 30 0d 0a 32 32 31 30 0d 0a 0d 0a 71 75 65 72 79  0..2210....query
16a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16b0: 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  CT - col1 + col0
16c0: 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f   * tab0.col0 FRO
16d0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab0..----..11
16e0: 32 38 0d 0a 34 39 30 0d 0a 37 38 33 30 0d 0a 0d  28..490..7830...
16f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1700: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
1710: 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  + + col2 * col2 
1720: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1730: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1740: 0a 31 34 32 37 0d 0a 36 31 37 0d 0a 36 39 38 0d  .1427..617..698.
1750: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1760: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
1770: 31 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62  1 - col0 * + tab
1780: 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2.col2 FROM tab2
1790: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 37 0d 0a 2d  ..----..-2087..-
17a0: 32 32 30 0d 0a 2d 33 30 31 39 0d 0a 0d 0a 71 75  220..-3019....qu
17b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17c0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 31  ELECT ALL + tab1
17d0: 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2a  .col1 * + col0 *
17e0: 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63 6f 6c   tab1.col0 + col
17f0: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
1800: 2d 0d 0a 32 33 37 0d 0a 34 31 30 32 34 0d 0a 38  -..237..41024..8
1810: 33 32 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3280....query I 
1820: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1830: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  - cor0.col1 FROM
1840: 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
1850: 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53  OSS JOIN tab0 AS
1860: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
1870: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1880: 20 62 32 33 34 37 39 38 64 34 37 30 36 33 31 34   b234798d4706314
1890: 62 61 31 34 65 61 61 64 35 33 39 64 30 61 61 38  ba14eaad539d0aa8
18a0: 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
18b0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
18c0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
18d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
18e0: 20 2d 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 32   - + CAST ( col2
18f0: 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20   AS REAL ) FROM 
1900: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a  tab0..----..-9..
1910: 33 34 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49  34..7....query I
1920: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1930: 20 41 4c 4c 20 35 20 41 53 20 63 6f 6c 32 20 46   ALL 5 AS col2 F
1940: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41  ROM tab1, tab2 A
1950: 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72  S cor0, tab2 cor
1960: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
1970: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36 37  es hashing to 67
1980: 39 37 64 34 30 30 39 39 30 32 33 37 37 39 62 38  97d40099023779b8
1990: 39 66 65 62 36 32 37 64 39 34 61 33 65 37 0d 0a  9feb627d94a3e7..
19a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19b0: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
19c0: 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 63 6f   + ( col0 ) * co
19d0: 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
19e0: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  2 cor0..----..13
19f0: 38 31 0d 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d  81..244..4628...
1a00: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1a10: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1a20: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a30: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1a40: 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20   CAST ( col2 AS 
1a50: 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 32  REAL ) FROM tab2
1a60: 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a  ..----..26..27..
1a70: 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
1a80: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1a90: 2b 20 63 6f 6c 30 20 2a 20 37 39 20 2b 20 63 6f  + col0 * 79 + co
1aa0: 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32  r0.col2 + - col2
1ab0: 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
1ac0: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
1ad0: 2d 32 36 36 37 0d 0a 35 31 33 0d 0a 39 37 35 0d  -2667..513..975.
1ae0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1af0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
1b00: 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29  ol2 + ( - col2 )
1b10: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1b20: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1b30: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c  ..0..0..0....onl
1b40: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1b50: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1b60: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1b70: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1b80: 72 74 20 6c 61 62 65 6c 2d 35 32 0d 0a 53 45 4c  rt label-52..SEL
1b90: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1ba0: 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56  ol2 + + col2 DIV
1bb0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
1bc0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1bd0: 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39  .----..55..58..9
1be0: 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  7....skipif mysq
1bf0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1c00: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1c10: 6f 72 74 20 6c 61 62 65 6c 2d 35 32 0d 0a 53 45  ort label-52..SE
1c20: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1c30: 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2f 20  col2 + + col2 / 
1c40: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
1c50: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1c60: 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37  ----..55..58..97
1c70: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1c80: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1c90: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1ca0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1cb0: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1cc0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33 0d  owsort label-53.
1cd0: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32  .SELECT + + col2
1ce0: 20 2b 20 39 38 20 2a 20 2b 20 63 6f 72 30 2e 63   + 98 * + cor0.c
1cf0: 6f 6c 31 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  ol1 + CAST( NULL
1d00: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
1d10: 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  or0.col2 * + col
1d20: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
1d30: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1d40: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
1d50: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
1d60: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1d70: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1d80: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33 0d 0a  wsort label-53..
1d90: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20  SELECT + + col2 
1da0: 2b 20 39 38 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  + 98 * + cor0.co
1db0: 6c 31 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  l1 + CAST ( NULL
1dc0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
1dd0: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f  cor0.col2 * + co
1de0: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
1df0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1e00: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
1e10: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
1e20: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e30: 2b 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a  + + ( - col1 ) *
1e40: 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 46   - col0 - col1 F
1e50: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1e60: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 36 0d 0a 31 38  ..----..1326..18
1e70: 36 0d 0a 34 35 34 33 0d 0a 0d 0a 71 75 65 72 79  6..4543....query
1e80: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e90: 43 54 20 2b 20 39 37 20 2b 20 2b 20 37 39 20 2a  CT + 97 + + 79 *
1ea0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
1eb0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 36  OM tab0..----..6
1ec0: 38 39 31 0d 0a 37 32 38 36 0d 0a 37 37 36 30 0d  891..7286..7760.
1ed0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ee0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62  rt..SELECT - tab
1ef0: 32 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  2.col2 + - col1 
1f00: 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20 46 52 4f  + - ( col2 ) FRO
1f10: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
1f20: 31 31 0d 0a 2d 38 35 0d 0a 2d 39 33 0d 0a 0d 0a  11..-85..-93....
1f30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f40: 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63  .SELECT + tab0.c
1f50: 6f 6c 31 20 2d 20 2b 20 74 61 62 30 2e 63 6f 6c  ol1 - + tab0.col
1f60: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
1f70: 2d 0d 0a 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a  -..53..9..96....
1f80: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1f90: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1fa0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1fb0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1fc0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1fd0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fe0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b   DISTINCT col2 +
1ff0: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 63   col1 * + col0 c
2000: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
2010: 2d 2d 2d 0d 0a 32 30 39 37 0d 0a 33 33 39 36 0d  ---..2097..3396.
2020: 0a 38 31 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .8181....query I
2030: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2040: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
2050: 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 2d  .col1 + col0 + -
2060: 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   ( cor0.col1 + c
2070: 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol0 ) AS col1 FR
2080: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
2090: 2d 2d 0d 0a 2d 32 30 0d 0a 2d 32 36 0d 0a 2d 35  --..-20..-26..-5
20a0: 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
20b0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
20c0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
20d0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
20e0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
20f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2100: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 35 33 20 63  ELECT ALL - 53 c
2110: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2120: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33   cor0..----..-53
2130: 0d 0a 2d 35 33 0d 0a 2d 35 33 0d 0a 0d 0a 6f 6e  ..-53..-53....on
2140: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2150: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2160: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2170: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2180: 6f 72 74 20 6c 61 62 65 6c 2d 36 31 0d 0a 53 45  ort label-61..SE
2190: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
21a0: 6c 31 20 44 49 56 20 63 6f 6c 30 20 2b 20 2b 20  l1 DIV col0 + + 
21b0: 28 20 2b 20 33 36 20 29 20 41 53 20 63 6f 6c 31  ( + 36 ) AS col1
21c0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
21d0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 34 34  r0..----..36..44
21e0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
21f0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2200: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2210: 72 74 20 6c 61 62 65 6c 2d 36 31 0d 0a 53 45 4c  rt label-61..SEL
2220: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
2230: 31 20 2f 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2b  1 / col0 + + ( +
2240: 20 33 36 20 29 20 41 53 20 63 6f 6c 31 20 46 52   36 ) AS col1 FR
2250: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2260: 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 34 34 0d 0a 0d  .----..36..44...
2270: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2280: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2290: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
22a0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
22b0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
22c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22d0: 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20  T col1 + col2 * 
22e0: 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col1 col0 FROM t
22f0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2300: 2d 0d 0a 31 39 34 0d 0a 32 39 32 34 0d 0a 37 35  -..194..2924..75
2310: 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  53....onlyif mys
2320: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2330: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2340: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2350: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2360: 6c 2d 36 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  l-63..SELECT ALL
2370: 20 2b 20 2b 20 63 6f 6c 31 20 44 49 56 20 28 20   + + col1 DIV ( 
2380: 37 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  7 ) AS col2 FROM
2390: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
23a0: 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 33 0d 0a 0d 0a  ---..1..1..3....
23b0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
23c0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
23d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
23e0: 61 62 65 6c 2d 36 33 0d 0a 53 45 4c 45 43 54 20  abel-63..SELECT 
23f0: 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 28  ALL + + col1 / (
2400: 20 37 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f   7 ) AS col2 FRO
2410: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2420: 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 33 0d 0a 0d  ----..1..1..3...
2430: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2440: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2450: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2460: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2470: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2480: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2490: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
24a0: 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  * + col0 + + col
24b0: 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2 col2 FROM tab2
24c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24d0: 31 33 38 31 0d 0a 32 34 34 0d 0a 34 36 32 38 0d  1381..244..4628.
24e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24f0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2500: 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  NCT - cor0.col1 
2510: 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  * - col0 AS col0
2520: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2530: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a  r0..----..2064..
2540: 33 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 6f 6e  3395..8099....on
2550: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2560: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2570: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2580: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2590: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25a0: 20 6c 61 62 65 6c 2d 36 36 0d 0a 53 45 4c 45 43   label-66..SELEC
25b0: 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  T cor0.col1 * - 
25c0: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
25d0: 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
25e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25f0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
2600: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2610: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2620: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2630: 72 74 20 6c 61 62 65 6c 2d 36 36 0d 0a 53 45 4c  rt label-66..SEL
2640: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  ECT cor0.col1 * 
2650: 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
2660: 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
2670: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2680: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2690: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
26a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26b0: 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c  DISTINCT - - col
26c0: 31 20 2a 20 34 36 20 41 53 20 63 6f 6c 31 20 46  1 * 46 AS col1 F
26d0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26e0: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 0d 0a 34 36  ..----..1196..46
26f0: 30 0d 0a 35 39 38 0d 0a 0d 0a 71 75 65 72 79 20  0..598....query 
2700: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2710: 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  T + - col1 * col
2720: 32 20 2b 20 38 37 20 2a 20 2d 20 63 6f 6c 32 20  2 + 87 * - col2 
2730: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2740: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 39 36 0d  0..----..-14596.
2750: 0a 2d 31 38 34 0d 0a 2d 35 37 30 39 0d 0a 0d 0a  .-184..-5709....
2760: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2770: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2780: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2790: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
27a0: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2b 20  - cor0.col1 - + 
27b0: 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20 52  CAST ( col2 AS R
27c0: 45 41 4c 20 29 20 41 53 20 63 6f 6c 32 20 46 52  EAL ) AS col2 FR
27d0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
27e0: 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d 35 38 0d  .----..-55..-58.
27f0: 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-85....query I 
2800: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2810: 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  ALL cor0.col2 + 
2820: 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53 20  - ( + col0 ) AS 
2830: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2840: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
2850: 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72  ..16..51....quer
2860: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2870: 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  ECT col2 * cor0.
2880: 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  col1 + cor0.col0
2890: 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
28a0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
28b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a  or0..----..-70..
28c0: 31 33 32 36 0d 0a 32 30 38 0d 0a 0d 0a 6f 6e 6c  1326..208....onl
28d0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
28e0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
28f0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2900: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2910: 72 74 20 6c 61 62 65 6c 2d 37 32 0d 0a 53 45 4c  rt label-72..SEL
2920: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
2930: 31 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20 63  1 DIV + col0 + c
2940: 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol2 * col2 * col
2950: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2960: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 33 35  or0..----..3..35
2970: 39 34 30 0d 0a 35 35 31 33 36 39 0d 0a 0d 0a 73  940..551369....s
2980: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2990: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
29a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
29b0: 62 65 6c 2d 37 32 0d 0a 53 45 4c 45 43 54 20 44  bel-72..SELECT D
29c0: 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2f 20 2b  ISTINCT col1 / +
29d0: 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63   col0 + col2 * c
29e0: 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol2 * col2 FROM 
29f0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2a00: 2d 2d 0d 0a 33 0d 0a 33 35 39 34 30 0d 0a 35 35  --..3..35940..55
2a10: 31 33 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1369....query I 
2a20: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a30: 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 63  ALL - + col0 + c
2a40: 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 32 34 20  or0.col0 * - 24 
2a50: 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  - + col0 FROM ta
2a60: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2a70: 0d 0a 2d 31 36 36 34 0d 0a 2d 32 30 38 30 0d 0a  ..-1664..-2080..
2a80: 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -78....query I r
2a90: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2aa0: 49 53 54 49 4e 43 54 20 38 34 20 2b 20 2b 20 63  ISTINCT 84 + + c
2ab0: 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  ol0 - col0 * - c
2ac0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
2ad0: 2d 2d 2d 0d 0a 31 34 30 0d 0a 36 32 34 36 0d 0a  ---..140..6246..
2ae0: 36 34 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6404....query I 
2af0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b00: 41 4c 4c 20 2d 20 37 33 20 2a 20 2b 20 63 6f 6c  ALL - 73 * + col
2b10: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2b20: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 31  ab2..----..-1241
2b30: 0d 0a 2d 32 32 36 33 0d 0a 2d 34 33 30 37 0d 0a  ..-2263..-4307..
2b40: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2b50: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2b60: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2b70: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2b80: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2b90: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ba0: 43 54 20 41 4c 4c 20 31 33 20 2a 20 2d 20 63 6f  CT ALL 13 * - co
2bb0: 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
2bc0: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a  1..----..-1248..
2bd0: 2d 37 30 32 0d 0a 2d 37 34 31 0d 0a 0d 0a 6f 6e  -702..-741....on
2be0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2bf0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2c00: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2c10: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2c20: 6f 72 74 20 6c 61 62 65 6c 2d 37 37 0d 0a 53 45  ort label-77..SE
2c30: 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20 63 6f  LECT col2 DIV co
2c40: 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
2c50: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2c60: 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .1..1..1....skip
2c70: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2c80: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2c90: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2ca0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2cb0: 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
2cc0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2cd0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2ce0: 6f 72 74 20 6c 61 62 65 6c 2d 37 37 0d 0a 53 45  ort label-77..SE
2cf0: 4c 45 43 54 20 63 6f 6c 32 20 2f 20 63 6f 6c 32  LECT col2 / col2
2d00: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
2d10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2d20: 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20  ..1..1....query 
2d30: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d40: 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 28 20 63  T - col2 + + ( c
2d50: 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2a  ol2 ) * + col2 *
2d60: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
2d70: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2d80: 0a 2d 2d 2d 2d 0d 0a 32 32 35 37 32 0d 0a 32 34  .----..22572..24
2d90: 35 31 30 0d 0a 33 39 38 35 38 0d 0a 0d 0a 71 75  510..39858....qu
2da0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2db0: 45 4c 45 43 54 20 33 36 20 2a 20 63 6f 6c 30 20  ELECT 36 * col0 
2dc0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2dd0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  0 cor0..----..12
2de0: 36 30 0d 0a 33 32 30 34 0d 0a 38 36 34 0d 0a 0d  60..3204..864...
2df0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2e00: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2e10: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2e20: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2e30: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 0d  owsort label-80.
2e40: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32  .SELECT + + col2
2e50: 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74   DIV col2 FROM t
2e60: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2e70: 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b  -..1..1..1....sk
2e80: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2e90: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2ea0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2eb0: 65 6c 2d 38 30 0d 0a 53 45 4c 45 43 54 20 2b 20  el-80..SELECT + 
2ec0: 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 46 52  + col2 / col2 FR
2ed0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2ee0: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a  .----..1..1..1..
2ef0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f00: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28 20  t..SELECT - + ( 
2f10: 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 72 30 2e  col2 ) * + cor0.
2f20: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
2f30: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2f40: 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34  ----..-2838..-74
2f50: 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79  62..-97....query
2f60: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f70: 43 54 20 34 31 20 2a 20 39 31 20 46 52 4f 4d 20  CT 41 * 91 FROM 
2f80: 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
2f90: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
2fa0: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 38  es hashing to f8
2fb0: 34 34 64 36 34 63 61 63 31 38 39 39 33 37 33 66  44d64cac1899373f
2fc0: 33 66 30 31 62 36 37 31 35 61 39 62 37 64 0d 0a  3f01b6715a9b7d..
2fd0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2fe0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2ff0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
3000: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
3010: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
3020: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3030: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
3040: 6c 31 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20 46  l1 * col1 col2 F
3050: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
3060: 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36  -100..-169..-676
3070: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3080: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
3090: 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20  - col0 + col0 * 
30a0: 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 33 38  cor0.col0 + + 38
30b0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
30c0: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
30d0: 32 32 38 0d 0a 35 39 30 0d 0a 37 38 37 30 0d 0a  228..590..7870..
30e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30f0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
3100: 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l2 * col2 AS col
3110: 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
3120: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d  ..----..-1444..-
3130: 36 37 36 0d 0a 2d 37 32 39 0d 0a 0d 0a 71 75 65  676..-729....que
3140: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3150: 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20  LECT - + col0 + 
3160: 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20  ( + cor0.col0 ) 
3170: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  * col2 FROM tab2
3180: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3190: 31 38 32 0d 0a 31 39 35 30 0d 0a 32 39 32 33 0d  182..1950..2923.
31a0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
31b0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
31c0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
31d0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
31e0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
31f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3200: 45 43 54 20 41 4c 4c 20 2d 20 28 20 2b 20 63 6f  ECT ALL - ( + co
3210: 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 32 20 63 6f  l2 ) * + col2 co
3220: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
3230: 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37 36 0d  --..-1444..-676.
3240: 0a 2d 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .-729....query I
3250: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3260: 20 41 4c 4c 20 2d 20 39 30 20 2b 20 2b 20 63 6f   ALL - 90 + + co
3270: 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
3280: 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  2, tab2 AS cor0.
3290: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
32a0: 68 61 73 68 69 6e 67 20 74 6f 20 34 39 36 62 66  hashing to 496bf
32b0: 32 61 36 33 31 37 62 36 64 33 66 31 61 32 62 30  2a6317b6d3f1a2b0
32c0: 34 66 66 37 38 39 39 63 30 62 61 0d 0a 0d 0a 71  4ff7899c0ba....q
32d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32e0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
32f0: 28 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 29 20  ( col1 + col0 ) 
3300: 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 41 53  * - tab2.col1 AS
3310: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
3320: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 38 0d 0a 2d 31  .----..-1178..-1
3330: 36 33 32 0d 0a 2d 38 30 38 33 0d 0a 0d 0a 6f 6e  632..-8083....on
3340: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
3350: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
3360: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
3370: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
3380: 6f 72 74 20 6c 61 62 65 6c 2d 39 30 0d 0a 53 45  ort label-90..SE
3390: 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c  LECT ALL + ( col
33a0: 30 20 29 20 44 49 56 20 2b 20 63 6f 6c 30 20 41  0 ) DIV + col0 A
33b0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
33c0: 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
33d0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
33e0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
33f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3400: 74 20 6c 61 62 65 6c 2d 39 30 0d 0a 53 45 4c 45  t label-90..SELE
3410: 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 30 20  CT ALL + ( col0 
3420: 29 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ) / + col0 AS co
3430: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
3440: 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73  --..1..1..1....s
3450: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
3460: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
3470: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
3480: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
3490: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
34a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34b0: 41 4c 4c 20 2b 20 28 20 63 6f 6c 32 20 29 20 63  ALL + ( col2 ) c
34c0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
34d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
34e0: 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20  33..82....query 
34f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3500: 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 32 20 29  T ALL + ( col2 )
3510: 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 33 20   * + col0 + + 3 
3520: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
3530: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 0d 0a 37 33 30  0..----..38..730
3540: 31 0d 0a 37 39 35 0d 0a 0d 0a 73 6b 69 70 69 66  1..795....skipif
3550: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
3560: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
3570: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
3580: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
3590: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
35a0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
35b0: 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 32 20   cor0.col1 col2 
35c0: 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
35d0: 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
35e0: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
35f0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
3600: 6f 20 64 36 37 31 61 30 36 34 65 32 64 61 37 30  o d671a064e2da70
3610: 39 63 61 34 63 64 66 65 61 33 31 37 62 38 65 38  9ca4cdfea317b8e8
3620: 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
3630: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
3640: 35 33 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  53 * col2 FROM t
3650: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
3660: 2d 0d 0a 32 38 36 32 0d 0a 33 30 32 31 0d 0a 35  -..2862..3021..5
3670: 30 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  088....query I r
3680: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
3690: 4c 4c 20 63 6f 6c 31 20 2a 20 33 31 20 46 52 4f  LL col1 * 31 FRO
36a0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
36b0: 2d 2d 2d 2d 0d 0a 32 36 36 36 0d 0a 32 38 32 31  ----..2666..2821
36c0: 0d 0a 33 30 30 37 0d 0a 0d 0a 71 75 65 72 79 20  ..3007....query 
36d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36e0: 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 28 20 63  T - - col2 * ( c
36f0: 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol2 ) FROM tab0 
3700: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
3710: 0d 0a 31 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a  ..1089..6724....
3720: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3730: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
3740: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46   + col2 * col2 F
3750: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
3760: 0d 0a 2d 2d 2d 2d 0d 0a 32 39 34 32 0d 0a 33 32  ..----..2942..32
3770: 35 39 0d 0a 39 32 32 39 0d 0a 0d 0a 71 75 65 72  59..9229....quer
3780: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3790: 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 2b  ECT - + col0 + +
37a0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
37b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d  cor0..----..-34.
37c0: 0a 2d 37 0d 0a 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-7..9....onlyif
37d0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
37e0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
37f0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
3800: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
3810: 6c 61 62 65 6c 2d 39 39 0d 0a 53 45 4c 45 43 54  label-99..SELECT
3820: 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 35 37   - col2 DIV - 57
3830: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 33 34 20 2a   + col1 * + 34 *
3840: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
3850: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
3860: 35 36 34 36 38 0d 0a 34 35 36 36 32 0d 0a 37 33  56468..45662..73
3870: 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  78....skipif mys
3880: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
3890: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
38a0: 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 0d 0a 53  sort label-99..S
38b0: 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2d  ELECT - col2 / -
38c0: 20 35 37 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 33   57 + col1 * + 3
38d0: 34 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  4 * col0 AS col2
38e0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
38f0: 0d 0a 31 35 36 34 36 38 0d 0a 34 35 36 36 32 0d  ..156468..45662.
3900: 0a 37 33 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .7378....onlyif 
3910: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
3920: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
3930: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
3940: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
3950: 61 62 65 6c 2d 31 30 30 0d 0a 53 45 4c 45 43 54  abel-100..SELECT
3960: 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 44 49 56   col2 + col0 DIV
3970: 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
3980: 31 0d 0a 2d 2d 2d 2d 0d 0a 35 31 0d 0a 35 34 0d  1..----..51..54.
3990: 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .90....skipif my
39a0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
39b0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
39c0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 0d  wsort label-100.
39d0: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63  .SELECT col2 + c
39e0: 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f  ol0 / - col1 FRO
39f0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 31  M tab1..----..51
3a00: 0d 0a 35 34 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72  ..54..90....quer
3a10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3a20: 45 43 54 20 2b 20 37 31 20 2b 20 63 6f 6c 31 20  ECT + 71 + col1 
3a30: 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  * cor0.col2 AS c
3a40: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
3a50: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31   cor0..----..131
3a60: 39 0d 0a 31 34 37 35 0d 0a 36 34 31 0d 0a 0d 0a  9..1475..641....
3a70: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3a80: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30  .SELECT + - col0
3a90: 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   * cor0.col1 * c
3aa0: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
3ab0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
3ac0: 0d 0a 2d 33 36 34 38 30 0d 0a 2d 34 32 31 32 0d  ..-36480..-4212.
3ad0: 0a 2d 39 39 38 34 30 0d 0a 0d 0a 6f 6e 6c 79 69  .-99840....onlyi
3ae0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
3af0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
3b00: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
3b10: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
3b20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
3b30: 62 65 6c 2d 31 30 33 0d 0a 53 45 4c 45 43 54 20  bel-103..SELECT 
3b40: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
3b50: 47 4e 45 44 20 29 20 2b 20 2b 20 37 39 20 46 52  GNED ) + + 79 FR
3b60: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
3b70: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
3b80: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
3b90: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
3ba0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3bb0: 74 20 6c 61 62 65 6c 2d 31 30 33 0d 0a 53 45 4c  t label-103..SEL
3bc0: 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  ECT CAST ( NULL 
3bd0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b  AS INTEGER ) + +
3be0: 20 37 39 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   79 FROM tab1..-
3bf0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
3c00: 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .NULL....onlyif 
3c10: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
3c20: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
3c30: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
3c40: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
3c50: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
3c60: 6c 2d 31 30 34 0d 0a 53 45 4c 45 43 54 20 44 49  l-104..SELECT DI
3c70: 53 54 49 4e 43 54 20 43 41 53 54 28 20 34 32 20  STINCT CAST( 42 
3c80: 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20  * col1 + + col0 
3c90: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
3ca0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
3cb0: 2d 2d 2d 0d 0a 31 30 39 35 0d 0a 34 38 34 0d 0a  ---..1095..484..
3cc0: 36 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  626....skipif my
3cd0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
3ce0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
3cf0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 0d  wsort label-104.
3d00: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
3d10: 20 43 41 53 54 20 28 20 34 32 20 2a 20 63 6f 6c   CAST ( 42 * col
3d20: 31 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e  1 + + col0 AS IN
3d30: 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20  TEGER ) AS col1 
3d40: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
3d50: 0a 31 30 39 35 0d 0a 34 38 34 0d 0a 36 32 36 0d  .1095..484..626.
3d60: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3d70: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 38  rt..SELECT - + 8
3d80: 34 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  4 FROM tab0, tab
3d90: 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  1, tab0 AS cor0.
3da0: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
3db0: 20 68 61 73 68 69 6e 67 20 74 6f 20 30 32 66 31   hashing to 02f1
3dc0: 36 38 38 62 38 36 31 30 38 30 36 63 61 32 38 37  688b8610806ca287
3dd0: 33 39 62 31 37 33 35 66 36 61 65 34 0d 0a 0d 0a  39b1735f6ae4....
3de0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3df0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
3e00: 6c 30 20 2a 20 2d 20 33 39 20 41 53 20 63 6f 6c  l0 * - 39 AS col
3e10: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
3e20: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 35 0d  or0..----..1365.
3e30: 0a 33 34 37 31 0d 0a 39 33 36 0d 0a 0d 0a 6f 6e  .3471..936....on
3e40: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
3e50: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
3e60: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
3e70: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
3e80: 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 0d 0a 53  ort label-107..S
3e90: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 28  ELECT - col1 + (
3ea0: 20 2b 20 63 6f 6c 32 20 29 20 44 49 56 20 2d 20   + col2 ) DIV - 
3eb0: 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
3ec0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
3ed0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a  or0..----..-15..
3ee0: 2d 32 30 0d 0a 2d 32 38 0d 0a 0d 0a 73 6b 69 70  -20..-28....skip
3ef0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
3f00: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
3f10: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
3f20: 2d 31 30 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -107..SELECT - c
3f30: 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29  ol1 + ( + col2 )
3f40: 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41   / - cor0.col1 A
3f50: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
3f60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3f70: 2d 31 35 0d 0a 2d 32 30 0d 0a 2d 32 38 0d 0a 0d  -15..-20..-28...
3f80: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
3f90: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
3fa0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
3fb0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
3fc0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38  owsort label-108
3fd0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
3fe0: 32 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 63  2 + - col2 DIV c
3ff0: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
4000: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
4010: 0d 0a 31 0d 0a 33 32 0d 0a 38 32 0d 0a 0d 0a 73  ..1..32..82....s
4020: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
4030: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
4040: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
4050: 62 65 6c 2d 31 30 38 0d 0a 53 45 4c 45 43 54 20  bel-108..SELECT 
4060: 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  ALL col2 + - col
4070: 32 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  2 / cor0.col0 FR
4080: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
4090: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 32 0d 0a 38 32  .----..1..32..82
40a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
40b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
40c0: 20 2a 20 2d 20 33 34 20 2b 20 2d 20 63 6f 72 30   * - 34 + - cor0
40d0: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
40e0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
40f0: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 33  .----..-1225..-3
4100: 31 31 35 0d 0a 2d 38 34 30 0d 0a 0d 0a 71 75 65  115..-840....que
4110: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4120: 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  LECT - col2 * - 
4130: 36 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  60 + + cor0.col2
4140: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
4150: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 39 34 0d 0a  r0..----..3294..
4160: 33 34 37 37 0d 0a 35 38 35 36 0d 0a 0d 0a 71 75  3477..5856....qu
4170: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4180: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2d  ELECT ALL col1 -
4190: 20 74 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab2.col0 FROM 
41a0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d  tab2..----..-19.
41b0: 0a 2d 36 32 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72  .-62..24....quer
41c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
41d0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
41e0: 6f 6c 32 20 2a 20 2d 20 28 20 63 6f 6c 30 20 29  ol2 * - ( col0 )
41f0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
4200: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
4210: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30  S cor0..----..70
4220: 0d 0a 37 33 38 37 0d 0a 38 31 36 0d 0a 0d 0a 71  ..7387..816....q
4230: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4240: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
4250: 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63  col2 + col0 AS c
4260: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
4270: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 39 0d 0a  r0..----..2919..
4280: 33 33 31 33 0d 0a 39 32 39 36 0d 0a 0d 0a 71 75  3313..9296....qu
4290: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
42a0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
42b0: 20 2b 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 30   + col2 * ( col0
42c0: 20 29 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31   ) + - cor0.col1
42d0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
42e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 0d 0a 33  r0..----..136..3
42f0: 36 33 38 0d 0a 37 36 36 37 0d 0a 0d 0a 6f 6e 6c  638..7667....onl
4300: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
4310: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
4320: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
4330: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
4340: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
4350: 6c 61 62 65 6c 2d 31 31 35 0d 0a 53 45 4c 45 43  label-115..SELEC
4360: 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2a  T ALL - + col2 *
4370: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
4380: 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
4390: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
43a0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
43b0: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
43c0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
43d0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
43e0: 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 0d 0a 53  ort label-115..S
43f0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
4400: 6c 32 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c  l2 * CAST ( NULL
4410: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
4420: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
4430: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
4440: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
4450: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
4460: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
4470: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
4480: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
4490: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
44a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
44b0: 63 6f 6c 32 20 2b 20 33 33 20 63 6f 6c 31 20 46  col2 + 33 col1 F
44c0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
44d0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 30 0d 0a  ..----..-49..0..
44e0: 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  32....query I ro
44f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
4500: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
4510: 28 20 28 20 63 6f 6c 30 20 29 20 29 20 46 52 4f  ( ( col0 ) ) FRO
4520: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
4530: 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d  ----..1343..217.
4540: 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .4602....query I
4550: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4560: 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 31   ALL - cor0.col1
4570: 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 28 20   + - col0 * - ( 
4580: 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32  + col0 ) AS col2
4590: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
45a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 34  r0..----..-17..4
45b0: 30 38 36 0d 0a 36 33 38 37 0d 0a 0d 0a 71 75 65  086..6387....que
45c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
45d0: 4c 45 43 54 20 63 6f 6c 32 20 2a 20 28 20 63 6f  LECT col2 * ( co
45e0: 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l1 ) AS col1 FRO
45f0: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
4600: 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39  -..2838..7462..9
4610: 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
4620: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
4630: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
4640: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
4650: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4660: 2d 31 32 30 0d 0a 53 45 4c 45 43 54 20 63 6f 72  -120..SELECT cor
4670: 30 2e 63 6f 6c 32 20 44 49 56 20 2d 20 39 37 20  0.col2 DIV - 97 
4680: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
4690: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
46a0: 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69  1..33..82....ski
46b0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
46c0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
46d0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
46e0: 6c 2d 31 32 30 0d 0a 53 45 4c 45 43 54 20 63 6f  l-120..SELECT co
46f0: 72 30 2e 63 6f 6c 32 20 2f 20 2d 20 39 37 20 2b  r0.col2 / - 97 +
4700: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
4710: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
4720: 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72  ..33..82....quer
4730: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4740: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 37  ECT DISTINCT + 7
4750: 33 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20  3 + - tab1.col2 
4760: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
4770: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 31 36  1..----..-23..16
4780: 0d 0a 31 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..19....onlyif m
4790: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
47a0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
47b0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
47c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
47d0: 62 65 6c 2d 31 32 32 0d 0a 53 45 4c 45 43 54 20  bel-122..SELECT 
47e0: 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20  DISTINCT col0 + 
47f0: 2b 20 63 6f 6c 32 20 2a 20 31 35 20 44 49 56 20  + col2 * 15 DIV 
4800: 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  - col1 AS col1 F
4810: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
4820: 2d 36 0d 0a 34 36 0d 0a 37 32 0d 0a 0d 0a 73 6b  -6..46..72....sk
4830: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
4840: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
4850: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
4860: 65 6c 2d 31 32 32 0d 0a 53 45 4c 45 43 54 20 44  el-122..SELECT D
4870: 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2b  ISTINCT col0 + +
4880: 20 63 6f 6c 32 20 2a 20 31 35 20 2f 20 2d 20 63   col2 * 15 / - c
4890: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
48a0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d   tab2..----..-6.
48b0: 0a 34 36 0d 0a 37 32 0d 0a 0d 0a 6f 6e 6c 79 69  .46..72....onlyi
48c0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
48d0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
48e0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
48f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4900: 20 6c 61 62 65 6c 2d 31 32 33 0d 0a 53 45 4c 45   label-123..SELE
4910: 43 54 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56 20  CT ALL col2 DIV 
4920: 2b 20 63 6f 6c 32 20 2b 20 28 20 74 61 62 31 2e  + col2 + ( tab1.
4930: 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46  col0 ) AS col1 F
4940: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
4950: 34 0d 0a 36 35 0d 0a 38 31 0d 0a 0d 0a 73 6b 69  4..65..81....ski
4960: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
4970: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
4980: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
4990: 6c 2d 31 32 33 0d 0a 53 45 4c 45 43 54 20 41 4c  l-123..SELECT AL
49a0: 4c 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20  L col2 / + col2 
49b0: 2b 20 28 20 74 61 62 31 2e 63 6f 6c 30 20 29 20  + ( tab1.col0 ) 
49c0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
49d0: 31 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 36 35 0d 0a  1..----..4..65..
49e0: 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
49f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
4a00: 4c 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 2d  L + ( col2 ) * -
4a10: 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b   col1 * - col0 +
4a20: 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41   - col1 - col0 A
4a30: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
4a40: 0d 0a 2d 2d 2d 2d 0d 0a 33 32 36 33 0d 0a 36 36  ..----..3263..66
4a50: 33 39 33 38 0d 0a 36 38 30 30 32 0d 0a 0d 0a 73  3938..68002....s
4a60: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
4a70: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
4a80: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
4a90: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
4aa0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
4ab0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4ac0: 41 4c 4c 20 39 36 20 2d 20 63 6f 6c 31 20 2a 20  ALL 96 - col1 * 
4ad0: 32 33 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  23 col2 FROM tab
4ae0: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 31 0d 0a  2..----..-1261..
4af0: 2d 32 39 35 0d 0a 2d 36 31 37 0d 0a 0d 0a 6f 6e  -295..-617....on
4b00: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
4b10: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
4b20: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
4b30: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
4b40: 6f 72 74 20 6c 61 62 65 6c 2d 31 32 36 0d 0a 53  ort label-126..S
4b50: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 44  ELECT ALL col1 D
4b60: 49 56 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 63 6f  IV - col2 - - co
4b70: 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
4b80: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a 32 32  0..----..-62..22
4b90: 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..88....skipif p
4ba0: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
4bb0: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
4bc0: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
4bd0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
4be0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
4bf0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
4c00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
4c10: 6c 61 62 65 6c 2d 31 32 36 0d 0a 53 45 4c 45 43  label-126..SELEC
4c20: 54 20 41 4c 4c 20 63 6f 6c 31 20 2f 20 2d 20 63  T ALL col1 / - c
4c30: 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30 20 63 6f 6c  ol2 - - col0 col
4c40: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
4c50: 2d 0d 0a 2d 36 32 0d 0a 32 32 0d 0a 38 38 0d 0a  -..-62..22..88..
4c60: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
4c70: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
4c80: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
4c90: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
4ca0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
4cb0: 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  7..SELECT ALL - 
4cc0: 63 6f 6c 31 20 44 49 56 20 32 33 20 2b 20 28 20  col1 DIV 23 + ( 
4cd0: 63 6f 6c 30 20 29 20 2a 20 37 34 20 46 52 4f 4d  col0 ) * 74 FROM
4ce0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 37   tab0..----..177
4cf0: 33 0d 0a 32 35 38 36 0d 0a 36 35 38 33 0d 0a 0d  3..2586..6583...
4d00: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
4d10: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
4d20: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
4d30: 6c 61 62 65 6c 2d 31 32 37 0d 0a 53 45 4c 45 43  label-127..SELEC
4d40: 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2f 20 32  T ALL - col1 / 2
4d50: 33 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 37  3 + ( col0 ) * 7
4d60: 34 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  4 FROM tab0..---
4d70: 2d 0d 0a 31 37 37 33 0d 0a 32 35 38 36 0d 0a 36  -..1773..2586..6
4d80: 35 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  583....query I r
4d90: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
4da0: 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b   col2 * - col1 +
4db0: 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30   + col2 * - col0
4dc0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
4dd0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
4de0: 0d 0a 31 36 34 0d 0a 32 30 34 36 0d 0a 36 32 0d  ..164..2046..62.
4df0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
4e00: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
4e10: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
4e20: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
4e30: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
4e40: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 0d  wsort label-129.
4e50: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
4e60: 6c 30 20 2b 20 2b 20 43 41 53 54 28 20 2d 20 63  l0 + + CAST( - c
4e70: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  ol0 + - col0 AS 
4e80: 53 49 47 4e 45 44 20 29 20 2a 20 28 20 63 6f 6c  SIGNED ) * ( col
4e90: 31 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  1 ) * - col2 FRO
4ea0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
4eb0: 2d 2d 2d 2d 0d 0a 31 30 32 31 34 37 0d 0a 31 31  ----..102147..11
4ec0: 37 32 35 0d 0a 32 33 39 33 38 32 0d 0a 0d 0a 73  725..239382....s
4ed0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
4ee0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
4ef0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
4f00: 62 65 6c 2d 31 32 39 0d 0a 53 45 4c 45 43 54 20  bel-129..SELECT 
4f10: 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 43  ALL + col0 + + C
4f20: 41 53 54 20 28 20 2d 20 63 6f 6c 30 20 2b 20 2d  AST ( - col0 + -
4f30: 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
4f40: 20 29 20 2a 20 28 20 63 6f 6c 31 20 29 20 2a 20   ) * ( col1 ) * 
4f50: 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  - col2 FROM tab2
4f60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4f70: 31 30 32 31 34 37 0d 0a 31 31 37 32 35 0d 0a 32  102147..11725..2
4f80: 33 39 33 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  39382....query I
4f90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4fa0: 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
4fb0: 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  l0 * - col2 + co
4fc0: 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41  l1 * cor0.col0 A
4fd0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
4fe0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4ff0: 2d 33 30 30 38 0d 0a 2d 36 36 34 30 0d 0a 2d 38  -3008..-6640..-8
5000: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
5010: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
5020: 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   - - cor0.col0 +
5030: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
5040: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
5050: 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35  ----..171..36..5
5060: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
5070: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
5080: 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a  TINCT - - col2 *
5090: 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   - col0 AS col2 
50a0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
50b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37  0..----..-35..-7
50c0: 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65  298..-792....que
50d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
50e0: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e  LECT ALL + cor0.
50f0: 63 6f 6c 32 20 2a 20 2d 20 28 20 2b 20 32 32 20  col2 * - ( + 22 
5100: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
5110: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
5120: 2d 0d 0a 2d 31 38 30 34 0d 0a 2d 32 32 0d 0a 2d  -..-1804..-22..-
5130: 37 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  726....onlyif my
5140: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
5150: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
5160: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
5170: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
5180: 65 6c 2d 31 33 34 0d 0a 53 45 4c 45 43 54 20 2b  el-134..SELECT +
5190: 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30   - col0 + - col0
51a0: 20 44 49 56 20 2b 20 34 36 20 46 52 4f 4d 20 74   DIV + 46 FROM t
51b0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
51c0: 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 39 30  -..-24..-35..-90
51d0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
51e0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
51f0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
5200: 72 74 20 6c 61 62 65 6c 2d 31 33 34 0d 0a 53 45  rt label-134..SE
5210: 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  LECT + - col0 + 
5220: 2d 20 63 6f 6c 30 20 2f 20 2b 20 34 36 20 46 52  - col0 / + 46 FR
5230: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
5240: 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d  .----..-24..-35.
5250: 0a 2d 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-90....onlyif m
5260: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
5270: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
5280: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
5290: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
52a0: 62 65 6c 2d 31 33 35 0d 0a 53 45 4c 45 43 54 20  bel-135..SELECT 
52b0: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
52c0: 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 44 49 56 20  col0 * col1 DIV 
52d0: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 72 30  cor0.col2 + cor0
52e0: 2e 63 6f 6c 30 20 44 49 56 20 28 20 63 6f 6c 30  .col0 DIV ( col0
52f0: 20 2a 20 63 6f 6c 30 20 29 20 63 6f 6c 31 20 46   * col0 ) col1 F
5300: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
5310: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 0d  ..----..-1..-10.
5320: 0a 2d 31 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-11....skipif p
5330: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
5340: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
5350: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
5360: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
5370: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
5380: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
5390: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
53a0: 6c 61 62 65 6c 2d 31 33 35 0d 0a 53 45 4c 45 43  label-135..SELEC
53b0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72  T DISTINCT - cor
53c0: 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2f 20  0.col0 * col1 / 
53d0: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 72 30  cor0.col2 + cor0
53e0: 2e 63 6f 6c 30 20 2f 20 28 20 63 6f 6c 30 20 2a  .col0 / ( col0 *
53f0: 20 63 6f 6c 30 20 29 20 63 6f 6c 31 20 46 52 4f   col0 ) col1 FRO
5400: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
5410: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 0d 0a 2d  ----..-1..-10..-
5420: 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  11....query I ro
5430: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
5440: 63 6f 6c 31 20 2a 20 32 33 20 46 52 4f 4d 20 74  col1 * 23 FROM t
5450: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
5460: 2d 0d 0a 31 33 35 37 0d 0a 33 39 31 0d 0a 37 31  -..1357..391..71
5470: 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
5480: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
5490: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
54a0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
54b0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
54c0: 2d 31 33 37 0d 0a 53 45 4c 45 43 54 20 74 61 62  -137..SELECT tab
54d0: 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  0.col0 + - col1 
54e0: 2b 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20 63  + - col1 DIV - c
54f0: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
5500: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   tab0..----..-1.
5510: 0a 2d 36 30 0d 0a 33 35 0d 0a 0d 0a 73 6b 69 70  .-60..35....skip
5520: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
5530: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
5540: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
5550: 2d 31 33 37 0d 0a 53 45 4c 45 43 54 20 74 61 62  -137..SELECT tab
5560: 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  0.col0 + - col1 
5570: 2b 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c  + - col1 / - col
5580: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
5590: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  ab0..----..-1..-
55a0: 36 30 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20  60..35....query 
55b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
55c0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62  T DISTINCT + tab
55d0: 31 2e 63 6f 6c 32 20 2b 20 2b 20 37 38 20 46 52  1.col2 + + 78 FR
55e0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
55f0: 33 32 0d 0a 31 33 35 0d 0a 31 37 34 0d 0a 0d 0a  32..135..174....
5600: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
5610: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
5620: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
5630: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
5640: 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
5650: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
5660: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
5670: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5680: 2b 20 33 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2d  + 3 * - col2 * -
5690: 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 20 28   col0 + - CAST (
56a0: 20 2d 20 63 6f 6c 31 20 41 53 20 52 45 41 4c 20   - col1 AS REAL 
56b0: 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  ) col2 FROM tab0
56c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
56d0: 32 30 32 0d 0a 32 31 39 38 35 0d 0a 32 34 36 32  202..21985..2462
56e0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
56f0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
5700: 49 4e 43 54 20 2d 20 37 31 20 2b 20 2b 20 63 6f  INCT - 71 + + co
5710: 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  r0.col1 AS col0 
5720: 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
5730: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
5740: 31 32 0d 0a 2d 34 30 0d 0a 2d 35 34 0d 0a 0d 0a  12..-40..-54....
5750: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
5760: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
5770: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
5780: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
5790: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
57a0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
57b0: 20 44 49 53 54 49 4e 43 54 20 2b 20 35 38 20 63   DISTINCT + 58 c
57c0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
57d0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
57e0: 2d 0d 0a 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -..58....query I
57f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5800: 20 39 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   99 AS col0 FROM
5810: 20 74 61 62 32 2c 20 74 61 62 32 20 63 6f 72 30   tab2, tab2 cor0
5820: 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
5830: 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
5840: 68 61 73 68 69 6e 67 20 74 6f 20 30 35 65 61 31  hashing to 05ea1
5850: 38 32 66 64 36 30 33 36 63 37 66 35 65 30 65 61  82fd6036c7f5e0ea
5860: 30 38 66 63 30 36 31 63 63 36 37 0d 0a 0d 0a 71  08fc061cc67....q
5870: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
5880: 53 45 4c 45 43 54 20 2b 20 38 30 20 41 53 20 63  SELECT + 80 AS c
5890: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
58a0: 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
58b0: 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
58c0: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
58d0: 6e 67 20 74 6f 20 36 64 64 35 30 33 38 62 65 37  ng to 6dd5038be7
58e0: 31 64 66 66 61 38 32 66 35 63 65 62 61 37 38 37  1dffa82f5ceba787
58f0: 63 61 61 62 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  caab91....onlyif
5900: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
5910: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
5920: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
5930: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
5940: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
5950: 65 6c 2d 31 34 34 0d 0a 53 45 4c 45 43 54 20 2b  el-144..SELECT +
5960: 20 2b 20 32 35 20 2a 20 63 6f 6c 30 20 2b 20 63   + 25 * col0 + c
5970: 6f 6c 32 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  ol2 + CAST( NULL
5980: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
5990: 20 36 34 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f   64 / - col0 FRO
59a0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
59b0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
59c0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
59d0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
59e0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
59f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
5a00: 34 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 32  44..SELECT + + 2
5a10: 35 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  5 * col0 + col2 
5a20: 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
5a30: 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 36   INTEGER ) * - 6
5a40: 34 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  4 / - col0 FROM 
5a50: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
5a60: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
5a70: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
5a80: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5a90: 41 4c 4c 20 63 6f 6c 32 20 2a 20 28 20 2b 20 63  ALL col2 * ( + c
5aa0: 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol0 ) AS col0 FR
5ab0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
5ac0: 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d  .----..35..7298.
5ad0: 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .792....query I 
5ae0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5af0: 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20  DISTINCT col1 * 
5b00: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f  - cor0.col0 + co
5b10: 6c 32 20 2b 20 2d 20 36 37 20 2a 20 2d 20 32 30  l2 + - 67 * - 20
5b20: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
5b30: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
5b40: 32 30 35 34 0d 0a 2d 36 36 37 37 0d 0a 2d 36 39  2054..-6677..-69
5b50: 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
5b60: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
5b70: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
5b80: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
5b90: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
5ba0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5bb0: 45 4c 45 43 54 20 2b 20 36 30 20 63 6f 6c 30 20  ELECT + 60 col0 
5bc0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
5bd0: 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 0d 0a 36 30 0d  0..----..60..60.
5be0: 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .60....query I r
5bf0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
5c00: 20 32 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c   21 * + cor0.col
5c10: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
5c20: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 32 0d  or0..----..1722.
5c30: 0a 32 31 0d 0a 36 39 33 0d 0a 0d 0a 71 75 65 72  .21..693....quer
5c40: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5c50: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b  ECT ALL + col2 +
5c60: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
5c70: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab2..----..5
5c80: 32 0d 0a 35 34 0d 0a 37 36 0d 0a 0d 0a 71 75 65  2..54..76....que
5c90: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5ca0: 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  LECT cor0.col1 *
5cb0: 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2b 20 31   cor0.col0 - + 1
5cc0: 33 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  3 FROM tab2, tab
5cd0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
5ce0: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
5cf0: 67 20 74 6f 20 35 38 32 66 39 64 65 35 38 65 33  g to 582f9de58e3
5d00: 30 35 33 65 66 32 62 37 31 33 36 66 31 36 63 65  053ef2b7136f16ce
5d10: 36 32 66 65 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  62fe9....onlyif 
5d20: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
5d30: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
5d40: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
5d50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5d60: 61 62 65 6c 2d 31 35 31 0d 0a 53 45 4c 45 43 54  abel-151..SELECT
5d70: 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20   DISTINCT - ( + 
5d80: 63 6f 6c 31 20 29 20 44 49 56 20 2b 20 28 20 63  col1 ) DIV + ( c
5d90: 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
5da0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
5db0: 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69  .----..-1....ski
5dc0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
5dd0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
5de0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
5df0: 6c 2d 31 35 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-151..SELECT DI
5e00: 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63 6f 6c  STINCT - ( + col
5e10: 31 20 29 20 2f 20 2b 20 28 20 63 6f 6c 31 20 29  1 ) / + ( col1 )
5e20: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
5e30: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
5e40: 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-1....query I 
5e50: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5e60: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
5e70: 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46 52  * col2 + col2 FR
5e80: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
5e90: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 33 35  .----..-108..-35
5ea0: 39 31 0d 0a 2d 37 35 38 34 0d 0a 0d 0a 71 75 65  91..-7584....que
5eb0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5ec0: 4c 45 43 54 20 2b 20 2d 20 35 31 20 2a 20 63 6f  LECT + - 51 * co
5ed0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
5ee0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32  cor0..----..-132
5ef0: 36 0d 0a 2d 31 33 37 37 0d 0a 2d 31 39 33 38 0d  6..-1377..-1938.
5f00: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5f10: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
5f20: 32 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  2 * - col2 * col
5f30: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
5f40: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 38 30  or0..----..11980
5f50: 38 0d 0a 33 32 34 39 30 0d 0a 37 35 38 31 36 0d  8..32490..75816.
5f60: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
5f70: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
5f80: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
5f90: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
5fa0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
5fb0: 35 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  55..SELECT ALL -
5fc0: 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 72 30   col2 DIV + cor0
5fd0: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
5fe0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
5ff0: 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35 0d 0a 2d  .----..-2..-5..-
6000: 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  7....skipif mysq
6010: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
6020: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
6030: 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 0d 0a 53  ort label-155..S
6040: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
6050: 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41   / + cor0.col1 A
6060: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
6070: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6080: 2d 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 71 75  -2..-5..-7....qu
6090: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
60a0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
60b0: 20 2d 20 28 20 63 6f 6c 32 20 29 20 2d 20 63 6f   - ( col2 ) - co
60c0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
60d0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34  cor0..----..-104
60e0: 0d 0a 2d 31 31 37 0d 0a 2d 33 34 0d 0a 0d 0a 71  ..-117..-34....q
60f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6100: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20  SELECT + col2 - 
6110: 2d 20 63 6f 6c 31 20 2a 20 37 20 46 52 4f 4d 20  - col1 * 7 FROM 
6120: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
6130: 2d 2d 0d 0a 31 32 37 0d 0a 31 38 37 0d 0a 32 33  --..127..187..23
6140: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
6150: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
6160: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
6170: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
6180: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
6190: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
61a0: 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  8..SELECT col1 *
61b0: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44   CAST( NULL AS D
61c0: 45 43 49 4d 41 4c 20 29 20 2d 20 63 6f 6c 30 20  ECIMAL ) - col0 
61d0: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  * - cor0.col1 FR
61e0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
61f0: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
6200: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
6210: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
6220: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
6230: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
6240: 31 35 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  158..SELECT col1
6250: 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   * CAST ( NULL A
6260: 53 20 52 45 41 4c 20 29 20 2d 20 63 6f 6c 30 20  S REAL ) - col0 
6270: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  * - cor0.col1 FR
6280: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
6290: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
62a0: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
62b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
62c0: 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 28 20  CT - - col2 * ( 
62d0: 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 32 20  col2 ) * + col2 
62e0: 2d 20 2b 20 32 39 20 2a 20 2d 20 63 6f 6c 32 20  - + 29 * - col2 
62f0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
6300: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
6310: 0a 33 30 0d 0a 33 36 38 39 34 0d 0a 35 35 33 37  .30..36894..5537
6320: 34 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  46....onlyif mys
6330: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
6340: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
6350: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
6360: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
6370: 6c 2d 31 36 30 0d 0a 53 45 4c 45 43 54 20 41 4c  l-160..SELECT AL
6380: 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  L - + col1 + + c
6390: 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 41 53 20  ol0 DIV col0 AS 
63a0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
63b0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
63c0: 36 0d 0a 2d 33 30 0d 0a 2d 35 38 0d 0a 0d 0a 73  6..-30..-58....s
63d0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
63e0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
63f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
6400: 62 65 6c 2d 31 36 30 0d 0a 53 45 4c 45 43 54 20  bel-160..SELECT 
6410: 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b  ALL - + col1 + +
6420: 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 41 53 20   col0 / col0 AS 
6430: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
6440: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
6450: 36 0d 0a 2d 33 30 0d 0a 2d 35 38 0d 0a 0d 0a 71  6..-30..-58....q
6460: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6470: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20  SELECT + + col1 
6480: 2b 20 63 6f 6c 32 20 2a 20 32 30 20 2b 20 63 6f  + col2 * 20 + co
6490: 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
64a0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
64b0: 0a 36 30 32 0d 0a 36 33 38 0d 0a 37 39 34 0d 0a  .602..638..794..
64c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
64d0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
64e0: 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  l0 - - col2 * - 
64f0: 32 33 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  23 FROM tab2 AS 
6500: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 30  cor0..----..-520
6510: 0d 0a 2d 36 31 34 0d 0a 2d 37 39 35 0d 0a 0d 0a  ..-614..-795....
6520: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6530: 0a 53 45 4c 45 43 54 20 63 6f 72 31 2e 63 6f 6c  .SELECT cor1.col
6540: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
6550: 61 62 30 20 63 6f 72 30 20 43 52 4f 53 53 20 4a  ab0 cor0 CROSS J
6560: 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31  OIN tab2 AS cor1
6570: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
6580: 20 68 61 73 68 69 6e 67 20 74 6f 20 35 39 31 31   hashing to 5911
6590: 62 61 63 35 31 34 34 31 66 34 66 66 36 34 30 62  bac51441f4ff640b
65a0: 32 61 32 62 37 32 31 65 61 38 65 33 0d 0a 0d 0a  2a2b721ea8e3....
65b0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
65c0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
65d0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
65e0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
65f0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 34 0d  wsort label-164.
6600: 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31  .SELECT - + col1
6610: 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 44   + - cor0.col2 D
6620: 49 56 20 2d 20 33 39 20 46 52 4f 4d 20 74 61 62  IV - 39 FROM tab
6630: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
6640: 0a 2d 31 31 0d 0a 2d 32 35 0d 0a 2d 39 0d 0a 0d  .-11..-25..-9...
6650: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
6660: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
6670: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6680: 6c 61 62 65 6c 2d 31 36 34 0d 0a 53 45 4c 45 43  label-164..SELEC
6690: 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63  T - + col1 + - c
66a0: 6f 72 30 2e 63 6f 6c 32 20 2f 20 2d 20 33 39 20  or0.col2 / - 39 
66b0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
66c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 32  0..----..-11..-2
66d0: 35 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..-9....query I
66e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
66f0: 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32   + col1 * - col2
6700: 20 2b 20 2b 20 28 20 39 39 20 29 20 46 52 4f 4d   + + ( 99 ) FROM
6710: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
6720: 2d 2d 2d 0d 0a 2d 31 31 34 39 0d 0a 2d 31 33 30  ---..-1149..-130
6730: 35 0d 0a 2d 34 37 31 0d 0a 0d 0a 71 75 65 72 79  5..-471....query
6740: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6750: 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  CT + + col1 + co
6760: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
6770: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37  0..----..119..17
6780: 33 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..98....skipif 
6790: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
67a0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
67b0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
67c0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
67d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
67e0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 32 38  t..SELECT - - 28
67f0: 20 2b 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20 46   + - col2 col2 F
6800: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
6810: 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 2d 35 34 0d  ..----..-5..-54.
6820: 0a 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .27....query I r
6830: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37  owsort..SELECT 7
6840: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
6850: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
6860: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 36 31  0..----..103..61
6870: 0d 0a 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..64....query I 
6880: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6890: 2b 20 38 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52  + 80 * - col2 FR
68a0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
68b0: 32 36 34 30 0d 0a 2d 36 35 36 30 0d 0a 2d 38 30  2640..-6560..-80
68c0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
68d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
68e0: 2d 20 32 37 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  - 27 * + cor0.co
68f0: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
6900: 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
6910: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
6920: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 34  es hashing to d4
6930: 33 63 62 35 65 63 34 39 64 30 37 65 64 32 38 61  3cb5ec49d07ed28a
6940: 62 66 34 35 61 33 64 61 64 35 62 64 34 64 0d 0a  bf45a3dad5bd4d..
6950: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6960: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
6970: 20 2a 20 2b 20 34 33 20 46 52 4f 4d 20 74 61 62   * + 43 FROM tab
6980: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 32 32 0d 0a  1..----..-2322..
6990: 2d 32 34 35 31 0d 0a 2d 34 31 32 38 0d 0a 0d 0a  -2451..-4128....
69a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
69b0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
69c0: 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32   ( col2 ) * col2
69d0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
69e0: 0d 0a 31 0d 0a 31 30 38 39 0d 0a 36 37 32 34 0d  ..1..1089..6724.
69f0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
6a00: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
6a10: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
6a20: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
6a30: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
6a40: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 33 0d  wsort label-173.
6a50: 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30  .SELECT - + col0
6a60: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 43 41 53 54   + - col2 * CAST
6a70: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
6a80: 20 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   ) * - col0 FROM
6a90: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
6aa0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
6ab0: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
6ac0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
6ad0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
6ae0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37  rowsort label-17
6af0: 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  3..SELECT - + co
6b00: 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 43 41  l0 + - col2 * CA
6b10: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
6b20: 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 30 20  EGER ) * - col0 
6b30: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
6b40: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
6b50: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ULL..NULL....onl
6b60: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
6b70: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
6b80: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
6b90: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
6ba0: 72 74 20 6c 61 62 65 6c 2d 31 37 34 0d 0a 53 45  rt label-174..SE
6bb0: 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  LECT + col1 + - 
6bc0: 63 6f 6c 30 20 44 49 56 20 2d 20 35 34 20 46 52  col0 DIV - 54 FR
6bd0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
6be0: 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 32  .----..11..14..2
6bf0: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
6c00: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
6c10: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
6c20: 6f 72 74 20 6c 61 62 65 6c 2d 31 37 34 0d 0a 53  ort label-174..S
6c30: 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d  ELECT + col1 + -
6c40: 20 63 6f 6c 30 20 2f 20 2d 20 35 34 20 46 52 4f   col0 / - 54 FRO
6c50: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
6c60: 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 32 36  ----..11..14..26
6c70: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
6c80: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
6c90: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
6ca0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
6cb0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
6cc0: 31 37 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  175..SELECT DIST
6cd0: 49 4e 43 54 20 2b 20 2d 20 31 37 20 44 49 56 20  INCT + - 17 DIV 
6ce0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
6cf0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
6d00: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
6d10: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
6d20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
6d30: 61 62 65 6c 2d 31 37 35 0d 0a 53 45 4c 45 43 54  abel-175..SELECT
6d40: 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 31 37   DISTINCT + - 17
6d50: 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
6d60: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  0 cor0..----..0.
6d70: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6d80: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34  rt..SELECT ALL 4
6d90: 36 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  6 FROM tab2 AS c
6da0: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
6db0: 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
6dc0: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
6dd0: 69 6e 67 20 74 6f 20 33 31 38 31 38 63 39 64 34  ing to 31818c9d4
6de0: 64 33 32 35 65 62 32 34 38 37 33 35 63 39 37 63  d325eb248735c97c
6df0: 62 31 64 63 65 33 39 0d 0a 0d 0a 6f 6e 6c 79 69  b1dce39....onlyi
6e00: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
6e10: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
6e20: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
6e30: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
6e40: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
6e50: 62 65 6c 2d 31 37 37 0d 0a 53 45 4c 45 43 54 20  bel-177..SELECT 
6e60: 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
6e70: 32 20 2b 20 43 41 53 54 28 20 63 6f 6c 30 20 41  2 + CAST( col0 A
6e80: 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63  S SIGNED ) * - c
6e90: 6f 6c 32 20 2a 20 2d 20 34 30 20 46 52 4f 4d 20  ol2 * - 40 FROM 
6ea0: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
6eb0: 0a 31 32 30 30 34 32 0d 0a 37 35 33 33 0d 0a 38  .120042..7533..8
6ec0: 31 30 39 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1094....skipif m
6ed0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
6ee0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
6ef0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 37  owsort label-177
6f00: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
6f10: 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 43 41 53  T + - col2 + CAS
6f20: 54 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45  T ( col0 AS INTE
6f30: 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2a  GER ) * - col2 *
6f40: 20 2d 20 34 30 20 46 52 4f 4d 20 74 61 62 32 20   - 40 FROM tab2 
6f50: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 30  cor0..----..1200
6f60: 34 32 0d 0a 37 35 33 33 0d 0a 38 31 30 39 34 0d  42..7533..81094.
6f70: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6f80: 72 74 0d 0a 53 45 4c 45 43 54 20 34 39 20 46 52  rt..SELECT 49 FR
6f90: 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f  OM tab0, tab0 co
6fa0: 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
6fb0: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a  , tab2 AS cor2..
6fc0: 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20  ----..81 values 
6fd0: 68 61 73 68 69 6e 67 20 74 6f 20 65 35 38 37 63  hashing to e587c
6fe0: 31 32 32 64 65 61 33 39 61 32 34 38 38 66 66 38  122dea39a2488ff8
6ff0: 38 62 38 38 34 63 65 61 34 36 32 0d 0a 0d 0a 71  8b884cea462....q
7000: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7010: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 32 38 20  SELECT ALL + 28 
7020: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
7030: 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
7040: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
7050: 68 61 73 68 69 6e 67 20 74 6f 20 61 61 64 33 32  hashing to aad32
7060: 32 33 32 63 34 32 38 62 33 65 63 62 35 61 64 61  232c428b3ecb5ada
7070: 36 33 66 37 65 39 62 30 61 39 37 0d 0a 0d 0a 71  63f7e9b0a97....q
7080: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7090: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
70a0: 2d 20 37 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 71 AS col0 FRO
70b0: 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  M tab2, tab2 AS 
70c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31 0d  cor0..----..-71.
70d0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
70e0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
70f0: 4e 43 54 20 2b 20 35 34 20 41 53 20 63 6f 6c 32  NCT + 54 AS col2
7100: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
7110: 0d 0a 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..54....query I 
7120: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7130: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 63 6f  - cor0.col2 - co
7140: 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  r0.col2 AS col2 
7150: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
7160: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d  0..----..-164..-
7170: 32 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65 72 79 20  2..-66....query 
7180: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7190: 54 20 2b 20 28 20 2d 20 38 20 29 20 2d 20 63 6f  T + ( - 8 ) - co
71a0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
71b0: 2d 2d 0d 0a 2d 33 32 0d 0a 2d 34 33 0d 0a 2d 39  --..-32..-43..-9
71c0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
71d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
71e0: 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b  TINCT + - col1 +
71f0: 20 2b 20 63 6f 6c 31 20 2d 20 32 31 20 2a 20 2d   + col1 - 21 * -
7200: 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f   col0 * col2 FRO
7210: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
7220: 2d 2d 2d 2d 0d 0a 33 39 36 39 0d 0a 34 32 35 38  ----..3969..4258
7230: 38 0d 0a 36 33 30 34 32 0d 0a 0d 0a 71 75 65 72  8..63042....quer
7240: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7250: 45 43 54 20 41 4c 4c 20 2d 20 32 36 20 46 52 4f  ECT ALL - 26 FRO
7260: 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  M tab1, tab1 AS 
7270: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
7280: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
7290: 34 37 64 30 35 37 34 32 37 34 31 34 36 64 65 32  47d0574274146de2
72a0: 37 33 38 32 39 37 38 35 33 36 34 61 64 61 33 39  73829785364ada39
72b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
72c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
72d0: 31 31 20 29 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  11 ) + col0 * + 
72e0: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
72f0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab0..----..12
7300: 33 36 0d 0a 35 38 37 0d 0a 37 39 33 32 0d 0a 0d  36..587..7932...
7310: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7320: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
7330: 2a 20 2b 20 38 35 20 41 53 20 63 6f 6c 32 20 46  * + 85 AS col2 F
7340: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
7350: 2d 2d 2d 0d 0a 32 32 31 30 0d 0a 32 32 39 35 0d  ---..2210..2295.
7360: 0a 33 32 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .3230....query I
7370: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7380: 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2b   + tab0.col0 * +
7390: 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
73a0: 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
73b0: 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
73c0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  b0..----..27 val
73d0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61  ues hashing to a
73e0: 65 65 65 62 34 62 65 63 34 62 65 31 36 65 61 66  eeeb4bec4be16eaf
73f0: 39 32 66 63 66 62 34 31 34 61 31 65 66 31 65 0d  92fcfb414a1ef1e.
7400: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
7410: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
7420: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
7430: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
7440: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
7450: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7460: 45 43 54 20 2b 20 36 31 20 63 6f 6c 32 20 46 52  ECT + 61 col2 FR
7470: 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  OM tab1, tab2 AS
7480: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
7490: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
74a0: 20 30 37 31 34 39 39 30 35 61 37 32 62 64 38 37   07149905a72bd87
74b0: 35 35 33 33 38 31 66 33 34 64 31 39 65 64 32 39  553381f34d19ed29
74c0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
74d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
74e0: 20 35 37 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c   57 * col0 - col
74f0: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
7500: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
7510: 31 33 33 35 0d 0a 31 39 39 34 0d 0a 34 39 39 31  1335..1994..4991
7520: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7530: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
7540: 49 4e 43 54 20 2b 20 31 31 20 2b 20 2b 20 63 6f  INCT + 11 + + co
7550: 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l2 * + col1 FROM
7560: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
7570: 2d 2d 2d 0d 0a 31 35 34 35 0d 0a 36 35 37 0d 0a  ---..1545..657..
7580: 38 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  848....query I r
7590: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36  owsort..SELECT 6
75a0: 34 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  4 * - cor0.col1 
75b0: 2d 20 37 31 20 46 52 4f 4d 20 74 61 62 32 20 63  - 71 FROM tab2 c
75c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 39  or0..----..-1159
75d0: 0d 0a 2d 32 30 35 35 0d 0a 2d 33 38 34 37 0d 0a  ..-2055..-3847..
75e0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
75f0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
7600: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
7610: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
7620: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39  rowsort label-19
7630: 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  3..SELECT ALL - 
7640: 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20 2b 20  col0 DIV col1 + 
7650: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
7660: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33  or0..----..1..33
7670: 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..82....skipif m
7680: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
7690: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
76a0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 33  owsort label-193
76b0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
76c0: 6f 6c 30 20 2f 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol0 / col1 + col
76d0: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
76e0: 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38  ..----..1..33..8
76f0: 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
7700: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
7710: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
7720: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
7730: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
7740: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39  rowsort label-19
7750: 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  4..SELECT - col0
7760: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2d   * - cor0.col1 -
7770: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
7780: 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20  IGNED ) AS col0 
7790: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
77a0: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
77b0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
77c0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
77d0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
77e0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
77f0: 6c 2d 31 39 34 0d 0a 53 45 4c 45 43 54 20 2d 20  l-194..SELECT - 
7800: 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col0 * - cor0.co
7810: 6c 31 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c  l1 - CAST ( NULL
7820: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
7830: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
7840: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
7850: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
7860: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7870: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 38  rt..SELECT - + 8
7880: 33 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  3 - col2 FROM ta
7890: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
78a0: 0d 0a 2d 31 30 39 0d 0a 2d 31 31 30 0d 0a 2d 31  ..-109..-110..-1
78b0: 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  21....onlyif mys
78c0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
78d0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
78e0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
78f0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
7900: 6c 2d 31 39 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-196..SELECT DI
7910: 53 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c 32 20  STINCT ( + col2 
7920: 29 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c  ) - col2 DIV col
7930: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
7940: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
7950: 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39 35 0d 0a 0d  -..53..56..95...
7960: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
7970: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
7980: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7990: 6c 61 62 65 6c 2d 31 39 36 0d 0a 53 45 4c 45 43  label-196..SELEC
79a0: 54 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63  T DISTINCT ( + c
79b0: 6f 6c 32 20 29 20 2d 20 63 6f 6c 32 20 2f 20 63  ol2 ) - col2 / c
79c0: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
79d0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
79e0: 2d 2d 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39 35 0d  ---..53..56..95.
79f0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
7a00: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
7a10: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
7a20: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
7a30: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
7a40: 39 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  97..SELECT DISTI
7a50: 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  NCT col0 * - col
7a60: 31 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 35  1 + - col2 DIV 5
7a70: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
7a80: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
7a90: 0d 0a 2d 31 33 35 30 0d 0a 2d 32 32 32 0d 0a 2d  ..-1350..-222..-
7aa0: 34 36 30 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  4607....skipif m
7ab0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
7ac0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
7ad0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 37  owsort label-197
7ae0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
7af0: 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  T col0 * - col1 
7b00: 2b 20 2d 20 63 6f 6c 32 20 2f 20 35 20 41 53 20  + - col2 / 5 AS 
7b10: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
7b20: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
7b30: 33 35 30 0d 0a 2d 32 32 32 0d 0a 2d 34 36 30 37  350..-222..-4607
7b40: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7b50: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
7b60: 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63  col2 + col1 AS c
7b70: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
7b80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d   cor0..----..55.
7b90: 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79  .58..85....query
7ba0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7bb0: 43 54 20 2b 20 38 20 46 52 4f 4d 20 74 61 62 30  CT + 8 FROM tab0
7bc0: 2c 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  , tab2, tab0 AS 
7bd0: 63 6f 72 30 2c 20 74 61 62 31 0d 0a 2d 2d 2d 2d  cor0, tab1..----
7be0: 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68  ..81 values hash
7bf0: 69 6e 67 20 74 6f 20 61 34 32 63 34 32 65 35 36  ing to a42c42e56
7c00: 65 37 35 39 36 30 64 39 37 63 30 39 64 64 37 33  e75960d97c09dd73
7c10: 31 64 39 39 63 30 31 0d 0a 0d 0a 71 75 65 72 79  1d99c01....query
7c20: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7c30: 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 2b  CT - tab1.col2 +
7c40: 20 2d 20 32 31 20 46 52 4f 4d 20 74 61 62 31 0d   - 21 FROM tab1.
7c50: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 0d 0a 2d 37 35  .----..-117..-75
7c60: 0d 0a 2d 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-78....onlyif 
7c70: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
7c80: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
7c90: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
7ca0: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
7cb0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
7cc0: 6c 2d 32 30 31 0d 0a 53 45 4c 45 43 54 20 2d 20  l-201..SELECT - 
7cd0: 63 6f 6c 32 20 2d 20 43 41 53 54 28 20 4e 55 4c  col2 - CAST( NUL
7ce0: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 63 6f  L AS SIGNED ) co
7cf0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
7d00: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
7d10: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  NULL....skipif p
7d20: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
7d30: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
7d40: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
7d50: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
7d60: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
7d70: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
7d80: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7d90: 6c 61 62 65 6c 2d 32 30 31 0d 0a 53 45 4c 45 43  label-201..SELEC
7da0: 54 20 2d 20 63 6f 6c 32 20 2d 20 43 41 53 54 20  T - col2 - CAST 
7db0: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
7dc0: 52 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  R ) col1 FROM ta
7dd0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b0..----..NULL..
7de0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
7df0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7e00: 45 4c 45 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f  ELECT ALL ( + co
7e10: 72 31 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c  r1.col2 ) AS col
7e20: 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
7e30: 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  2 AS cor0, tab0 
7e40: 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
7e50: 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
7e60: 20 74 6f 20 37 37 38 36 37 31 38 62 64 38 30 34   to 7786718bd804
7e70: 32 30 32 32 35 33 37 33 37 38 64 34 30 65 63 38  2022537378d40ec8
7e80: 37 34 37 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7475....onlyif m
7e90: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
7ea0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
7eb0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
7ec0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
7ed0: 62 65 6c 2d 32 30 33 0d 0a 53 45 4c 45 43 54 20  bel-203..SELECT 
7ee0: 2b 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 30 20  + col1 * ( col0 
7ef0: 29 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c  ) + col0 DIV col
7f00: 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  2 col2 FROM tab1
7f10: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34  ..----..1040..64
7f20: 31 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..78....skipif 
7f30: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
7f40: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
7f50: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
7f60: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
7f70: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
7f80: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
7f90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7fa0: 20 6c 61 62 65 6c 2d 32 30 33 0d 0a 53 45 4c 45   label-203..SELE
7fb0: 43 54 20 2b 20 63 6f 6c 31 20 2a 20 28 20 63 6f  CT + col1 * ( co
7fc0: 6c 30 20 29 20 2b 20 63 6f 6c 30 20 2f 20 63 6f  l0 ) + col0 / co
7fd0: 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
7fe0: 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36  1..----..1040..6
7ff0: 34 31 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20  41..78....query 
8000: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8010: 54 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  T tab0.col0 AS c
8020: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol1 FROM tab0, t
8030: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
8040: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
8050: 20 74 6f 20 38 62 34 39 37 39 39 39 34 32 61 39   to 8b49799942a9
8060: 65 33 35 33 61 33 64 32 37 39 63 66 36 34 65 66  e353a3d279cf64ef
8070: 33 66 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3f63....query I 
8080: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8090: 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  ALL - col1 + col
80a0: 31 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29  1 * - ( - col2 )
80b0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
80c0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
80d0: 32 33 35 0d 0a 31 33 37 38 0d 0a 35 36 30 0d 0a  235..1378..560..
80e0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
80f0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
8100: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
8110: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
8120: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
8130: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8140: 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f  CT ALL + cor0.co
8150: 6c 31 20 2a 20 34 37 20 63 6f 6c 31 20 46 52 4f  l1 * 47 col1 FRO
8160: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
8170: 2d 2d 2d 2d 0d 0a 31 32 32 32 0d 0a 34 37 30 0d  ----..1222..470.
8180: 0a 36 31 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .611....onlyif m
8190: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
81a0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
81b0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
81c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
81d0: 62 65 6c 2d 32 30 37 0d 0a 53 45 4c 45 43 54 20  bel-207..SELECT 
81e0: 2d 20 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c  - - col1 DIV col
81f0: 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
8200: 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
8210: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
8220: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
8230: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8240: 74 20 6c 61 62 65 6c 2d 32 30 37 0d 0a 53 45 4c  t label-207..SEL
8250: 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2f 20 63  ECT - - col1 / c
8260: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
8270: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a  r0..----..1..1..
8280: 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
8290: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
82a0: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
82b0: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
82c0: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
82d0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30  rowsort label-20
82e0: 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  8..SELECT + - co
82f0: 6c 32 20 2a 20 43 41 53 54 28 20 28 20 63 6f 6c  l2 * CAST( ( col
8300: 30 20 29 20 41 53 20 53 49 47 4e 45 44 20 29 20  0 ) AS SIGNED ) 
8310: 2a 20 2d 20 34 37 20 46 52 4f 4d 20 74 61 62 32  * - 47 FROM tab2
8320: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8330: 31 34 31 30 39 34 0d 0a 38 38 38 33 0d 0a 39 35  141094..8883..95
8340: 33 31 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  316....skipif my
8350: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
8360: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
8370: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30 38 0d  wsort label-208.
8380: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32  .SELECT + - col2
8390: 20 2a 20 43 41 53 54 20 28 20 28 20 63 6f 6c 30   * CAST ( ( col0
83a0: 20 29 20 41 53 20 49 4e 54 45 47 45 52 20 29 20   ) AS INTEGER ) 
83b0: 2a 20 2d 20 34 37 20 46 52 4f 4d 20 74 61 62 32  * - 47 FROM tab2
83c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
83d0: 31 34 31 30 39 34 0d 0a 38 38 38 33 0d 0a 39 35  141094..8883..95
83e0: 33 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  316....query I r
83f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
8400: 49 53 54 49 4e 43 54 20 2d 20 2b 20 28 20 63 6f  ISTINCT - + ( co
8410: 6c 31 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  l1 ) * cor0.col0
8420: 20 2d 20 36 33 20 2a 20 2b 20 63 6f 72 30 2e 63   - 63 * + cor0.c
8430: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
8440: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
8450: 2d 2d 2d 0d 0a 2d 36 33 32 30 0d 0a 2d 36 35 38  ---..-6320..-658
8460: 0d 0a 2d 39 35 31 36 0d 0a 0d 0a 71 75 65 72 79  ..-9516....query
8470: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8480: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 39 35 20 41  CT - col0 * 95 A
8490: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
84a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
84b0: 2d 32 38 35 0d 0a 2d 36 30 38 30 0d 0a 2d 37 36  -285..-6080..-76
84c0: 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
84d0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
84e0: 53 54 49 4e 43 54 20 33 30 20 2b 20 36 37 20 46  STINCT 30 + 67 F
84f0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
8500: 0d 0a 2d 2d 2d 2d 0d 0a 39 37 0d 0a 0d 0a 71 75  ..----..97....qu
8510: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8520: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20  ELECT ALL - ( - 
8530: 28 20 63 6f 6c 30 20 29 20 29 20 2b 20 63 6f 6c  ( col0 ) ) + col
8540: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
8550: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
8560: 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 71  171..36..57....q
8570: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8580: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
8590: 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f  cor0.col1 + - co
85a0: 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  l2 * col0 + col2
85b0: 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
85c0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
85d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d  0..----..10..13.
85e0: 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .26....query I r
85f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
8600: 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  LL - - col0 * + 
8610: 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  7 FROM tab2 AS c
8620: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 35  or0..----..49..5
8630: 34 36 0d 0a 35 35 33 0d 0a 0d 0a 71 75 65 72 79  46..553....query
8640: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8650: 43 54 20 63 6f 6c 32 20 2a 20 2d 20 32 32 20 41  CT col2 * - 22 A
8660: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
8670: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8680: 2d 31 38 30 34 0d 0a 2d 32 32 0d 0a 2d 37 32 36  -1804..-22..-726
8690: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
86a0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
86b0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
86c0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
86d0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
86e0: 32 31 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  216..SELECT ALL 
86f0: 2b 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  + + ( - cor0.col
8700: 31 20 29 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c  1 ) * col0 + col
8710: 31 20 44 49 56 20 2b 20 37 37 20 63 6f 6c 30 20  1 DIV + 77 col0 
8720: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
8730: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 33 0d 0a  0..----..-2063..
8740: 2d 33 33 39 34 0d 0a 2d 38 30 39 38 0d 0a 0d 0a  -3394..-8098....
8750: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
8760: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
8770: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
8780: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
8790: 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
87a0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
87b0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
87c0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31  rowsort label-21
87d0: 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  6..SELECT ALL + 
87e0: 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  + ( - cor0.col1 
87f0: 29 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  ) * col0 + col1 
8800: 2f 20 2b 20 37 37 20 63 6f 6c 30 20 46 52 4f 4d  / + 77 col0 FROM
8810: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
8820: 2d 2d 2d 0d 0a 2d 32 30 36 33 0d 0a 2d 33 33 39  ---..-2063..-339
8830: 34 0d 0a 2d 38 30 39 38 0d 0a 0d 0a 71 75 65 72  4..-8098....quer
8840: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8850: 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 39 39 20  ECT + col2 * 99 
8860: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
8870: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
8880: 0a 32 35 37 34 0d 0a 32 36 37 33 0d 0a 33 37 36  .2574..2673..376
8890: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
88a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
88b0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63   - cor0.col2 + c
88c0: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
88d0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
88e0: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
88f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8900: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
8910: 20 2d 20 39 33 20 46 52 4f 4d 20 74 61 62 31 2c   - 93 FROM tab1,
8920: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
8930: 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-93....query I
8940: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8950: 20 63 6f 6c 32 20 2b 20 31 33 20 46 52 4f 4d 20   col2 + 13 FROM 
8960: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 39 0d 0a  tab2..----..39..
8970: 34 30 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20  40..51....query 
8980: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8990: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38 39 20  T DISTINCT - 89 
89a0: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  + + cor0.col1 AS
89b0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
89c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
89d0: 36 33 0d 0a 2d 37 36 0d 0a 2d 37 39 0d 0a 0d 0a  63..-76..-79....
89e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
89f0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 31 20 2d  .SELECT ALL 71 -
8a00: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
8a10: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
8a20: 0a 2d 32 35 0d 0a 31 34 0d 0a 31 37 0d 0a 0d 0a  .-25..14..17....
8a30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8a40: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
8a50: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   * - cor0.col2 *
8a60: 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53   + ( + col0 ) AS
8a70: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
8a80: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
8a90: 32 30 37 39 33 36 0d 0a 2d 37 33 37 32 38 30 0d  207936..-737280.
8aa0: 0a 2d 38 37 34 38 0d 0a 0d 0a 73 6b 69 70 69 66  .-8748....skipif
8ab0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
8ac0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
8ad0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
8ae0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
8af0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
8b00: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
8b10: 6f 6c 30 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20  ol0 * tab1.col1 
8b20: 2b 20 2d 20 31 35 20 2a 20 2b 20 63 6f 6c 31 20  + - 15 * + col1 
8b30: 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  + + col2 * + col
8b40: 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  1 col1 FROM tab1
8b50: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 30 0d 0a 31 30  ..----..1060..10
8b60: 39 32 0d 0a 32 30 39 33 0d 0a 0d 0a 71 75 65 72  92..2093....quer
8b70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8b80: 45 43 54 20 44 49 53 54 49 4e 43 54 20 31 31 20  ECT DISTINCT 11 
8b90: 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 33 33 20  * - col0 + + 33 
8ba0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
8bb0: 0a 2d 34 34 0d 0a 2d 38 32 35 0d 0a 2d 38 33 36  .-44..-825..-836
8bc0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8bd0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
8be0: 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  INCT + col0 + co
8bf0: 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 36 37  l1 * col0 * + 67
8c00: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
8c10: 0d 0a 34 32 39 34 34 0d 0a 35 32 32 39 0d 0a 36  ..42944..5229..6
8c20: 39 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9760....query I 
8c30: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8c40: 34 37 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  47 * + col0 + + 
8c50: 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col2 * cor0.col1
8c60: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
8c70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 34 35 0d 0a  r0..----..1545..
8c80: 33 35 37 38 0d 0a 35 30 30 38 0d 0a 0d 0a 73 6b  3578..5008....sk
8c90: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
8ca0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
8cb0: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
8cc0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
8cd0: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
8ce0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
8cf0: 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  LL + col1 * - co
8d00: 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
8d10: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
8d20: 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37  .-1040..-640..-7
8d30: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
8d40: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
8d50: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
8d60: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
8d70: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8d80: 2d 32 32 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -229..SELECT ALL
8d90: 20 2b 20 30 20 44 49 56 20 2d 20 63 6f 6c 32 20   + 0 DIV - col2 
8da0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
8db0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
8dc0: 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .0..0..0....skip
8dd0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
8de0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
8df0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8e00: 2d 32 32 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -229..SELECT ALL
8e10: 20 2b 20 30 20 2f 20 2d 20 63 6f 6c 32 20 41 53   + 0 / - col2 AS
8e20: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
8e30: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
8e40: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
8e50: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8e60: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
8e70: 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol1 * col2 * col
8e80: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
8e90: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
8ea0: 2d 31 36 32 32 34 0d 0a 2d 33 36 35 30 34 0d 0a  -16224..-36504..
8eb0: 2d 35 37 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -5700....query I
8ec0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8ed0: 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30   - col2 * - col0
8ee0: 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
8ef0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
8f00: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 39 35  or0..----..-3395
8f10: 0d 0a 2d 36 36 34 31 31 38 0d 0a 2d 36 38 31 31  ..-664118..-6811
8f20: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
8f30: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
8f40: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2b   - cor0.col1 - +
8f50: 20 28 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f   ( col1 ) * - co
8f60: 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
8f70: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
8f80: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 38 0d 0a 33  0..----..1978..3
8f90: 32 39 38 0d 0a 38 30 30 38 0d 0a 0d 0a 71 75 65  298..8008....que
8fa0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
8fb0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
8fc0: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  col0 * + col0 + 
8fd0: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53  + col1 * col0 AS
8fe0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
8ff0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
9000: 33 34 35 36 0d 0a 2d 35 33 36 30 0d 0a 36 39 0d  3456..-5360..69.
9010: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9020: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
9030: 20 63 6f 6c 31 20 2d 20 33 30 20 46 52 4f 4d 20   col1 - 30 FROM 
9040: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
9050: 2d 2d 0d 0a 35 36 0d 0a 36 31 0d 0a 36 37 0d 0a  --..56..61..67..
9060: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
9070: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
9080: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
9090: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
90a0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
90b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
90c0: 43 54 20 2d 20 63 6f 6c 31 20 2a 20 34 32 20 63  CT - col1 * 42 c
90d0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
90e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
90f0: 39 32 0d 0a 2d 34 32 30 0d 0a 2d 35 34 36 0d 0a  92..-420..-546..
9100: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9110: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
9120: 6c 30 20 2a 20 28 20 2d 20 38 38 20 29 20 2a 20  l0 * ( - 88 ) * 
9130: 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
9140: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
9150: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 36 33  or0..----..-1663
9160: 32 0d 0a 2d 31 37 38 34 36 34 0d 0a 2d 32 36 34  2..-178464..-264
9170: 31 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  176....query I r
9180: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
9190: 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 63   col2 + col2 * c
91a0: 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ol1 + tab1.col0 
91b0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
91c0: 0a 31 34 32 34 0d 0a 31 34 36 31 0d 0a 36 39 31  .1424..1461..691
91d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
91e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
91f0: 20 2a 20 63 6f 6c 32 20 2b 20 37 31 20 2a 20 63   * col2 + 71 * c
9200: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
9210: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33   tab1..----..133
9220: 36 30 0d 0a 33 37 35 0d 0a 38 31 39 32 0d 0a 0d  60..375..8192...
9230: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9240: 0d 0a 53 45 4c 45 43 54 20 2d 20 32 33 20 2a 20  ..SELECT - 23 * 
9250: 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2d 20 2b 20  - tab1.col1 - + 
9260: 38 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  8 * + col1 FROM 
9270: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 0d  tab1..----..150.
9280: 0a 31 39 35 0d 0a 33 39 30 0d 0a 0d 0a 71 75 65  .195..390....que
9290: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
92a0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
92b0: 35 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  50 + col0 FROM t
92c0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
92d0: 2d 0d 0a 31 31 34 0d 0a 31 33 30 0d 0a 35 33 0d  -..114..130..53.
92e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
92f0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 30  rt..SELECT - + 0
9300: 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
9310: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
9320: 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
9330: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9340: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
9350: 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46   + - cor0.col1 F
9360: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
9370: 2d 2d 2d 0d 0a 2d 31 31 38 0d 0a 2d 33 34 0d 0a  ---..-118..-34..
9380: 2d 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -62....query I r
9390: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
93a0: 4c 4c 20 2d 20 32 30 20 41 53 20 63 6f 6c 32 20  LL - 20 AS col2 
93b0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
93c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 32  0..----..-20..-2
93d0: 30 0d 0a 2d 32 30 0d 0a 0d 0a 71 75 65 72 79 20  0..-20....query 
93e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
93f0: 54 20 41 4c 4c 20 28 20 2d 20 63 6f 6c 30 20 29  T ALL ( - col0 )
9400: 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   * col1 AS col1 
9410: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
9420: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a  0..----..-2064..
9430: 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a  -3395..-8099....
9440: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9450: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
9460: 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a   - col0 * col0 *
9470: 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
9480: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
9490: 0a 32 33 34 0d 0a 34 30 39 36 30 0d 0a 38 33 32  .234..40960..832
94a0: 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  00....onlyif mys
94b0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
94c0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
94d0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
94e0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
94f0: 6c 2d 32 34 36 0d 0a 53 45 4c 45 43 54 20 41 4c  l-246..SELECT AL
9500: 4c 20 2d 20 35 37 20 44 49 56 20 2d 20 63 6f 6c  L - 57 DIV - col
9510: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
9520: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
9530: 0a 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .8....skipif mys
9540: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
9550: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
9560: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 36 0d 0a  sort label-246..
9570: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 35 37 20  SELECT ALL - 57 
9580: 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  / - col0 FROM ta
9590: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
95a0: 0d 0a 30 0d 0a 30 0d 0a 38 0d 0a 0d 0a 71 75 65  ..0..0..8....que
95b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
95c0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
95d0: 2d 20 33 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 30 AS col0 FRO
95e0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
95f0: 2d 2d 2d 2d 0d 0a 33 30 0d 0a 0d 0a 71 75 65 72  ----..30....quer
9600: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9610: 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20 2d 20  ECT ALL + - ( - 
9620: 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 30 20  col1 ) * + col0 
9630: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
9640: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32  0..----..1343..2
9650: 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72  17..4602....quer
9660: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9670: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
9680: 6f 6c 31 20 2a 20 36 33 20 46 52 4f 4d 20 74 61  ol1 * 63 FROM ta
9690: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
96a0: 0d 0a 31 36 33 38 0d 0a 36 33 30 0d 0a 38 31 39  ..1638..630..819
96b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
96c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
96d0: 6c 32 20 2b 20 2b 20 28 20 63 6f 6c 32 20 2a 20  l2 + + ( col2 * 
96e0: 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30  col2 ) FROM tab0
96f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9700: 31 31 32 32 0d 0a 32 0d 0a 36 38 30 36 0d 0a 0d  1122..2..6806...
9710: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
9720: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
9730: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
9740: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
9750: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
9760: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9770: 54 20 44 49 53 54 49 4e 43 54 20 28 20 36 35 20  T DISTINCT ( 65 
9780: 29 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  ) * col2 * cor0.
9790: 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
97a0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
97b0: 2d 0d 0a 34 33 37 30 36 30 0d 0a 36 35 0d 0a 37  -..437060..65..7
97c0: 30 37 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0785....query I 
97d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
97e0: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
97f0: 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  * + cor0.col2 + 
9800: 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  col0 * col0 + co
9810: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
9820: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
9830: 2d 2d 0d 0a 31 34 31 39 0d 0a 31 35 34 37 34 0d  --..1419..15474.
9840: 0a 33 35 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .3500....skipif 
9850: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
9860: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
9870: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
9880: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
9890: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
98a0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
98b0: 20 2d 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46   - - col1 col0 F
98c0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
98d0: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
98e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
98f0: 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 38 38  CT - - col0 + 88
9900: 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   - col0 AS col2 
9910: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
9920: 30 0d 0a 2d 2d 2d 2d 0d 0a 38 38 0d 0a 38 38 0d  0..----..88..88.
9930: 0a 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .88....query I r
9940: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
9950: 49 53 54 49 4e 43 54 20 31 37 20 2b 20 2d 20 63  ISTINCT 17 + - c
9960: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
9970: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
9980: 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 36 35 0d 0a 31  ---..-16..-65..1
9990: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
99a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
99b0: 20 28 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f   ( col2 ) + - co
99c0: 6c 30 20 2a 20 37 31 20 41 53 20 63 6f 6c 31 20  l0 * 71 AS col1 
99d0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
99e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d  0..----..-159..-
99f0: 34 34 38 37 0d 0a 2d 35 35 38 34 0d 0a 0d 0a 71  4487..-5584....q
9a00: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9a10: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
9a20: 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20  + col2 * col0 + 
9a30: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
9a40: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
9a50: 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a 32 31 30  ..----..196..210
9a60: 36 0d 0a 33 30 38 31 0d 0a 0d 0a 71 75 65 72 79  6..3081....query
9a70: 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49   IIIIIIIIIIIIIII
9a80: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9a90: 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30   ALL * FROM tab0
9aa0: 2c 20 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53  , tab1 cor0 CROS
9ab0: 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62  S JOIN tab2, tab
9ac0: 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31 20  1 AS cor1, tab1 
9ad0: 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor2..----..3
9ae0: 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69  645 values hashi
9af0: 6e 67 20 74 6f 20 63 61 39 31 64 31 66 35 32 33  ng to ca91d1f523
9b00: 61 38 37 30 31 37 66 36 37 32 33 30 34 35 34 38  a87017f672304548
9b10: 65 39 31 61 37 37 0d 0a 0d 0a 71 75 65 72 79 20  e91a77....query 
9b20: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9b30: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 33 20 2a  T DISTINCT - 3 *
9b40: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
9b50: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  0 cor0..----..-2
9b60: 35 38 0d 0a 2d 32 37 33 0d 0a 2d 32 39 31 0d 0a  58..-273..-291..
9b70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9b80: 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f  t..SELECT ( + co
9b90: 72 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c  r0.col1 ) AS col
9ba0: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
9bb0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39  or0..----..86..9
9bc0: 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  1..97....query I
9bd0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9be0: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
9bf0: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   * - cor0.col0 *
9c00: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
9c10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
9c20: 36 34 38 30 0d 0a 34 32 31 32 0d 0a 39 39 38 34  6480..4212..9984
9c30: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
9c40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 38  sort..SELECT ( 8
9c50: 38 20 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  8 ) * - col0 FRO
9c60: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
9c70: 31 31 32 0d 0a 2d 33 30 38 30 0d 0a 2d 37 38 33  112..-3080..-783
9c80: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
9c90: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32  sort..SELECT - 2
9ca0: 39 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62  9 * col0 + - tab
9cb0: 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2.col2 FROM tab2
9cc0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 38 38 0d 0a 2d  ..----..-2288..-
9cd0: 32 33 30 0d 0a 2d 32 33 32 39 0d 0a 0d 0a 71 75  230..-2329....qu
9ce0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9cf0: 45 4c 45 43 54 20 2d 20 2b 20 35 20 46 52 4f 4d  ELECT - + 5 FROM
9d00: 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63   tab2, tab2 AS c
9d10: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
9d20: 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
9d30: 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
9d40: 68 69 6e 67 20 74 6f 20 34 66 33 34 36 64 64 32  hing to 4f346dd2
9d50: 66 36 35 30 34 37 63 38 33 36 63 36 39 35 37 66  f65047c836c6957f
9d60: 38 30 66 30 65 66 39 65 0d 0a 0d 0a 71 75 65 72  80f0ef9e....quer
9d70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9d80: 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e  ECT col2 + cor0.
9d90: 63 6f 6c 31 20 2d 20 2d 20 38 32 20 46 52 4f 4d  col1 - - 82 FROM
9da0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
9db0: 2d 2d 2d 0d 0a 31 33 37 0d 0a 31 34 30 0d 0a 31  ---..137..140..1
9dc0: 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  67....query I ro
9dd0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
9de0: 31 32 20 2a 20 63 6f 6c 32 20 2b 20 28 20 2d 20  12 * col2 + ( - 
9df0: 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30  col1 ) FROM tab0
9e00: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9e10: 2d 38 35 0d 0a 33 31 30 0d 0a 38 39 33 0d 0a 0d  -85..310..893...
9e20: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
9e30: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
9e40: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
9e50: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
9e60: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 37  owsort label-267
9e70: 0d 0a 53 45 4c 45 43 54 20 2d 20 33 38 20 44 49  ..SELECT - 38 DI
9e80: 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  V - cor0.col0 FR
9e90: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
9ea0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 32 0d  .----..0..0..12.
9eb0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
9ec0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
9ed0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9ee0: 74 20 6c 61 62 65 6c 2d 32 36 37 0d 0a 53 45 4c  t label-267..SEL
9ef0: 45 43 54 20 2d 20 33 38 20 2f 20 2d 20 63 6f 72  ECT - 38 / - cor
9f00: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
9f10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9f20: 30 0d 0a 30 0d 0a 31 32 0d 0a 0d 0a 6f 6e 6c 79  0..0..12....only
9f30: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
9f40: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
9f50: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
9f60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9f70: 74 20 6c 61 62 65 6c 2d 32 36 38 0d 0a 53 45 4c  t label-268..SEL
9f80: 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  ECT col0 + - col
9f90: 30 20 44 49 56 20 2d 20 28 20 2b 20 28 20 63 6f  0 DIV - ( + ( co
9fa0: 6c 31 20 29 20 29 20 46 52 4f 4d 20 74 61 62 31  l1 ) ) FROM tab1
9fb0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a   cor0..----..3..
9fc0: 37 30 0d 0a 38 36 0d 0a 0d 0a 73 6b 69 70 69 66  70..86....skipif
9fd0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
9fe0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
9ff0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
a000: 36 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  68..SELECT col0 
a010: 2b 20 2d 20 63 6f 6c 30 20 2f 20 2d 20 28 20 2b  + - col0 / - ( +
a020: 20 28 20 63 6f 6c 31 20 29 20 29 20 46 52 4f 4d   ( col1 ) ) FROM
a030: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
a040: 0d 0a 33 0d 0a 37 30 0d 0a 38 36 0d 0a 0d 0a 6f  ..3..70..86....o
a050: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
a060: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
a070: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
a080: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
a090: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 39 0d 0a  sort label-269..
a0a0: 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 31 20  SELECT ( + col1 
a0b0: 29 20 2b 20 28 20 63 6f 6c 30 20 29 20 44 49 56  ) + ( col0 ) DIV
a0c0: 20 63 6f 6c 30 20 2d 20 36 39 20 2a 20 28 20 2d   col0 - 69 * ( -
a0d0: 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
a0e0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
a0f0: 0a 31 38 35 34 0d 0a 31 38 39 35 0d 0a 32 36 34  .1854..1895..264
a100: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
a110: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
a120: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
a130: 6f 72 74 20 6c 61 62 65 6c 2d 32 36 39 0d 0a 53  ort label-269..S
a140: 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 31 20 29  ELECT ( + col1 )
a150: 20 2b 20 28 20 63 6f 6c 30 20 29 20 2f 20 63 6f   + ( col0 ) / co
a160: 6c 30 20 2d 20 36 39 20 2a 20 28 20 2d 20 63 6f  l0 - 69 * ( - co
a170: 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  l2 ) FROM tab2 A
a180: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
a190: 35 34 0d 0a 31 38 39 35 0d 0a 32 36 34 30 0d 0a  54..1895..2640..
a1a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a1b0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 30 20 46  t..SELECT - 10 F
a1c0: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41  ROM tab2, tab0 A
a1d0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
a1e0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
a1f0: 6f 20 66 36 38 66 33 33 30 33 32 38 34 36 65 32  o f68f33032846e2
a200: 31 65 65 36 62 32 63 36 36 38 66 63 31 30 33 35  1ee6b2c668fc1035
a210: 35 65 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  5e....onlyif mys
a220: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
a230: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
a240: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
a250: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
a260: 6c 2d 32 37 31 0d 0a 53 45 4c 45 43 54 20 63 6f  l-271..SELECT co
a270: 6c 32 20 2b 20 2d 20 39 36 20 44 49 56 20 2d 20  l2 + - 96 DIV - 
a280: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
a290: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab0..----..1.
a2a0: 0a 33 34 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69  .34..83....skipi
a2b0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
a2c0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
a2d0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
a2e0: 32 37 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  271..SELECT col2
a2f0: 20 2b 20 2d 20 39 36 20 2f 20 2d 20 63 6f 6c 31   + - 96 / - col1
a300: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
a310: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 34 0d  b0..----..1..34.
a320: 0a 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .83....onlyif my
a330: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
a340: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
a350: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
a360: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
a370: 65 6c 2d 32 37 32 0d 0a 53 45 4c 45 43 54 20 41  el-272..SELECT A
a380: 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  LL - col1 + + co
a390: 6c 30 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d  l0 DIV col1 FROM
a3a0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   tab2..----..-13
a3b0: 0d 0a 2d 33 31 0d 0a 2d 35 38 0d 0a 0d 0a 73 6b  ..-31..-58....sk
a3c0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
a3d0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
a3e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
a3f0: 65 6c 2d 32 37 32 0d 0a 53 45 4c 45 43 54 20 41  el-272..SELECT A
a400: 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  LL - col1 + + co
a410: 6c 30 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 / col1 FROM t
a420: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a  ab2..----..-13..
a430: 2d 33 31 0d 0a 2d 35 38 0d 0a 0d 0a 71 75 65 72  -31..-58....quer
a440: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a450: 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  ECT - col0 * - c
a460: 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 + col0 AS co
a470: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
a480: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 38  cor0..----..2088
a490: 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d 0a  ..3430..8188....
a4a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a4b0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
a4c0: 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   - + col1 * + co
a4d0: 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 35 30 20 2a  r0.col0 + - 50 *
a4e0: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
a4f0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
a500: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 39 33 0d 0a  0..----..-5293..
a510: 2d 35 36 37 0d 0a 2d 38 35 30 32 0d 0a 0d 0a 71  -567..-8502....q
a520: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a530: 53 45 4c 45 43 54 20 2b 20 38 33 20 2d 20 63 6f  SELECT + 83 - co
a540: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
a550: 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 0d 0a 37 30 0d  0..----..57..70.
a560: 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .73....query I r
a570: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
a580: 49 53 54 49 4e 43 54 20 2d 20 37 31 20 2b 20 2b  ISTINCT - 71 + +
a590: 20 63 6f 6c 30 20 2a 20 2b 20 28 20 63 6f 6c 32   col0 * + ( col2
a5a0: 20 2a 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   * col0 ) AS col
a5b0: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
a5c0: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 34 0d 0a 31 38  ..----..1154..18
a5d0: 39 33 37 0d 0a 36 34 39 34 35 31 0d 0a 0d 0a 6f  937..649451....o
a5e0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
a5f0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
a600: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
a610: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
a620: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 37 0d 0a  sort label-277..
a630: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
a640: 2d 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  - + col1 + col2 
a650: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20  + cor0.col2 DIV 
a660: 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
a670: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
a680: 2d 0d 0a 2d 35 32 0d 0a 2d 39 0d 0a 2d 39 36 0d  -..-52..-9..-96.
a690: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
a6a0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
a6b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a6c0: 74 20 6c 61 62 65 6c 2d 32 37 37 0d 0a 53 45 4c  t label-277..SEL
a6d0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
a6e0: 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2b 20 63   col1 + col2 + c
a6f0: 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f 72 30 2e  or0.col2 / cor0.
a700: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
a710: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
a720: 32 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 71 75  2..-9..-96....qu
a730: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
a740: 45 4c 45 43 54 20 2d 20 34 33 20 2b 20 2b 20 63  ELECT - 43 + + c
a750: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
a760: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 33  r0..----..-36..3
a770: 35 0d 0a 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  5..36....query I
a780: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a790: 20 41 4c 4c 20 2b 20 2d 20 32 33 20 46 52 4f 4d   ALL + - 23 FROM
a7a0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
a7b0: 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53  OSS JOIN tab0 AS
a7c0: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
a7d0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
a7e0: 20 63 65 36 30 62 66 34 62 30 36 34 37 64 30 66   ce60bf4b0647d0f
a7f0: 63 62 31 38 61 30 35 36 32 65 33 35 31 63 35 32  cb18a0562e351c52
a800: 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  d....query I row
a810: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
a820: 30 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  0.col1 + cor0.co
a830: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
a840: 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
a850: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
a860: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 61  es hashing to 1a
a870: 30 36 33 62 66 62 36 39 34 66 33 34 38 31 32 32  063bfb694f348122
a880: 63 64 30 37 33 39 32 39 35 63 61 36 34 31 0d 0a  cd0739295ca641..
a890: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a8a0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
a8b0: 6c 31 20 2a 20 28 20 63 6f 6c 31 20 29 20 41 53  l1 * ( col1 ) AS
a8c0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
a8d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
a8e0: 38 39 0d 0a 33 34 38 31 0d 0a 39 36 31 0d 0a 0d  89..3481..961...
a8f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a900: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
a910: 63 6f 6c 32 20 2b 20 2b 20 74 61 62 31 2e 63 6f  col2 + + tab1.co
a920: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
a930: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 34  tab1..----..1344
a940: 0d 0a 31 34 35 38 0d 0a 36 32 37 0d 0a 0d 0a 71  ..1458..627....q
a950: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a960: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
a970: 2d 20 33 32 20 46 52 4f 4d 20 74 61 62 32 20 41  - 32 FROM tab2 A
a980: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
a990: 32 31 36 0d 0a 2d 38 33 32 0d 0a 2d 38 36 34 0d  216..-832..-864.
a9a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a9b0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
a9c0: 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a   col1 + - col2 *
a9d0: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
a9e0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
a9f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 30 0d 0a  0..----..-2890..
aa00: 2d 33 32 33 39 0d 0a 2d 39 32 30 33 0d 0a 0d 0a  -3239..-9203....
aa10: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
aa20: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
aa30: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
aa40: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
aa50: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
aa60: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
aa70: 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20   cor0.col2 col1 
aa80: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
aa90: 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38  ----..26..27..38
aaa0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
aab0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
aac0: 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 32 39  l2 * - col0 + 29
aad0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
aae0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 30 0d 0a  b2..----..-160..
aaf0: 2d 31 39 39 39 0d 0a 2d 32 39 37 33 0d 0a 0d 0a  -1999..-2973....
ab00: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
ab10: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
ab20: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
ab30: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
ab40: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
ab50: 72 74 20 6c 61 62 65 6c 2d 32 38 37 0d 0a 53 45  rt label-287..SE
ab60: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
ab70: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
ab80: 47 4e 45 44 20 29 20 63 6f 6c 31 20 46 52 4f 4d  GNED ) col1 FROM
ab90: 20 74 61 62 30 20 63 6f 72 30 20 43 52 4f 53 53   tab0 cor0 CROSS
aba0: 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 31   JOIN tab2, tab1
abb0: 20 63 6f 72 31 2c 20 74 61 62 32 20 41 53 20 63   cor1, tab2 AS c
abc0: 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or2..----..NULL.
abd0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
abe0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
abf0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
ac00: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
ac10: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
ac20: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
ac30: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
ac40: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
ac50: 2d 32 38 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  -287..SELECT DIS
ac60: 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20 4e  TINCT + CAST ( N
ac70: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
ac80: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
ac90: 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
aca0: 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72 31 2c  tab2, tab1 cor1,
acb0: 20 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d   tab2 AS cor2..-
acc0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
acd0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
ace0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 35 30  LECT DISTINCT 50
acf0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
ad00: 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
ad10: 0d 0a 2d 2d 2d 2d 0d 0a 35 30 0d 0a 0d 0a 6f 6e  ..----..50....on
ad20: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
ad30: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
ad40: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
ad50: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
ad60: 6f 72 74 20 6c 61 62 65 6c 2d 32 38 39 0d 0a 53  ort label-289..S
ad70: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
ad80: 20 37 35 20 2b 20 63 6f 6c 30 20 29 20 44 49 56   75 + col0 ) DIV
ad90: 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
ada0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
adb0: 0a 2d 31 0d 0a 2d 32 0d 0a 0d 0a 73 6b 69 70 69  .-1..-2....skipi
adc0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
add0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
ade0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
adf0: 32 38 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  289..SELECT DIST
ae00: 49 4e 43 54 20 28 20 37 35 20 2b 20 63 6f 6c 30  INCT ( 75 + col0
ae10: 20 29 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20 63   ) / - col2 AS c
ae20: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
ae30: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 0d 0a 6f  ---..-1..-2....o
ae40: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
ae50: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
ae60: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
ae70: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
ae80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ae90: 74 20 6c 61 62 65 6c 2d 32 39 30 0d 0a 53 45 4c  t label-290..SEL
aea0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43  ECT DISTINCT + C
aeb0: 41 53 54 28 20 2d 20 63 6f 6c 30 20 41 53 20 53  AST( - col0 AS S
aec0: 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20  IGNED ) AS col1 
aed0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
aee0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38  0..----..-7..-78
aef0: 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-79....skipif 
af00: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
af10: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
af20: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 39  rowsort label-29
af30: 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
af40: 43 54 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f  CT + CAST ( - co
af50: 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
af60: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
af70: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
af80: 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d  .-7..-78..-79...
af90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
afa0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
afb0: 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  T + - col0 + - c
afc0: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
afd0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
afe0: 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a  ---..-137..-38..
aff0: 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -96....query I r
b000: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
b010: 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  LL + - cor0.col1
b020: 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   + - col1 + + co
b030: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
b040: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 38  cor0..----..-148
b050: 0d 0a 2d 31 35 39 0d 0a 2d 39 33 0d 0a 0d 0a 71  ..-159..-93....q
b060: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
b070: 53 45 4c 45 43 54 20 63 6f 72 31 2e 63 6f 6c 30  SELECT cor1.col0
b080: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
b090: 62 30 2c 20 74 61 62 32 20 63 6f 72 30 2c 20 74  b0, tab2 cor0, t
b0a0: 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
b0b0: 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
b0c0: 68 69 6e 67 20 74 6f 20 31 65 31 66 31 30 39 35  hing to 1e1f1095
b0d0: 33 65 62 38 65 66 66 65 39 62 32 30 65 37 34 36  3eb8effe9b20e746
b0e0: 66 38 61 37 66 64 38 33 0d 0a 0d 0a 71 75 65 72  f8a7fd83....quer
b0f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b100: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
b110: 6f 6c 31 20 2a 20 38 20 2a 20 2d 20 63 6f 6c 32  ol1 * 8 * - col2
b120: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
b130: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 33 32 0d  r0..----..11232.
b140: 0a 34 35 36 30 0d 0a 39 39 38 34 0d 0a 0d 0a 73  .4560..9984....s
b150: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
b160: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
b170: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
b180: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
b190: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
b1a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b1b0: 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ALL + cor0.col2 
b1c0: 2a 20 28 20 63 6f 6c 32 20 29 20 2b 20 38 35 20  * ( col2 ) + 85 
b1d0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
b1e0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
b1f0: 32 39 0d 0a 37 36 31 0d 0a 38 31 34 0d 0a 0d 0a  29..761..814....
b200: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b210: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
b220: 6f 6c 31 20 2b 20 37 31 20 41 53 20 63 6f 6c 31  ol1 + 71 AS col1
b230: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
b240: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d  r0..----..-15..-
b250: 32 30 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79  20..-26....query
b260: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
b270: 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30  CT col0 + - col0
b280: 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   * cor0.col1 AS 
b290: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
b2a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 34  or0..----..-1264
b2b0: 0d 0a 2d 32 31 30 0d 0a 2d 34 35 32 34 0d 0a 0d  ..-210..-4524...
b2c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b2d0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
b2e0: 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c  ( col1 ) + - col
b2f0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
b300: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 0d 0a  ab1..----..-44..
b310: 2d 35 34 0d 0a 34 39 0d 0a 0d 0a 71 75 65 72 79  -54..49....query
b320: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
b330: 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  CT + - col1 * co
b340: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
b350: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
b360: 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d  .-2064..-3395..-
b370: 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
b380: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b390: 2d 20 63 6f 6c 30 20 2b 20 2d 20 31 31 20 46 52  - col0 + - 11 FR
b3a0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
b3b0: 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 38 39 0d  .----..-18..-89.
b3c0: 0a 2d 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-90....onlyif m
b3d0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
b3e0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
b3f0: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
b400: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
b410: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
b420: 2d 33 30 31 0d 0a 53 45 4c 45 43 54 20 44 49 53  -301..SELECT DIS
b430: 54 49 4e 43 54 20 2b 20 2b 20 43 41 53 54 28 20  TINCT + + CAST( 
b440: 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20  NULL AS DECIMAL 
b450: 29 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  ) + col2 * col0 
b460: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
b470: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
b480: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
b490: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
b4a0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
b4b0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30  rowsort label-30
b4c0: 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
b4d0: 43 54 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55  CT + + CAST ( NU
b4e0: 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2b 20 63  LL AS REAL ) + c
b4f0: 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 * col0 AS co
b500: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
b510: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
b520: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
b530: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
b540: 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  r0.col2 AS col1 
b550: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
b560: 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  AS cor0, tab2 AS
b570: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
b580: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
b590: 6f 20 36 61 34 33 65 37 66 31 35 31 39 34 61 66  o 6a43e7f15194af
b5a0: 37 33 66 65 31 63 38 33 33 38 35 65 36 65 62 65  73fe1c83385e6ebe
b5b0: 62 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  bc....query I ro
b5c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 34  wsort..SELECT 94
b5d0: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
b5e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
b5f0: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
b600: 20 74 6f 20 62 30 66 66 62 37 35 32 37 66 34 66   to b0ffb7527f4f
b610: 62 66 34 34 66 33 30 39 34 35 65 31 63 63 62 35  bf44f30945e1ccb5
b620: 38 63 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8c24....query I 
b630: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b640: 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20  - col2 * col2 + 
b650: 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
b660: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
b670: 2d 31 31 32 32 0d 0a 2d 32 0d 0a 2d 36 38 30 36  -1122..-2..-6806
b680: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
b690: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
b6a0: 20 2a 20 36 36 20 2a 20 2b 20 28 20 74 61 62 30   * 66 * + ( tab0
b6b0: 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20  .col2 ) AS col0 
b6c0: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
b6d0: 0a 32 33 31 30 0d 0a 34 38 31 36 36 38 0d 0a 35  .2310..481668..5
b6e0: 32 32 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2272....query I 
b6f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b700: 44 49 53 54 49 4e 43 54 20 2d 20 31 31 20 41 53  DISTINCT - 11 AS
b710: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c   col1 FROM tab0,
b720: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
b730: 2d 2d 2d 0d 0a 2d 31 31 0d 0a 0d 0a 71 75 65 72  ---..-11....quer
b740: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b750: 45 43 54 20 2d 20 28 20 63 6f 6c 31 20 29 20 2b  ECT - ( col1 ) +
b760: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2d 20   + col1 * + ( - 
b770: 39 38 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  98 ) FROM tab1..
b780: 2d 2d 2d 2d 0d 0a 2d 31 32 38 37 0d 0a 2d 32 35  ----..-1287..-25
b790: 37 34 0d 0a 2d 39 39 30 0d 0a 0d 0a 71 75 65 72  74..-990....quer
b7a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b7b0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31  ECT DISTINCT - 1
b7c0: 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  9 AS col0 FROM t
b7d0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a  ab1..----..-19..
b7e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b7f0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20  t..SELECT - ( - 
b800: 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2b 20  col0 * col2 + + 
b810: 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 29 20 46 52  col1 * col2 ) FR
b820: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
b830: 31 36 34 0d 0a 2d 32 30 34 36 0d 0a 2d 36 32 0d  164..-2046..-62.
b840: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
b850: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
b860: 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63  NCT + - col0 + c
b870: 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol0 * col0 AS co
b880: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
b890: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 33 32  cor0..----..4032
b8a0: 0d 0a 36 0d 0a 36 33 32 30 0d 0a 0d 0a 71 75 65  ..6..6320....que
b8b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b8c0: 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  LECT + col1 * + 
b8d0: 33 34 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  34 * - col2 AS c
b8e0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
b8f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35   cor0..----..-25
b900: 33 37 30 38 0d 0a 2d 33 32 39 38 0d 0a 2d 39 36  3708..-3298..-96
b910: 34 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  492....query I r
b920: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
b930: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b   + col2 * col2 +
b940: 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
b950: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
b960: 2d 2d 0d 0a 31 31 32 32 0d 0a 32 0d 0a 36 38 30  --..1122..2..680
b970: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
b980: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
b990: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
b9a0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
b9b0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
b9c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
b9d0: 45 4c 45 43 54 20 39 37 20 63 6f 6c 30 20 46 52  ELECT 97 col0 FR
b9e0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 39  OM tab0..----..9
b9f0: 37 0d 0a 39 37 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c  7..97..97....onl
ba00: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
ba10: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
ba20: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
ba30: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
ba40: 72 74 20 6c 61 62 65 6c 2d 33 31 34 0d 0a 53 45  rt label-314..SE
ba50: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
ba60: 28 20 63 6f 6c 32 20 29 20 44 49 56 20 2b 20 34  ( col2 ) DIV + 4
ba70: 37 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  7 FROM tab2..---
ba80: 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  -..0....skipif m
ba90: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
baa0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
bab0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31 34  owsort label-314
bac0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
bad0: 54 20 2b 20 28 20 63 6f 6c 32 20 29 20 2f 20 2b  T + ( col2 ) / +
bae0: 20 34 37 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   47 FROM tab2..-
baf0: 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ---..0....skipif
bb00: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
bb10: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
bb20: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
bb30: 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2a 20   ALL + - col2 * 
bb40: 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20 52  CAST ( col2 AS R
bb50: 45 41 4c 20 29 20 2b 20 2b 20 63 6f 72 30 2e 63  EAL ) + + cor0.c
bb60: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
bb70: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
bb80: 35 36 0d 0a 2d 36 36 34 32 0d 0a 30 0d 0a 0d 0a  56..-6642..0....
bb90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
bba0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
bbb0: 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  l0 + + col2 AS c
bbc0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
bbd0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33  r0..----..171..3
bbe0: 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  6..57....query I
bbf0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
bc00: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b   + cor0.col1 + +
bc10: 20 63 6f 6c 30 20 2a 20 32 32 20 41 53 20 63 6f   col0 * 22 AS co
bc20: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
bc30: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 35 35  cor0..----..1755
bc40: 0d 0a 31 37 37 35 0d 0a 31 38 35 0d 0a 0d 0a 71  ..1775..185....q
bc50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
bc60: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
bc70: 31 20 2a 20 63 6f 6c 30 20 2b 20 28 20 28 20 63  1 * col0 + ( ( c
bc80: 6f 6c 32 20 29 20 29 20 46 52 4f 4d 20 74 61 62  ol2 ) ) FROM tab
bc90: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d 0a 33  0..----..2097..3
bca0: 33 39 36 0d 0a 38 31 38 31 0d 0a 0d 0a 6f 6e 6c  396..8181....onl
bcb0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
bcc0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
bcd0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
bce0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
bcf0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
bd00: 6c 61 62 65 6c 2d 33 31 39 0d 0a 53 45 4c 45 43  label-319..SELEC
bd10: 54 20 2d 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  T - - CAST( NULL
bd20: 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 46 52   AS DECIMAL ) FR
bd30: 4f 4d 20 74 61 62 32 20 63 6f 72 30 20 43 52 4f  OM tab2 cor0 CRO
bd40: 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20  SS JOIN tab0 AS 
bd50: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
bd60: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
bd70: 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31 35  cd7a7901e47c1515
bd80: 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30 62  5404aff0d216fe0b
bd90: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
bda0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
bdb0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
bdc0: 72 74 20 6c 61 62 65 6c 2d 33 31 39 0d 0a 53 45  rt label-319..SE
bdd0: 4c 45 43 54 20 2d 20 2d 20 43 41 53 54 20 28 20  LECT - - CAST ( 
bde0: 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 46  NULL AS REAL ) F
bdf0: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 20 43 52  ROM tab2 cor0 CR
be00: 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53  OSS JOIN tab0 AS
be10: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
be20: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
be30: 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31   cd7a7901e47c151
be40: 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30  55404aff0d216fe0
be50: 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  b....query I row
be60: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
be70: 6f 6c 31 20 2d 20 2b 20 33 39 20 46 52 4f 4d 20  ol1 - + 39 FROM 
be80: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 34 37 0d 0a  tab0..----..47..
be90: 35 32 0d 0a 35 38 0d 0a 0d 0a 71 75 65 72 79 20  52..58....query 
bea0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
beb0: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
bec0: 63 6f 6c 32 20 2b 20 28 20 35 31 20 29 20 41 53  col2 + ( 51 ) AS
bed0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
bee0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
bef0: 37 0d 0a 37 38 0d 0a 38 39 0d 0a 0d 0a 71 75 65  7..78..89....que
bf00: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
bf10: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
bf20: 63 6f 6c 30 20 2a 20 2b 20 32 20 46 52 4f 4d 20  col0 * + 2 FROM 
bf30: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
bf40: 2d 2d 0d 0a 2d 31 37 38 0d 0a 2d 34 38 0d 0a 2d  --..-178..-48..-
bf50: 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
bf60: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
bf70: 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30  r0.col0 * - cor0
bf80: 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c  .col1 FROM tab0,
bf90: 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
bfa0: 61 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor1..----..
bfb0: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
bfc0: 67 20 74 6f 20 30 36 34 66 30 64 31 32 66 35 61  g to 064f0d12f5a
bfd0: 35 34 38 39 30 38 31 38 30 33 30 62 61 38 38 39  54890818030ba889
bfe0: 65 37 65 35 63 0d 0a 0d 0a 73 6b 69 70 69 66 20  e7e5c....skipif 
bff0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
c000: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
c010: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c020: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
c030: 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  * col2 + - col0 
c040: 2a 20 63 6f 6c 32 20 2f 20 43 41 53 54 20 28 20  * col2 / CAST ( 
c050: 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 52 45 41  cor0.col0 AS REA
c060: 4c 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  L ) AS col1 FROM
c070: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
c080: 2d 2d 2d 0d 0a 30 0d 0a 31 30 35 36 0d 0a 36 36  ---..0..1056..66
c090: 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  42....skipif mys
c0a0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
c0b0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
c0c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
c0d0: 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54   - col2 + + CAST
c0e0: 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 52 45 41   ( + col2 AS REA
c0f0: 4c 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  L ) * col0 FROM 
c100: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
c110: 2d 2d 0d 0a 31 36 32 0d 0a 32 30 30 32 0d 0a 32  --..162..2002..2
c120: 39 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  964....query I r
c130: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
c140: 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 31 20 29  ol0 * ( - col1 )
c150: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
c160: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d  r0..----..-1040.
c170: 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 6f 6e  .-640..-78....on
c180: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
c190: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
c1a0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
c1b0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
c1c0: 6f 72 74 20 6c 61 62 65 6c 2d 33 32 37 0d 0a 53  ort label-327..S
c1d0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
c1e0: 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 44   col1 + + col2 D
c1f0: 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  IV col0 FROM tab
c200: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
c210: 0a 31 37 0d 0a 33 34 0d 0a 35 39 0d 0a 0d 0a 73  .17..34..59....s
c220: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
c230: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
c240: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
c250: 62 65 6c 2d 33 32 37 0d 0a 53 45 4c 45 43 54 20  bel-327..SELECT 
c260: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
c270: 2b 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20  + + col2 / col0 
c280: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
c290: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 34 0d  0..----..17..34.
c2a0: 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .59....query I r
c2b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
c2c0: 20 74 61 62 32 2e 63 6f 6c 31 20 29 20 2a 20 2d   tab2.col1 ) * -
c2d0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
c2e0: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36  .----..-1534..-6
c2f0: 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72  46..-837....quer
c300: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c310: 45 43 54 20 63 6f 6c 31 20 2b 20 38 36 20 2b 20  ECT col1 + 86 + 
c320: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
c330: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab2..----..12
c340: 30 0d 0a 31 34 38 0d 0a 32 30 34 0d 0a 0d 0a 71  0..148..204....q
c350: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c360: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
c370: 2d 20 63 6f 6c 30 20 2b 20 36 39 20 41 53 20 63  - col0 + 69 AS c
c380: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
c390: 2d 2d 2d 0d 0a 2d 32 30 0d 0a 33 34 0d 0a 34 35  ---..-20..34..45
c3a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c3b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 33 20 2a  ort..SELECT 93 *
c3c0: 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2b 20 35   tab2.col2 + + 5
c3d0: 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
c3e0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
c3f0: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
c400: 67 20 74 6f 20 38 66 33 34 39 30 31 38 61 33 31  g to 8f349018a31
c410: 62 63 38 34 61 38 66 62 35 36 34 37 34 34 65 34  bc84a8fb564744e4
c420: 61 32 64 62 63 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  a2dbc....onlyif 
c430: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
c440: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
c450: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
c460: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
c470: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
c480: 6c 2d 33 33 32 0d 0a 53 45 4c 45 43 54 20 2b 20  l-332..SELECT + 
c490: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
c4a0: 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 32 20  GNED ) + - col2 
c4b0: 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52  * - col0 col1 FR
c4c0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
c4d0: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
c4e0: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
c4f0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
c500: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
c510: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
c520: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
c530: 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
c540: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
c550: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
c560: 72 74 20 6c 61 62 65 6c 2d 33 33 32 0d 0a 53 45  rt label-332..SE
c570: 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55  LECT + CAST ( NU
c580: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
c590: 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + - col2 * - col
c5a0: 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  0 col1 FROM tab2
c5b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c5c0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
c5d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c5e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20  ort..SELECT ( - 
c5f0: 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20 2b 20  cor0.col2 ) * + 
c600: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
c610: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
c620: 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d  534..-646..-837.
c630: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
c640: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
c650: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
c660: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
c670: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
c680: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 34 0d  wsort label-334.
c690: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
c6a0: 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32   - - col0 * col2
c6b0: 20 2a 20 2d 20 43 41 53 54 28 20 63 6f 6c 30 20   * - CAST( col0 
c6c0: 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20  AS SIGNED ) + + 
c6d0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
c6e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 30  or0..----..-1190
c6f0: 0d 0a 2d 31 38 39 38 34 0d 0a 2d 36 34 39 34 33  ..-18984..-64943
c700: 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
c710: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
c720: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
c730: 6f 72 74 20 6c 61 62 65 6c 2d 33 33 34 0d 0a 53  ort label-334..S
c740: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
c750: 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a   - col0 * col2 *
c760: 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41   - CAST ( col0 A
c770: 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20  S INTEGER ) + + 
c780: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
c790: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 30  or0..----..-1190
c7a0: 0d 0a 2d 31 38 39 38 34 0d 0a 2d 36 34 39 34 33  ..-18984..-64943
c7b0: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
c7c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
c7d0: 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2d   col0 + col2 * -
c7e0: 20 63 6f 6c 31 20 2d 20 2d 20 32 20 46 52 4f 4d   col1 - - 2 FROM
c7f0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
c800: 2d 2d 2d 0d 0a 2d 31 31 36 36 0d 0a 2d 31 33 39  ---..-1166..-139
c810: 39 0d 0a 2d 35 30 34 0d 0a 0d 0a 6f 6e 6c 79 69  9..-504....onlyi
c820: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
c830: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
c840: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
c850: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c860: 20 6c 61 62 65 6c 2d 33 33 36 0d 0a 53 45 4c 45   label-336..SELE
c870: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
c880: 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20 34 34   DIV + col0 + 44
c890: 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
c8a0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
c8b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 32 31 0d  0..----..18..21.
c8c0: 0a 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .6....skipif mys
c8d0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
c8e0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
c8f0: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 36 0d 0a  sort label-336..
c900: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
c910: 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 2b 20  col1 / + col0 + 
c920: 34 34 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c  44 - col2 AS col
c930: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
c940: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 32  or0..----..18..2
c950: 31 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..6....query I 
c960: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c970: 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  ALL - col1 * - c
c980: 6f 6c 30 20 2b 20 2d 20 32 32 20 2a 20 2b 20 63  ol0 + - 22 * + c
c990: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
c9a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37   cor0..----..-37
c9b0: 37 0d 0a 34 30 33 30 0d 0a 35 30 37 0d 0a 0d 0a  7..4030..507....
c9c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c9d0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
c9e0: 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   - col0 * - col2
c9f0: 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
ca00: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
ca10: 2d 36 32 0d 0a 37 30 36 0d 0a 37 32 30 37 0d 0a  -62..706..7207..
ca20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ca30: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
ca40: 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
ca50: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
ca60: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 34 0d 0a  r0..----..1264..
ca70: 32 31 30 0d 0a 34 35 32 34 0d 0a 0d 0a 71 75 65  210..4524....que
ca80: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
ca90: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
caa0: 6c 32 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l2 - + cor0.col1
cab0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
cac0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d  r0..----..-33..-
cad0: 34 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49  4..21....query I
cae0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
caf0: 20 41 4c 4c 20 2b 20 74 61 62 30 2e 63 6f 6c 31   ALL + tab0.col1
cb00: 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 35 34   * + col0 + - 54
cb10: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
cb20: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 31 30 0d 0a  b0..----..2010..
cb30: 33 33 34 31 0d 0a 38 30 34 35 0d 0a 0d 0a 6f 6e  3341..8045....on
cb40: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
cb50: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
cb60: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
cb70: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
cb80: 6f 72 74 20 6c 61 62 65 6c 2d 33 34 32 0d 0a 53  ort label-342..S
cb90: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 33 20 44  ELECT ALL - 83 D
cba0: 49 56 20 2b 20 38 31 20 63 6f 6c 31 20 46 52 4f  IV + 81 col1 FRO
cbb0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
cbc0: 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70  ..-1..-1....skip
cbd0: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
cbe0: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
cbf0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
cc00: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
cc10: 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
cc20: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
cc30: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
cc40: 6f 72 74 20 6c 61 62 65 6c 2d 33 34 32 0d 0a 53  ort label-342..S
cc50: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 33 20 2f  ELECT ALL - 83 /
cc60: 20 2b 20 38 31 20 63 6f 6c 31 20 46 52 4f 4d 20   + 81 col1 FROM 
cc70: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  tab1..----..-1..
cc80: 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20  -1..-1....query 
cc90: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
cca0: 54 20 41 4c 4c 20 2d 20 34 39 20 46 52 4f 4d 20  T ALL - 49 FROM 
ccb0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d  tab1..----..-49.
ccc0: 0a 2d 34 39 0d 0a 2d 34 39 0d 0a 0d 0a 71 75 65  .-49..-49....que
ccd0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
cce0: 4c 45 43 54 20 2b 20 37 33 20 2a 20 2b 20 63 6f  LECT + 73 * + co
ccf0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
cd00: 2d 2d 0d 0a 32 34 30 39 0d 0a 35 39 38 36 0d 0a  --..2409..5986..
cd10: 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  73....query I ro
cd20: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
cd30: 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20  STINCT + + col1 
cd40: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  + col1 * col2 FR
cd50: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
cd60: 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a 31 34 33  .----..1261..143
cd70: 30 0d 0a 35 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  0..580....onlyif
cd80: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
cd90: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
cda0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
cdb0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
cdc0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
cdd0: 65 6c 2d 33 34 36 0d 0a 53 45 4c 45 43 54 20 2d  el-346..SELECT -
cde0: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44   CAST( NULL AS D
cdf0: 45 43 49 4d 41 4c 20 29 20 2d 20 2b 20 63 6f 6c  ECIMAL ) - + col
ce00: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
ce10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
ce20: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
ce30: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
ce40: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
ce50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
ce60: 62 65 6c 2d 33 34 36 0d 0a 53 45 4c 45 43 54 20  bel-346..SELECT 
ce70: 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
ce80: 20 52 45 41 4c 20 29 20 2d 20 2b 20 63 6f 6c 30   REAL ) - + col0
ce90: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
cea0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
ceb0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
cec0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ced0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
cee0: 20 32 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74   22 FROM tab2, t
cef0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
cf00: 2d 0d 0a 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -..22....query I
cf10: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
cf20: 20 41 4c 4c 20 2d 20 32 36 20 2b 20 2b 20 63 6f   ALL - 26 + + co
cf30: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
cf40: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d  cor0..----..-23.
cf50: 0a 33 38 0d 0a 35 34 0d 0a 0d 0a 6f 6e 6c 79 69  .38..54....onlyi
cf60: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
cf70: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
cf80: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
cf90: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
cfa0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
cfb0: 62 65 6c 2d 33 34 39 0d 0a 53 45 4c 45 43 54 20  bel-349..SELECT 
cfc0: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 43 41  col2 * col0 + CA
cfd0: 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
cfe0: 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  ED ) FROM tab2..
cff0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
d000: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
d010: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
d020: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
d030: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
d040: 34 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  49..SELECT col2 
d050: 2a 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20  * col0 + CAST ( 
d060: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
d070: 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
d080: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
d090: 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
d0a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74  owsort..SELECT t
d0b0: 61 62 32 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  ab2.col2 * col1 
d0c0: 2d 20 39 37 20 2a 20 2b 20 63 6f 6c 32 20 41 53  - 97 * + col2 AS
d0d0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
d0e0: 0a 2d 2d 2d 2d 0d 0a 2d 31 37 38 32 0d 0a 2d 33  .----..-1782..-3
d0f0: 30 34 30 0d 0a 2d 39 38 38 0d 0a 0d 0a 71 75 65  040..-988....que
d100: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d110: 4c 45 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 32  LECT + tab0.col2
d120: 20 2b 20 2d 20 39 33 20 2a 20 36 33 20 46 52 4f   + - 93 * 63 FRO
d130: 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  M tab0, tab0 AS 
d140: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
d150: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
d160: 66 35 31 30 35 66 37 34 33 30 36 33 30 30 34 38  f5105f7430630048
d170: 65 36 63 33 38 32 35 39 65 31 33 35 34 37 33 39  e6c38259e1354739
d180: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
d190: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
d1a0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
d1b0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
d1c0: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
d1d0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35 32  owsort label-352
d1e0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 20 2a  ..SELECT ALL 3 *
d1f0: 20 2b 20 63 6f 6c 30 20 2a 20 43 41 53 54 28 20   + col0 * CAST( 
d200: 2b 20 31 38 20 41 53 20 53 49 47 4e 45 44 20 29  + 18 AS SIGNED )
d210: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
d220: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33  b1..----..162..3
d230: 34 35 36 0d 0a 34 33 32 30 0d 0a 0d 0a 73 6b 69  456..4320....ski
d240: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
d250: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
d260: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
d270: 6c 2d 33 35 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-352..SELECT AL
d280: 4c 20 33 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 43  L 3 * + col0 * C
d290: 41 53 54 20 28 20 2b 20 31 38 20 41 53 20 49 4e  AST ( + 18 AS IN
d2a0: 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20  TEGER ) AS col1 
d2b0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
d2c0: 0a 31 36 32 0d 0a 33 34 35 36 0d 0a 34 33 32 30  .162..3456..4320
d2d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d2e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
d2f0: 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 33  + ( col0 ) * + 3
d300: 35 20 2b 20 39 38 20 41 53 20 63 6f 6c 32 20 46  5 + 98 AS col2 F
d310: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
d320: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 33 0d 0a 33 32  ..----..1323..32
d330: 31 33 0d 0a 39 33 38 0d 0a 0d 0a 71 75 65 72 79  13..938....query
d340: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d350: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
d360: 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30  r0.col0 * - cor0
d370: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
d380: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
d390: 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d  .----..49..6084.
d3a0: 0a 36 32 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .6241....skipif 
d3b0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
d3c0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
d3d0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
d3e0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
d3f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d400: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
d410: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 37 32 20 2a   + col1 * + 72 *
d420: 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f   - col2 col0 FRO
d430: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
d440: 2d 2d 2d 2d 0d 0a 2d 31 30 31 30 36 32 0d 0a 2d  ----..-101062..-
d450: 34 31 30 33 30 0d 0a 2d 38 39 38 34 33 0d 0a 0d  41030..-89843...
d460: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d470: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
d480: 54 20 2d 20 2b 20 34 37 20 2b 20 63 6f 72 30 2e  T - + 47 + cor0.
d490: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
d4a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
d4b0: 34 0d 0a 31 37 0d 0a 33 33 0d 0a 0d 0a 71 75 65  4..17..33....que
d4c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d4d0: 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 38 30  LECT + col1 * 80
d4e0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
d4f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 38 38 30 0d 0a  r0..----..6880..
d500: 37 32 38 30 0d 0a 37 37 36 30 0d 0a 0d 0a 6f 6e  7280..7760....on
d510: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
d520: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
d530: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
d540: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
d550: 6f 72 74 20 6c 61 62 65 6c 2d 33 35 38 0d 0a 53  ort label-358..S
d560: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
d570: 2e 63 6f 6c 31 20 2a 20 36 34 20 44 49 56 20 2b  .col1 * 64 DIV +
d580: 20 31 36 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   16 col2 FROM ta
d590: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
d5a0: 0d 0a 31 32 34 0d 0a 32 33 36 0d 0a 36 38 0d 0a  ..124..236..68..
d5b0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
d5c0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
d5d0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
d5e0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
d5f0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
d600: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
d610: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
d620: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d630: 33 35 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  358..SELECT ALL 
d640: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 36 34  + cor0.col1 * 64
d650: 20 2f 20 2b 20 31 36 20 63 6f 6c 32 20 46 52 4f   / + 16 col2 FRO
d660: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
d670: 2d 2d 2d 2d 0d 0a 31 32 34 0d 0a 32 33 36 0d 0a  ----..124..236..
d680: 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  68....onlyif mys
d690: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
d6a0: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
d6b0: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
d6c0: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
d6d0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
d6e0: 35 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  59..SELECT DISTI
d6f0: 4e 43 54 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53  NCT col2 * + CAS
d700: 54 28 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41  T( col0 * col1 A
d710: 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
d720: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
d730: 2d 2d 0d 0a 33 33 39 35 0d 0a 36 36 34 31 31 38  --..3395..664118
d740: 0d 0a 36 38 31 31 32 0d 0a 0d 0a 73 6b 69 70 69  ..68112....skipi
d750: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
d760: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
d770: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d780: 33 35 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  359..SELECT DIST
d790: 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2b 20 43 41  INCT col2 * + CA
d7a0: 53 54 20 28 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  ST ( col0 * col1
d7b0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
d7c0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
d7d0: 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d 0a 36 36 34  .----..3395..664
d7e0: 31 31 38 0d 0a 36 38 31 31 32 0d 0a 0d 0a 6f 6e  118..68112....on
d7f0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
d800: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
d810: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
d820: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
d830: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d840: 20 6c 61 62 65 6c 2d 33 36 30 0d 0a 53 45 4c 45   label-360..SELE
d850: 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e  CT ALL + - cor0.
d860: 63 6f 6c 32 20 2b 20 43 41 53 54 28 20 63 6f 72  col2 + CAST( cor
d870: 30 2e 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44  0.col0 AS SIGNED
d880: 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   ) * - cor0.col2
d890: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
d8a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 34 0d  r0..----..-2054.
d8b0: 0a 2d 32 31 36 0d 0a 2d 33 30 34 30 0d 0a 0d 0a  .-216..-3040....
d8c0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
d8d0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
d8e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
d8f0: 61 62 65 6c 2d 33 36 30 0d 0a 53 45 4c 45 43 54  abel-360..SELECT
d900: 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f   ALL + - cor0.co
d910: 6c 32 20 2b 20 43 41 53 54 20 28 20 63 6f 72 30  l2 + CAST ( cor0
d920: 2e 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52  .col0 AS INTEGER
d930: 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   ) * - cor0.col2
d940: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
d950: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 34 0d  r0..----..-2054.
d960: 0a 2d 32 31 36 0d 0a 2d 33 30 34 30 0d 0a 0d 0a  .-216..-3040....
d970: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d980: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
d990: 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31   * col0 + + col1
d9a0: 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
d9b0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
d9c0: 2d 0d 0a 31 35 35 36 31 0d 0a 33 34 39 32 0d 0a  -..15561..3492..
d9d0: 34 39 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4902....query I 
d9e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
d9f0: 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ALL - cor0.col1 
da00: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20  * - cor0.col1 - 
da10: 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32  ( col2 ) AS col2
da20: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
da30: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 36 33 0d 0a  r0..----..7363..
da40: 38 31 39 39 0d 0a 39 34 30 38 0d 0a 0d 0a 71 75  8199..9408....qu
da50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
da60: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a  ELECT ALL col1 *
da70: 20 37 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   75 AS col0 FROM
da80: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
da90: 2d 2d 2d 0d 0a 36 34 35 30 0d 0a 36 38 32 35 0d  ---..6450..6825.
daa0: 0a 37 32 37 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .7275....onlyif 
dab0: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
dac0: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
dad0: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
dae0: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
daf0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
db00: 6c 2d 33 36 34 0d 0a 53 45 4c 45 43 54 20 44 49  l-364..SELECT DI
db10: 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20  STINCT + - col2 
db20: 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  * + CAST( NULL A
db30: 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 63  S SIGNED ) + + c
db40: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
db50: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
db60: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
db70: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
db80: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
db90: 6f 72 74 20 6c 61 62 65 6c 2d 33 36 34 0d 0a 53  ort label-364..S
dba0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
dbb0: 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54   - col2 * + CAST
dbc0: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
dbd0: 45 52 20 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52  ER ) + + col0 FR
dbe0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
dbf0: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f  .----..NULL....o
dc00: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
dc10: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
dc20: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
dc30: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
dc40: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 36 35 0d 0a  sort label-365..
dc50: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
dc60: 30 20 2b 20 2b 20 28 20 34 34 20 29 20 2a 20 63  0 + + ( 44 ) * c
dc70: 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2b 20 63  or0.col0 DIV + c
dc80: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
dc90: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
dca0: 2d 2d 2d 0d 0a 31 33 33 0d 0a 36 38 0d 0a 37 39  ---..133..68..79
dcb0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
dcc0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
dcd0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
dce0: 72 74 20 6c 61 62 65 6c 2d 33 36 35 0d 0a 53 45  rt label-365..SE
dcf0: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
dd00: 2b 20 2b 20 28 20 34 34 20 29 20 2a 20 63 6f 72  + + ( 44 ) * cor
dd10: 30 2e 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20  0.col0 / + col0 
dd20: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
dd30: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
dd40: 0a 31 33 33 0d 0a 36 38 0d 0a 37 39 0d 0a 0d 0a  .133..68..79....
dd50: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
dd60: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
dd70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
dd80: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
dd90: 30 2e 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 20  0.col2 * - CAST 
dda0: 28 20 63 6f 6c 30 20 41 53 20 52 45 41 4c 20 29  ( col0 AS REAL )
ddb0: 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + + col0 AS col
ddc0: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
ddd0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 30 39 0d 0a 2d  ..----..-7209..-
dde0: 37 36 38 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  768..0....query 
ddf0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
de00: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
de10: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol2 * - col0 AS 
de20: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
de30: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
de40: 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30  62..-3648..-7680
de50: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
de60: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
de70: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + + cor0.col2 * 
de80: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  - cor0.col2 + + 
de90: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col2 * - col1 FR
dea0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
deb0: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 36 0d 0a 2d 32  .----..-1566..-2
dec0: 30 39 30 0d 0a 2d 32 32 31 30 0d 0a 0d 0a 71 75  090..-2210....qu
ded0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
dee0: 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d  ELECT - col2 * -
def0: 20 63 6f 6c 31 20 2d 20 63 6f 72 30 2e 63 6f 6c   col1 - cor0.col
df00: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
df10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 38 0d  or0..----..1168.
df20: 0a 31 34 30 31 0d 0a 35 30 36 0d 0a 0d 0a 71 75  .1401..506....qu
df30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
df40: 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c 30  ELECT - ( + col0
df50: 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   ) * col1 + + co
df60: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
df70: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
df80: 2d 2d 0d 0a 2d 35 37 36 0d 0a 2d 37 35 0d 0a 2d  --..-576..-75..-
df90: 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  960....query I r
dfa0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
dfb0: 49 53 54 49 4e 43 54 20 37 36 20 46 52 4f 4d 20  ISTINCT 76 FROM 
dfc0: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
dfd0: 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .76....query I r
dfe0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
dff0: 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32  ISTINCT - + col2
e000: 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   + - col1 + col0
e010: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
e020: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d  r0..----..-29..-
e030: 33 0d 0a 2d 37 37 0d 0a 0d 0a 71 75 65 72 79 20  3..-77....query 
e040: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e050: 54 20 2d 20 38 36 20 2b 20 63 6f 6c 32 20 41 53  T - 86 + col2 AS
e060: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
e070: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
e080: 34 38 0d 0a 2d 35 39 0d 0a 2d 36 30 0d 0a 0d 0a  48..-59..-60....
e090: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e0a0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
e0b0: 20 2b 20 36 31 20 2b 20 63 6f 6c 32 20 2a 20 63   + 61 + col2 * c
e0c0: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
e0d0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 37   tab1..----..297
e0e0: 37 0d 0a 33 33 31 30 0d 0a 39 32 37 37 0d 0a 0d  7..3310..9277...
e0f0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
e100: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
e110: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
e120: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
e130: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 35  owsort label-375
e140: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
e150: 54 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 31  T + col2 DIV + 1
e160: 39 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  9 + - col0 + col
e170: 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 * col2 FROM ta
e180: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 37 32 31  b0..----..0..721
e190: 33 0d 0a 37 36 39 0d 0a 0d 0a 73 6b 69 70 69 66  3..769....skipif
e1a0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
e1b0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
e1c0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
e1d0: 37 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  75..SELECT DISTI
e1e0: 4e 43 54 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 31  NCT + col2 / + 1
e1f0: 39 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  9 + - col0 + col
e200: 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 * col2 FROM ta
e210: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 37 32 31  b0..----..0..721
e220: 33 0d 0a 37 36 39 0d 0a 0d 0a 71 75 65 72 79 20  3..769....query 
e230: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e240: 54 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 63  T ( + col0 ) * c
e250: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
e260: 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37  ---..35..7298..7
e270: 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
e280: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
e290: 6c 32 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 31  l2 + + tab1.col1
e2a0: 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 46   * + tab1.col1 F
e2b0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
e2c0: 31 35 37 0d 0a 32 36 35 0d 0a 37 33 30 0d 0a 0d  157..265..730...
e2d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e2e0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
e2f0: 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63  col1 * col0 AS c
e300: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
e310: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36   cor0..----..206
e320: 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d 0a 0d  4..3395..8099...
e330: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e340: 0d 0a 53 45 4c 45 43 54 20 2d 20 39 39 20 2b 20  ..SELECT - 99 + 
e350: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
e360: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab1..----..-7
e370: 33 0d 0a 2d 38 36 0d 0a 2d 38 39 0d 0a 0d 0a 71  3..-86..-89....q
e380: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e390: 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
e3a0: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
e3b0: 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f  tab1 AS cor0 CRO
e3c0: 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20  SS JOIN tab1 AS 
e3d0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
e3e0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
e3f0: 30 64 63 39 62 62 65 33 39 32 64 35 32 64 66 39  0dc9bbe392d52df9
e400: 33 64 32 61 31 31 35 64 37 66 36 32 32 64 62 61  3d2a115d7f622dba
e410: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
e420: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  ort..SELECT - ta
e430: 62 32 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41  b2.col1 + col2 A
e440: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
e450: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d  ..----..-33..-4.
e460: 0a 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .21....onlyif my
e470: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
e480: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
e490: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
e4a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
e4b0: 65 6c 2d 33 38 32 0d 0a 53 45 4c 45 43 54 20 63  el-382..SELECT c
e4c0: 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56  ol1 + + col2 DIV
e4d0: 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f   - col0 col1 FRO
e4e0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
e4f0: 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 32 0d 0a 38 0d  ----..10..12..8.
e500: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
e510: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
e520: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
e530: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
e540: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
e550: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
e560: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
e570: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
e580: 2d 33 38 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -382..SELECT col
e590: 31 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 63  1 + + col2 / - c
e5a0: 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
e5b0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
e5c0: 0d 0a 31 30 0d 0a 31 32 0d 0a 38 0d 0a 0d 0a 6f  ..10..12..8....o
e5d0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
e5e0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
e5f0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
e600: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
e610: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 33 0d 0a  sort label-383..
e620: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20  SELECT - col2 * 
e630: 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c  + col1 DIV + col
e640: 31 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  1 + col1 * col1 
e650: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
e660: 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 36 33 0d 0a 38  0..----..7363..8
e670: 31 39 39 0d 0a 39 34 30 38 0d 0a 0d 0a 73 6b 69  199..9408....ski
e680: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
e690: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
e6a0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
e6b0: 6c 2d 33 38 33 0d 0a 53 45 4c 45 43 54 20 2d 20  l-383..SELECT - 
e6c0: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2f 20  col2 * + col1 / 
e6d0: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20  + col1 + col1 * 
e6e0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
e6f0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  S cor0..----..73
e700: 36 33 0d 0a 38 31 39 39 0d 0a 39 34 30 38 0d 0a  63..8199..9408..
e710: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
e720: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
e730: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
e740: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
e750: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
e760: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e770: 43 54 20 44 49 53 54 49 4e 43 54 20 37 33 20 63  CT DISTINCT 73 c
e780: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
e790: 2d 2d 2d 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79  ---..73....query
e7a0: 20 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f   IIIIIIIIIIII ro
e7b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20  wsort..SELECT * 
e7c0: 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 2c  FROM tab2, tab0,
e7d0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
e7e0: 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor1..----..
e7f0: 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68 69  972 values hashi
e800: 6e 67 20 74 6f 20 65 61 30 66 37 34 37 35 38 38  ng to ea0f747588
e810: 64 64 66 35 38 36 39 65 65 31 38 61 35 65 32 32  ddf5869ee18a5e22
e820: 64 39 66 32 33 37 0d 0a 0d 0a 73 6b 69 70 69 66  d9f237....skipif
e830: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
e840: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
e850: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
e860: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
e870: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
e880: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
e890: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 31  ol2 * + col1 + 1
e8a0: 38 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  8 col0 FROM tab2
e8b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 35   cor0..----..155
e8c0: 32 0d 0a 36 36 34 0d 0a 38 35 35 0d 0a 0d 0a 71  2..664..855....q
e8d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e8e0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
e8f0: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  - cor0.col2 * co
e900: 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29 20  l2 + - ( col0 ) 
e910: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
e920: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 33 0d 0a  0..----..-1113..
e930: 2d 33 36 0d 0a 2d 36 38 31 33 0d 0a 0d 0a 71 75  -36..-6813....qu
e940: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
e950: 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2d 20 2d  ELECT + col1 - -
e960: 20 28 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d   ( + col2 ) FROM
e970: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d   tab2..----..55.
e980: 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79  .58..85....query
e990: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e9a0: 43 54 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20  CT ( + col2 ) * 
e9b0: 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  4 AS col1 FROM t
e9c0: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
e9d0: 32 31 36 0d 0a 32 32 38 0d 0a 33 38 34 0d 0a 0d  216..228..384...
e9e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e9f0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
ea00: 54 20 2b 20 31 35 20 2b 20 2b 20 63 6f 72 30 2e  T + 15 + + cor0.
ea10: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
ea20: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
ea30: 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 33 39 0d 0a 35  ----..104..39..5
ea40: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
ea50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
ea60: 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63  TINCT + col1 + c
ea70: 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 * - cor0.col
ea80: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
ea90: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
eaa0: 2d 0d 0a 2d 31 32 33 35 0d 0a 2d 31 33 37 38 0d  -..-1235..-1378.
eab0: 0a 2d 35 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-560....skipif 
eac0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
ead0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
eae0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
eaf0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
eb00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
eb10: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
eb20: 32 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 63  20 * cor0.col2 c
eb30: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
eb40: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34   cor0..----..164
eb50: 30 0d 0a 32 30 0d 0a 36 36 30 0d 0a 0d 0a 71 75  0..20..660....qu
eb60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
eb70: 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 30  ELECT + ( + col0
eb80: 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) + col1 FROM t
eb90: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
eba0: 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30  -..110..132..180
ebb0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ebc0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 34 20 2a  ort..SELECT 14 *
ebd0: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
ebe0: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
ebf0: 2d 2d 2d 2d 0d 0a 31 34 30 0d 0a 31 38 32 0d 0a  ----..140..182..
ec00: 33 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  364....query I r
ec10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
ec20: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
ec30: 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
ec40: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  0 cor0..----..-9
ec50: 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79  ..34..7....query
ec60: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ec70: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
ec80: 6c 32 20 2a 20 28 20 2b 20 38 38 20 29 20 46 52  l2 * ( + 88 ) FR
ec90: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
eca0: 32 32 38 38 0d 0a 2d 32 33 37 36 0d 0a 2d 33 33  2288..-2376..-33
ecb0: 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  44....query I ro
ecc0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
ecd0: 63 6f 6c 32 20 2b 20 2b 20 28 20 2b 20 63 6f 72  col2 + + ( + cor
ece0: 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31  0.col1 ) AS col1
ecf0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
ed00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38  r0..----..55..58
ed10: 0d 0a 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..85....onlyif m
ed20: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
ed30: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
ed40: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
ed50: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
ed60: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
ed70: 2d 33 39 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  -398..SELECT + +
ed80: 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 2b 20 43   cor0.col0 / + C
ed90: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
eda0: 4e 45 44 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c  NED ) + cor0.col
edb0: 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  1 * col2 AS col1
edc0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
edd0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
ede0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
edf0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
ee00: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
ee10: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
ee20: 65 6c 2d 33 39 38 0d 0a 53 45 4c 45 43 54 20 2b  el-398..SELECT +
ee30: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 2b   + cor0.col0 / +
ee40: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
ee50: 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 72 30  INTEGER ) + cor0
ee60: 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20  .col1 * col2 AS 
ee70: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
ee80: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
ee90: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
eea0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
eeb0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
eec0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
eed0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
eee0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39  rowsort label-39
eef0: 39 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  9..SELECT + - co
ef00: 6c 31 20 44 49 56 20 35 32 20 2b 20 63 6f 6c 30  l1 DIV 52 + col0
ef10: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
ef20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 33 34  r0..----..23..34
ef30: 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..88....skipif m
ef40: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
ef50: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
ef60: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 39  owsort label-399
ef70: 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
ef80: 31 20 2f 20 35 32 20 2b 20 63 6f 6c 30 20 46 52  1 / 52 + col0 FR
ef90: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
efa0: 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 33 34 0d 0a 38  .----..23..34..8
efb0: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
efc0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
efd0: 20 34 34 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2d   44 * - col1 * -
efe0: 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
eff0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
f000: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 39  cor0..----..-149
f010: 33 38 30 0d 0a 2d 33 35 36 33 35 36 0d 0a 2d 39  380..-356356..-9
f020: 30 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0816....query I 
f030: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f040: 2d 20 28 20 37 37 20 29 20 2a 20 2d 20 63 6f 6c  - ( 77 ) * - col
f050: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
f060: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 30 32 0d  or0..----..2002.
f070: 0a 32 30 37 39 0d 0a 32 39 32 36 0d 0a 0d 0a 71  .2079..2926....q
f080: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
f090: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
f0a0: 38 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  86 AS col0 FROM 
f0b0: 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
f0c0: 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61  SS JOIN tab1, ta
f0d0: 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32  b0 AS cor1, tab2
f0e0: 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
f0f0: 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  86....query I ro
f100: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
f110: 53 54 49 4e 43 54 20 2b 20 33 38 20 2a 20 2d 20  STINCT + 38 * - 
f120: 28 20 63 6f 6c 31 20 29 20 2a 20 34 34 20 2b 20  ( col1 ) * 44 + 
f130: 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  - col1 * - col2 
f140: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
f150: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  0 cor0..----..-1
f160: 34 30 39 35 34 0d 0a 2d 31 34 34 36 39 30 0d 0a  40954..-144690..
f170: 2d 31 36 32 30 38 37 0d 0a 0d 0a 6f 6e 6c 79 69  -162087....onlyi
f180: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
f190: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
f1a0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
f1b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f1c0: 20 6c 61 62 65 6c 2d 34 30 34 0d 0a 53 45 4c 45   label-404..SELE
f1d0: 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20  CT ALL - + col0 
f1e0: 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f  DIV cor0.col0 co
f1f0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
f200: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
f210: 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66  -1..-1....skipif
f220: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
f230: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
f240: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
f250: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
f260: 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
f270: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
f280: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f290: 74 20 6c 61 62 65 6c 2d 34 30 34 0d 0a 53 45 4c  t label-404..SEL
f2a0: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30  ECT ALL - + col0
f2b0: 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c   / cor0.col0 col
f2c0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
f2d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
f2e0: 31 0d 0a 2d 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  1..-1....onlyif 
f2f0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
f300: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
f310: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
f320: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
f330: 61 62 65 6c 2d 34 30 35 0d 0a 53 45 4c 45 43 54  abel-405..SELECT
f340: 20 2b 20 36 38 20 44 49 56 20 37 36 20 46 52 4f   + 68 DIV 76 FRO
f350: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
f360: 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
f370: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
f380: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
f390: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
f3a0: 65 6c 2d 34 30 35 0d 0a 53 45 4c 45 43 54 20 2b  el-405..SELECT +
f3b0: 20 36 38 20 2f 20 37 36 20 46 52 4f 4d 20 74 61   68 / 76 FROM ta
f3c0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b1 cor0..----..0
f3d0: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
f3e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f3f0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38 39 20  T DISTINCT - 89 
f400: 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  * - col1 AS col0
f410: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
f420: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 33 0d 0a  r0..----..1513..
f430: 32 37 35 39 0d 0a 35 32 35 31 0d 0a 0d 0a 71 75  2759..5251....qu
f440: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f450: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
f460: 20 34 32 20 2b 20 2d 20 34 32 20 46 52 4f 4d 20   42 + - 42 FROM 
f470: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
f480: 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  --..0....query I
f490: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f4a0: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
f4b0: 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   - + col0 AS col
f4c0: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
f4d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a  or0..----..-41..
f4e0: 2d 35 32 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79  -52..20....query
f4f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
f500: 43 54 20 41 4c 4c 20 31 39 20 2a 20 63 6f 72 30  CT ALL 19 * cor0
f510: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20  .col0 FROM tab2 
f520: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
f530: 33 33 0d 0a 31 34 38 32 0d 0a 31 35 30 31 0d 0a  33..1482..1501..
f540: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f550: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
f560: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b  ol2 * - col1 + +
f570: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
f580: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
f590: 31 34 37 35 0d 0a 2d 36 32 39 0d 0a 2d 38 30 36  1475..-629..-806
f5a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f5b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
f5c0: 49 4e 43 54 20 2d 20 28 20 2b 20 63 6f 6c 32 20  INCT - ( + col2 
f5d0: 29 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 37 38 20  ) * col0 + - 78 
f5e0: 2b 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 46  + + ( + col0 ) F
f5f0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
f600: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 37 0d 0a 2d 33  ..----..-237..-3
f610: 36 36 32 0d 0a 2d 37 36 37 38 0d 0a 0d 0a 71 75  662..-7678....qu
f620: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f630: 45 4c 45 43 54 20 2b 20 2d 20 36 39 20 2b 20 63  ELECT + - 69 + c
f640: 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 * + cor0.col
f650: 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
f660: 0d 0a 2d 2d 2d 2d 0d 0a 32 32 30 0d 0a 33 34 31  ..----..220..341
f670: 32 0d 0a 38 39 32 0d 0a 0d 0a 71 75 65 72 79 20  2..892....query 
f680: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f690: 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2d 20 63  T ALL + col1 - c
f6a0: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol2 * + col0 AS 
f6b0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
f6c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
f6d0: 35 38 0d 0a 2d 31 39 36 39 0d 0a 2d 32 39 38 35  58..-1969..-2985
f6e0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
f6f0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
f700: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
f710: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
f720: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
f730: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 34  owsort label-414
f740: 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 37  ..SELECT CAST( 7
f750: 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  0 AS SIGNED ) * 
f760: 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
f770: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
f780: 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 30 32 30 0d 0a 2d  ..----..-6020..-
f790: 36 33 37 30 0d 0a 2d 36 37 39 30 0d 0a 0d 0a 73  6370..-6790....s
f7a0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
f7b0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
f7c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
f7d0: 62 65 6c 2d 34 31 34 0d 0a 53 45 4c 45 43 54 20  bel-414..SELECT 
f7e0: 43 41 53 54 20 28 20 37 30 20 41 53 20 49 4e 54  CAST ( 70 AS INT
f7f0: 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 31 20  EGER ) * - col1 
f800: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
f810: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
f820: 0a 2d 36 30 32 30 0d 0a 2d 36 33 37 30 0d 0a 2d  .-6020..-6370..-
f830: 36 37 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6790....query I 
f840: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f850: 44 49 53 54 49 4e 43 54 20 32 39 20 2d 20 28 20  DISTINCT 29 - ( 
f860: 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20 2b 20  cor0.col2 ) * + 
f870: 35 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  50 * - col2 FROM
f880: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
f890: 2d 2d 2d 0d 0a 31 34 35 38 32 39 0d 0a 31 36 32  ---..145829..162
f8a0: 34 37 39 0d 0a 34 36 30 38 32 39 0d 0a 0d 0a 6f  479..460829....o
f8b0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
f8c0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
f8d0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
f8e0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
f8f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f900: 74 20 6c 61 62 65 6c 2d 34 31 36 0d 0a 53 45 4c  t label-416..SEL
f910: 45 43 54 20 43 41 53 54 28 20 2b 20 34 35 20 41  ECT CAST( + 45 A
f920: 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63  S SIGNED ) * + c
f930: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
f940: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 31 35   tab2..----..315
f950: 0d 0a 33 35 31 30 0d 0a 33 35 35 35 0d 0a 0d 0a  ..3510..3555....
f960: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
f970: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
f980: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
f990: 61 62 65 6c 2d 34 31 36 0d 0a 53 45 4c 45 43 54  abel-416..SELECT
f9a0: 20 43 41 53 54 20 28 20 2b 20 34 35 20 41 53 20   CAST ( + 45 AS 
f9b0: 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f  INTEGER ) * + co
f9c0: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
f9d0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 31 35 0d  tab2..----..315.
f9e0: 0a 33 35 31 30 0d 0a 33 35 35 35 0d 0a 0d 0a 71  .3510..3555....q
f9f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
fa00: 53 45 4c 45 43 54 20 2b 20 2d 20 33 38 20 2a 20  SELECT + - 38 * 
fa10: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
fa20: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
fa30: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35 34 0d 0a 2d  ..----..-1254..-
fa40: 33 31 31 36 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65  3116..-38....que
fa50: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
fa60: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 36  LECT DISTINCT 46
fa70: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
fa80: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  b0 cor0..----..4
fa90: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
faa0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
fab0: 20 2b 20 36 31 20 2a 20 36 38 20 41 53 20 63 6f   + 61 * 68 AS co
fac0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
fad0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 34 38  cor0..----..4148
fae0: 0d 0a 34 31 34 38 0d 0a 34 31 34 38 0d 0a 0d 0a  ..4148..4148....
faf0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
fb00: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
fb10: 6c 31 20 2a 20 2d 20 35 34 20 46 52 4f 4d 20 74  l1 * - 54 FROM t
fb20: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
fb30: 2d 0d 0a 31 34 30 34 0d 0a 35 34 30 0d 0a 37 30  -..1404..540..70
fb40: 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
fb50: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
fb60: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
fb70: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
fb80: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
fb90: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
fba0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
fbb0: 20 2d 20 63 6f 6c 32 20 2b 20 37 33 20 2a 20 2d   - col2 + 73 * -
fbc0: 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20   col0 col1 FROM 
fbd0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
fbe0: 2d 2d 0d 0a 2d 35 33 38 0d 0a 2d 35 37 32 30 0d  --..-538..-5720.
fbf0: 0a 2d 35 38 30 35 0d 0a 0d 0a 71 75 65 72 79 20  .-5805....query 
fc00: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fc10: 54 20 2d 20 63 6f 6c 32 20 2a 20 37 39 20 41 53  T - col2 * 79 AS
fc20: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
fc30: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
fc40: 32 30 35 34 0d 0a 2d 32 31 33 33 0d 0a 2d 33 30  2054..-2133..-30
fc50: 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
fc60: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
fc70: 53 54 49 4e 43 54 20 2d 20 28 20 63 6f 72 30 2e  STINCT - ( cor0.
fc80: 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30 20 46 52  col1 ) * col0 FR
fc90: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
fca0: 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d  --..-1343..-217.
fcb0: 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20  .-4602....query 
fcc0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fcd0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 37 20  T DISTINCT + 57 
fce0: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
fcf0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
fd00: 31 31 36 0d 0a 37 34 0d 0a 38 38 0d 0a 0d 0a 71  116..74..88....q
fd10: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
fd20: 53 45 4c 45 43 54 20 41 4c 4c 20 36 37 20 2a 20  SELECT ALL 67 * 
fd30: 63 6f 6c 31 20 2a 20 28 20 2d 20 63 6f 6c 30 20  col1 * ( - col0 
fd40: 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
fd50: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 38 32  or0..----..-1382
fd60: 38 38 0d 0a 2d 32 32 37 34 36 35 0d 0a 2d 35 34  88..-227465..-54
fd70: 32 36 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2633....query I 
fd80: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
fd90: 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 33 33 20  DISTINCT + - 33 
fda0: 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
fdb0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
fdc0: 0d 0a 31 32 35 34 0d 0a 38 35 38 0d 0a 38 39 31  ..1254..858..891
fdd0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
fde0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
fdf0: 31 39 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 74 61  19 * + col2 + ta
fe00: 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b0.col2 FROM tab
fe10: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 30 0d 0a 32  0..----..1640..2
fe20: 30 0d 0a 36 36 30 0d 0a 0d 0a 71 75 65 72 79 20  0..660....query 
fe30: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fe40: 54 20 41 4c 4c 20 2b 20 31 33 20 2b 20 63 6f 6c  T ALL + 13 + col
fe50: 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  2 * - col0 AS co
fe60: 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
fe70: 2d 2d 0d 0a 2d 31 34 39 0d 0a 2d 33 36 33 35 0d  --..-149..-3635.
fe80: 0a 2d 37 36 36 37 0d 0a 0d 0a 71 75 65 72 79 20  .-7667....query 
fe90: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fea0: 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20 38  T ALL col1 * - 8
feb0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
fec0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 0d 0a  r0..----..-136..
fed0: 2d 32 34 38 0d 0a 2d 34 37 32 0d 0a 0d 0a 71 75  -248..-472....qu
fee0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
fef0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
ff00: 20 63 6f 6c 32 20 2a 20 36 35 20 46 52 4f 4d 20   col2 * 65 FROM 
ff10: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
ff20: 2d 2d 0d 0a 31 36 39 30 0d 0a 31 37 35 35 0d 0a  --..1690..1755..
ff30: 32 34 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2470....query I 
ff40: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ff50: 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 28  ALL + - col0 + (
ff60: 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a   col1 + + col2 *
ff70: 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   - col1 ) FROM t
ff80: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
ff90: 2d 0d 0a 2d 31 33 31 35 0d 0a 2d 31 33 38 31 0d  -..-1315..-1381.
ffa0: 0a 2d 36 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-624....onlyif 
ffb0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
ffc0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
ffd0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
ffe0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
fff0: 61 62 65 6c 2d 34 33 32 0d 0a 53 45 4c 45 43 54  abel-432..SELECT
10000 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 44 49 56 20   ALL - col0 DIV 
10010 37 35 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  75 FROM tab2 cor
10020 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  0..----..-1..-1.
10030 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
10040 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
10050 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
10060 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33 32 0d 0a  sort label-432..
10070 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
10080 30 20 2f 20 37 35 20 46 52 4f 4d 20 74 61 62 32  0 / 75 FROM tab2
10090 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
100a0 0a 2d 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  .-1..0....query 
100b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
100c0 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 2b  T ALL + col1 + +
100d0 20 28 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   ( + col2 * - co
100e0 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l1 ) FROM tab1 A
100f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
10100 32 33 35 0d 0a 2d 31 33 37 38 0d 0a 2d 35 36 30  235..-1378..-560
10110 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
10120 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
10130 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
10140 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
10150 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
10160 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10170 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  LECT - col0 + co
10180 6c 31 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 32  l1 + - tab0.col2
10190 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
101a0 0a 2d 2d 2d 2d 0d 0a 2d 38 30 0d 0a 32 39 0d 0a  .----..-80..29..
101b0 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
101c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
101d0 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d 20  STINCT col1 * - 
101e0 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63  col1 + col2 AS c
101f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
10200 2d 2d 2d 0d 0a 2d 37 33 36 33 0d 0a 2d 38 31 39  ---..-7363..-819
10210 39 0d 0a 2d 39 34 30 38 0d 0a 0d 0a 6f 6e 6c 79  9..-9408....only
10220 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
10230 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
10240 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
10250 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10260 74 20 6c 61 62 65 6c 2d 34 33 36 0d 0a 53 45 4c  t label-436..SEL
10270 45 43 54 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20  ECT tab0.col0 + 
10280 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c  - col0 DIV + col
10290 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
102a0 2d 0d 0a 30 0d 0a 32 34 0d 0a 38 38 0d 0a 0d 0a  -..0..24..88....
102b0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
102c0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
102d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
102e0 61 62 65 6c 2d 34 33 36 0d 0a 53 45 4c 45 43 54  abel-436..SELECT
102f0 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   tab0.col0 + - c
10300 6f 6c 30 20 2f 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 / + col2 FRO
10310 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
10320 0a 32 34 0d 0a 38 38 0d 0a 0d 0a 71 75 65 72 79  .24..88....query
10330 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
10340 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2d 20  CT ALL - col2 - 
10350 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
10360 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  M tab2..----..-5
10370 32 0d 0a 2d 35 34 0d 0a 2d 37 36 0d 0a 0d 0a 71  2..-54..-76....q
10380 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10390 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
103a0 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  col0 - col1 FROM
103b0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32   tab0..----..-62
103c0 0d 0a 37 30 36 0d 0a 37 32 30 37 0d 0a 0d 0a 71  ..706..7207....q
103d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
103e0 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
103f0 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 + col0 AS col
10400 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
10410 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
10420 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10430 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
10440 30 20 2b 20 63 6f 6c 30 20 2d 20 31 38 20 46 52  0 + col0 - 18 FR
10450 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
10460 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 31 31 30 0d  .----..-12..110.
10470 0a 31 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .142....query I 
10480 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10490 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 28 20 2b 20  cor0.col0 + ( + 
104a0 32 34 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  24 ) AS col2 FRO
104b0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
104c0 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31 30 33 0d 0a  ----..102..103..
104d0 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
104e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
104f0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
10500 28 20 2d 20 31 31 20 29 20 46 52 4f 4d 20 74 61  ( - 11 ) FROM ta
10510 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
10520 0d 0a 2d 32 38 0d 0a 2d 34 32 0d 0a 2d 37 30 0d  ..-28..-42..-70.
10530 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
10540 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
10550 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
10560 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
10570 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
10580 34 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  43..SELECT col2 
10590 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  + - col2 DIV - c
105a0 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d  ol0 + - col2 * -
105b0 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20   col0 col2 FROM 
105c0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34  tab2..----..2054
105d0 0d 0a 32 31 39 0d 0a 33 30 34 30 0d 0a 0d 0a 73  ..219..3040....s
105e0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
105f0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
10600 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
10610 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
10620 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
10630 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
10640 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
10650 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 33  owsort label-443
10660 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
10670 2d 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20  - col2 / - col0 
10680 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + - col2 * - col
10690 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0 col2 FROM tab2
106a0 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34 0d 0a 32 31  ..----..2054..21
106b0 39 0d 0a 33 30 34 30 0d 0a 0d 0a 6f 6e 6c 79 69  9..3040....onlyi
106c0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
106d0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
106e0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
106f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10700 20 6c 61 62 65 6c 2d 34 34 34 0d 0a 53 45 4c 45   label-444..SELE
10710 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
10720 6c 31 20 2a 20 43 41 53 54 28 20 33 36 20 41 53  l1 * CAST( 36 AS
10730 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30   SIGNED ) + col0
10740 20 44 49 56 20 2d 20 43 41 53 54 28 20 2d 20 33   DIV - CAST( - 3
10750 36 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  6 AS SIGNED ) FR
10760 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
10770 33 30 39 36 0d 0a 2d 33 32 37 34 0d 0a 2d 33 34  3096..-3274..-34
10780 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  92....skipif mys
10790 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
107a0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
107b0 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 34 0d 0a  sort label-444..
107c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
107d0 2d 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20  - col1 * CAST ( 
107e0 33 36 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  36 AS INTEGER ) 
107f0 2b 20 63 6f 6c 30 20 2f 20 2d 20 43 41 53 54 20  + col0 / - CAST 
10800 28 20 2d 20 33 36 20 41 53 20 49 4e 54 45 47 45  ( - 36 AS INTEGE
10810 52 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  R ) FROM tab0..-
10820 2d 2d 2d 0d 0a 2d 33 30 39 36 0d 0a 2d 33 32 37  ---..-3096..-327
10830 34 0d 0a 2d 33 34 39 32 0d 0a 0d 0a 71 75 65 72  4..-3492....quer
10840 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10850 45 43 54 20 63 6f 6c 32 20 2a 20 74 61 62 32 2e  ECT col2 * tab2.
10860 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53  col1 + - col1 AS
10870 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
10880 0a 2d 2d 2d 2d 0d 0a 31 34 37 35 0d 0a 36 32 39  .----..1475..629
10890 0d 0a 38 30 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..806....skipif 
108a0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
108b0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
108c0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
108d0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
108e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
108f0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
10900 63 6f 6c 31 20 2b 20 2d 20 38 39 20 2a 20 63 6f  col1 + - 89 * co
10910 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
10920 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 31 0d 0a 2d  1..----..-241..-
10930 35 36 38 36 0d 0a 2d 37 31 30 37 0d 0a 0d 0a 6f  5686..-7107....o
10940 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
10950 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
10960 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
10970 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
10980 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 37 0d 0a  sort label-447..
10990 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
109a0 2d 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  - - col2 * col2 
109b0 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  DIV cor0.col1 FR
109c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
109d0 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 32 33 0d 0a 38  .----..11..23..8
109e0 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
109f0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
10a00 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
10a10 6f 72 74 20 6c 61 62 65 6c 2d 34 34 37 0d 0a 53  ort label-447..S
10a20 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
10a30 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2f   - col2 * col2 /
10a40 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
10a50 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
10a60 2d 2d 0d 0a 31 31 0d 0a 32 33 0d 0a 38 34 0d 0a  --..11..23..84..
10a70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10a80 74 0d 0a 53 45 4c 45 43 54 20 33 39 20 41 53 20  t..SELECT 39 AS 
10a90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
10aa0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
10ab0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
10ac0 68 69 6e 67 20 74 6f 20 35 65 63 63 34 64 33 64  hing to 5ecc4d3d
10ad0 65 36 38 61 65 38 32 38 61 32 64 35 32 32 64 66  e68ae828a2d522df
10ae0 66 38 35 37 31 63 62 66 0d 0a 0d 0a 71 75 65 72  f8571cbf....quer
10af0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10b00 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2d  ECT col2 * + ( -
10b10 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
10b20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
10b30 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 36 0d 0a  0..----..-2916..
10b40 2d 33 32 34 39 0d 0a 2d 39 32 31 36 0d 0a 0d 0a  -3249..-9216....
10b50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10b60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
10b70 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   + - col2 * - co
10b80 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
10b90 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
10ba0 2d 2d 0d 0a 31 39 34 0d 0a 32 39 32 34 0d 0a 37  --..194..2924..7
10bb0 35 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  553....onlyif my
10bc0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
10bd0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
10be0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
10bf0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
10c00 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
10c10 34 35 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  451..SELECT ALL 
10c20 63 6f 6c 30 20 2b 20 43 41 53 54 28 20 4e 55 4c  col0 + CAST( NUL
10c30 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f 20  L AS SIGNED ) / 
10c40 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
10c50 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
10c60 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
10c70 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
10c80 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
10c90 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
10ca0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
10cb0 35 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  51..SELECT ALL c
10cc0 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ol0 + CAST ( NUL
10cd0 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f  L AS INTEGER ) /
10ce0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
10cf0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
10d00 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
10d10 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
10d20 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
10d30 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
10d40 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
10d50 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
10d60 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
10d70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
10d80 2d 20 63 6f 6c 32 20 2a 20 34 38 20 2b 20 31 34  - col2 * 48 + 14
10d90 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2b   * + tab1.col0 +
10da0 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 63 6f 6c   - tab1.col0 col
10db0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
10dc0 2d 0d 0a 2d 31 39 30 34 0d 0a 2d 32 35 35 33 0d  -..-1904..-2553.
10dd0 0a 2d 33 35 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-3568....onlyif
10de0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
10df0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
10e00 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
10e10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
10e20 6c 61 62 65 6c 2d 34 35 33 0d 0a 53 45 4c 45 43  label-453..SELEC
10e30 54 20 63 6f 6c 30 20 44 49 56 20 2b 20 38 39 20  T col0 DIV + 89 
10e40 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
10e50 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
10e60 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
10e70 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
10e80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
10e90 6c 61 62 65 6c 2d 34 35 33 0d 0a 53 45 4c 45 43  label-453..SELEC
10ea0 54 20 63 6f 6c 30 20 2f 20 2b 20 38 39 20 46 52  T col0 / + 89 FR
10eb0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
10ec0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
10ed0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10ee0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
10ef0 2d 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  - + col0 * col0 
10f00 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  * cor0.col0 FROM
10f10 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
10f20 0d 0a 2d 33 34 33 0d 0a 2d 34 37 34 35 35 32 0d  ..-343..-474552.
10f30 0a 2d 34 39 33 30 33 39 0d 0a 0d 0a 6f 6e 6c 79  .-493039....only
10f40 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
10f50 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
10f60 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
10f70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10f80 74 20 6c 61 62 65 6c 2d 34 35 35 0d 0a 53 45 4c  t label-455..SEL
10f90 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 36 38 20  ECT col2 + + 68 
10fa0 44 49 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  DIV - col1 FROM 
10fb0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
10fc0 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d  --..1..33..82...
10fd0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
10fe0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
10ff0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
11000 6c 61 62 65 6c 2d 34 35 35 0d 0a 53 45 4c 45 43  label-455..SELEC
11010 54 20 63 6f 6c 32 20 2b 20 2b 20 36 38 20 2f 20  T col2 + + 68 / 
11020 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
11030 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11040 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65  1..33..82....que
11050 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11060 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
11070 2d 20 63 6f 6c 32 20 2a 20 2d 20 39 32 20 46 52  - col2 * - 92 FR
11080 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
11090 0a 2d 2d 2d 2d 0d 0a 34 39 36 38 0d 0a 35 32 34  .----..4968..524
110a0 34 0d 0a 38 38 33 32 0d 0a 0d 0a 6f 6e 6c 79 69  4..8832....onlyi
110b0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
110c0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
110d0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
110e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
110f0 20 6c 61 62 65 6c 2d 34 35 37 0d 0a 53 45 4c 45   label-457..SELE
11100 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a  CT + tab1.col0 *
11110 20 63 6f 6c 32 20 44 49 56 20 2b 20 28 20 63 6f   col2 DIV + ( co
11120 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l0 ) AS col1 FRO
11130 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34  M tab1..----..54
11140 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70  ..57..96....skip
11150 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
11160 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
11170 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
11180 2d 34 35 37 0d 0a 53 45 4c 45 43 54 20 2b 20 74  -457..SELECT + t
11190 61 62 31 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  ab1.col0 * col2 
111a0 2f 20 2b 20 28 20 63 6f 6c 30 20 29 20 41 53 20  / + ( col0 ) AS 
111b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
111c0 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36  ----..54..57..96
111d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
111e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
111f0 6c 30 20 2a 20 28 20 31 34 20 29 20 2b 20 63 6f  l0 * ( 14 ) + co
11200 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
11210 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 33  tab1..----..1133
11220 0d 0a 36 38 0d 0a 39 30 36 0d 0a 0d 0a 71 75 65  ..68..906....que
11230 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11240 4c 45 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 30  LECT - tab0.col0
11250 20 2b 20 34 30 20 46 52 4f 4d 20 74 61 62 30 0d   + 40 FROM tab0.
11260 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 31 36 0d 0a  .----..-49..16..
11270 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
11280 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
11290 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
112a0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
112b0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
112c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36  rowsort label-46
112d0 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  0..SELECT ALL - 
112e0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
112f0 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46  GNED ) AS col1 F
11300 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 2c 20  ROM tab2, tab1, 
11310 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
11320 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  b0..----..81 val
11330 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
11340 62 33 33 63 33 30 64 36 66 35 32 62 62 62 32 34  b33c30d6f52bbb24
11350 33 33 38 61 32 39 33 63 37 34 30 66 32 39 63 0d  338a293c740f29c.
11360 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
11370 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
11380 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11390 74 20 6c 61 62 65 6c 2d 34 36 30 0d 0a 53 45 4c  t label-460..SEL
113a0 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28  ECT ALL - CAST (
113b0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
113c0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
113d0 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62 30  tab2, tab1, tab0
113e0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 0d 0a   AS cor0, tab0..
113f0 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20  ----..81 values 
11400 68 61 73 68 69 6e 67 20 74 6f 20 63 62 33 33 63  hashing to cb33c
11410 33 30 64 36 66 35 32 62 62 62 32 34 33 33 38 61  30d6f52bbb24338a
11420 32 39 33 63 37 34 30 66 32 39 63 0d 0a 0d 0a 71  293c740f29c....q
11430 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11440 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 31 20  SELECT ( + col1 
11450 29 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) - col0 FROM ta
11460 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d  b2..----..-19..-
11470 36 32 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20  62..24....query 
11480 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11490 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 28 20 2d  T - col0 + - ( -
114a0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b   col1 * - col0 +
114b0 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 29 20 41   col1 * col0 ) A
114c0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
114d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 36 35 0d 0a 2d  ..----..-2765..-
114e0 34 34 31 0d 0a 2d 39 32 38 32 0d 0a 0d 0a 71 75  441..-9282....qu
114f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11500 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 31  ELECT DISTINCT 1
11510 35 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  5 + - col1 FROM 
11520 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d  tab2..----..-16.
11530 0a 2d 32 0d 0a 2d 34 34 0d 0a 0d 0a 71 75 65 72  .-2..-44....quer
11540 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11550 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT + - cor0.col
11560 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  0 * - cor0.col2 
11570 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
11580 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36  0..----..162..36
11590 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 6f 6e 6c 79  48..7680....only
115a0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
115b0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
115c0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
115d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
115e0 74 20 6c 61 62 65 6c 2d 34 36 35 0d 0a 53 45 4c  t label-465..SEL
115f0 45 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20  ECT - tab2.col2 
11600 44 49 56 20 35 32 20 2b 20 63 6f 6c 32 20 2a 20  DIV 52 + col2 * 
11610 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  ( col2 ) FROM ta
11620 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a  b2..----..1444..
11630 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a 73 6b 69 70  676..729....skip
11640 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
11650 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
11660 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
11670 2d 34 36 35 0d 0a 53 45 4c 45 43 54 20 2d 20 74  -465..SELECT - t
11680 61 62 32 2e 63 6f 6c 32 20 2f 20 35 32 20 2b 20  ab2.col2 / 52 + 
11690 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 32 20 29 20  col2 * ( col2 ) 
116a0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
116b0 0a 31 34 34 34 0d 0a 36 37 36 0d 0a 37 32 39 0d  .1444..676..729.
116c0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
116d0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
116e0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
116f0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
11700 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
11710 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 36 0d  wsort label-466.
11720 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
11730 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
11740 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 30  IGNED ) + - col0
11750 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
11760 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
11770 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
11780 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
11790 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
117a0 36 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  66..SELECT DISTI
117b0 4e 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  NCT CAST ( NULL 
117c0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d  AS INTEGER ) + -
117d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
117e0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
117f0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
11800 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
11810 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
11820 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
11830 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
11840 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11850 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63  + ( - col1 ) * c
11860 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
11870 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d  b0..----..-2064.
11880 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d  .-3395..-8099...
11890 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
118a0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
118b0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
118c0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
118d0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
118e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
118f0 54 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 63  T - ( col2 ) * c
11900 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol2 col0 FROM ta
11910 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
11920 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d 36 37  ..-1..-1089..-67
11930 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  24....onlyif mys
11940 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
11950 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
11960 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
11970 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11980 6c 2d 34 36 39 0d 0a 53 45 4c 45 43 54 20 44 49  l-469..SELECT DI
11990 53 54 49 4e 43 54 20 2b 20 38 39 20 44 49 56 20  STINCT + 89 DIV 
119a0 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab0.col1 FROM t
119b0 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
119c0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d  0..----..0..1...
119d0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
119e0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
119f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
11a00 6c 61 62 65 6c 2d 34 36 39 0d 0a 53 45 4c 45 43  label-469..SELEC
11a10 54 20 44 49 53 54 49 4e 43 54 20 2b 20 38 39 20  T DISTINCT + 89 
11a20 2f 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d  / tab0.col1 FROM
11a30 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
11a40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  or0..----..0..1.
11a50 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
11a60 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
11a70 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
11a80 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
11a90 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
11aa0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 30 0d  wsort label-470.
11ab0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
11ac0 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2d   - tab1.col1 + -
11ad0 20 28 20 63 6f 6c 30 20 29 20 2a 20 2d 20 43 41   ( col0 ) * - CA
11ae0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
11af0 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  ED ) AS col1 FRO
11b00 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab1..----..NU
11b10 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
11b20 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
11b30 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
11b40 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 30 0d 0a  sort label-470..
11b50 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11b60 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2d 20  - tab1.col1 + - 
11b70 28 20 63 6f 6c 30 20 29 20 2a 20 2d 20 43 41 53  ( col0 ) * - CAS
11b80 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
11b90 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52  GER ) AS col1 FR
11ba0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
11bb0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
11bc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
11bd0 20 36 33 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c   63 + col1 * col
11be0 32 20 2a 20 2b 20 37 30 20 46 52 4f 4d 20 74 61  2 * + 70 FROM ta
11bf0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 34 34 33  b2..----..107443
11c00 0d 0a 34 35 32 38 33 0d 0a 35 38 36 35 33 0d 0a  ..45283..58653..
11c10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11c20 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 32 20 2a  t..SELECT - 72 *
11c30 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41   - col1 + col0 A
11c40 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
11c50 0d 0a 2d 2d 2d 2d 0d 0a 36 32 31 36 0d 0a 36 36  ..----..6216..66
11c60 34 31 0d 0a 37 30 31 39 0d 0a 0d 0a 71 75 65 72  41..7019....quer
11c70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11c80 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 72 30  ECT ALL + + cor0
11c90 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63  .col0 + col2 * c
11ca0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
11cb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32  r0..----..132..2
11cc0 38 36 32 0d 0a 37 35 35 31 0d 0a 0d 0a 71 75 65  862..7551....que
11cd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11ce0 4c 45 43 54 20 2b 20 31 34 20 2a 20 63 6f 6c 32  LECT + 14 * col2
11cf0 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
11d00 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
11d10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 0d 0a  or0..----..409..
11d20 34 32 33 0d 0a 35 34 39 0d 0a 0d 0a 6f 6e 6c 79  423..549....only
11d30 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
11d40 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
11d50 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
11d60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11d70 74 20 6c 61 62 65 6c 2d 34 37 35 0d 0a 53 45 4c  t label-475..SEL
11d80 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 44 49 56  ECT ALL col0 DIV
11d90 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63   - cor0.col0 + c
11da0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
11db0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
11dc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 32 35  r0..----..12..25
11dd0 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..9....skipif my
11de0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
11df0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
11e00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 35 0d  wsort label-475.
11e10 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
11e20 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   / - cor0.col0 +
11e30 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
11e40 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
11e50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a  cor0..----..12..
11e60 32 35 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49  25..9....query I
11e70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11e80 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   + + col2 * col2
11e90 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11ea0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
11eb0 0d 0a 31 0d 0a 31 30 38 39 0d 0a 36 37 32 34 0d  ..1..1089..6724.
11ec0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11ed0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
11ee0 4e 43 54 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29  NCT + ( + col0 )
11ef0 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   * col2 AS col1 
11f00 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
11f10 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39  0..----..35..729
11f20 38 0d 0a 37 39 32 0d 0a 0d 0a 73 6b 69 70 69 66  8..792....skipif
11f30 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
11f40 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
11f50 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
11f60 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
11f70 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
11f80 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
11f90 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  NCT + col0 + col
11fa0 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  1 col0 FROM tab0
11fb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11fc0 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d  110..132..180...
11fd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11fe0 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 36 39 20  ..SELECT - - 69 
11ff0 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  * col1 AS col0 F
12000 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
12010 0d 0a 2d 2d 2d 2d 0d 0a 35 39 33 34 0d 0a 36 32  ..----..5934..62
12020 37 39 0d 0a 36 36 39 33 0d 0a 0d 0a 71 75 65 72  79..6693....quer
12030 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12040 45 43 54 20 41 4c 4c 20 2b 20 31 38 20 2b 20 63  ECT ALL + 18 + c
12050 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
12060 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34   cor0..----..114
12070 0d 0a 37 32 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72  ..72..75....quer
12080 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12090 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32  ECT DISTINCT + 2
120a0 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 28  1 + + col1 * + (
120b0 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 41 53 20   cor0.col1 ) AS 
120c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
120d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34  S cor0..----..74
120e0 31 37 0d 0a 38 33 30 32 0d 0a 39 34 33 30 0d 0a  17..8302..9430..
120f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12100 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
12110 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  CT + col1 * - co
12120 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63  l0 + - col0 AS c
12130 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
12140 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
12150 32 30 0d 0a 2d 37 30 34 0d 0a 2d 38 31 0d 0a 0d  20..-704..-81...
12160 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12170 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34  ..SELECT ALL + 4
12180 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
12190 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
121a0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
121b0 68 61 73 68 69 6e 67 20 74 6f 20 37 33 30 64 66  hashing to 730df
121c0 66 37 38 65 38 33 31 31 32 33 37 34 39 36 31 65  f78e83112374961e
121d0 61 37 31 31 66 39 38 65 62 61 61 0d 0a 0d 0a 71  a711f98ebaa....q
121e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
121f0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 35 34 20  SELECT ALL - 54 
12200 2a 20 38 39 20 41 53 20 63 6f 6c 30 20 46 52 4f  * 89 AS col0 FRO
12210 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  M tab0, tab0 AS 
12220 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
12230 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
12240 37 39 62 37 61 63 30 61 66 36 33 64 63 65 62 62  79b7ac0af63dcebb
12250 37 62 31 66 37 32 66 31 37 35 37 38 32 30 36 64  7b1f72f17578206d
12260 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
12270 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
12280 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
12290 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
122a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
122b0 34 38 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  485..SELECT ALL 
122c0 39 37 20 2a 20 63 6f 6c 31 20 44 49 56 20 63 6f  97 * col1 DIV co
122d0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
122e0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
122f0 2d 2d 0d 0a 32 30 0d 0a 34 32 39 0d 0a 37 33 0d  --..20..429..73.
12300 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
12310 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
12320 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12330 74 20 6c 61 62 65 6c 2d 34 38 35 0d 0a 53 45 4c  t label-485..SEL
12340 45 43 54 20 41 4c 4c 20 39 37 20 2a 20 63 6f 6c  ECT ALL 97 * col
12350 31 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  1 / col0 AS col1
12360 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
12370 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 34 32  r0..----..20..42
12380 39 0d 0a 37 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  9..73....onlyif 
12390 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
123a0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
123b0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
123c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
123d0 61 62 65 6c 2d 34 38 36 0d 0a 53 45 4c 45 43 54  abel-486..SELECT
123e0 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 44   + col0 + col1 D
123f0 49 56 20 2d 20 37 39 20 46 52 4f 4d 20 74 61 62  IV - 79 FROM tab
12400 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
12410 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b  .3..64..80....sk
12420 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
12430 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
12440 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
12450 65 6c 2d 34 38 36 0d 0a 53 45 4c 45 43 54 20 2b  el-486..SELECT +
12460 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2f 20 2d   col0 + col1 / -
12470 20 37 39 20 46 52 4f 4d 20 74 61 62 31 20 41 53   79 FROM tab1 AS
12480 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a   cor0..----..3..
12490 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20  64..80....query 
124a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
124b0 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  T + cor0.col0 AS
124c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c   col0 FROM tab2,
124d0 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
124e0 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
124f0 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
12500 68 69 6e 67 20 74 6f 20 31 65 31 66 31 30 39 35  hing to 1e1f1095
12510 33 65 62 38 65 66 66 65 39 62 32 30 65 37 34 36  3eb8effe9b20e746
12520 66 38 61 37 66 64 38 33 0d 0a 0d 0a 73 6b 69 70  f8a7fd83....skip
12530 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
12540 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
12550 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
12560 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
12570 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
12580 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
12590 54 49 4e 43 54 20 2b 20 36 38 20 63 6f 6c 32 20  TINCT + 68 col2 
125a0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
125b0 0a 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .68....onlyif my
125c0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
125d0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
125e0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
125f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
12600 65 6c 2d 34 38 39 0d 0a 53 45 4c 45 43 54 20 44  el-489..SELECT D
12610 49 53 54 49 4e 43 54 20 2d 20 33 34 20 2a 20 63  ISTINCT - 34 * c
12620 6f 6c 31 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b  ol1 - col2 DIV +
12630 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
12640 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
12650 33 34 30 0d 0a 2d 34 34 33 0d 0a 2d 39 30 32 0d  340..-443..-902.
12660 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
12670 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
12680 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12690 74 20 6c 61 62 65 6c 2d 34 38 39 0d 0a 53 45 4c  t label-489..SEL
126a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 33  ECT DISTINCT - 3
126b0 34 20 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20  4 * col1 - col2 
126c0 2f 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  / + col0 FROM ta
126d0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
126e0 0d 0a 2d 33 34 30 0d 0a 2d 34 34 33 0d 0a 2d 39  ..-340..-443..-9
126f0 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
12700 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
12710 53 54 49 4e 43 54 20 2d 20 2d 20 28 20 2d 20 63  STINCT - - ( - c
12720 6f 6c 30 20 29 20 2a 20 2b 20 28 20 63 6f 72 30  ol0 ) * + ( cor0
12730 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62  .col2 ) FROM tab
12740 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
12750 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39  .-35..-7298..-79
12760 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
12770 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
12780 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
12790 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
127a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
127b0 2d 34 39 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -491..SELECT - c
127c0 6f 6c 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol1 DIV cor0.col
127d0 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0 col2 FROM tab2
127e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
127f0 2d 34 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -4..0..0....skip
12800 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
12810 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
12820 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
12830 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
12840 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
12850 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
12860 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
12870 6f 72 74 20 6c 61 62 65 6c 2d 34 39 31 0d 0a 53  ort label-491..S
12880 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 63  ELECT - col1 / c
12890 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32 20 46 52  or0.col0 col2 FR
128a0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
128b0 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 30 0d 0a 30 0d  .----..-4..0..0.
128c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
128d0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
128e0 30 20 2a 20 35 36 20 41 53 20 63 6f 6c 32 20 46  0 * 56 AS col2 F
128f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
12900 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 32 0d 0a 2d 34  ..----..-392..-4
12910 33 36 38 0d 0a 2d 34 34 32 34 0d 0a 0d 0a 71 75  368..-4424....qu
12920 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12930 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61 62 32  ELECT ALL - tab2
12940 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20  .col0 * col2 AS 
12950 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
12960 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32  ----..-189..-202
12970 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65 72  8..-3002....quer
12980 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12990 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
129a0 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a   col0 + - col2 *
129b0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
129c0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
129d0 36 35 0d 0a 2d 33 37 31 32 0d 0a 2d 37 37 36 30  65..-3712..-7760
129e0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
129f0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
12a00 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
12a10 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
12a20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
12a30 34 39 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  495..SELECT ALL 
12a40 2b 20 38 30 20 2a 20 2b 20 63 6f 6c 30 20 44 49  + 80 * + col0 DI
12a50 56 20 63 6f 6c 30 20 2d 20 2b 20 28 20 2b 20 63  V col0 - + ( + c
12a60 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63  ol2 ) * + cor0.c
12a70 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
12a80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
12a90 33 36 0d 0a 2d 33 31 36 39 0d 0a 2d 39 31 33 36  36..-3169..-9136
12aa0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
12ab0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
12ac0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
12ad0 72 74 20 6c 61 62 65 6c 2d 34 39 35 0d 0a 53 45  rt label-495..SE
12ae0 4c 45 43 54 20 41 4c 4c 20 2b 20 38 30 20 2a 20  LECT ALL + 80 * 
12af0 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2d 20  + col0 / col0 - 
12b00 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 2b  + ( + col2 ) * +
12b10 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
12b20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
12b30 2d 2d 0d 0a 2d 32 38 33 36 0d 0a 2d 33 31 36 39  --..-2836..-3169
12b40 0d 0a 2d 39 31 33 36 0d 0a 0d 0a 71 75 65 72 79  ..-9136....query
12b50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12b60 43 54 20 41 4c 4c 20 2d 20 2b 20 28 20 37 30 20  CT ALL - + ( 70 
12b70 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20  ) + cor0.col1 - 
12b80 2b 20 37 39 20 2a 20 2d 20 28 20 63 6f 6c 30 20  + 79 * - ( col0 
12b90 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
12ba0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 31 34 0d 0a  or0..----..514..
12bb0 36 31 35 31 0d 0a 36 31 38 38 0d 0a 0d 0a 73 6b  6151..6188....sk
12bc0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
12bd0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
12be0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
12bf0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
12c00 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
12c10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
12c20 49 53 54 49 4e 43 54 20 2d 20 31 33 20 63 6f 6c  ISTINCT - 13 col
12c30 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
12c40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a  or0..----..-13..
12c50 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
12c60 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
12c70 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
12c80 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
12c90 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
12ca0 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 38 0d 0a  sort label-498..
12cb0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
12cc0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45  CAST( NULL AS DE
12cd0 43 49 4d 41 4c 20 29 20 2f 20 39 36 20 41 53 20  CIMAL ) / 96 AS 
12ce0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
12cf0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
12d00 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
12d10 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
12d20 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
12d30 65 6c 2d 34 39 38 0d 0a 53 45 4c 45 43 54 20 44  el-498..SELECT D
12d40 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 4e  ISTINCT CAST ( N
12d50 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2f 20  ULL AS REAL ) / 
12d60 39 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  96 AS col1 FROM 
12d70 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab1..----..NULL
12d80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12d90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
12da0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20  + cor0.col2 + - 
12db0 39 31 20 2a 20 32 33 20 46 52 4f 4d 20 74 61 62  91 * 23 FROM tab
12dc0 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  0 AS cor0 CROSS 
12dd0 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72  JOIN tab0 AS cor
12de0 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
12df0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 37 38  s hashing to 378
12e00 66 36 62 36 63 65 62 61 61 39 36 39 39 32 37 34  f6b6cebaa9699274
12e10 34 32 37 33 33 39 66 65 36 32 38 64 39 0d 0a 0d  427339fe628d9...
12e20 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
12e30 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
12e40 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
12e50 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
12e60 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 30  owsort label-500
12e70 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
12e80 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 41 53  col2 DIV col0 AS
12e90 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
12ea0 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 38 0d 0a  .----..104..18..
12eb0 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
12ec0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
12ed0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
12ee0 6f 72 74 20 6c 61 62 65 6c 2d 35 30 30 0d 0a 53  ort label-500..S
12ef0 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c  ELECT col2 * col
12f00 32 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  2 / col0 AS col1
12f10 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
12f20 0d 0a 31 30 34 0d 0a 31 38 0d 0a 38 0d 0a 0d 0a  ..104..18..8....
12f30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
12f40 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32  .SELECT + + col2
12f50 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 31   + + col2 - col1
12f60 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
12f70 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
12f80 0d 0a 2d 37 0d 0a 32 33 0d 0a 35 39 0d 0a 0d 0a  ..-7..23..59....
12f90 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
12fa0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
12fb0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
12fc0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
12fd0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
12fe0 72 74 20 6c 61 62 65 6c 2d 35 30 32 0d 0a 53 45  rt label-502..SE
12ff0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  LECT - col0 + - 
13000 38 30 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 43 41  80 + col0 / - CA
13010 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
13020 4d 41 4c 20 29 20 41 53 20 63 6f 6c 31 20 46 52  MAL ) AS col1 FR
13030 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
13040 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
13050 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
13060 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
13070 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
13080 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
13090 35 30 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  502..SELECT - co
130a0 6c 30 20 2b 20 2d 20 38 30 20 2b 20 63 6f 6c 30  l0 + - 80 + col0
130b0 20 2f 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   / - CAST ( NULL
130c0 20 41 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f   AS REAL ) AS co
130d0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
130e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
130f0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
13100 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13110 0a 53 45 4c 45 43 54 20 31 31 20 2b 20 28 20 2b  .SELECT 11 + ( +
13120 20 63 6f 6c 32 20 29 20 2d 20 2d 20 63 6f 6c 32   col2 ) - - col2
13130 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
13140 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
13150 0d 0a 31 31 39 0d 0a 31 32 35 0d 0a 32 30 33 0d  ..119..125..203.
13160 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13170 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 31  rt..SELECT + - 1
13180 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  7 AS col0 FROM t
13190 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
131a0 2d 0d 0a 2d 31 37 0d 0a 2d 31 37 0d 0a 2d 31 37  -..-17..-17..-17
131b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
131c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
131d0 49 4e 43 54 20 2d 20 28 20 2d 20 63 6f 6c 31 20  INCT - ( - col1 
131e0 29 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 28  ) * - col1 * - (
131f0 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   + col2 ) AS col
13200 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
13210 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 34 30 36  or0..----..24406
13220 38 0d 0a 36 37 39 30 34 32 0d 0a 39 34 30 39 0d  8..679042..9409.
13230 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
13240 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
13250 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
13260 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
13270 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
13280 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 36 0d  wsort label-506.
13290 0a 53 45 4c 45 43 54 20 2b 20 32 34 20 2a 20 2d  .SELECT + 24 * -
132a0 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2d   col2 * col0 + -
132b0 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20 41 53   CAST( + col0 AS
132c0 20 53 49 47 4e 45 44 20 29 20 2d 20 63 6f 6c 31   SIGNED ) - col1
132d0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
132e0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
132f0 0d 0a 2d 31 38 34 34 31 33 0d 0a 2d 33 39 31 37  ..-184413..-3917
13300 0d 0a 2d 38 37 36 32 36 0d 0a 0d 0a 73 6b 69 70  ..-87626....skip
13310 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
13320 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
13330 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
13340 2d 35 30 36 0d 0a 53 45 4c 45 43 54 20 2b 20 32  -506..SELECT + 2
13350 34 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  4 * - col2 * col
13360 30 20 2b 20 2d 20 43 41 53 54 20 28 20 2b 20 63  0 + - CAST ( + c
13370 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
13380 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
13390 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
133a0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 34 34 31 33  0..----..-184413
133b0 0d 0a 2d 33 39 31 37 0d 0a 2d 38 37 36 32 36 0d  ..-3917..-87626.
133c0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
133d0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
133e0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
133f0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
13400 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
13410 30 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  07..SELECT - - c
13420 6f 6c 32 20 2a 20 63 6f 6c 30 20 44 49 56 20 63  ol2 * col0 DIV c
13430 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
13440 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
13450 0d 0a 30 0d 0a 38 30 0d 0a 39 0d 0a 0d 0a 73 6b  ..0..80..9....sk
13460 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
13470 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
13480 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
13490 65 6c 2d 35 30 37 0d 0a 53 45 4c 45 43 54 20 2d  el-507..SELECT -
134a0 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2f   - col2 * col0 /
134b0 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
134c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
134d0 2d 2d 0d 0a 30 0d 0a 38 30 0d 0a 39 0d 0a 0d 0a  --..0..80..9....
134e0 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
134f0 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
13500 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20   tab1 WHERE NOT 
13510 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 49 4e  col0 * - col2 IN
13520 20 28 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d   ( col0 )..----.
13530 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
13540 67 20 74 6f 20 38 64 36 36 39 32 65 36 64 34 31  g to 8d6692e6d41
13550 35 30 35 63 33 61 64 34 32 64 39 31 39 62 64 39  505c3ad42d919bd9
13560 65 63 64 30 64 0d 0a 0d 0a 71 75 65 72 79 20 49  ecd0d....query I
13570 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13580 20 41 4c 4c 20 2b 20 74 61 62 32 2e 63 6f 6c 31   ALL + tab2.col1
13590 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2a   + - tab2.col0 *
135a0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
135b0 32 20 57 48 45 52 45 20 4e 4f 54 20 28 20 4e 55  2 WHERE NOT ( NU
135c0 4c 4c 20 29 20 3d 20 2b 20 63 6f 6c 32 0d 0a 2d  LL ) = + col2..-
135d0 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
135e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
135f0 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63  ISTINCT col0 * c
13600 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
13610 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20   tab1 WHERE NOT 
13620 4e 55 4c 4c 20 42 45 54 57 45 45 4e 20 63 6f 6c  NULL BETWEEN col
13630 31 20 41 4e 44 20 2b 20 63 6f 6c 32 0d 0a 2d 2d  1 AND + col2..--
13640 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  --....query III 
13650 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13660 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  ALL * FROM tab0 
13670 57 48 45 52 45 20 28 20 4e 55 4c 4c 20 29 20 3e  WHERE ( NULL ) >
13680 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   NULL..----....q
13690 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
136a0 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20  SELECT col1 * + 
136b0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 41 53  col0 + - col0 AS
136c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
136d0 0a 2d 2d 2d 2d 0d 0a 32 30 34 30 0d 0a 33 33 36  .----..2040..336
136e0 30 0d 0a 38 30 31 30 0d 0a 0d 0a 71 75 65 72 79  0..8010....query
136f0 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
13700 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31  LECT * FROM tab1
13710 20 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 30 20   WHERE NOT col0 
13720 49 4e 20 28 20 2d 20 63 6f 6c 30 20 29 0d 0a 2d  IN ( - col0 )..-
13730 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
13740 73 68 69 6e 67 20 74 6f 20 38 64 36 36 39 32 65  shing to 8d6692e
13750 36 64 34 31 35 30 35 63 33 61 64 34 32 64 39 31  6d41505c3ad42d91
13760 39 62 64 39 65 63 64 30 64 0d 0a 0d 0a 71 75 65  9bd9ecd0d....que
13770 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13780 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  LECT + col2 * - 
13790 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  col2 * col1 + + 
137a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
137b0 2d 2d 2d 2d 0d 0a 2d 32 32 35 39 32 0d 0a 2d 32  ----..-22592..-2
137c0 34 34 36 39 0d 0a 2d 33 39 38 30 36 0d 0a 0d 0a  4469..-39806....
137d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
137e0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
137f0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
13800 30 20 57 48 45 52 45 20 4e 4f 54 20 2b 20 63 6f  0 WHERE NOT + co
13810 6c 32 20 3c 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d  l2 < NULL..----.
13820 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
13830 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
13840 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
13850 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
13860 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
13870 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13880 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2b  ECT ALL col2 + +
13890 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20   col2 col0 FROM 
138a0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a  tab2..----..52..
138b0 35 34 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20  54..76....query 
138c0 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
138d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
138e0 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e  ROM tab0 WHERE N
138f0 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28  OT NULL NOT IN (
13900 20 2d 20 63 6f 6c 30 20 2a 20 74 61 62 30 2e 63   - col0 * tab0.c
13910 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ol1 )..----....q
13920 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
13930 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
13940 74 61 62 31 20 57 48 45 52 45 20 4e 55 4c 4c 20  tab1 WHERE NULL 
13950 3e 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 0d  > col0 - + col2.
13960 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
13970 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13980 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
13990 57 48 45 52 45 20 4e 55 4c 4c 20 3d 20 4e 55 4c  WHERE NULL = NUL
139a0 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  L..----....query
139b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
139c0 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f  CT ALL col0 * co
139d0 6c 32 20 2d 20 2d 20 74 61 62 31 2e 63 6f 6c 31  l2 - - tab1.col1
139e0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
139f0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 0d 0a 33  b1..----..188..3
13a00 36 35 38 0d 0a 37 36 39 33 0d 0a 0d 0a 71 75 65  658..7693....que
13a10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13a20 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 41 53  LECT ALL col1 AS
13a30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
13a40 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 42  WHERE NOT NULL B
13a50 45 54 57 45 45 4e 20 2b 20 63 6f 6c 31 20 2a 20  ETWEEN + col1 * 
13a60 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  - col2 + - col0 
13a70 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a  AND NULL..----..
13a80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13a90 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
13aa0 43 54 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 63  CT tab2.col2 * c
13ab0 6f 6c 31 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  ol1 - col1 * + c
13ac0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
13ad0 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ---..0....query 
13ae0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13af0 54 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  T col2 FROM tab1
13b00 20 57 48 45 52 45 20 2d 20 63 6f 6c 31 20 2a 20   WHERE - col1 * 
13b10 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 49 4e 20 28  col2 / col2 IN (
13b20 20 74 61 62 31 2e 63 6f 6c 32 20 29 0d 0a 2d 2d   tab1.col2 )..--
13b30 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
13b40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
13b50 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  col1 - col0 * - 
13b60 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
13b70 2d 2d 2d 2d 0d 0a 31 35 38 0d 0a 31 39 36 39 0d  ----..158..1969.
13b80 0a 32 39 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .2985....query I
13b90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13ba0 20 44 49 53 54 49 4e 43 54 20 74 61 62 32 2e 63   DISTINCT tab2.c
13bb0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
13bc0 20 74 61 62 32 20 57 48 45 52 45 20 2b 20 63 6f   tab2 WHERE + co
13bd0 6c 32 20 2f 20 63 6f 6c 31 20 49 4e 20 28 20 2b  l2 / col1 IN ( +
13be0 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   col2 )..----...
13bf0 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
13c00 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
13c10 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 20  NCT * FROM tab1 
13c20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 4e  WHERE NOT NULL N
13c30 4f 54 20 49 4e 20 28 20 2d 20 63 6f 6c 30 20 29  OT IN ( - col0 )
13c40 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
13c50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13c60 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  T + col2 + col2 
13c70 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
13c80 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
13c90 31 31 34 0d 0a 37 38 0d 0a 38 31 0d 0a 0d 0a 71  114..78..81....q
13ca0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13cb0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
13cc0 63 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f 6c 30  col1 * tab0.col0
13cd0 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + + col0 FROM t
13ce0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 32 31 0d  ab0..----..2121.
13cf0 0a 33 34 33 31 0d 0a 38 32 37 30 0d 0a 0d 0a 71  .3431..8270....q
13d00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13d10 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20  SELECT + + col2 
13d20 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  - - col1 AS col2
13d30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
13d40 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a  .----..109..67..
13d50 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  80....query III 
13d60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13d70 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  ALL * FROM tab0 
13d80 57 48 45 52 45 20 28 20 63 6f 6c 31 20 2b 20 63  WHERE ( col1 + c
13d90 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 29 20 49  ol1 * - col2 ) I
13da0 4e 20 28 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  N ( col2 + col1 
13db0 2a 20 2b 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d  * + col2 )..----
13dc0 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f  ....query III ro
13dd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
13de0 4c 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48  L * FROM tab2 WH
13df0 45 52 45 20 4e 4f 54 20 28 20 4e 55 4c 4c 20 29  ERE NOT ( NULL )
13e00 20 3e 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d   > ( NULL )..---
13e10 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
13e20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
13e30 31 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  1 * col2 * col2 
13e40 2b 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30 20  + col2 - + col0 
13e50 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 41 53  * - tab2.col0 AS
13e60 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
13e70 0a 2d 2d 2d 2d 0d 0a 32 32 36 37 35 0d 0a 33 30  .----..22675..30
13e80 38 32 37 0d 0a 34 35 39 39 34 0d 0a 0d 0a 71 75  827..45994....qu
13e90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13ea0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b  ELECT ALL col0 +
13eb0 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 46   col1 + + col1 F
13ec0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
13ed0 31 39 36 0d 0a 32 32 39 0d 0a 32 37 31 0d 0a 0d  196..229..271...
13ee0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13ef0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
13f00 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62  T - col0 * + tab
13f10 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  2.col0 AS col0 F
13f20 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
13f30 2d 34 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32 34  -49..-6084..-624
13f40 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
13f50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
13f60 30 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  0 + col0 * + col
13f70 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
13f80 61 62 30 20 41 53 20 63 6f 72 30 20 57 48 45 52  ab0 AS cor0 WHER
13f90 45 20 28 20 4e 55 4c 4c 20 29 20 4e 4f 54 20 49  E ( NULL ) NOT I
13fa0 4e 20 28 20 2b 20 63 6f 6c 32 20 29 0d 0a 2d 2d  N ( + col2 )..--
13fb0 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  --....onlyif mys
13fc0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
13fd0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
13fe0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
13ff0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
14000 6c 2d 35 33 36 0d 0a 53 45 4c 45 43 54 20 63 6f  l-536..SELECT co
14010 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31  r0.col2 + + col1
14020 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74   DIV col0 FROM t
14030 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
14040 2d 0d 0a 33 0d 0a 33 36 0d 0a 38 33 0d 0a 0d 0a  -..3..36..83....
14050 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
14060 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
14070 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
14080 61 62 65 6c 2d 35 33 36 0d 0a 53 45 4c 45 43 54  abel-536..SELECT
14090 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63   cor0.col2 + + c
140a0 6f 6c 31 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 / col0 FROM 
140b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
140c0 2d 2d 0d 0a 33 0d 0a 33 36 0d 0a 38 33 0d 0a 0d  --..3..36..83...
140d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
140e0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
140f0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
14100 6f 72 30 20 57 48 45 52 45 20 28 20 2b 20 63 6f  or0 WHERE ( + co
14110 6c 32 20 29 20 3d 20 2d 20 63 6f 6c 30 20 2a 20  l2 ) = - col0 * 
14120 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b  col0..----....sk
14130 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
14140 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
14150 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
14160 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
14170 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
14180 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
14190 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a  ISTINCT - col2 *
141a0 20 37 35 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c   75 + + col0 col
141b0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
141c0 2d 0d 0a 2d 34 30 34 37 0d 0a 2d 34 32 31 31 0d  -..-4047..-4211.
141d0 0a 2d 37 31 32 30 0d 0a 0d 0a 71 75 65 72 79 20  .-7120....query 
141e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
141f0 54 20 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  T 0 AS col0 FROM
14200 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
14210 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53  OSS JOIN tab2 AS
14220 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
14230 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
14240 20 38 62 37 35 31 33 36 62 32 62 35 31 63 37 37   8b75136b2b51c77
14250 33 34 35 63 30 33 38 30 34 65 63 31 63 64 61 35  345c03804ec1cda5
14260 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  c....query I row
14270 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
14280 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   - + col0 * + co
14290 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
142a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
142b0 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d  --..-1343..-217.
142c0 0a 2d 34 36 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-4602....onlyif
142d0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
142e0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
142f0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
14300 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
14310 6c 61 62 65 6c 2d 35 34 31 0d 0a 53 45 4c 45 43  label-541..SELEC
14320 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72  T DISTINCT + cor
14330 30 2e 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c  0.col1 DIV + col
14340 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
14350 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
14360 2d 0d 0a 30 0d 0a 38 0d 0a 0d 0a 73 6b 69 70 69  -..0..8....skipi
14370 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
14380 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
14390 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
143a0 35 34 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  541..SELECT DIST
143b0 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  INCT + cor0.col1
143c0 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   / + col0 AS col
143d0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
143e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 38 0d  or0..----..0..8.
143f0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
14400 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
14410 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
14420 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
14430 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
14440 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14450 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30  ECT ALL + - col0
14460 20 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46   * - col1 col0 F
14470 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
14480 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31  ..----..1343..21
14490 37 0d 0a 34 36 30 32 0d 0a 0d 0a 6f 6e 6c 79 69  7..4602....onlyi
144a0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
144b0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
144c0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
144d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
144e0 20 6c 61 62 65 6c 2d 35 34 33 0d 0a 53 45 4c 45   label-543..SELE
144f0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
14500 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 2a  r0.col2 - col2 *
14510 20 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f 72 30   - col1 DIV cor0
14520 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
14530 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
14540 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .----..0....skip
14550 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
14560 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
14570 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
14580 2d 35 34 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -543..SELECT DIS
14590 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  TINCT - cor0.col
145a0 32 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  2 - col2 * - col
145b0 31 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  1 / cor0.col1 AS
145c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
145d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
145e0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
145f0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
14600 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
14610 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
14620 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
14630 35 34 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  544..SELECT - co
14640 6c 30 20 44 49 56 20 2d 20 35 30 20 2b 20 31 33  l0 DIV - 50 + 13
14650 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
14660 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 31 34 0d 0a 31  .----..13..14..1
14670 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
14680 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
14690 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
146a0 6f 72 74 20 6c 61 62 65 6c 2d 35 34 34 0d 0a 53  ort label-544..S
146b0 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2f 20 2d  ELECT - col0 / -
146c0 20 35 30 20 2b 20 31 33 20 46 52 4f 4d 20 74 61   50 + 13 FROM ta
146d0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
146e0 33 0d 0a 31 34 0d 0a 31 34 0d 0a 0d 0a 6f 6e 6c  3..14..14....onl
146f0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
14700 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
14710 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
14720 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
14730 72 74 20 6c 61 62 65 6c 2d 35 34 35 0d 0a 53 45  rt label-545..SE
14740 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  LECT - col0 + co
14750 6c 31 20 44 49 56 20 2b 20 63 6f 6c 32 20 46 52  l1 DIV + col2 FR
14760 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
14770 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 38 38 0d  .----..-22..-88.
14780 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .62....skipif my
14790 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
147a0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
147b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34 35 0d  wsort label-545.
147c0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
147d0 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 32 20 46   col1 / + col2 F
147e0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
147f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 38 38  ..----..-22..-88
14800 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..62....query I 
14810 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14820 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
14830 63 6f 6c 30 20 2b 20 2d 20 31 20 41 53 20 63 6f  col0 + - 1 AS co
14840 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
14850 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a  cor0..----..-4..
14860 2d 36 35 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65 72  -65..-81....quer
14870 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14880 45 43 54 20 41 4c 4c 20 31 37 20 2a 20 2b 20 63  ECT ALL 17 * + c
14890 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 * col0 FROM 
148a0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
148b0 2d 2d 0d 0a 31 33 30 35 36 30 0d 0a 32 37 35 34  --..130560..2754
148c0 0d 0a 36 32 30 31 36 0d 0a 0d 0a 71 75 65 72 79  ..62016....query
148d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
148e0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34 34  CT DISTINCT - 44
148f0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
14900 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
14910 0d 0a 2d 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-44....query I
14920 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14930 20 41 4c 4c 20 63 6f 6c 32 20 2d 20 2b 20 63 6f   ALL col2 - + co
14940 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 28 20  l0 * col0 * + ( 
14950 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46  col1 ) AS col0 F
14960 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
14970 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32 34 0d  ..----..-118824.
14980 0a 2d 34 39 35 30 33 0d 0a 2d 37 32 30 37 32 39  .-49503..-720729
14990 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
149a0 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
149b0 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
149c0 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
149d0 2c 20 74 61 62 31 20 63 6f 72 31 2c 20 74 61 62  , tab1 cor1, tab
149e0 30 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37  0 cor2..----..97
149f0 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  2 values hashing
14a00 20 74 6f 20 34 33 66 30 63 35 31 35 31 31 63 38   to 43f0c51511c8
14a10 36 34 32 64 31 39 31 39 30 66 64 34 64 66 63 66  642d19190fd4dfcf
14a20 39 30 35 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20  905a....query I 
14a30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14a40 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  + col0 * - col1 
14a50 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  * - col2 + + col
14a60 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
14a70 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 35 33 37  ab1..----..36537
14a80 0d 0a 34 32 36 36 0d 0a 39 39 39 33 36 0d 0a 0d  ..4266..99936...
14a90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14aa0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 32 20  ..SELECT ALL 72 
14ab0 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  * - cor0.col1 FR
14ac0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
14ad0 0a 2d 2d 2d 2d 0d 0a 2d 36 31 39 32 0d 0a 2d 36  .----..-6192..-6
14ae0 35 35 32 0d 0a 2d 36 39 38 34 0d 0a 0d 0a 6f 6e  552..-6984....on
14af0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
14b00 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
14b10 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
14b20 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
14b30 6f 72 74 20 6c 61 62 65 6c 2d 35 35 33 0d 0a 53  ort label-553..S
14b40 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54  ELECT ALL + CAST
14b50 28 20 2d 20 34 36 20 41 53 20 53 49 47 4e 45 44  ( - 46 AS SIGNED
14b60 20 29 20 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20   ) DIV + col1 + 
14b70 28 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  ( - col1 * + col
14b80 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  2 ) FROM tab2 AS
14b90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
14ba0 33 34 0d 0a 2d 36 34 38 0d 0a 2d 38 33 38 0d 0a  34..-648..-838..
14bb0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
14bc0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
14bd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14be0 20 6c 61 62 65 6c 2d 35 35 33 0d 0a 53 45 4c 45   label-553..SELE
14bf0 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28 20  CT ALL + CAST ( 
14c00 2d 20 34 36 20 41 53 20 49 4e 54 45 47 45 52 20  - 46 AS INTEGER 
14c10 29 20 2f 20 2b 20 63 6f 6c 31 20 2b 20 28 20 2d  ) / + col1 + ( -
14c20 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 29   col1 * + col2 )
14c30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
14c40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d  r0..----..-1534.
14c50 0a 2d 36 34 38 0d 0a 2d 38 33 38 0d 0a 0d 0a 71  .-648..-838....q
14c60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14c70 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
14c80 2d 20 63 6f 6c 31 20 2a 20 2d 20 34 33 20 2a 20  - col1 * - 43 * 
14c90 2b 20 63 6f 6c 30 20 2b 20 2d 20 39 34 20 46 52  + col0 + - 94 FR
14ca0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
14cb0 0a 2d 2d 2d 2d 0d 0a 32 37 34 32 36 0d 0a 33 32  .----..27426..32
14cc0 36 30 0d 0a 34 34 36 32 36 0d 0a 0d 0a 71 75 65  60..44626....que
14cd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14ce0 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 35 39 20  LECT ALL + - 59 
14cf0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
14d00 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
14d10 0a 2d 35 39 0d 0a 2d 35 39 0d 0a 2d 35 39 0d 0a  .-59..-59..-59..
14d20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14d30 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
14d40 43 54 20 2b 20 35 33 20 2b 20 2b 20 63 6f 6c 31  CT + 53 + + col1
14d50 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
14d60 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
14d70 0d 0a 31 31 32 0d 0a 37 30 0d 0a 38 34 0d 0a 0d  ..112..70..84...
14d80 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
14d90 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
14da0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
14db0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
14dc0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
14dd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14de0 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c  T ALL col1 * col
14df0 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  2 col2 FROM tab0
14e00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33   cor0..----..283
14e10 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71  8..7462..97....q
14e20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14e30 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20  SELECT + + col1 
14e40 2a 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20  * + col0 - col2 
14e50 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  * + col0 * col0 
14e60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
14e70 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
14e80 31 30 36 0d 0a 2d 31 35 33 35 38 32 0d 0a 2d 32  106..-153582..-2
14e90 33 35 38 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49  35815....query I
14ea0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14eb0 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2b 20   ALL - - col1 + 
14ec0 34 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  40 FROM tab1 AS 
14ed0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 30 0d 0a  cor0..----..50..
14ee0 35 33 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20  53..66....query 
14ef0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14f00 54 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63  T + + col2 - - c
14f10 6f 6c 30 20 2a 20 38 20 41 53 20 63 6f 6c 30 20  ol0 * 8 AS col0 
14f20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
14f30 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 39 0d 0a 37 33  0..----..569..73
14f40 36 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  6..78....query I
14f50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14f60 20 2d 20 63 6f 6c 31 20 2a 20 28 20 63 6f 72 30   - col1 * ( cor0
14f70 2e 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 32  .col2 ) * + col2
14f80 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
14f90 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
14fa0 0d 0a 2d 31 31 39 38 30 38 0d 0a 2d 33 32 34 39  ..-119808..-3249
14fb0 30 0d 0a 2d 37 35 38 31 36 0d 0a 0d 0a 73 6b 69  0..-75816....ski
14fc0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
14fd0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
14fe0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
14ff0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
15000 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
15010 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
15020 53 54 49 4e 43 54 20 2b 20 74 61 62 31 2e 63 6f  STINCT + tab1.co
15030 6c 30 20 2a 20 63 6f 6c 31 20 63 6f 6c 31 20 46  l0 * col1 col1 F
15040 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
15050 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d  1040..640..78...
15060 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15070 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31 35 20  ..SELECT ALL 15 
15080 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52  * col0 + col2 FR
15090 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
150a0 0a 2d 2d 2d 2d 0d 0a 31 34 31 37 0d 0a 33 39 33  .----..1417..393
150b0 0d 0a 35 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..526....onlyif 
150c0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
150d0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
150e0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
150f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
15100 61 62 65 6c 2d 35 36 34 0d 0a 53 45 4c 45 43 54  abel-564..SELECT
15110 20 41 4c 4c 20 39 38 20 44 49 56 20 2b 20 63 6f   ALL 98 DIV + co
15120 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63  l2 + - col0 AS c
15130 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
15140 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
15150 0a 2d 36 33 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69  .-63..-79....ski
15160 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
15170 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
15180 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
15190 6c 2d 35 36 34 0d 0a 53 45 4c 45 43 54 20 41 4c  l-564..SELECT AL
151a0 4c 20 39 38 20 2f 20 2b 20 63 6f 6c 32 20 2b 20  L 98 / + col2 + 
151b0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
151c0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
151d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 33 0d  ..----..-2..-63.
151e0 0a 2d 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-79....onlyif m
151f0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
15200 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
15210 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
15220 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
15230 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
15240 2d 35 36 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  -565..SELECT DIS
15250 54 49 4e 43 54 20 43 41 53 54 28 20 2b 20 63 6f  TINCT CAST( + co
15260 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  l0 AS SIGNED ) F
15270 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
15280 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38  ..----..3..64..8
15290 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
152a0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
152b0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
152c0 6f 72 74 20 6c 61 62 65 6c 2d 35 36 35 0d 0a 53  ort label-565..S
152d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43  ELECT DISTINCT C
152e0 41 53 54 20 28 20 2b 20 63 6f 6c 30 20 41 53 20  AST ( + col0 AS 
152f0 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
15300 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
15310 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a  -..3..64..80....
15320 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15330 0a 53 45 4c 45 43 54 20 32 32 20 41 53 20 63 6f  .SELECT 22 AS co
15340 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
15350 2d 2d 0d 0a 32 32 0d 0a 32 32 0d 0a 32 32 0d 0a  --..22..22..22..
15360 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15370 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
15380 36 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  66 AS col2 FROM 
15390 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
153a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
153b0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 34  es hashing to a4
153c0 30 38 31 30 38 64 34 32 33 64 37 37 38 34 62 37  08108d423d7784b7
153d0 64 36 31 30 63 62 37 37 39 65 35 31 35 61 0d 0a  d610cb779e515a..
153e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
153f0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
15400 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31  r0.col2 * - col1
15410 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   + - cor0.col1 *
15420 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 28   cor0.col1 * - (
15430 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20   col2 ) AS col1 
15440 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
15450 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 33 36 0d 0a  0..----..10336..
15460 32 35 31 31 30 0d 0a 38 38 39 37 32 0d 0a 0d 0a  25110..88972....
15470 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15480 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
15490 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a   - col2 + col1 *
154a0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b   - cor0.col2 + +
154b0 20 32 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f   21 * col0 AS co
154c0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
154d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31 37  cor0..----..-717
154e0 0d 0a 37 38 0d 0a 39 37 35 0d 0a 0d 0a 71 75 65  ..78..975....que
154f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15500 4c 45 43 54 20 41 4c 4c 20 2b 20 33 37 20 2a 20  LECT ALL + 37 * 
15510 2d 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20  - col2 - + col2 
15520 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
15530 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
15540 0a 2d 31 32 35 34 0d 0a 2d 33 31 31 36 0d 0a 2d  .-1254..-3116..-
15550 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
15560 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
15570 4c 20 39 31 20 2a 20 63 6f 6c 31 20 2b 20 2d 20  L 91 * col1 + - 
15580 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 41 53  col0 * - col1 AS
15590 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
155a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 30  cor0..----..2890
155b0 0d 0a 33 30 33 38 0d 0a 39 39 37 31 0d 0a 0d 0a  ..3038..9971....
155c0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
155d0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
155e0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
155f0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
15600 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
15610 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15620 20 2b 20 37 20 2a 20 63 6f 6c 31 20 63 6f 6c 32   + 7 * col1 col2
15630 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
15640 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 32 0d 0a 36  r0..----..602..6
15650 33 37 0d 0a 36 37 39 0d 0a 0d 0a 71 75 65 72 79  37..679....query
15660 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15670 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
15680 33 35 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c  35 - col0 AS col
15690 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
156a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a  or0..----..-54..
156b0 30 0d 0a 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49  0..11....query I
156c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
156d0 20 2b 20 2b 20 33 32 20 41 53 20 63 6f 6c 30 20   + + 32 AS col0 
156e0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
156f0 2d 2d 2d 2d 0d 0a 33 32 0d 0a 33 32 0d 0a 33 32  ----..32..32..32
15700 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
15710 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
15720 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
15730 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
15740 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
15750 35 37 35 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  575..SELECT - + 
15760 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 30 20  col0 DIV - col0 
15770 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
15780 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
15790 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .1..1..1....skip
157a0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
157b0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
157c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
157d0 2d 35 37 35 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -575..SELECT - +
157e0 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20 41   col0 / - col0 A
157f0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
15800 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15810 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79  1..1..1....query
15820 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15830 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
15840 6c 30 20 2a 20 31 34 20 41 53 20 63 6f 6c 30 20  l0 * 14 AS col0 
15850 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
15860 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 36 0d 0a  0..----..-1246..
15870 2d 33 33 36 0d 0a 2d 34 39 30 0d 0a 0d 0a 6f 6e  -336..-490....on
15880 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
15890 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
158a0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
158b0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
158c0 6f 72 74 20 6c 61 62 65 6c 2d 35 37 37 0d 0a 53  ort label-577..S
158d0 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d  ELECT + col1 + -
158e0 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 46   col1 DIV col2 F
158f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
15900 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a  ..----..10..13..
15910 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  26....skipif mys
15920 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
15930 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
15940 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 37 0d 0a  sort label-577..
15950 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20  SELECT + col1 + 
15960 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 46 52  - col1 / col2 FR
15970 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
15980 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32  .----..10..13..2
15990 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
159a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
159b0 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   - - cor0.col1 *
159c0 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
159d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
159e0 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d  .-2064..-3395..-
159f0 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
15a00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15a10 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
15a20 34 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  47 AS col1 FROM 
15a30 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
15a40 2d 2d 0d 0a 31 31 32 38 0d 0a 31 36 34 35 0d 0a  --..1128..1645..
15a50 34 31 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4183....query I 
15a60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15a70 2d 20 63 6f 6c 31 20 2a 20 39 33 20 46 52 4f 4d  - col1 * 93 FROM
15a80 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
15a90 2d 2d 2d 0d 0a 2d 31 35 38 31 0d 0a 2d 32 38 38  ---..-1581..-288
15aa0 33 0d 0a 2d 35 34 38 37 0d 0a 0d 0a 71 75 65 72  3..-5487....quer
15ab0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15ac0 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  ECT + + col0 * c
15ad0 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 46 52 4f  ol2 - + col2 FRO
15ae0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
15af0 2d 2d 2d 2d 0d 0a 33 34 0d 0a 37 32 31 36 0d 0a  ----..34..7216..
15b00 37 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  759....query I r
15b10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
15b20 20 63 6f 6c 30 20 2a 20 2d 20 35 38 20 46 52 4f   col0 * - 58 FRO
15b30 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
15b40 2d 2d 2d 2d 0d 0a 34 30 36 0d 0a 34 35 32 34 0d  ----..406..4524.
15b50 0a 34 35 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .4582....onlyif 
15b60 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
15b70 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
15b80 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
15b90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
15ba0 61 62 65 6c 2d 35 38 33 0d 0a 53 45 4c 45 43 54  abel-583..SELECT
15bb0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
15bc0 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32   + + col1 * col2
15bd0 20 2b 20 63 6f 6c 32 20 44 49 56 20 34 35 20 46   + col2 DIV 45 F
15be0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
15bf0 32 38 31 34 0d 0a 36 32 0d 0a 37 33 37 34 0d 0a  2814..62..7374..
15c00 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
15c10 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
15c20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15c30 20 6c 61 62 65 6c 2d 35 38 33 0d 0a 53 45 4c 45   label-583..SELE
15c40 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
15c50 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  l0 + + col1 * co
15c60 6c 32 20 2b 20 63 6f 6c 32 20 2f 20 34 35 20 46  l2 + col2 / 45 F
15c70 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
15c80 32 38 31 34 0d 0a 36 32 0d 0a 37 33 37 34 0d 0a  2814..62..7374..
15c90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15ca0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
15cb0 20 2b 20 38 36 20 41 53 20 63 6f 6c 32 20 46 52   + 86 AS col2 FR
15cc0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
15cd0 35 38 0d 0a 35 35 30 34 0d 0a 36 38 38 30 0d 0a  58..5504..6880..
15ce0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15cf0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30  t..SELECT + tab0
15d00 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2d  .col2 + col1 * -
15d10 20 63 6f 6c 31 20 2b 20 2b 20 74 61 62 30 2e 63   col1 + + tab0.c
15d20 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
15d30 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33   tab0..----..-73
15d40 33 39 0d 0a 2d 38 31 31 30 0d 0a 2d 39 33 37 33  39..-8110..-9373
15d50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15d60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 38  ort..SELECT + 38
15d70 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   * cor0.col1 AS 
15d80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
15d90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32  S cor0..----..32
15da0 36 38 0d 0a 33 34 35 38 0d 0a 33 36 38 36 0d 0a  68..3458..3686..
15db0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15dc0 74 0d 0a 53 45 4c 45 43 54 20 34 20 2a 20 2d 20  t..SELECT 4 * - 
15dd0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
15de0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
15df0 30 34 0d 0a 2d 34 30 0d 0a 2d 35 32 0d 0a 0d 0a  04..-40..-52....
15e00 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
15e10 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
15e20 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
15e30 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
15e40 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
15e50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15e60 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2d 20 28   tab2.col2 + - (
15e70 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 29 20 63   col1 * col2 ) c
15e80 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
15e90 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 36 30 38  ---..-1508..-608
15ea0 0d 0a 2d 38 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-810....onlyif
15eb0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
15ec0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
15ed0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
15ee0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
15ef0 6c 61 62 65 6c 2d 35 38 39 0d 0a 53 45 4c 45 43  label-589..SELEC
15f00 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 37  T - col2 DIV + 7
15f10 36 20 2b 20 2d 20 33 34 20 63 6f 6c 30 20 46 52  6 + - 34 col0 FR
15f20 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
15f30 33 34 0d 0a 2d 33 34 0d 0a 2d 33 35 0d 0a 0d 0a  34..-34..-35....
15f40 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
15f50 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
15f60 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
15f70 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
15f80 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
15f90 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
15fa0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
15fb0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38  rowsort label-58
15fc0 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  9..SELECT - col2
15fd0 20 2f 20 2b 20 37 36 20 2b 20 2d 20 33 34 20 63   / + 76 + - 34 c
15fe0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
15ff0 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 33 34 0d 0a 2d  ---..-34..-34..-
16000 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
16010 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
16020 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20  STINCT + col0 * 
16030 2b 20 38 39 20 46 52 4f 4d 20 74 61 62 32 0d 0a  + 89 FROM tab2..
16040 2d 2d 2d 2d 0d 0a 36 32 33 0d 0a 36 39 34 32 0d  ----..623..6942.
16050 0a 37 30 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .7031....query I
16060 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16070 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2b 20   ALL + col0 * + 
16080 39 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  94 AS col1 FROM 
16090 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 35 38 0d  tab2..----..658.
160a0 0a 37 33 33 32 0d 0a 37 34 32 36 0d 0a 0d 0a 71  .7332..7426....q
160b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
160c0 53 45 4c 45 43 54 20 35 36 20 41 53 20 63 6f 6c  SELECT 56 AS col
160d0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
160e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a 35  or0..----..56..5
160f0 36 0d 0a 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  6..56....query I
16100 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16110 20 35 34 20 2a 20 2b 20 33 32 20 2b 20 63 6f 6c   54 * + 32 + col
16120 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  0 + + cor0.col0 
16130 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
16140 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 33 34 0d 0a 31  0..----..1734..1
16150 38 35 36 0d 0a 31 38 38 38 0d 0a 0d 0a 71 75 65  856..1888....que
16160 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16170 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 34 34  LECT col1 * + 44
16180 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
16190 0d 0a 33 37 38 34 0d 0a 34 30 30 34 0d 0a 34 32  ..3784..4004..42
161a0 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  68....query I ro
161b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
161c0 6c 31 20 2a 20 2d 20 34 38 20 41 53 20 63 6f 6c  l1 * - 48 AS col
161d0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
161e0 2d 0d 0a 2d 31 34 38 38 0d 0a 2d 32 38 33 32 0d  -..-1488..-2832.
161f0 0a 2d 38 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-816....onlyif 
16200 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
16210 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
16220 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
16230 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16240 61 62 65 6c 2d 35 39 36 0d 0a 53 45 4c 45 43 54  abel-596..SELECT
16250 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56 20 2b 20   ALL col2 DIV + 
16260 32 38 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  28 FROM tab1..--
16270 2d 2d 0d 0a 31 0d 0a 32 0d 0a 33 0d 0a 0d 0a 73  --..1..2..3....s
16280 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
16290 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
162a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
162b0 62 65 6c 2d 35 39 36 0d 0a 53 45 4c 45 43 54 20  bel-596..SELECT 
162c0 41 4c 4c 20 63 6f 6c 32 20 2f 20 2b 20 32 38 20  ALL col2 / + 28 
162d0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
162e0 0a 31 0d 0a 32 0d 0a 33 0d 0a 0d 0a 71 75 65 72  .1..2..3....quer
162f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16300 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a  ECT ALL + col2 *
16310 20 2b 20 63 6f 6c 30 20 2a 20 74 61 62 32 2e 63   + col0 * tab2.c
16320 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
16330 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34   tab2..----..114
16340 30 37 36 0d 0a 35 31 30 33 0d 0a 35 32 37 32 38  076..5103..52728
16350 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
16360 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
16370 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
16380 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
16390 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
163a0 35 39 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  598..SELECT ALL 
163b0 63 6f 6c 32 20 44 49 56 20 31 37 20 46 52 4f 4d  col2 DIV 17 FROM
163c0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab2..----..1..
163d0 31 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1..2....skipif m
163e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
163f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
16400 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39 38  owsort label-598
16410 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
16420 32 20 2f 20 31 37 20 46 52 4f 4d 20 74 61 62 32  2 / 17 FROM tab2
16430 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 32 0d  ..----..1..1..2.
16440 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16450 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63  rt..SELECT + ( c
16460 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20 2d 20 63  or0.col1 ) + - c
16470 6f 6c 32 20 2a 20 2d 20 28 20 63 6f 72 30 2e 63  ol2 * - ( cor0.c
16480 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41  ol0 ) * - col1 A
16490 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
164a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
164b0 2d 31 31 39 35 39 33 0d 0a 2d 35 31 30 31 37 0d  -119593..-51017.
164c0 0a 2d 35 38 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-5828....onlyif
164d0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
164e0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
164f0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
16500 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
16510 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
16520 65 6c 2d 36 30 30 0d 0a 53 45 4c 45 43 54 20 2d  el-600..SELECT -
16530 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
16540 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 2a  IGNED ) + col0 *
16550 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   + cor0.col2 FRO
16560 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
16570 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
16580 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
16590 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
165a0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
165b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
165c0 30 30 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  00..SELECT - CAS
165d0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
165e0 47 45 52 20 29 20 2b 20 63 6f 6c 30 20 2a 20 2b  GER ) + col0 * +
165f0 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
16600 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
16610 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
16620 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  NULL....onlyif m
16630 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
16640 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
16650 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
16660 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
16670 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16680 2d 36 30 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -601..SELECT ALL
16690 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53   CAST( col0 AS S
166a0 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20 46  IGNED ) * col0 F
166b0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
166c0 31 32 32 35 0d 0a 35 37 36 0d 0a 37 39 32 31 0d  1225..576..7921.
166d0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
166e0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
166f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16700 74 20 6c 61 62 65 6c 2d 36 30 31 0d 0a 53 45 4c  t label-601..SEL
16710 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 63  ECT ALL CAST ( c
16720 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
16730 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
16740 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35  0..----..1225..5
16750 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a 71 75 65 72  76..7921....quer
16760 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16770 45 43 54 20 2d 20 35 39 20 2b 20 2d 20 63 6f 6c  ECT - 59 + - col
16780 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
16790 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a  ab2..----..-85..
167a0 2d 38 36 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72  -86..-97....quer
167b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
167c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
167d0 30 20 2a 20 37 37 20 2b 20 2b 20 74 61 62 31 2e  0 * 77 + + tab1.
167e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
167f0 2d 2d 2d 2d 0d 0a 32 38 35 0d 0a 34 39 38 35 0d  ----..285..4985.
16800 0a 36 32 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .6256....query I
16810 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16820 20 41 4c 4c 20 2d 20 38 31 20 46 52 4f 4d 20 74   ALL - 81 FROM t
16830 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62 31 20  ab0, tab1, tab1 
16840 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
16850 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
16860 20 74 6f 20 64 30 62 66 65 38 34 39 34 66 35 32   to d0bfe8494f52
16870 32 33 35 64 39 66 63 61 66 62 35 61 63 35 64 65  235d9fcafb5ac5de
16880 33 66 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3f81....onlyif m
16890 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
168a0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
168b0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
168c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
168d0 62 65 6c 2d 36 30 35 0d 0a 53 45 4c 45 43 54 20  bel-605..SELECT 
168e0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
168f0 44 49 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  DIV col2 AS col2
16900 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
16910 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ..-1..0....skipi
16920 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
16930 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
16940 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
16950 36 30 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  605..SELECT DIST
16960 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2f 20 63 6f  INCT - col0 / co
16970 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
16980 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  tab1..----..-1..
16990 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
169a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74  sort..SELECT - t
169b0 61 62 31 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  ab1.col2 * + cor
169c0 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0.col2 FROM tab1
169d0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
169e0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
169f0 61 73 68 69 6e 67 20 74 6f 20 35 63 34 34 30 61  ashing to 5c440a
16a00 33 30 34 66 36 61 62 63 32 65 64 36 38 66 30 37  304f6abc2ed68f07
16a10 38 34 66 37 64 37 64 33 62 66 0d 0a 0d 0a 71 75  84f7d7d3bf....qu
16a20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16a30 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
16a40 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b  ol0 * + col0 * +
16a50 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b   col0 + - col0 +
16a60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
16a70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
16a80 36 32 30 39 30 0d 0a 35 30 0d 0a 35 31 31 39 33  62090..50..51193
16a90 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
16aa0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
16ab0 20 2b 20 63 6f 6c 31 20 2a 20 35 39 20 2b 20 2b   + col1 * 59 + +
16ac0 20 36 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52   60 ) AS col1 FR
16ad0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
16ae0 35 31 33 34 0d 0a 2d 35 34 32 39 0d 0a 2d 35 37  5134..-5429..-57
16af0 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
16b00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
16b10 63 6f 6c 31 20 2b 20 2d 20 35 36 20 41 53 20 63  col1 + - 56 AS c
16b20 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
16b30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
16b40 32 0d 0a 2d 31 34 37 0d 0a 2d 31 35 33 0d 0a 0d  2..-147..-153...
16b50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16b60 0d 0a 53 45 4c 45 43 54 20 2d 20 37 36 20 2d 20  ..SELECT - 76 - 
16b70 2b 20 36 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 60 AS col2 FRO
16b80 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  M tab0, tab0 AS 
16b90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
16ba0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
16bb0 30 38 66 39 37 66 39 37 62 37 34 35 39 35 30 37  08f97f97b7459507
16bc0 35 32 62 39 62 39 39 62 39 36 33 39 33 31 37 61  52b9b99b9639317a
16bd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16be0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 37 20 41  ort..SELECT 47 A
16bf0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
16c00 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
16c10 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31  OIN tab0 AS cor1
16c20 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
16c30 20 68 61 73 68 69 6e 67 20 74 6f 20 34 66 65 31   hashing to 4fe1
16c40 39 32 66 32 39 36 37 39 31 65 31 65 34 30 65 61  92f296791e1e40ea
16c50 30 30 61 36 38 61 61 38 64 61 62 37 0d 0a 0d 0a  00a68aa8dab7....
16c60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16c70 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31  .SELECT - - col1
16c80 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2d   * - cor0.col0 -
16c90 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20   + ( - col1 ) * 
16ca0 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
16cb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16cc0 2d 31 32 38 30 34 0d 0a 2d 31 36 33 38 30 0d 0a  -12804..-16380..
16cd0 2d 39 34 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -9460....query I
16ce0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16cf0 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   - + col2 * - co
16d00 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 28 20 63 6f  r0.col2 * - ( co
16d10 6c 32 20 2a 20 31 37 20 29 20 2d 20 2b 20 63 6f  l2 * 17 ) - + co
16d20 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l1 * col0 AS col
16d30 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
16d40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 34  or0..----..-1504
16d50 31 35 35 32 0d 0a 2d 32 36 37 36 39 36 36 0d 0a  1552..-2676966..
16d60 2d 33 31 34 38 39 32 31 0d 0a 0d 0a 71 75 65 72  -3148921....quer
16d70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16d80 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 37 37 20  ECT col2 * - 77 
16d90 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  + + col0 AS col2
16da0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
16db0 0a 2d 2d 2d 2d 0d 0a 2d 34 31 35 35 0d 0a 2d 34  .----..-4155..-4
16dc0 33 32 35 0d 0a 2d 37 33 31 32 0d 0a 0d 0a 6f 6e  325..-7312....on
16dd0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
16de0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
16df0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
16e00 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
16e10 6f 72 74 20 6c 61 62 65 6c 2d 36 31 35 0d 0a 53  ort label-615..S
16e20 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 44  ELECT - + col2 D
16e30 49 56 20 2b 20 31 38 20 41 53 20 63 6f 6c 30 20  IV + 18 AS col0 
16e40 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
16e50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  0..----..-1..-1.
16e60 0a 2d 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .-2....skipif my
16e70 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
16e80 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
16e90 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 35 0d  wsort label-615.
16ea0 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32  .SELECT - + col2
16eb0 20 2f 20 2b 20 31 38 20 41 53 20 63 6f 6c 30 20   / + 18 AS col0 
16ec0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
16ed0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  0..----..-1..-1.
16ee0 0a 2d 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .-2....query I r
16ef0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
16f00 20 63 6f 6c 32 20 2a 20 36 39 20 2b 20 2b 20 63   col2 * 69 + + c
16f10 6f 6c 31 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 - col1 AS co
16f20 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
16f30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 32  cor0..----..-372
16f40 36 0d 0a 2d 33 39 33 33 0d 0a 2d 36 36 32 34 0d  6..-3933..-6624.
16f50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16f60 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
16f70 31 20 2a 20 28 20 38 36 20 29 20 41 53 20 63 6f  1 * ( 86 ) AS co
16f80 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
16f90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31  cor0..----..-111
16fa0 38 0d 0a 2d 32 32 33 36 0d 0a 2d 38 36 30 0d 0a  8..-2236..-860..
16fb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16fc0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
16fd0 43 54 20 38 38 20 41 53 20 63 6f 6c 31 20 46 52  CT 88 AS col1 FR
16fe0 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  OM tab2, tab0 AS
16ff0 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
17000 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 38 0d 0a 0d  or1..----..88...
17010 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17020 0d 0a 53 45 4c 45 43 54 20 2b 20 31 32 20 41 53  ..SELECT + 12 AS
17030 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
17040 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
17050 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
17060 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
17070 68 69 6e 67 20 74 6f 20 37 30 32 34 37 38 63 35  hing to 702478c5
17080 33 63 61 66 32 66 37 65 62 62 39 66 66 66 39 36  3caf2f7ebb9fff96
17090 64 38 30 30 66 35 61 36 0d 0a 0d 0a 73 6b 69 70  d800f5a6....skip
170a0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
170b0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
170c0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
170d0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
170e0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
170f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
17100 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a 20  0.col0 - col2 * 
17110 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2d 20  + tab0.col0 * - 
17120 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
17130 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 31 36 30  ab0..----..26160
17140 0d 0a 35 39 38 35 32 35 0d 0a 37 30 0d 0a 0d 0a  ..598525..70....
17150 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
17160 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
17170 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
17180 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
17190 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
171a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
171b0 20 2d 20 35 33 20 2b 20 37 20 63 6f 6c 31 20 46   - 53 + 7 col1 F
171c0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63  ROM tab2, tab1 c
171d0 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a  or0, tab2 cor1..
171e0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
171f0 68 61 73 68 69 6e 67 20 74 6f 20 35 61 35 64 34  hashing to 5a5d4
17200 35 39 38 39 64 63 63 36 61 30 36 64 39 65 65 35  5989dcc6a06d9ee5
17210 61 30 38 39 34 35 35 31 38 66 39 0d 0a 0d 0a 71  a08945518f9....q
17220 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
17230 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
17240 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30  LECT * FROM tab0
17250 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20  , tab0 AS cor0, 
17260 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61  tab2 AS cor1, ta
17270 62 32 2c 20 74 61 62 32 20 63 6f 72 32 0d 0a 2d  b2, tab2 cor2..-
17280 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73  ---..3645 values
17290 20 68 61 73 68 69 6e 67 20 74 6f 20 36 37 37 65   hashing to 677e
172a0 66 36 62 38 36 34 39 33 61 37 65 34 38 64 32 66  f6b86493a7e48d2f
172b0 36 61 33 63 66 64 37 65 65 61 34 63 0d 0a 0d 0a  6a3cfd7eea4c....
172c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
172d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
172e0 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2d   col2 * col1 + -
172f0 20 34 36 20 2d 20 2b 20 36 36 20 2a 20 2d 20 63   46 - + 66 * - c
17300 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 * - cor0.col
17310 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
17320 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
17330 2d 33 37 30 39 36 0d 0a 2d 38 31 31 36 36 0d 0a  -37096..-81166..
17340 2d 39 31 33 30 36 0d 0a 0d 0a 73 6b 69 70 69 66  -91306....skipif
17350 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
17360 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
17370 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
17380 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
17390 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
173a0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
173b0 20 63 6f 6c 31 20 2a 20 2d 20 32 30 20 63 6f 6c   col1 * - 20 col
173c0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
173d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 30 0d  or0..----..1720.
173e0 0a 31 38 32 30 0d 0a 31 39 34 30 0d 0a 0d 0a 71  .1820..1940....q
173f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17400 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20  SELECT + + col0 
17410 2a 20 2b 20 37 34 20 41 53 20 63 6f 6c 32 20 46  * + 74 AS col2 F
17420 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
17430 0d 0a 2d 2d 2d 2d 0d 0a 32 32 32 0d 0a 34 37 33  ..----..222..473
17440 36 0d 0a 35 39 32 30 0d 0a 0d 0a 6f 6e 6c 79 69  6..5920....onlyi
17450 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
17460 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
17470 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
17480 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17490 20 6c 61 62 65 6c 2d 36 32 36 0d 0a 53 45 4c 45   label-626..SELE
174a0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
174b0 20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20 63   DIV + col0 AS c
174c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
174d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a  r0..----..1..2..
174e0 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
174f0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
17500 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
17510 6f 72 74 20 6c 61 62 65 6c 2d 36 32 36 0d 0a 53  ort label-626..S
17520 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
17530 6f 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20  ol1 / + col0 AS 
17540 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
17550 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d  or0..----..1..2.
17560 0a 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .3....onlyif mys
17570 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
17580 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
17590 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
175a0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
175b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
175c0 32 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  27..SELECT DISTI
175d0 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b  NCT - + col1 + +
175e0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
175f0 49 47 4e 45 44 20 29 20 63 6f 6c 32 20 46 52 4f  IGNED ) col2 FRO
17600 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
17610 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
17620 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
17630 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
17640 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
17650 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
17660 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
17670 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
17680 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
17690 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 37 0d  wsort label-627.
176a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
176b0 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41   - + col1 + + CA
176c0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
176d0 45 47 45 52 20 29 20 63 6f 6c 32 20 46 52 4f 4d  EGER ) col2 FROM
176e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
176f0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ---..NULL....onl
17700 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
17710 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
17720 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
17730 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
17740 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
17750 6c 61 62 65 6c 2d 36 32 38 0d 0a 53 45 4c 45 43  label-628..SELEC
17760 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d  T ALL + col1 * -
17770 20 43 41 53 54 28 20 63 6f 72 30 2e 63 6f 6c 30   CAST( cor0.col0
17780 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63   AS SIGNED ) + c
17790 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
177a0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
177b0 31 30 32 37 0d 0a 2d 35 32 0d 0a 2d 36 33 30 0d  1027..-52..-630.
177c0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
177d0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
177e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
177f0 74 20 6c 61 62 65 6c 2d 36 32 38 0d 0a 53 45 4c  t label-628..SEL
17800 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a  ECT ALL + col1 *
17810 20 2d 20 43 41 53 54 20 28 20 63 6f 72 30 2e 63   - CAST ( cor0.c
17820 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
17830 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
17840 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
17850 2d 0d 0a 2d 31 30 32 37 0d 0a 2d 35 32 0d 0a 2d  -..-1027..-52..-
17860 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  630....query I r
17870 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
17880 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a  ISTINCT + col1 *
17890 20 2d 20 34 36 20 46 52 4f 4d 20 74 61 62 30 20   - 46 FROM tab0 
178a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
178b0 33 39 35 36 0d 0a 2d 34 31 38 36 0d 0a 2d 34 34  3956..-4186..-44
178c0 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
178d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
178e0 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 32 20 29 20  col2 * ( col2 ) 
178f0 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
17900 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
17910 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 39 33 36 0d 0a  ..----..207936..
17920 37 33 37 32 38 30 0d 0a 38 37 34 38 0d 0a 0d 0a  737280..8748....
17930 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17940 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
17950 2e 63 6f 6c 30 20 2d 20 33 36 20 41 53 20 63 6f  .col0 - 36 AS co
17960 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
17970 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
17980 2d 31 32 0d 0a 35 33 0d 0a 0d 0a 71 75 65 72 79  -12..53....query
17990 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
179a0 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20  CT ALL + + col2 
179b0 2b 20 2b 20 35 31 20 46 52 4f 4d 20 74 61 62 31  + + 51 FROM tab1
179c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35   cor0..----..105
179d0 0d 0a 31 30 38 0d 0a 31 34 37 0d 0a 0d 0a 71 75  ..108..147....qu
179e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
179f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
17a00 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41   - col1 * col0 A
17a10 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
17a20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17a30 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d  1040..640..78...
17a40 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
17a50 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
17a60 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
17a70 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
17a80 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
17a90 6f 72 74 20 6c 61 62 65 6c 2d 36 33 34 0d 0a 53  ort label-634..S
17aa0 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20 43  ELECT col1 + + C
17ab0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
17ac0 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20  NED ) FROM tab0 
17ad0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
17ae0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
17af0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
17b00 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
17b10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17b20 74 20 6c 61 62 65 6c 2d 36 33 34 0d 0a 53 45 4c  t label-634..SEL
17b30 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53  ECT col1 + + CAS
17b40 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
17b50 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20  GER ) FROM tab0 
17b60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
17b70 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
17b80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17b90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
17ba0 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 2d 20   ( + col1 ) + - 
17bb0 28 20 39 35 20 29 20 2a 20 2d 20 63 6f 6c 31 20  ( 95 ) * - col1 
17bc0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
17bd0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 32 0d 0a 32  1..----..1222..2
17be0 34 34 34 0d 0a 39 34 30 0d 0a 0d 0a 71 75 65 72  444..940....quer
17bf0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17c00 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b  ECT ALL - col0 +
17c10 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 63 6f 6c   tab1.col0 * col
17c20 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
17c30 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 30 33 32 0d  ab1..----..4032.
17c40 0a 36 0d 0a 36 33 32 30 0d 0a 0d 0a 71 75 65 72  .6..6320....quer
17c50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17c60 45 43 54 20 28 20 32 30 20 29 20 2b 20 2b 20 63  ECT ( 20 ) + + c
17c70 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 * col1 FROM 
17c80 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
17c90 2d 2d 0d 0a 37 34 31 36 0d 0a 38 33 30 31 0d 0a  --..7416..8301..
17ca0 39 34 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  9429....onlyif m
17cb0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
17cc0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
17cd0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
17ce0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17cf0 62 65 6c 2d 36 33 38 0d 0a 53 45 4c 45 43 54 20  bel-638..SELECT 
17d00 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 44 49  DISTINCT col2 DI
17d10 56 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  V - col2 AS col2
17d20 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
17d30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a  r0..----..-1....
17d40 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
17d50 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
17d60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17d70 61 62 65 6c 2d 36 33 38 0d 0a 53 45 4c 45 43 54  abel-638..SELECT
17d80 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2f   DISTINCT col2 /
17d90 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
17da0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
17db0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 71  0..----..-1....q
17dc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17dd0 53 45 4c 45 43 54 20 38 38 20 41 53 20 63 6f 6c  SELECT 88 AS col
17de0 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
17df0 0d 0a 2d 2d 2d 2d 0d 0a 38 38 0d 0a 38 38 0d 0a  ..----..88..88..
17e00 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
17e10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
17e20 4c 20 2d 20 28 20 35 39 20 29 20 2a 20 2b 20 63  L - ( 59 ) * + c
17e30 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
17e40 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
17e50 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 35 39 30  ---..-1534..-590
17e60 0d 0a 2d 37 36 37 0d 0a 0d 0a 71 75 65 72 79 20  ..-767....query 
17e70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17e80 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72  T DISTINCT + cor
17e90 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20  0.col0 + col1 * 
17ea0 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  - cor0.col1 FROM
17eb0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
17ec0 2d 2d 2d 0d 0a 2d 37 33 37 32 0d 0a 2d 38 31 39  ---..-7372..-819
17ed0 32 0d 0a 2d 39 33 37 34 0d 0a 0d 0a 71 75 65 72  2..-9374....quer
17ee0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17ef0 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  ECT cor0.col1 + 
17f00 2b 20 39 39 20 2a 20 63 6f 6c 32 20 41 53 20 63  + 99 * col2 AS c
17f10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
17f20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 33   cor0..----..263
17f30 33 0d 0a 32 37 30 34 0d 0a 33 37 37 39 0d 0a 0d  3..2704..3779...
17f40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17f50 0d 0a 53 45 4c 45 43 54 20 2d 20 32 37 20 2b 20  ..SELECT - 27 + 
17f60 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20  - cor0.col1 * + 
17f70 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
17f80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
17f90 30 35 0d 0a 2d 31 30 36 37 0d 0a 2d 36 36 37 0d  05..-1067..-667.
17fa0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
17fb0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
17fc0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
17fd0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
17fe0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
17ff0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 34 0d  wsort label-644.
18000 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
18010 6c 32 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20  l2 * CAST( NULL 
18020 41 53 20 44 45 43 49 4d 41 4c 20 29 20 46 52 4f  AS DECIMAL ) FRO
18030 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab0..----..NU
18040 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
18050 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
18060 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
18070 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18080 20 6c 61 62 65 6c 2d 36 34 34 0d 0a 53 45 4c 45   label-644..SELE
18090 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20  CT ALL - col2 * 
180a0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52  CAST ( NULL AS R
180b0 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30 0d  EAL ) FROM tab0.
180c0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
180d0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
180e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
180f0 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  CT + col1 * + co
18100 6c 31 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 32  l1 * + tab2.col2
18110 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
18120 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 38 32 0d  b2..----..10982.
18130 0a 32 35 39 34 37 0d 0a 39 30 35 30 36 0d 0a 0d  .25947..90506...
18140 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
18150 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
18160 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
18170 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
18180 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
18190 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
181a0 54 20 2d 20 36 39 20 63 6f 6c 31 20 46 52 4f 4d  T - 69 col1 FROM
181b0 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30   tab0, tab1 cor0
181c0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
181d0 20 68 61 73 68 69 6e 67 20 74 6f 20 33 62 64 37   hashing to 3bd7
181e0 34 36 30 65 66 61 34 38 63 36 36 63 30 37 32 61  460efa48c66c072a
181f0 64 35 66 33 63 32 64 65 66 37 65 39 0d 0a 0d 0a  d5f3c2def7e9....
18200 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18210 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
18220 20 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c   col2 + tab0.col
18230 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
18240 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 36  ab0..----..-1056
18250 0d 0a 2d 36 36 34 32 0d 0a 30 0d 0a 0d 0a 71 75  ..-6642..0....qu
18260 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18270 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
18280 6f 6c 31 20 2d 20 2b 20 37 38 20 2a 20 2d 20 63  ol1 - + 78 * - c
18290 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
182a0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 37 37   tab2..----..577
182b0 0d 0a 36 31 34 33 0d 0a 36 31 37 39 0d 0a 0d 0a  ..6143..6179....
182c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
182d0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 74  .SELECT col1 + t
182e0 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  ab2.col1 * col1 
182f0 2a 20 37 36 20 2d 20 2d 20 28 20 2d 20 63 6f 6c  * 76 - - ( - col
18300 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
18310 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 31 39   tab2..----..219
18320 36 34 0d 0a 32 36 34 35 35 36 0d 0a 37 33 30 33  64..264556..7303
18330 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
18340 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
18350 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
18360 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
18370 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
18380 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35  rowsort label-65
18390 30 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 72 30  0..SELECT ( cor0
183a0 2e 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 28 20  .col1 + - CAST( 
183b0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
183c0 20 2a 20 2d 20 36 34 20 29 20 46 52 4f 4d 20 74   * - 64 ) FROM t
183d0 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
183e0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
183f0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37  s hashing to cd7
18400 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34 30  a7901e47c1515540
18410 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d  4aff0d216fe0b...
18420 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
18430 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
18440 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
18450 6c 61 62 65 6c 2d 36 35 30 0d 0a 53 45 4c 45 43  label-650..SELEC
18460 54 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  T ( cor0.col1 + 
18470 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
18480 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 36   INTEGER ) * - 6
18490 34 20 29 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  4 ) FROM tab0, t
184a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
184b0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
184c0 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31 65  ing to cd7a7901e
184d0 34 37 63 31 35 31 35 35 34 30 34 61 66 66 30 64  47c15155404aff0d
184e0 32 31 36 66 65 30 62 0d 0a 0d 0a 6f 6e 6c 79 69  216fe0b....onlyi
184f0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
18500 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
18510 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
18520 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
18530 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
18540 62 65 6c 2d 36 35 31 0d 0a 53 45 4c 45 43 54 20  bel-651..SELECT 
18550 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 63  ALL + + col2 + c
18560 6f 6c 30 20 2a 20 2d 20 43 41 53 54 28 20 4e 55  ol0 * - CAST( NU
18570 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f  LL AS SIGNED ) /
18580 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
18590 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
185a0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
185b0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
185c0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
185d0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
185e0 6f 72 74 20 6c 61 62 65 6c 2d 36 35 31 0d 0a 53  ort label-651..S
185f0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
18600 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41  l2 + col0 * - CA
18610 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
18620 45 47 45 52 20 29 20 2f 20 2b 20 63 6f 6c 31 20  EGER ) / + col1 
18630 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
18640 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
18650 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
18660 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18670 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
18680 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l0 + + cor0.col0
18690 20 2a 20 38 35 20 2a 20 2b 20 63 6f 6c 31 20 46   * 85 * + col1 F
186a0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
186b0 2d 2d 2d 0d 0a 35 34 34 36 34 0d 0a 36 36 33 33  ---..54464..6633
186c0 0d 0a 38 38 34 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..88480....onlyi
186d0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
186e0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
186f0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
18700 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18710 20 6c 61 62 65 6c 2d 36 35 33 0d 0a 53 45 4c 45   label-653..SELE
18720 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20  CT ALL + col1 + 
18730 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 44 49 56 20  col0 + col0 DIV 
18740 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
18750 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
18760 2d 0d 0a 33 30 0d 0a 37 35 0d 0a 39 34 0d 0a 0d  -..30..75..94...
18770 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
18780 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
18790 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
187a0 6c 61 62 65 6c 2d 36 35 33 0d 0a 53 45 4c 45 43  label-653..SELEC
187b0 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 63  T ALL + col1 + c
187c0 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 72  ol0 + col0 / cor
187d0 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
187e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
187f0 33 30 0d 0a 37 35 0d 0a 39 34 0d 0a 0d 0a 71 75  30..75..94....qu
18800 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18810 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
18820 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 35 30 20 46   * col1 + + 50 F
18830 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
18840 31 35 30 0d 0a 32 31 39 0d 0a 37 32 36 0d 0a 0d  150..219..726...
18850 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18860 0d 0a 53 45 4c 45 43 54 20 38 37 20 2a 20 2b 20  ..SELECT 87 * + 
18870 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
18880 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 30  M tab2..----..60
18890 39 0d 0a 36 37 38 36 0d 0a 36 38 37 33 0d 0a 0d  9..6786..6873...
188a0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
188b0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
188c0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
188d0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
188e0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
188f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18900 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  T cor0.col1 + + 
18910 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 63 6f  col2 + + col0 co
18920 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
18930 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 0d  cor0..----..134.
18940 0a 31 36 33 0d 0a 36 35 0d 0a 0d 0a 73 6b 69 70  .163..65....skip
18950 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
18960 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
18970 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
18980 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
18990 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
189a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
189b0 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63  TINCT - - cor0.c
189c0 6f 6c 32 20 2a 20 63 6f 6c 32 20 63 6f 6c 30 20  ol2 * col2 col0 
189d0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
189e0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33  0..----..2916..3
189f0 32 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a 71 75 65  249..9216....que
18a00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18a10 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
18a20 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32  r0.col1 * - col2
18a30 20 2b 20 39 39 20 2b 20 2d 20 34 39 20 2a 20 63   + 99 + - 49 * c
18a40 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
18a50 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
18a60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30  cor0..----..-100
18a70 38 30 37 0d 0a 2d 31 34 37 36 34 35 0d 0a 2d 39  807..-147645..-9
18a80 39 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  999....query I r
18a90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
18aa0 4c 4c 20 2d 20 38 36 20 41 53 20 63 6f 6c 32 20  LL - 86 AS col2 
18ab0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
18ac0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 38  0..----..-86..-8
18ad0 36 0d 0a 2d 38 36 0d 0a 0d 0a 71 75 65 72 79 20  6..-86....query 
18ae0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18af0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 37  T DISTINCT + + 7
18b00 39 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  9 FROM tab1 AS c
18b10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 39 0d 0a 0d  or0..----..79...
18b20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18b30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
18b40 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63  ol0 * - col0 + c
18b50 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
18b60 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   tab0..----..-11
18b70 32 38 0d 0a 2d 34 39 30 0d 0a 2d 37 38 33 30 0d  28..-490..-7830.
18b80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18b90 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 30 20  rt..SELECT - 20 
18ba0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
18bb0 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 32 30 0d 0a  ----..-20..-20..
18bc0 2d 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -20....query I r
18bd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
18be0 49 53 54 49 4e 43 54 20 31 39 20 46 52 4f 4d 20  ISTINCT 19 FROM 
18bf0 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
18c00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a 0d 0a  r0..----..19....
18c10 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
18c20 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
18c30 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
18c40 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  0 AS cor0 CROSS 
18c50 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61 62 30 20  JOIN tab0, tab0 
18c60 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20 63 6f  AS cor1, tab0 co
18c70 72 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 33  r2, tab2 AS cor3
18c80 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c  ..----..3645 val
18c90 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
18ca0 30 61 66 38 32 39 62 32 65 61 36 33 66 64 38 61  0af829b2ea63fd8a
18cb0 32 35 64 64 64 64 64 62 38 35 31 66 63 64 35 0d  25dddddb851fcd5.
18cc0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18cd0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74  rt..SELECT ALL t
18ce0 61 62 30 2e 63 6f 6c 32 20 2b 20 2d 20 28 20 2b  ab0.col2 + - ( +
18cf0 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
18d00 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
18d10 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
18d20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18d30 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
18d40 31 20 2a 20 2b 20 28 20 63 6f 6c 30 20 29 20 2b  1 * + ( col0 ) +
18d50 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41   + col0 * col0 A
18d60 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
18d70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18d80 34 37 33 36 0d 0a 37 34 34 30 0d 0a 38 37 0d 0a  4736..7440..87..
18d90 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
18da0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
18db0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
18dc0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
18dd0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36  rowsort label-66
18de0 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  7..SELECT ALL co
18df0 6c 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30  l1 DIV cor0.col0
18e00 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   - col0 AS col2 
18e10 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
18e20 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a  ----..-64..-80..
18e30 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
18e40 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
18e50 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
18e60 6f 72 74 20 6c 61 62 65 6c 2d 36 36 37 0d 0a 53  ort label-667..S
18e70 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2f  ELECT ALL col1 /
18e80 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c   cor0.col0 - col
18e90 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
18ea0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
18eb0 2d 36 34 0d 0a 2d 38 30 0d 0a 35 0d 0a 0d 0a 71  -64..-80..5....q
18ec0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18ed0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
18ee0 31 20 2b 20 28 20 28 20 63 6f 72 30 2e 63 6f 6c  1 + ( ( cor0.col
18ef0 32 20 29 20 29 20 2a 20 63 6f 6c 32 20 41 53 20  2 ) ) * col2 AS 
18f00 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
18f10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
18f20 36 31 0d 0a 37 33 35 0d 0a 37 36 30 0d 0a 0d 0a  61..735..760....
18f30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18f40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
18f50 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 34   + cor0.col1 * 4
18f60 39 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  9 - - col2 * col
18f70 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
18f80 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
18f90 2d 0d 0a 31 31 38 33 39 0d 0a 34 37 38 39 0d 0a  -..11839..4789..
18fa0 35 30 33 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  5039....skipif p
18fb0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
18fc0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
18fd0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
18fe0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
18ff0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19000 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
19010 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  * - col1 + + col
19020 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0 col0 FROM tab2
19030 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19040 2d 31 34 35 36 0d 0a 2d 35 36 37 0d 0a 2d 38 33  -1456..-567..-83
19050 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
19060 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
19070 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2b 20 33  TINCT col0 + + 3
19080 33 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  3 FROM tab0 AS c
19090 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 0d 0a  or0..----..122..
190a0 35 37 0d 0a 36 38 0d 0a 0d 0a 71 75 65 72 79 20  57..68....query 
190b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
190c0 54 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 63 6f  T tab1.col1 * co
190d0 6c 31 20 2b 20 37 37 20 2a 20 63 6f 6c 31 20 46  l1 + 77 * col1 F
190e0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
190f0 31 31 37 30 0d 0a 32 36 37 38 0d 0a 38 37 30 0d  1170..2678..870.
19100 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19110 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35  rt..SELECT ALL 5
19120 39 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  9 FROM tab1, tab
19130 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  2 AS cor0, tab2 
19140 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
19150 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
19160 20 74 6f 20 65 32 39 66 65 66 38 63 64 65 63 31   to e29fef8cdec1
19170 65 65 34 35 61 37 31 64 32 31 33 66 31 36 64 32  ee45a71d213f16d2
19180 66 31 64 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  f1d3....skipif p
19190 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
191a0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
191b0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
191c0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
191d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
191e0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32  ..SELECT ALL - 2
191f0 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f  2 * cor0.col2 co
19200 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
19210 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38  cor0..----..-118
19220 38 0d 0a 2d 31 32 35 34 0d 0a 2d 32 31 31 32 0d  8..-1254..-2112.
19230 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
19240 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
19250 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
19260 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
19270 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
19280 37 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  75..SELECT col2 
19290 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49  + + cor0.col0 DI
192a0 56 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  V - col2 AS col0
192b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
192c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 33  r0..----..-34..3
192d0 33 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..81....skipif 
192e0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
192f0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
19300 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37  rowsort label-67
19310 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  5..SELECT col2 +
19320 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 2d   + cor0.col0 / -
19330 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
19340 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
19350 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 33 33 0d 0a  .----..-34..33..
19360 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
19370 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
19380 4c 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 31 20 2b  L - col2 + + 1 +
19390 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63   col1 * + cor0.c
193a0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
193b0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
193c0 2d 2d 2d 0d 0a 31 31 35 33 0d 0a 31 33 35 31 0d  ---..1153..1351.
193d0 0a 35 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .514....query I 
193e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
193f0 41 4c 4c 20 2b 20 28 20 2d 20 39 20 29 20 2a 20  ALL + ( - 9 ) * 
19400 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52  - col1 + col0 FR
19410 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
19420 2d 2d 0d 0a 32 33 32 0d 0a 32 38 36 0d 0a 36 30  --..232..286..60
19430 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
19440 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
19450 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63   - col1 + cor0.c
19460 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol2 * col2 FROM 
19470 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
19480 2d 2d 0d 0a 32 38 39 30 0d 0a 33 32 33 39 0d 0a  --..2890..3239..
19490 39 32 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9203....query I 
194a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
194b0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
194c0 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col1 + - col0 * 
194d0 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
194e0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
194f0 2d 0d 0a 2d 33 35 0d 0a 2d 34 31 30 36 0d 0a 2d  -..-35..-4106..-
19500 36 34 31 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  6413....skipif p
19510 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
19520 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
19530 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
19540 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
19550 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19560 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
19570 2d 20 63 6f 6c 32 20 2a 20 28 20 74 61 62 30 2e  - col2 * ( tab0.
19580 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 29 20  col2 * + col1 ) 
19590 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
195a0 2d 2d 2d 2d 0d 0a 2d 32 32 34 37 36 39 36 0d 0a  ----..-2247696..
195b0 2d 33 33 39 35 0d 0a 2d 35 34 34 35 37 36 37 36  -3395..-54457676
195c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
195d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
195e0 49 4e 43 54 20 2b 20 32 33 20 2b 20 2d 20 63 6f  INCT + 23 + - co
195f0 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a  r0.col0 + col0 *
19600 20 28 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d   ( + col1 ) FROM
19610 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
19620 2d 2d 2d 0d 0a 31 32 38 37 0d 0a 32 33 33 0d 0a  ---..1287..233..
19630 34 35 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4547....query I 
19640 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19650 41 4c 4c 20 31 20 2b 20 2d 20 63 6f 6c 31 20 2b  ALL 1 + - col1 +
19660 20 31 30 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63   10 * col2 * - c
19670 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
19680 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
19690 33 39 38 0d 0a 2d 36 34 37 36 0d 0a 2d 38 34 30  398..-6476..-840
196a0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
196b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
196c0 54 49 4e 43 54 20 2b 20 39 30 20 2b 20 63 6f 6c  TINCT + 90 + col
196d0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
196e0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
196f0 2d 0d 0a 31 32 33 0d 0a 31 37 32 0d 0a 39 31 0d  -..123..172..91.
19700 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19710 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 37  rt..SELECT + + 7
19720 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  4 AS col0 FROM t
19730 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
19740 2d 0d 0a 37 34 0d 0a 37 34 0d 0a 37 34 0d 0a 0d  -..74..74..74...
19750 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19760 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
19770 2a 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2d 20 63  * col2 * + ( - c
19780 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 41 53 20  ol2 ) + col0 AS 
19790 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
197a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
197b0 39 38 38 38 0d 0a 33 32 35 35 34 0d 0a 37 35 38  9888..32554..758
197c0 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  19....query I ro
197d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
197e0 53 54 49 4e 43 54 20 2b 20 37 33 20 41 53 20 63  STINCT + 73 AS c
197f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
19800 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 0d   cor0..----..73.
19810 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19820 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
19830 4e 43 54 20 34 35 20 2b 20 2d 20 63 6f 6c 30 20  NCT 45 + - col0 
19840 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
19850 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 33  0..----..-33..-3
19860 34 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49  4..38....query I
19870 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19880 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2b 20   ALL - + col2 + 
19890 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 31 20  cor0.col0 + + 1 
198a0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
198b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
198c0 0a 2d 31 39 0d 0a 34 32 0d 0a 35 33 0d 0a 0d 0a  .-19..42..53....
198d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
198e0 0a 53 45 4c 45 43 54 20 2d 20 34 39 20 41 53 20  .SELECT - 49 AS 
198f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20  col1 FROM tab2, 
19900 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
19910 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
19920 68 69 6e 67 20 74 6f 20 30 31 62 31 66 61 32 32  hing to 01b1fa22
19930 66 65 65 38 37 32 61 37 62 61 36 34 66 39 30 64  fee872a7ba64f90d
19940 36 30 34 36 66 66 61 65 0d 0a 0d 0a 71 75 65 72  6046ffae....quer
19950 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19960 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  ECT col1 + col0 
19970 2a 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20 41  * - ( - col1 ) A
19980 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
19990 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
199a0 31 33 36 30 0d 0a 32 34 38 0d 0a 34 36 36 31 0d  1360..248..4661.
199b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
199c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
199d0 4e 43 54 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a  NCT - ( col2 ) *
199e0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2b   col2 + + col0 +
199f0 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   + col2 AS col0 
19a00 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
19a10 0a 2d 32 38 35 39 0d 0a 2d 33 31 32 38 0d 0a 2d  .-2859..-3128..-
19a20 39 30 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9040....query I 
19a30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19a40 36 35 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  65 * - cor0.col0
19a50 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
19a60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
19a70 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
19a80 20 61 65 32 35 63 39 31 39 37 30 34 37 34 31 34   ae25c9197047414
19a90 36 30 63 64 65 35 61 61 39 34 62 64 36 33 34 66  60cde5aa94bd634f
19aa0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
19ab0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
19ac0 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c 31 20 29  TINCT ( + col1 )
19ad0 20 2a 20 63 6f 6c 32 20 2a 20 74 61 62 31 2e 63   * col2 * tab1.c
19ae0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20  ol2 + - col1 AS 
19af0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
19b00 2d 2d 2d 2d 0d 0a 31 31 39 37 39 35 0d 0a 33 32  ----..119795..32
19b10 34 38 30 0d 0a 37 35 37 39 30 0d 0a 0d 0a 71 75  480..75790....qu
19b20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19b30 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a  ELECT - - col1 *
19b40 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41   - col1 + col1 A
19b50 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
19b60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19b70 2d 32 37 32 0d 0a 2d 33 34 32 32 0d 0a 2d 39 33  -272..-3422..-93
19b80 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
19b90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
19ba0 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30   - col0 * + col0
19bb0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
19bc0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
19bd0 0a 2d 31 31 32 38 0d 0a 2d 34 39 30 0d 0a 2d 37  .-1128..-490..-7
19be0 38 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  830....onlyif my
19bf0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
19c00 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
19c10 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
19c20 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
19c30 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
19c40 36 39 36 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41  696..SELECT + CA
19c50 53 54 28 20 2d 20 34 31 20 41 53 20 53 49 47 4e  ST( - 41 AS SIGN
19c60 45 44 20 29 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  ED ) - - cor0.co
19c70 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
19c80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d  cor0..----..-10.
19c90 0a 2d 32 34 0d 0a 31 38 0d 0a 0d 0a 73 6b 69 70  .-24..18....skip
19ca0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
19cb0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
19cc0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
19cd0 2d 36 39 36 0d 0a 53 45 4c 45 43 54 20 2b 20 43  -696..SELECT + C
19ce0 41 53 54 20 28 20 2d 20 34 31 20 41 53 20 49 4e  AST ( - 41 AS IN
19cf0 54 45 47 45 52 20 29 20 2d 20 2d 20 63 6f 72 30  TEGER ) - - cor0
19d00 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20  .col1 FROM tab2 
19d10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
19d20 31 30 0d 0a 2d 32 34 0d 0a 31 38 0d 0a 0d 0a 6f  10..-24..18....o
19d30 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
19d40 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
19d50 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
19d60 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
19d70 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 37 0d 0a  sort label-697..
19d80 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 30 20  SELECT + ( col0 
19d90 29 20 2a 20 63 6f 6c 31 20 44 49 56 20 2d 20 63  ) * col1 DIV - c
19da0 6f 6c 31 20 2d 20 38 39 20 46 52 4f 4d 20 74 61  ol1 - 89 FROM ta
19db0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
19dc0 0d 0a 2d 31 31 33 0d 0a 2d 31 32 34 0d 0a 2d 31  ..-113..-124..-1
19dd0 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  78....skipif mys
19de0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
19df0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
19e00 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 37 0d 0a  sort label-697..
19e10 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 30 20  SELECT + ( col0 
19e20 29 20 2a 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c  ) * col1 / - col
19e30 31 20 2d 20 38 39 20 46 52 4f 4d 20 74 61 62 30  1 - 89 FROM tab0
19e40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19e50 2d 31 31 33 0d 0a 2d 31 32 34 0d 0a 2d 31 37 38  -113..-124..-178
19e60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19e70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
19e80 2d 20 2d 20 31 30 20 2b 20 2b 20 32 33 20 41 53  - - 10 + + 23 AS
19e90 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
19ea0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
19eb0 33 0d 0a 33 33 0d 0a 33 33 0d 0a 0d 0a 73 6b 69  3..33..33....ski
19ec0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
19ed0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
19ee0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
19ef0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
19f00 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
19f10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
19f20 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20  STINCT - col1 * 
19f30 63 6f 6c 31 20 2b 20 2d 20 74 61 62 30 2e 63 6f  col1 + - tab0.co
19f40 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c 30  l1 + - col0 col0
19f50 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
19f60 0d 0a 2d 37 35 30 36 0d 0a 2d 38 34 36 31 0d 0a  ..-7506..-8461..
19f70 2d 39 35 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -9541....query I
19f80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19f90 20 2d 20 28 20 35 20 29 20 46 52 4f 4d 20 74 61   - ( 5 ) FROM ta
19fa0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 2d 35  b0..----..-5..-5
19fb0 0d 0a 2d 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..-5....onlyif m
19fc0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
19fd0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
19fe0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
19ff0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
1a000 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1a010 2d 37 30 31 0d 0a 53 45 4c 45 43 54 20 43 41 53  -701..SELECT CAS
1a020 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
1a030 44 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b  D ) * + col0 * +
1a040 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
1a050 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
1a060 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
1a070 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1a080 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1a090 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a0a0 37 30 31 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  701..SELECT CAST
1a0b0 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
1a0c0 45 52 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2a 20  ER ) * + col0 * 
1a0d0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
1a0e0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1a0f0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
1a100 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a110 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
1a120 20 28 20 63 6f 6c 32 20 29 20 2d 20 2d 20 63 6f   ( col2 ) - - co
1a130 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1a140 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a  cor0..----..55..
1a150 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20  58..85....query 
1a160 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a170 54 20 2b 20 28 20 36 34 20 29 20 46 52 4f 4d 20  T + ( 64 ) FROM 
1a180 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1a190 2d 2d 0d 0a 36 34 0d 0a 36 34 0d 0a 36 34 0d 0a  --..64..64..64..
1a1a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a1b0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1a1c0 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2d  CT col2 * col1 -
1a1d0 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   + col2 * + col1
1a1e0 20 2a 20 2d 20 37 37 20 41 53 20 63 6f 6c 31 20   * - 77 AS col1 
1a1f0 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
1a200 2d 2d 2d 2d 0d 0a 31 31 39 36 35 32 0d 0a 35 30  ----..119652..50
1a210 33 38 38 0d 0a 36 35 32 38 36 0d 0a 0d 0a 71 75  388..65286....qu
1a220 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a230 45 4c 45 43 54 20 41 4c 4c 20 2b 20 36 33 20 2b  ELECT ALL + 63 +
1a240 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63   col0 * - cor0.c
1a250 6f 6c 32 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ol2 - col1 AS co
1a260 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
1a270 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 39 0d  cor0..----..-69.
1a280 0a 2d 37 33 32 36 0d 0a 2d 38 31 35 0d 0a 0d 0a  .-7326..-815....
1a290 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a2a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
1a2b0 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 30 20  col1 ) + + col0 
1a2c0 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53  * col2 + col1 AS
1a2d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1a2e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
1a2f0 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a  5..7298..792....
1a300 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
1a310 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
1a320 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
1a330 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
1a340 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
1a350 72 74 20 6c 61 62 65 6c 2d 37 30 37 0d 0a 53 45  rt label-707..SE
1a360 4c 45 43 54 20 41 4c 4c 20 2d 20 31 31 20 2a 20  LECT ALL - 11 * 
1a370 63 6f 6c 32 20 2a 20 2b 20 34 39 20 2b 20 2b 20  col2 * + 49 + + 
1a380 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2a 20  col2 * - col2 * 
1a390 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20 41  + CAST( + col0 A
1a3a0 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
1a3b0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1a3c0 0a 2d 31 33 34 35 35 38 0d 0a 2d 31 39 36 35 36  .-134558..-19656
1a3d0 0d 0a 2d 36 36 37 34 32 0d 0a 0d 0a 73 6b 69 70  ..-66742....skip
1a3e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1a3f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1a400 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1a410 2d 37 30 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -707..SELECT ALL
1a420 20 2d 20 31 31 20 2a 20 63 6f 6c 32 20 2a 20 2b   - 11 * col2 * +
1a430 20 34 39 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d   49 + + col2 * -
1a440 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 20 28   col2 * + CAST (
1a450 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   + col0 AS INTEG
1a460 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63  ER ) FROM tab2 c
1a470 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 35  or0..----..-1345
1a480 35 38 0d 0a 2d 31 39 36 35 36 0d 0a 2d 36 36 37  58..-19656..-667
1a490 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  42....query I ro
1a4a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1a4b0 53 54 49 4e 43 54 20 2d 20 2b 20 32 31 20 2d 20  STINCT - + 21 - 
1a4c0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
1a4d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
1a4e0 0d 0a 34 33 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72  ..43..59....quer
1a4f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a500 45 43 54 20 2d 20 2d 20 28 20 2d 20 63 6f 6c 30  ECT - - ( - col0
1a510 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) + col1 FROM t
1a520 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1a530 2d 0d 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d  -..-19..-62..24.
1a540 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1a550 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1a560 4e 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20  NCT + tab2.col0 
1a570 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1a580 32 2c 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  2, tab1, tab2 AS
1a590 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a   cor0..----..7..
1a5a0 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20  78..79....query 
1a5b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a5c0 54 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 2a 20  T col2 - col1 * 
1a5d0 31 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  17 FROM tab1 AS 
1a5e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33  cor0..----..-113
1a5f0 0d 0a 2d 31 32 35 0d 0a 2d 33 38 38 0d 0a 0d 0a  ..-125..-388....
1a600 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1a610 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1a620 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1a630 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1a640 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1a650 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a660 20 34 35 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   45 col0 FROM ta
1a670 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 35 0d 0a 34 35  b1..----..45..45
1a680 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..45....query I 
1a690 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a6a0 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 41 53 20 63  col2 - col1 AS c
1a6b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1a6c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d   cor0..----..28.
1a6d0 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79  .47..83....query
1a6e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a6f0 43 54 20 33 36 20 2a 20 2b 20 63 6f 6c 30 20 41  CT 36 * + col0 A
1a700 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
1a710 0d 0a 2d 2d 2d 2d 0d 0a 32 35 32 0d 0a 32 38 30  ..----..252..280
1a720 38 0d 0a 32 38 34 34 0d 0a 0d 0a 71 75 65 72 79  8..2844....query
1a730 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a740 43 54 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 35  CT tab2.col0 * 5
1a750 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  5 AS col2 FROM t
1a760 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
1a770 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
1a780 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 31 39  s hashing to b19
1a790 66 64 32 31 36 64 66 61 33 33 30 65 34 33 34 65  fd216dfa330e434e
1a7a0 33 64 39 35 31 30 32 32 62 63 33 36 64 0d 0a 0d  3d951022bc36d...
1a7b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a7c0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
1a7d0 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 46 52  + col2 + col1 FR
1a7e0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1a7f0 2d 2d 0d 0a 31 39 35 0d 0a 32 30 35 0d 0a 32 36  --..195..205..26
1a800 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
1a810 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1a820 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1a830 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1a840 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1a850 2d 37 31 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -717..SELECT col
1a860 31 20 2a 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d  1 * - col0 DIV -
1a870 20 28 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d   ( + col0 ) FROM
1a880 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d   tab0..----..86.
1a890 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69  .91..97....skipi
1a8a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1a8b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1a8c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a8d0 37 31 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  717..SELECT col1
1a8e0 20 2a 20 2d 20 63 6f 6c 30 20 2f 20 2d 20 28 20   * - col0 / - ( 
1a8f0 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  + col0 ) FROM ta
1a900 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31  b0..----..86..91
1a910 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
1a920 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a930 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
1a940 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  + col0 * - col0 
1a950 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1a960 0a 2d 32 36 32 31 34 34 0d 0a 2d 32 37 0d 0a 2d  .-262144..-27..-
1a970 35 31 32 30 30 30 0d 0a 0d 0a 71 75 65 72 79 20  512000....query 
1a980 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a990 54 20 41 4c 4c 20 35 33 20 46 52 4f 4d 20 74 61  T ALL 53 FROM ta
1a9a0 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b1, tab2 AS cor0
1a9b0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
1a9c0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
1a9d0 68 61 73 68 69 6e 67 20 74 6f 20 38 36 36 61 65  hashing to 866ae
1a9e0 31 62 34 61 62 39 65 35 62 34 30 34 33 61 63 31  1b4ab9e5b4043ac1
1a9f0 62 63 66 64 34 31 33 61 61 61 36 0d 0a 0d 0a 71  bcfd413aaa6....q
1aa00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1aa10 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
1aa20 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 + col2 FROM t
1aa30 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1aa40 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 73 6b  28..47..83....sk
1aa50 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1aa60 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1aa70 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1aa80 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1aa90 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1aaa0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1aab0 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 28  ISTINCT col1 * (
1aac0 20 2b 20 63 6f 6c 30 20 29 20 63 6f 6c 31 20 46   + col0 ) col1 F
1aad0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1aae0 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d  1343..217..4602.
1aaf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ab00 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
1ab10 6f 72 30 2e 63 6f 6c 30 20 2b 20 36 35 20 2a 20  or0.col0 + 65 * 
1ab20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
1ab30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ab40 34 34 38 0d 0a 34 39 39 32 0d 0a 35 30 35 36 0d  448..4992..5056.
1ab50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ab60 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
1ab70 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20  0.col1 + + col0 
1ab80 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  * col2 FROM tab1
1ab90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1aba0 31 33 36 0d 0a 33 36 33 38 0d 0a 37 36 36 37 0d  136..3638..7667.
1abb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1abc0 72 74 0d 0a 53 45 4c 45 43 54 20 32 37 20 46 52  rt..SELECT 27 FR
1abd0 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
1abe0 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
1abf0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
1ac00 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1ac10 31 61 33 63 65 66 35 63 33 33 62 38 66 38 37 66  1a3cef5c33b8f87f
1ac20 66 65 64 65 64 33 37 38 66 64 32 30 37 37 35 33  feded378fd207753
1ac30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ac40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1ac50 49 4e 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 32  INCT - tab2.col2
1ac60 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
1ac70 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab2 cor0..---
1ac80 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38  -..-26..-27..-38
1ac90 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1aca0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1acb0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1acc0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1acd0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1ace0 37 32 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  726..SELECT ALL 
1acf0 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c  - col0 DIV - col
1ad00 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
1ad10 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 36 0d  ab1..----..0..6.
1ad20 0a 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .6....skipif mys
1ad30 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1ad40 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1ad50 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 36 0d 0a  sort label-726..
1ad60 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1ad70 30 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  0 / - col1 AS co
1ad80 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
1ad90 2d 2d 0d 0a 30 0d 0a 36 0d 0a 36 0d 0a 0d 0a 71  --..0..6..6....q
1ada0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1adb0 53 45 4c 45 43 54 20 2d 20 36 33 20 46 52 4f 4d  SELECT - 63 FROM
1adc0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
1add0 0d 0a 2d 36 33 0d 0a 2d 36 33 0d 0a 2d 36 33 0d  ..-63..-63..-63.
1ade0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1adf0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1ae00 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1ae10 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1ae20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1ae30 32 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 38  28..SELECT + + 8
1ae40 30 20 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20  0 DIV + col2 AS 
1ae50 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1ae60 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1ae70 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..1....skipif 
1ae80 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1ae90 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1aea0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32  rowsort label-72
1aeb0 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 38 30  8..SELECT + + 80
1aec0 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   / + col2 AS col
1aed0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1aee0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  or0..----..0..1.
1aef0 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .1....onlyif mys
1af00 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1af10 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1af20 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1af30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1af40 6c 2d 37 32 39 0d 0a 53 45 4c 45 43 54 20 2b 20  l-729..SELECT + 
1af50 2d 20 38 33 20 44 49 56 20 2d 20 63 6f 6c 31 20  - 83 DIV - col1 
1af60 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1af70 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 34  0..----..1..2..4
1af80 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1af90 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1afa0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1afb0 72 74 20 6c 61 62 65 6c 2d 37 32 39 0d 0a 53 45  rt label-729..SE
1afc0 4c 45 43 54 20 2b 20 2d 20 38 33 20 2f 20 2d 20  LECT + - 83 / - 
1afd0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1afe0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
1aff0 0a 32 0d 0a 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .2..4....onlyif 
1b000 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1b010 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1b020 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1b030 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b040 61 62 65 6c 2d 37 33 30 0d 0a 53 45 4c 45 43 54  abel-730..SELECT
1b050 20 38 36 20 44 49 56 20 32 37 20 46 52 4f 4d 20   86 DIV 27 FROM 
1b060 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1b070 2d 2d 0d 0a 33 0d 0a 33 0d 0a 33 0d 0a 0d 0a 73  --..3..3..3....s
1b080 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1b090 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1b0a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1b0b0 62 65 6c 2d 37 33 30 0d 0a 53 45 4c 45 43 54 20  bel-730..SELECT 
1b0c0 38 36 20 2f 20 32 37 20 46 52 4f 4d 20 74 61 62  86 / 27 FROM tab
1b0d0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1b0e0 0a 33 0d 0a 33 0d 0a 33 0d 0a 0d 0a 6f 6e 6c 79  .3..3..3....only
1b0f0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1b100 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1b110 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1b120 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1b130 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b140 61 62 65 6c 2d 37 33 31 0d 0a 53 45 4c 45 43 54  abel-731..SELECT
1b150 20 43 41 53 54 28 20 63 6f 72 30 2e 63 6f 6c 32   CAST( cor0.col2
1b160 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
1b170 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
1b180 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d  -..54..57..96...
1b190 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1b1a0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1b1b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1b1c0 6c 61 62 65 6c 2d 37 33 31 0d 0a 53 45 4c 45 43  label-731..SELEC
1b1d0 54 20 43 41 53 54 20 28 20 63 6f 72 30 2e 63 6f  T CAST ( cor0.co
1b1e0 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l2 AS INTEGER ) 
1b1f0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
1b200 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36  ----..54..57..96
1b210 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b220 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
1b230 6c 30 20 2a 20 35 34 20 41 53 20 63 6f 6c 31 20  l0 * 54 AS col1 
1b240 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1b250 0a 31 36 32 0d 0a 33 34 35 36 0d 0a 34 33 32 30  .162..3456..4320
1b260 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b270 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1b280 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
1b290 61 62 32 2c 20 74 61 62 30 2c 20 74 61 62 32 20  ab2, tab0, tab2 
1b2a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1b2b0 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
1b2c0 20 74 6f 20 31 65 31 66 31 30 39 35 33 65 62 38   to 1e1f10953eb8
1b2d0 65 66 66 65 39 62 32 30 65 37 34 36 66 38 61 37  effe9b20e746f8a7
1b2e0 66 64 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  fd83....onlyif m
1b2f0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1b300 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1b310 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1b320 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1b330 62 65 6c 2d 37 33 34 0d 0a 53 45 4c 45 43 54 20  bel-734..SELECT 
1b340 2b 20 63 6f 6c 31 20 44 49 56 20 32 35 20 63 6f  + col1 DIV 25 co
1b350 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
1b360 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73  --..0..0..1....s
1b370 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1b380 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1b390 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1b3a0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1b3b0 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
1b3c0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1b3d0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1b3e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 33 34  owsort label-734
1b3f0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
1b400 2f 20 32 35 20 63 6f 6c 31 20 46 52 4f 4d 20 74  / 25 col1 FROM t
1b410 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab1..----..0..0.
1b420 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .1....skipif pos
1b430 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1b440 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1b450 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1b460 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
1b470 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1b480 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1b490 2b 20 63 6f 6c 30 20 2a 20 33 33 20 2d 20 37 37  + col0 * 33 - 77
1b4a0 20 2a 20 74 61 62 32 2e 63 6f 6c 32 20 63 6f 6c   * tab2.col2 col
1b4b0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
1b4c0 2d 0d 0a 2d 31 38 34 38 0d 0a 2d 33 31 39 0d 0a  -..-1848..-319..
1b4d0 35 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  572....query I r
1b4e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1b4f0 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 32 20 2a   col1 * ( col2 *
1b500 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   + col0 ) AS col
1b510 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1b520 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36  or0..----..-1196
1b530 35 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35 38 35  52..-51034..-585
1b540 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
1b550 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1b560 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1b570 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1b580 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1b590 2d 37 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  -737..SELECT DIS
1b5a0 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20  TINCT cor0.col2 
1b5b0 44 49 56 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63  DIV - col2 + - c
1b5c0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
1b5d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1b5e0 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 36 35 0d 0a 2d 38  ---..-4..-65..-8
1b5f0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
1b600 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1b610 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1b620 6f 72 74 20 6c 61 62 65 6c 2d 37 33 37 0d 0a 53  ort label-737..S
1b630 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1b640 6f 72 30 2e 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c  or0.col2 / - col
1b650 32 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  2 + - col0 AS co
1b660 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
1b670 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a  cor0..----..-4..
1b680 2d 36 35 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65 72  -65..-81....quer
1b690 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1b6a0 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29  ECT + ( + col0 )
1b6b0 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   * - col2 * col2
1b6c0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1b6d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1b6e0 0d 0a 2d 32 36 31 33 36 0d 0a 2d 33 35 0d 0a 2d  ..-26136..-35..-
1b6f0 35 39 38 34 33 36 0d 0a 0d 0a 71 75 65 72 79 20  598436....query 
1b700 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b710 54 20 41 4c 4c 20 2b 20 2b 20 33 38 20 46 52 4f  T ALL + + 38 FRO
1b720 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
1b730 2d 0d 0a 33 38 0d 0a 33 38 0d 0a 33 38 0d 0a 0d  -..38..38..38...
1b740 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b750 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
1b760 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e  * - col2 + cor0.
1b770 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
1b780 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1b790 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 32 31 36  ----..-34..-7216
1b7a0 0d 0a 2d 37 35 39 0d 0a 0d 0a 71 75 65 72 79 20  ..-759....query 
1b7b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b7c0 54 20 41 4c 4c 20 2d 20 2b 20 28 20 2d 20 63 6f  T ALL - + ( - co
1b7d0 6c 31 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  l1 ) * + cor0.co
1b7e0 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l1 + col0 FROM t
1b7f0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1b800 2d 0d 0a 31 36 34 0d 0a 32 34 39 0d 0a 36 37 39  -..164..249..679
1b810 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1b820 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1b830 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1b840 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1b850 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b860 37 34 32 0d 0a 53 45 4c 45 43 54 20 32 37 20 44  742..SELECT 27 D
1b870 49 56 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  IV - col2 + col1
1b880 20 2a 20 36 38 20 2a 20 2b 20 63 6f 6c 32 20 46   * 68 * + col2 F
1b890 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1b8a0 0d 0a 2d 2d 2d 2d 0d 0a 33 38 37 36 30 0d 0a 38  ..----..38760..8
1b8b0 34 38 36 34 0d 0a 39 35 34 37 32 0d 0a 0d 0a 73  4864..95472....s
1b8c0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1b8d0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1b8e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1b8f0 62 65 6c 2d 37 34 32 0d 0a 53 45 4c 45 43 54 20  bel-742..SELECT 
1b900 32 37 20 2f 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  27 / - col2 + co
1b910 6c 31 20 2a 20 36 38 20 2a 20 2b 20 63 6f 6c 32  l1 * 68 * + col2
1b920 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1b930 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 37 36 30 0d  r0..----..38760.
1b940 0a 38 34 38 36 34 0d 0a 39 35 34 37 32 0d 0a 0d  .84864..95472...
1b950 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1b960 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1b970 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1b980 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1b990 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1b9a0 6f 72 74 20 6c 61 62 65 6c 2d 37 34 33 0d 0a 53  ort label-743..S
1b9b0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
1b9c0 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  ( col2 AS SIGNED
1b9d0 20 29 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 34 39   ) * - col0 * 49
1b9e0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1b9f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1ba00 37 31 35 0d 0a 33 35 37 36 30 32 0d 0a 33 38 38  715..357602..388
1ba10 30 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  08....skipif pos
1ba20 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1ba30 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1ba40 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1ba50 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
1ba60 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1ba70 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1ba80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1ba90 62 65 6c 2d 37 34 33 0d 0a 53 45 4c 45 43 54 20  bel-743..SELECT 
1baa0 41 4c 4c 20 2d 20 43 41 53 54 20 28 20 63 6f 6c  ALL - CAST ( col
1bab0 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  2 AS INTEGER ) *
1bac0 20 2d 20 63 6f 6c 30 20 2a 20 34 39 20 63 6f 6c   - col0 * 49 col
1bad0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1bae0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 35 0d  or0..----..1715.
1baf0 0a 33 35 37 36 30 32 0d 0a 33 38 38 30 38 0d 0a  .357602..38808..
1bb00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bb10 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d  t..SELECT col0 -
1bb20 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1bb30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d  cor0..----..-23.
1bb40 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 6f 6e 6c 79 69  .54..67....onlyi
1bb50 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1bb60 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1bb70 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1bb80 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1bb90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1bba0 62 65 6c 2d 37 34 35 0d 0a 53 45 4c 45 43 54 20  bel-745..SELECT 
1bbb0 2d 20 43 41 53 54 28 20 2d 20 31 34 20 41 53 20  - CAST( - 14 AS 
1bbc0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
1bbd0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1bbe0 0d 0a 31 34 0d 0a 31 34 0d 0a 31 34 0d 0a 0d 0a  ..14..14..14....
1bbf0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1bc00 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1bc10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1bc20 61 62 65 6c 2d 37 34 35 0d 0a 53 45 4c 45 43 54  abel-745..SELECT
1bc30 20 2d 20 43 41 53 54 20 28 20 2d 20 31 34 20 41   - CAST ( - 14 A
1bc40 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
1bc50 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1bc60 2d 2d 2d 0d 0a 31 34 0d 0a 31 34 0d 0a 31 34 0d  ---..14..14..14.
1bc70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1bc80 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63  rt..SELECT + ( c
1bc90 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 30 20 2d  ol0 ) * - col0 -
1bca0 20 38 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20   81 * col1 FROM 
1bcb0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1bcc0 2d 2d 0d 0a 2d 31 35 32 39 32 0d 0a 2d 37 35 34  --..-15292..-754
1bcd0 32 0d 0a 2d 39 30 38 32 0d 0a 0d 0a 6f 6e 6c 79  2..-9082....only
1bce0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1bcf0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1bd00 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1bd10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bd20 74 20 6c 61 62 65 6c 2d 37 34 37 0d 0a 53 45 4c  t label-747..SEL
1bd30 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  ECT col2 * col2 
1bd40 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 63  + - col2 DIV + c
1bd50 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1bd60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31   cor0..----..291
1bd70 35 0d 0a 33 32 34 38 0d 0a 39 32 31 35 0d 0a 0d  5..3248..9215...
1bd80 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1bd90 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1bda0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1bdb0 6c 61 62 65 6c 2d 37 34 37 0d 0a 53 45 4c 45 43  label-747..SELEC
1bdc0 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20  T col2 * col2 + 
1bdd0 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20  - col2 / + col2 
1bde0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1bdf0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 35 0d 0a 33  0..----..2915..3
1be00 32 34 38 0d 0a 39 32 31 35 0d 0a 0d 0a 6f 6e 6c  248..9215....onl
1be10 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1be20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1be30 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1be40 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1be50 72 74 20 6c 61 62 65 6c 2d 37 34 38 0d 0a 53 45  rt label-748..SE
1be60 4c 45 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 32  LECT + tab0.col2
1be70 20 44 49 56 20 36 35 20 41 53 20 63 6f 6c 30 20   DIV 65 AS col0 
1be80 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1be90 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .0..0..1....skip
1bea0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1beb0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1bec0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1bed0 2d 37 34 38 0d 0a 53 45 4c 45 43 54 20 2b 20 74  -748..SELECT + t
1bee0 61 62 30 2e 63 6f 6c 32 20 2f 20 36 35 20 41 53  ab0.col2 / 65 AS
1bef0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
1bf00 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a  .----..0..0..1..
1bf10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bf20 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 39 20 2b  t..SELECT - 19 +
1bf30 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
1bf40 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1bf50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 0d 0a 2d  0..----..-101..-
1bf60 32 30 0d 0a 2d 35 32 0d 0a 0d 0a 6f 6e 6c 79 69  20..-52....onlyi
1bf70 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1bf80 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1bf90 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1bfa0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1bfb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1bfc0 62 65 6c 2d 37 35 30 0d 0a 53 45 4c 45 43 54 20  bel-750..SELECT 
1bfd0 44 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 4e  DISTINCT CAST( N
1bfe0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
1bff0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  + + cor0.col2 FR
1c000 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1c010 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
1c020 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1c030 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1c040 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1c050 62 65 6c 2d 37 35 30 0d 0a 53 45 4c 45 43 54 20  bel-750..SELECT 
1c060 44 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20  DISTINCT CAST ( 
1c070 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
1c080 29 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ) + + cor0.col2 
1c090 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1c0a0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
1c0b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c0c0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
1c0d0 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53  col1 + - col1 AS
1c0e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1c0f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1c100 32 33 35 0d 0a 31 33 37 38 0d 0a 35 36 30 0d 0a  235..1378..560..
1c110 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1c120 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1c130 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1c140 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1c150 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35  rowsort label-75
1c160 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  2..SELECT ALL + 
1c170 2b 20 28 20 33 35 20 29 20 44 49 56 20 63 6f 6c  + ( 35 ) DIV col
1c180 32 20 2b 20 2d 20 38 37 20 46 52 4f 4d 20 74 61  2 + - 87 FROM ta
1c190 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1c1a0 0d 0a 2d 38 37 0d 0a 2d 38 37 0d 0a 2d 38 37 0d  ..-87..-87..-87.
1c1b0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1c1c0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1c1d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c1e0 74 20 6c 61 62 65 6c 2d 37 35 32 0d 0a 53 45 4c  t label-752..SEL
1c1f0 45 43 54 20 41 4c 4c 20 2b 20 2b 20 28 20 33 35  ECT ALL + + ( 35
1c200 20 29 20 2f 20 63 6f 6c 32 20 2b 20 2d 20 38 37   ) / col2 + - 87
1c210 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1c220 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 37 0d 0a 2d  r0..----..-87..-
1c230 38 37 0d 0a 2d 38 37 0d 0a 0d 0a 6f 6e 6c 79 69  87..-87....onlyi
1c240 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1c250 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1c260 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1c270 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c280 20 6c 61 62 65 6c 2d 37 35 33 0d 0a 53 45 4c 45   label-753..SELE
1c290 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 33 37  CT + col0 DIV 37
1c2a0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
1c2b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1c2c0 0a 31 0d 0a 33 33 0d 0a 38 34 0d 0a 0d 0a 73 6b  .1..33..84....sk
1c2d0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1c2e0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1c2f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1c300 65 6c 2d 37 35 33 0d 0a 53 45 4c 45 43 54 20 2b  el-753..SELECT +
1c310 20 63 6f 6c 30 20 2f 20 33 37 20 2b 20 63 6f 6c   col0 / 37 + col
1c320 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1c330 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33  or0..----..1..33
1c340 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..84....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 31 35 20 2a 20 2d 20  DISTINCT 15 * - 
1c370 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
1c380 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1c390 2d 2d 2d 2d 0d 0a 2d 31 34 34 30 0d 0a 2d 38 31  ----..-1440..-81
1c3a0 30 0d 0a 2d 38 35 35 0d 0a 0d 0a 71 75 65 72 79  0..-855....query
1c3b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c3c0 43 54 20 31 32 20 2b 20 63 6f 6c 32 20 41 53 20  CT 12 + col2 AS 
1c3d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
1c3e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38  S cor0..----..38
1c3f0 0d 0a 33 39 0d 0a 35 30 0d 0a 0d 0a 71 75 65 72  ..39..50....quer
1c400 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c410 45 43 54 20 2d 20 38 33 20 2d 20 63 6f 6c 30 20  ECT - 83 - col0 
1c420 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1c430 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 0d 0a 2d  1..----..-147..-
1c440 31 36 33 0d 0a 2d 38 36 0d 0a 0d 0a 71 75 65 72  163..-86....quer
1c450 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c460 45 43 54 20 2d 20 36 20 2a 20 2b 20 63 6f 6c 31  ECT - 6 * + col1
1c470 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1c480 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 36 0d 0a  r0..----..-516..
1c490 2d 35 34 36 0d 0a 2d 35 38 32 0d 0a 0d 0a 71 75  -546..-582....qu
1c4a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c4b0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63  ELECT - col2 * c
1c4c0 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  ol2 + col0 * + c
1c4d0 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  or0.col2 + - col
1c4e0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
1c4f0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1c500 2d 0d 0a 2d 35 37 31 0d 0a 31 32 39 33 0d 0a 31  -..-571..1293..1
1c510 35 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  541....query I r
1c520 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38  owsort..SELECT 8
1c530 37 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  7 * - col1 * - c
1c540 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
1c550 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36   cor0..----..116
1c560 38 34 31 0d 0a 31 38 38 37 39 0d 0a 34 30 30 33  841..18879..4003
1c570 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
1c580 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1c590 35 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  5 * + col2 FROM 
1c5a0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1c5b0 2d 2d 0d 0a 32 37 30 0d 0a 32 38 35 0d 0a 34 38  --..270..285..48
1c5c0 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
1c5d0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1c5e0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1c5f0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1c600 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1c610 2d 37 36 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -761..SELECT ALL
1c620 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56   + cor0.col1 DIV
1c630 20 36 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   67 AS col2 FROM
1c640 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1c650 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a  ---..1..1..1....
1c660 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1c670 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1c680 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1c690 61 62 65 6c 2d 37 36 31 0d 0a 53 45 4c 45 43 54  abel-761..SELECT
1c6a0 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 31   ALL + cor0.col1
1c6b0 20 2f 20 36 37 20 41 53 20 63 6f 6c 32 20 46 52   / 67 AS col2 FR
1c6c0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1c6d0 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a  .----..1..1..1..
1c6e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c6f0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1c700 43 54 20 63 6f 6c 30 20 2a 20 28 20 63 6f 72 30  CT col0 * ( cor0
1c710 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20  .col2 ) AS col0 
1c720 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1c730 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39  0..----..35..729
1c740 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20  8..792....query 
1c750 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c760 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T - col2 * + col
1c770 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  1 * - cor0.col2 
1c780 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1c790 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1c7a0 0a 32 32 35 39 39 0d 0a 32 34 35 34 38 0d 0a 33  .22599..24548..3
1c7b0 39 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9884....query I 
1c7c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c7d0 2b 20 34 35 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 45 AS col0 FRO
1c7e0 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
1c7f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
1c800 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1c810 36 30 62 39 66 39 33 35 65 65 38 65 34 30 34 64  60b9f935ee8e404d
1c820 31 35 35 61 32 66 35 65 39 35 31 35 63 30 35 30  155a2f5e9515c050
1c830 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c840 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
1c850 62 32 2e 63 6f 6c 31 20 2b 20 2d 20 38 31 20 41  b2.col1 + - 81 A
1c860 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1c870 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab0 cor0..---
1c880 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
1c890 69 6e 67 20 74 6f 20 63 38 38 35 38 37 61 37 39  ing to c88587a79
1c8a0 30 30 37 66 62 35 66 31 35 32 63 62 33 31 36 35  007fb5f152cb3165
1c8b0 34 30 30 32 33 61 66 0d 0a 0d 0a 71 75 65 72 79  40023af....query
1c8c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c8d0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1c8e0 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 37 30 20 41  l1 * col2 * 70 A
1c8f0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1c900 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c910 31 30 37 33 38 30 0d 0a 34 35 32 32 30 0d 0a 35  107380..45220..5
1c920 38 35 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8590....onlyif m
1c930 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
1c940 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
1c950 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
1c960 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
1c970 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1c980 2d 37 36 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  -767..SELECT + +
1c990 20 63 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e 55   col0 * CAST( NU
1c9a0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 63  LL AS SIGNED ) c
1c9b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1c9c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1c9d0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1c9e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1c9f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1ca00 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1ca10 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1ca20 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
1ca30 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1ca40 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1ca50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1ca60 36 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  67..SELECT + + c
1ca70 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 4e 55 4c  ol0 * CAST ( NUL
1ca80 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 63  L AS INTEGER ) c
1ca90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1caa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1cab0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1cac0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cad0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1cae0 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  T cor0.col2 + + 
1caf0 63 6f 6c 32 20 2b 20 2b 20 28 20 63 6f 6c 32 20  col2 + + ( col2 
1cb00 2a 20 33 31 20 29 20 46 52 4f 4d 20 74 61 62 31  * 31 ) FROM tab1
1cb10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1cb20 31 37 38 32 0d 0a 31 38 38 31 0d 0a 33 31 36 38  1782..1881..3168
1cb30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1cb40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1cb50 2d 20 63 6f 6c 30 20 2a 20 35 34 20 46 52 4f 4d  - col0 * 54 FROM
1cb60 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1cb70 2d 2d 2d 0d 0a 2d 31 32 39 36 0d 0a 2d 31 38 39  ---..-1296..-189
1cb80 30 0d 0a 2d 34 38 30 36 0d 0a 0d 0a 71 75 65 72  0..-4806....quer
1cb90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1cba0 45 43 54 20 2d 20 35 31 20 41 53 20 63 6f 6c 31  ECT - 51 AS col1
1cbb0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
1cbc0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
1cbd0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
1cbe0 68 61 73 68 69 6e 67 20 74 6f 20 32 37 62 63 63  hashing to 27bcc
1cbf0 33 31 34 33 33 63 65 39 30 38 33 33 65 64 37 36  31433ce90833ed76
1cc00 36 31 39 63 62 64 38 64 36 61 34 0d 0a 0d 0a 6f  619cbd8d6a4....o
1cc10 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1cc20 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1cc30 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1cc40 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1cc50 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 31 0d 0a  sort label-771..
1cc60 53 45 4c 45 43 54 20 63 6f 6c 30 20 44 49 56 20  SELECT col0 DIV 
1cc70 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 46 52  col1 + - col0 FR
1cc80 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
1cc90 33 0d 0a 2d 35 38 0d 0a 2d 37 34 0d 0a 0d 0a 73  3..-58..-74....s
1cca0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1ccb0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1ccc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1ccd0 62 65 6c 2d 37 37 31 0d 0a 53 45 4c 45 43 54 20  bel-771..SELECT 
1cce0 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 2b 20 2d 20  col0 / col1 + - 
1ccf0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
1cd00 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 35 38 0d 0a 2d  ----..-3..-58..-
1cd10 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
1cd20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1cd30 53 54 49 4e 43 54 20 2b 20 36 39 20 2b 20 2b 20  STINCT + 69 + + 
1cd40 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  tab2.col0 AS col
1cd50 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
1cd60 2d 0d 0a 31 34 37 0d 0a 31 34 38 0d 0a 37 36 0d  -..147..148..76.
1cd70 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1cd80 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1cd90 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1cda0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1cdb0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1cdc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1cdd0 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 28 20 63  ECT col2 * + ( c
1cde0 6f 6c 32 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20  ol2 ) col2 FROM 
1cdf0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1ce00 2d 2d 0d 0a 31 0d 0a 31 30 38 39 0d 0a 36 37 32  --..1..1089..672
1ce10 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  4....skipif post
1ce20 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1ce30 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1ce40 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1ce50 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1ce60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ce70 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a  ELECT + + col1 *
1ce80 20 63 6f 6c 31 20 2b 20 37 34 20 63 6f 6c 31 20   col1 + 74 col1 
1ce90 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
1cea0 2d 2d 2d 2d 0d 0a 31 37 34 0d 0a 32 34 33 0d 0a  ----..174..243..
1ceb0 37 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  750....query I r
1cec0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1ced0 6f 6c 31 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c  ol1 * - tab0.col
1cee0 32 20 2b 20 32 20 2a 20 2b 20 63 6f 6c 31 20 2a  2 + 2 * + col1 *
1cef0 20 32 35 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   25 FROM tab0..-
1cf00 2d 2d 2d 0d 0a 2d 32 39 31 32 0d 0a 31 34 36 32  ---..-2912..1462
1cf10 0d 0a 34 37 35 33 0d 0a 0d 0a 71 75 65 72 79 20  ..4753....query 
1cf20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1cf30 54 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20  T - tab2.col0 * 
1cf40 2d 20 63 6f 6c 32 20 2d 20 2b 20 74 61 62 32 2e  - col2 - + tab2.
1cf50 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
1cf60 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35  M tab2..----..15
1cf70 38 0d 0a 31 39 36 39 0d 0a 32 39 38 35 0d 0a 0d  8..1969..2985...
1cf80 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1cf90 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1cfa0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1cfb0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1cfc0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1cfd0 6f 72 74 20 6c 61 62 65 6c 2d 37 37 37 0d 0a 53  ort label-777..S
1cfe0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1cff0 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 28 20   col0 + - CAST( 
1d000 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
1d010 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1d020 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1d030 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
1d040 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1d050 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1d060 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1d070 37 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  77..SELECT DISTI
1d080 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 43  NCT - col0 + - C
1d090 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
1d0a0 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20  TEGER ) AS col1 
1d0b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1d0c0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
1d0d0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1d0e0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1d0f0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1d100 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1d110 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 38  owsort label-778
1d120 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
1d130 32 31 20 44 49 56 20 2d 20 34 32 20 46 52 4f 4d  21 DIV - 42 FROM
1d140 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
1d150 0d 0a 2d 32 37 0d 0a 2d 32 38 0d 0a 2d 34 38 0d  ..-27..-28..-48.
1d160 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1d170 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1d180 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d190 74 20 6c 61 62 65 6c 2d 37 37 38 0d 0a 53 45 4c  t label-778..SEL
1d1a0 45 43 54 20 63 6f 6c 32 20 2a 20 32 31 20 2f 20  ECT col2 * 21 / 
1d1b0 2d 20 34 32 20 46 52 4f 4d 20 74 61 62 31 20 63  - 42 FROM tab1 c
1d1c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a  or0..----..-27..
1d1d0 2d 32 38 0d 0a 2d 34 38 0d 0a 0d 0a 71 75 65 72  -28..-48....quer
1d1e0 79 20 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  y IIIIIIIII rows
1d1f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1d200 2a 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  * FROM tab0 cor0
1d210 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30   CROSS JOIN tab0
1d220 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d  , tab2 cor1..---
1d230 2d 0d 0a 32 34 33 20 76 61 6c 75 65 73 20 68 61  -..243 values ha
1d240 73 68 69 6e 67 20 74 6f 20 63 65 35 33 63 30 65  shing to ce53c0e
1d250 38 38 33 39 63 39 36 39 62 30 35 31 33 35 36 38  8839c969b0513568
1d260 64 61 36 65 62 32 63 34 62 0d 0a 0d 0a 71 75 65  da6eb2c4b....que
1d270 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d280 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 36 37  LECT + col2 * 67
1d290 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1d2a0 0d 0a 32 32 31 31 0d 0a 35 34 39 34 0d 0a 36 37  ..2211..5494..67
1d2b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d2c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1d2d0 49 4e 43 54 20 28 20 63 6f 6c 32 20 29 20 2a 20  INCT ( col2 ) * 
1d2e0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
1d2f0 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d  ----..189..2028.
1d300 0a 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .3002....query I
1d310 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1d320 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
1d330 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31  r0.col1 * - col1
1d340 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1d350 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1d360 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a 36 37 36 0d  ..100..169..676.
1d370 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1d380 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1d390 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1d3a0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1d3b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1d3c0 38 33 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63  83..SELECT - ( c
1d3d0 6f 6c 30 20 29 20 44 49 56 20 2d 20 32 39 20 2b  ol0 ) DIV - 29 +
1d3e0 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
1d3f0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1d400 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a  or0..----..102..
1d410 31 37 31 0d 0a 36 37 36 0d 0a 0d 0a 73 6b 69 70  171..676....skip
1d420 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1d430 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1d440 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1d450 2d 37 38 33 0d 0a 53 45 4c 45 43 54 20 2d 20 28  -783..SELECT - (
1d460 20 63 6f 6c 30 20 29 20 2f 20 2d 20 32 39 20 2b   col0 ) / - 29 +
1d470 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
1d480 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1d490 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a  or0..----..102..
1d4a0 31 37 31 0d 0a 36 37 36 0d 0a 0d 0a 71 75 65 72  171..676....quer
1d4b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d4c0 45 43 54 20 2b 20 33 33 20 2b 20 63 6f 6c 31 20  ECT + 33 + col1 
1d4d0 2a 20 37 36 20 2a 20 39 37 20 46 52 4f 4d 20 74  * 76 * 97 FROM t
1d4e0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 33 35  ab2..----..12535
1d4f0 37 0d 0a 32 32 38 35 36 35 0d 0a 34 33 34 39 38  7..228565..43498
1d500 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1d510 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1d520 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  0 + cor0.col0 + 
1d530 2d 20 28 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  - ( + col2 + col
1d540 32 20 2a 20 2d 20 63 6f 6c 30 20 29 20 46 52 4f  2 * - col0 ) FRO
1d550 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1d560 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 37 33 39 34 0d  ----..104..7394.
1d570 0a 38 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .807....query I 
1d580 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d590 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
1d5a0 2b 20 2b 20 63 6f 6c 30 20 2b 20 33 32 20 41 53  + + col0 + 32 AS
1d5b0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
1d5c0 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 37 33 0d 0a 38  .----..12..73..8
1d5d0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1d5e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 20 2a  sort..SELECT 9 *
1d5f0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
1d600 0a 2d 2d 2d 2d 0d 0a 31 35 33 0d 0a 32 37 39 0d  .----..153..279.
1d610 0a 35 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .531....query I 
1d620 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d630 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2d 20  - tab2.col1 * - 
1d640 31 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  12 AS col1 FROM 
1d650 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
1d660 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
1d670 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 36  es hashing to 26
1d680 66 64 66 33 30 35 66 66 36 61 33 39 38 30 35 30  fdf305ff6a398050
1d690 63 39 63 66 66 38 34 36 38 37 37 31 31 37 0d 0a  c9cff846877117..
1d6a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d6b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
1d6c0 39 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  96 AS col0 FROM 
1d6d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1d6e0 2d 2d 0d 0a 2d 39 36 0d 0a 2d 39 36 0d 0a 2d 39  --..-96..-96..-9
1d6f0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
1d700 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1d710 54 49 4e 43 54 20 2b 20 31 20 41 53 20 63 6f 6c  TINCT + 1 AS col
1d720 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1d730 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a  or0..----..1....
1d740 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d750 0a 53 45 4c 45 43 54 20 2b 20 39 35 20 2b 20 2d  .SELECT + 95 + -
1d760 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2d   col1 * + col0 -
1d770 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
1d780 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1d790 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 35 0d 0a  0..----..-2055..
1d7a0 2d 33 33 39 37 0d 0a 2d 38 30 39 35 0d 0a 0d 0a  -3397..-8095....
1d7b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d7c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1d7d0 20 35 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   55 AS col2 FROM
1d7e0 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
1d7f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 0d  or0..----..55...
1d800 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d810 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 30 2e  ..SELECT - tab0.
1d820 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
1d830 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74 61  M tab0, tab2, ta
1d840 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b0 cor0..----..2
1d850 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
1d860 20 74 6f 20 36 61 34 33 65 37 66 31 35 31 39 34   to 6a43e7f15194
1d870 61 66 37 33 66 65 31 63 38 33 33 38 35 65 36 65  af73fe1c83385e6e
1d880 62 65 62 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20  bebc....query I 
1d890 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d8a0 41 4c 4c 20 2b 20 39 20 46 52 4f 4d 20 74 61 62  ALL + 9 FROM tab
1d8b0 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  1, tab0 AS cor0.
1d8c0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
1d8d0 68 61 73 68 69 6e 67 20 74 6f 20 30 33 62 39 33  hashing to 03b93
1d8e0 62 35 33 31 30 37 65 33 36 63 66 37 64 35 32 34  b53107e36cf7d524
1d8f0 65 34 38 63 35 30 39 62 31 37 62 0d 0a 0d 0a 71  e48c509b17b....q
1d900 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d910 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20 74  SELECT ALL ( - t
1d920 61 62 30 2e 63 6f 6c 31 20 29 20 2a 20 28 20 63  ab0.col1 ) * ( c
1d930 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol0 ) AS col1 FR
1d940 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
1d950 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30  2064..-3395..-80
1d960 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
1d970 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1d980 4c 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 74 61 62  L - col0 * - tab
1d990 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  1.col1 AS col0 F
1d9a0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1d9b0 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d  1040..640..78...
1d9c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d9d0 0d 0a 53 45 4c 45 43 54 20 35 30 20 2a 20 2b 20  ..SELECT 50 * + 
1d9e0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
1d9f0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab0..----..12
1da00 30 30 0d 0a 31 37 35 30 0d 0a 34 34 35 30 0d 0a  00..1750..4450..
1da10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1da20 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
1da30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a  .col0 + + col1 *
1da40 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
1da50 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1da60 0a 31 36 34 0d 0a 32 34 39 0d 0a 36 37 39 0d 0a  .164..249..679..
1da70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1da80 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 38  t..SELECT ALL 68
1da90 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1daa0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  b1 cor0..----..6
1dab0 38 0d 0a 36 38 0d 0a 36 38 0d 0a 0d 0a 71 75 65  8..68..68....que
1dac0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1dad0 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20  LECT + + col0 + 
1dae0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
1daf0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1db00 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a 36  ---..128..160..6
1db10 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1db20 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1db30 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1db40 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
1db50 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2d 20 2d 20  col2 * col1 - - 
1db60 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 2b 20  CAST ( - col2 + 
1db70 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 52 45 41  cor0.col1 AS REA
1db80 4c 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  L ) AS col2 FROM
1db90 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1dba0 2d 2d 2d 0d 0a 31 39 33 0d 0a 32 38 39 31 0d 0a  ---..193..2891..
1dbb0 37 34 37 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  7471....skipif p
1dbc0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1dbd0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1dbe0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1dbf0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1dc00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1dc10 0d 0a 53 45 4c 45 43 54 20 2d 20 33 36 20 63 6f  ..SELECT - 36 co
1dc20 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
1dc30 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 33  0..----..-36..-3
1dc40 36 0d 0a 2d 33 36 0d 0a 0d 0a 73 6b 69 70 69 66  6..-36....skipif
1dc50 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1dc60 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1dc70 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1dc80 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1dc90 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
1dca0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
1dcb0 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 38  2 + + col1 * - 8
1dcc0 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  1 col2 FROM tab1
1dcd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1dce0 2d 32 30 35 32 0d 0a 2d 37 35 33 0d 0a 2d 39 35  -2052..-753..-95
1dcf0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1dd00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1dd10 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d  TINCT - col1 * -
1dd20 20 63 6f 6c 30 20 2a 20 35 33 20 41 53 20 63 6f   col0 * 53 AS co
1dd30 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
1dd40 2d 2d 0d 0a 31 31 35 30 31 0d 0a 32 34 33 39 30  --..11501..24390
1dd50 36 0d 0a 37 31 31 37 39 0d 0a 0d 0a 71 75 65 72  6..71179....quer
1dd60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1dd70 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72  ECT DISTINCT cor
1dd80 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  1.col0 FROM tab0
1dd90 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
1dda0 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 32 20 41  OIN tab2, tab2 A
1ddb0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 37 0d  S cor1..----..7.
1ddc0 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 6f 6e 6c 79 69  .78..79....onlyi
1ddd0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1dde0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1ddf0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1de00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1de10 20 6c 61 62 65 6c 2d 38 30 36 0d 0a 53 45 4c 45   label-806..SELE
1de20 43 54 20 2d 20 35 34 20 44 49 56 20 2b 20 37 38  CT - 54 DIV + 78
1de30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1de40 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1de50 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
1de60 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1de70 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1de80 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1de90 6c 2d 38 30 36 0d 0a 53 45 4c 45 43 54 20 2d 20  l-806..SELECT - 
1dea0 35 34 20 2f 20 2b 20 37 38 20 41 53 20 63 6f 6c  54 / + 78 AS col
1deb0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1dec0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
1ded0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
1dee0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1def0 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 35 34  STINCT col1 * 54
1df00 20 2b 20 2d 20 36 32 20 2a 20 63 6f 6c 30 20 46   + - 62 * col0 F
1df10 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1df20 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 35 30 0d 0a 2d  ..----..-1650..-
1df30 33 39 38 30 0d 0a 31 32 34 30 0d 0a 0d 0a 71 75  3980..1240....qu
1df40 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
1df50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1df60 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d   DISTINCT * FROM
1df70 20 74 61 62 30 20 63 6f 72 30 20 43 52 4f 53 53   tab0 cor0 CROSS
1df80 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 30   JOIN tab2, tab0
1df90 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31 20 63   AS cor1, tab1 c
1dfa0 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76  or2..----..972 v
1dfb0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1dfc0 20 38 32 65 31 35 64 35 39 36 37 62 32 37 32 38   82e15d5967b2728
1dfd0 30 34 65 35 37 34 37 37 34 38 39 35 61 30 32 32  04e574774895a022
1dfe0 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
1dff0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1e000 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1e010 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1e020 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1e030 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e040 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1e050 20 28 20 2d 20 37 34 20 29 20 63 6f 6c 31 20 46   ( - 74 ) col1 F
1e060 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1e070 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
1e080 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1e090 53 54 49 4e 43 54 20 28 20 74 61 62 30 2e 63 6f  STINCT ( tab0.co
1e0a0 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 28 20  l2 + - col1 * ( 
1e0b0 63 6f 6c 32 20 29 20 29 20 46 52 4f 4d 20 74 61  col2 ) ) FROM ta
1e0c0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 35 0d  b0..----..-2805.
1e0d0 0a 2d 37 33 38 30 0d 0a 2d 39 36 0d 0a 0d 0a 6f  .-7380..-96....o
1e0e0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1e0f0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1e100 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1e110 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1e120 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e130 74 20 6c 61 62 65 6c 2d 38 31 31 0d 0a 53 45 4c  t label-811..SEL
1e140 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20 2d 20  ECT ALL CAST( - 
1e150 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29  col0 AS SIGNED )
1e160 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41   + - cor0.col2 A
1e170 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1e180 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e190 2d 31 30 34 0d 0a 2d 31 31 37 0d 0a 2d 33 34 0d  -104..-117..-34.
1e1a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1e1b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1e1c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e1d0 74 20 6c 61 62 65 6c 2d 38 31 31 0d 0a 53 45 4c  t label-811..SEL
1e1e0 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 2d  ECT ALL CAST ( -
1e1f0 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
1e200 20 29 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   ) + - cor0.col2
1e210 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1e220 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1e230 0d 0a 2d 31 30 34 0d 0a 2d 31 31 37 0d 0a 2d 33  ..-104..-117..-3
1e240 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1e250 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1e260 54 49 4e 43 54 20 2b 20 33 31 20 2b 20 28 20 2d  TINCT + 31 + ( -
1e270 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20   col1 ) AS col1 
1e280 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1e290 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 32 31 0d  0..----..18..21.
1e2a0 0a 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .5....onlyif mys
1e2b0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
1e2c0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
1e2d0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
1e2e0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
1e2f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1e300 31 33 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  13..SELECT - CAS
1e310 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
1e320 44 20 29 20 2a 20 2d 20 34 35 20 46 52 4f 4d 20  D ) * - 45 FROM 
1e330 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1e340 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
1e350 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
1e360 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1e370 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1e380 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 33  owsort label-813
1e390 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20  ..SELECT - CAST 
1e3a0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
1e3b0 52 20 29 20 2a 20 2d 20 34 35 20 46 52 4f 4d 20  R ) * - 45 FROM 
1e3c0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1e3d0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
1e3e0 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
1e3f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e400 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  ALL col0 * + col
1e410 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 + col1 FROM ta
1e420 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b0 cor0..----..2
1e430 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31 39 30 0d  150..3492..8190.
1e440 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1e450 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1e460 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1e470 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1e480 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1e490 31 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  15..SELECT DISTI
1e4a0 4e 43 54 20 28 20 2d 20 36 33 20 29 20 44 49 56  NCT ( - 63 ) DIV
1e4b0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
1e4c0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab0..----..0
1e4d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1e4e0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1e4f0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1e500 72 74 20 6c 61 62 65 6c 2d 38 31 35 0d 0a 53 45  rt label-815..SE
1e510 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
1e520 2d 20 36 33 20 29 20 2f 20 63 6f 6c 31 20 41 53  - 63 ) / col1 AS
1e530 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
1e540 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .----..0....quer
1e550 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e560 45 43 54 20 41 4c 4c 20 2b 20 2b 20 28 20 63 6f  ECT ALL + + ( co
1e570 6c 31 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l1 ) + cor0.col1
1e580 20 2a 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20   * + ( + col0 ) 
1e590 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1e5a0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32  0..----..1360..2
1e5b0 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 71 75 65 72  48..4661....quer
1e5c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e5d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1e5e0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ol2 + - col2 AS 
1e5f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
1e600 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
1e610 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1e620 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1e630 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1e640 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1e650 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 38 0d  wsort label-818.
1e660 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 44 49 56  .SELECT col1 DIV
1e670 20 2b 20 32 32 20 46 52 4f 4d 20 74 61 62 32 20   + 22 FROM tab2 
1e680 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1e690 0d 0a 31 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66  ..1..2....skipif
1e6a0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1e6b0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1e6c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1e6d0 31 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  18..SELECT col1 
1e6e0 2f 20 2b 20 32 32 20 46 52 4f 4d 20 74 61 62 32  / + 22 FROM tab2
1e6f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e700 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79  0..1..2....query
1e710 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e720 43 54 20 2d 20 2b 20 28 20 63 6f 6c 30 20 29 20  CT - + ( col0 ) 
1e730 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1e740 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  0 cor0..----..-2
1e750 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71  4..-35..-89....q
1e760 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e770 53 45 4c 45 43 54 20 2d 20 37 31 20 2b 20 63 6f  SELECT - 71 + co
1e780 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1e790 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d  cor0..----..-33.
1e7a0 0a 2d 34 34 0d 0a 2d 34 35 0d 0a 0d 0a 71 75 65  .-44..-45....que
1e7b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e7c0 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  LECT cor0.col1 +
1e7d0 20 2b 20 36 31 20 46 52 4f 4d 20 74 61 62 31 20   + 61 FROM tab1 
1e7e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
1e7f0 31 0d 0a 37 34 0d 0a 38 37 0d 0a 0d 0a 6f 6e 6c  1..74..87....onl
1e800 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1e810 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1e820 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1e830 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1e840 72 74 20 6c 61 62 65 6c 2d 38 32 32 0d 0a 53 45  rt label-822..SE
1e850 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
1e860 44 49 56 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c  DIV + col1 - col
1e870 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0 col0 FROM tab1
1e880 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 36 35 0d  ..----..-4..-65.
1e890 0a 2d 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-81....skipif p
1e8a0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1e8b0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1e8c0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1e8d0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1e8e0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1e8f0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1e900 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1e910 6c 61 62 65 6c 2d 38 32 32 0d 0a 53 45 4c 45 43  label-822..SELEC
1e920 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2f 20 2b  T ALL - col1 / +
1e930 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 63 6f 6c   col1 - col0 col
1e940 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
1e950 2d 0d 0a 2d 34 0d 0a 2d 36 35 0d 0a 2d 38 31 0d  -..-4..-65..-81.
1e960 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1e970 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
1e980 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
1e990 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
1e9a0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
1e9b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32 33 0d  wsort label-823.
1e9c0 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30  .SELECT - + cor0
1e9d0 2e 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 2a 20 43  .col1 - col1 * C
1e9e0 41 53 54 28 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  AST( - col0 * co
1e9f0 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  l1 AS SIGNED ) F
1ea00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1ea10 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38 31 34 0d 0a 32  ..----..22814..2
1ea20 37 31 34 35 39 0d 0a 36 36 39 36 0d 0a 0d 0a 73  71459..6696....s
1ea30 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1ea40 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1ea50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1ea60 62 65 6c 2d 38 32 33 0d 0a 53 45 4c 45 43 54 20  bel-823..SELECT 
1ea70 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20  - + cor0.col1 - 
1ea80 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 2d 20  col1 * CAST ( - 
1ea90 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20 49  col0 * col1 AS I
1eaa0 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
1eab0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1eac0 0d 0a 32 32 38 31 34 0d 0a 32 37 31 34 35 39 0d  ..22814..271459.
1ead0 0a 36 36 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .6696....query I
1eae0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1eaf0 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 32   col1 * col2 + 2
1eb00 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  4 AS col1 FROM t
1eb10 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1eb20 2d 0d 0a 31 32 37 32 0d 0a 31 34 32 38 0d 0a 35  -..1272..1428..5
1eb30 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  94....query I ro
1eb40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1eb50 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col0 + col0 * - 
1eb60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1eb70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
1eb80 30 33 32 0d 0a 2d 36 0d 0a 2d 36 33 32 30 0d 0a  032..-6..-6320..
1eb90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1eba0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1ebb0 43 54 20 28 20 63 6f 6c 32 20 29 20 2b 20 2b 20  CT ( col2 ) + + 
1ebc0 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20 2b 20 63  ( - col2 ) + + c
1ebd0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1ebe0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d   cor0..----..17.
1ebf0 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 6f 6e 6c 79 69  .31..59....onlyi
1ec00 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1ec10 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1ec20 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1ec30 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1ec40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1ec50 62 65 6c 2d 38 32 37 0d 0a 53 45 4c 45 43 54 20  bel-827..SELECT 
1ec60 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c  DISTINCT ( + col
1ec70 32 20 29 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c  2 ) * CAST( NULL
1ec80 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 46 52   AS DECIMAL ) FR
1ec90 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1eca0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
1ecb0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1ecc0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1ecd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1ece0 62 65 6c 2d 38 32 37 0d 0a 53 45 4c 45 43 54 20  bel-827..SELECT 
1ecf0 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c  DISTINCT ( + col
1ed00 32 20 29 20 2a 20 43 41 53 54 20 28 20 4e 55 4c  2 ) * CAST ( NUL
1ed10 4c 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d  L AS REAL ) FROM
1ed20 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1ed30 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
1ed40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ed50 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 28 20  LECT - col2 + ( 
1ed60 2d 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c  - col1 ) * + col
1ed70 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 * col2 FROM ta
1ed80 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1ed90 0d 0a 2d 36 31 31 39 36 36 0d 0a 2d 39 33 36 38  ..-611966..-9368
1eda0 37 0d 0a 2d 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  7..-98....onlyif
1edb0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1edc0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1edd0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1ede0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1edf0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1ee00 65 6c 2d 38 32 39 0d 0a 53 45 4c 45 43 54 20 2b  el-829..SELECT +
1ee10 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20   col1 * + CAST( 
1ee20 28 20 63 6f 6c 30 20 29 20 41 53 20 53 49 47 4e  ( col0 ) AS SIGN
1ee30 45 44 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  ED ) + col2 FROM
1ee40 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1ee50 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34 34 0d 0a  ---..1381..244..
1ee60 34 36 32 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  4628....skipif m
1ee70 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1ee80 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1ee90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32 39  owsort label-829
1eea0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
1eeb0 2a 20 2b 20 43 41 53 54 20 28 20 28 20 63 6f 6c  * + CAST ( ( col
1eec0 30 20 29 20 41 53 20 49 4e 54 45 47 45 52 20 29  0 ) AS INTEGER )
1eed0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
1eee0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1eef0 0a 31 33 38 31 0d 0a 32 34 34 0d 0a 34 36 32 38  .1381..244..4628
1ef00 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ef10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
1ef20 20 2a 20 2b 20 34 20 41 53 20 63 6f 6c 32 20 46   * + 4 AS col2 F
1ef30 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
1ef40 2d 2d 2d 0d 0a 31 33 32 0d 0a 33 32 38 0d 0a 34  ---..132..328..4
1ef50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ef60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
1ef70 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col0 * + col1 + 
1ef80 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
1ef90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1efa0 2d 32 30 38 38 0d 0a 2d 33 34 33 30 0d 0a 2d 38  -2088..-3430..-8
1efb0 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  188....query I r
1efc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35  owsort..SELECT 5
1efd0 37 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  7 + + col0 * col
1efe0 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  0 * + col0 AS co
1eff0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
1f000 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 30 0d 0a 34 37  0..----..400..47
1f010 34 36 30 39 0d 0a 34 39 33 30 39 36 0d 0a 0d 0a  4609..493096....
1f020 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f030 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a  .SELECT - col1 *
1f040 20 34 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   41 AS col2 FROM
1f050 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1f060 2d 2d 2d 0d 0a 2d 31 30 36 36 0d 0a 2d 34 31 30  ---..-1066..-410
1f070 0d 0a 2d 35 33 33 0d 0a 0d 0a 71 75 65 72 79 20  ..-533....query 
1f080 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f090 54 20 2d 20 2d 20 32 34 20 2a 20 63 6f 6c 31 20  T - - 24 * col1 
1f0a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1f0b0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 30 0d 0a 33 31  0..----..240..31
1f0c0 32 0d 0a 36 32 34 0d 0a 0d 0a 71 75 65 72 79 20  2..624....query 
1f0d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f0e0 54 20 2b 20 2d 20 39 37 20 46 52 4f 4d 20 74 61  T + - 97 FROM ta
1f0f0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
1f100 39 37 0d 0a 2d 39 37 0d 0a 2d 39 37 0d 0a 0d 0a  97..-97..-97....
1f110 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
1f120 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
1f130 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
1f140 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
1f150 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
1f160 72 74 20 6c 61 62 65 6c 2d 38 33 36 0d 0a 53 45  rt label-836..SE
1f170 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41  LECT DISTINCT CA
1f180 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
1f190 4d 41 4c 20 29 20 41 53 20 63 6f 6c 32 20 46 52  MAL ) AS col2 FR
1f1a0 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
1f1b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1f1c0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
1f1d0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1f1e0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1f1f0 6f 72 74 20 6c 61 62 65 6c 2d 38 33 36 0d 0a 53  ort label-836..S
1f200 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43  ELECT DISTINCT C
1f210 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45  AST ( NULL AS RE
1f220 41 4c 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  AL ) AS col2 FRO
1f230 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
1f240 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
1f250 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f260 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1f270 49 4e 43 54 20 2b 20 39 37 20 41 53 20 63 6f 6c  INCT + 97 AS col
1f280 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
1f290 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1f2a0 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .97....query I r
1f2b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1f2c0 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  or0.col1 * - col
1f2d0 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
1f2e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d  ..----..-1343..-
1f2f0 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75  217..-4602....qu
1f300 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f310 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
1f320 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30   * col0 + - cor0
1f330 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
1f340 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1f350 0a 2d 2d 2d 2d 0d 0a 2d 36 31 34 33 0d 0a 2d 36  .----..-6143..-6
1f360 32 35 38 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72  258..-80....quer
1f370 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
1f380 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
1f390 30 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20  0 AS cor0 WHERE 
1f3a0 4e 55 4c 4c 20 42 45 54 57 45 45 4e 20 4e 55 4c  NULL BETWEEN NUL
1f3b0 4c 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  L AND NULL..----
1f3c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f3d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
1f3e0 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  r0.col1 AS col0 
1f3f0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1f400 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
1f410 32 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  2..----..9 value
1f420 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 36 31  s hashing to c61
1f430 64 32 37 61 30 30 32 32 65 36 64 30 32 32 33 37  d27a0022e6d02237
1f440 31 64 63 35 38 38 31 39 61 62 32 37 32 0d 0a 0d  1dc58819ab272...
1f450 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f460 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1f470 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 74 61 62  T - col2 + - tab
1f480 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0.col2 FROM tab0
1f490 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d 32  ..----..-164..-2
1f4a0 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-66....query I
1f4b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1f4c0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
1f4d0 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a   - col0 + col2 *
1f4e0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
1f4f0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1f500 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
1f510 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
1f520 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  l1 + + col1 * + 
1f530 74 61 62 31 2e 63 6f 6c 30 20 2d 20 63 6f 6c 32  tab1.col0 - col2
1f540 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1f550 0d 0a 35 30 0d 0a 35 39 33 0d 0a 39 35 37 0d 0a  ..50..593..957..
1f560 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
1f570 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
1f580 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f  OM tab2 WHERE NO
1f590 54 20 63 6f 6c 30 20 4e 4f 54 20 49 4e 20 28 20  T col0 NOT IN ( 
1f5a0 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  + col2 * + col2 
1f5b0 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  + - col1 * col1 
1f5c0 2d 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a  - col0 )..----..
1f5d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f5e0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
1f5f0 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   + - col2 + + co
1f600 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l1 * - col0 FROM
1f610 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   tab0..----..-21
1f620 33 30 0d 0a 2d 33 33 39 37 0d 0a 2d 38 32 36 33  30..-3397..-8263
1f630 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f640 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
1f650 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + + col1 * + co
1f660 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 * col1 AS col
1f670 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
1f680 2d 0d 0a 31 30 35 37 0d 0a 31 37 36 33 30 0d 0a  -..1057..17630..
1f690 32 32 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2293....query I 
1f6a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f6b0 41 4c 4c 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  ALL col0 + col0 
1f6c0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 20 57  FROM tab0 cor0 W
1f6d0 48 45 52 45 20 4e 4f 54 20 63 6f 6c 31 20 4e 4f  HERE NOT col1 NO
1f6e0 54 20 49 4e 20 28 20 63 6f 6c 31 20 2b 20 63 6f  T IN ( col1 + co
1f6f0 72 30 2e 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2b  r0.col0 / col0 +
1f700 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   col0 )..----...
1f710 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f720 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1f730 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T - cor0.col2 * 
1f740 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
1f750 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
1f760 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1f770 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38  .-1534..-646..-8
1f780 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
1f790 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1f7a0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
1f7b0 4d 20 74 61 62 32 20 63 6f 72 30 20 57 48 45 52  M tab2 cor0 WHER
1f7c0 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c 3d 20 2d 20  E NOT NULL <= - 
1f7d0 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  col0..----....qu
1f7e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f7f0 45 4c 45 43 54 20 63 6f 6c 32 20 41 53 20 63 6f  ELECT col2 AS co
1f800 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45  l0 FROM tab2 WHE
1f810 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20 2b 20 63  RE NULL IN ( + c
1f820 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ol1 )..----....q
1f830 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f840 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e  SELECT + + cor0.
1f850 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  col0 * col0 + co
1f860 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1f870 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a  cor0..----..56..
1f880 36 31 36 32 0d 0a 36 33 32 30 0d 0a 0d 0a 71 75  6162..6320....qu
1f890 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f8a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1f8b0 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63  ol2 + col1 + - c
1f8c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
1f8d0 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a  ---..1..33..82..
1f8e0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1f8f0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1f900 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1f910 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1f920 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35  rowsort label-85
1f930 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
1f940 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  CT - col0 + col2
1f950 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74   DIV col1 FROM t
1f960 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d  ab2..----..-7..-
1f970 37 37 0d 0a 2d 37 38 0d 0a 0d 0a 73 6b 69 70 69  77..-78....skipi
1f980 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1f990 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1f9a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1f9b0 38 35 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  854..SELECT DIST
1f9c0 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  INCT - col0 + co
1f9d0 6c 32 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 / col1 FROM t
1f9e0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d  ab2..----..-7..-
1f9f0 37 37 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72 79  77..-78....query
1fa00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1fa10 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  CT - col0 * - co
1fa20 6c 30 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 30  l0 * - tab2.col0
1fa30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1fa40 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 33 0d 0a  b2..----..-343..
1fa50 2d 34 37 34 35 35 32 0d 0a 2d 34 39 33 30 33 39  -474552..-493039
1fa60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1fa70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
1fa80 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  l1 * col1 * col2
1fa90 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + - col0 AS col
1faa0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
1fab0 2d 0d 0a 2d 31 31 30 36 31 0d 0a 2d 32 35 39 35  -..-11061..-2595
1fac0 34 0d 0a 2d 39 30 35 38 34 0d 0a 0d 0a 71 75 65  4..-90584....que
1fad0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1fae0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
1faf0 2b 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  + tab0.col0 AS c
1fb00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
1fb10 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36  ---..-2..-62..-6
1fb20 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1fb30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1fb40 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2b   col1 * + col2 +
1fb50 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
1fb60 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1fb70 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38 0d 0a 36  0..----..1508..6
1fb80 30 38 0d 0a 38 31 30 0d 0a 0d 0a 71 75 65 72 79  08..810....query
1fb90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1fba0 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 2b 20  CT - - col1 + + 
1fbb0 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 2d 20  col0 * col0 * - 
1fbc0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1fbd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
1fbe0 31 32 0d 0a 2d 34 37 34 34 39 33 0d 0a 2d 34 39  12..-474493..-49
1fbf0 33 30 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3022....query I 
1fc00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1fc10 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ALL + cor0.col2 
1fc20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  + cor0.col1 + co
1fc30 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l2 * col2 AS col
1fc40 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
1fc50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 39 39 0d  or0..----..1499.
1fc60 0a 37 36 31 0d 0a 37 38 37 0d 0a 0d 0a 73 6b 69  .761..787....ski
1fc70 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1fc80 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1fc90 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1fca0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1fcb0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
1fcc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1fcd0 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  L + cor0.col2 + 
1fce0 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  - col0 col1 FROM
1fcf0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
1fd00 0d 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a  ..-7..16..51....
1fd10 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1fd20 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1fd30 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1fd40 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1fd50 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1fd60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fd70 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 2d 20   ALL + col1 + - 
1fd80 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 63 6f  col1 * + col1 co
1fd90 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1fda0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 32  cor0..----..-272
1fdb0 0d 0a 2d 33 34 32 32 0d 0a 2d 39 33 30 0d 0a 0d  ..-3422..-930...
1fdc0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1fdd0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1fde0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1fdf0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1fe00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 33  owsort label-863
1fe10 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1fe20 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  T cor0.col2 * co
1fe30 6c 30 20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53  l0 DIV + col0 AS
1fe40 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1fe50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
1fe60 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69  4..57..96....ski
1fe70 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1fe80 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1fe90 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1fea0 6c 2d 38 36 33 0d 0a 53 45 4c 45 43 54 20 44 49  l-863..SELECT DI
1feb0 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32  STINCT cor0.col2
1fec0 20 2a 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30   * col0 / + col0
1fed0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1fee0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1fef0 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a  ..54..57..96....
1ff00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ff10 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
1ff20 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31   + col0 * + col1
1ff30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
1ff40 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1ff50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 32 33 0d  0..----..-36423.
1ff60 0a 2d 34 31 35 38 0d 0a 2d 39 39 37 34 34 0d 0a  .-4158..-99744..
1ff70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ff80 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
1ff90 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2b   col2 + + col0 +
1ffa0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
1ffb0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1ffc0 0a 2d 2d 2d 2d 0d 0a 32 32 39 0d 0a 32 39 34 38  .----..229..2948
1ffd0 0d 0a 37 36 34 32 0d 0a 0d 0a 71 75 65 72 79 20  ..7642....query 
1ffe0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1fff0 54 20 38 36 20 2b 20 74 61 62 31 2e 63 6f 6c 32  T 86 + tab1.col2
20000 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
20010 0d 0a 31 34 30 0d 0a 31 34 33 0d 0a 31 38 32 0d  ..140..143..182.
20020 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
20030 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
20040 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
20050 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
20060 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
20070 36 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  67..SELECT ALL +
20080 20 38 35 20 44 49 56 20 63 6f 6c 31 20 2b 20 32   85 DIV col1 + 2
20090 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
200a0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 32  ab0..----..21..2
200b0 31 0d 0a 32 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..21....skipif 
200c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
200d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
200e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36  rowsort label-86
200f0 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  7..SELECT ALL + 
20100 38 35 20 2f 20 63 6f 6c 31 20 2b 20 32 31 20 41  85 / col1 + 21 A
20110 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
20120 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 32 31 0d 0a  ..----..21..21..
20130 32 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  21....skipif pos
20140 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
20150 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
20160 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
20170 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
20180 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20190 53 45 4c 45 43 54 20 2d 20 2b 20 32 33 20 63 6f  SELECT - + 23 co
201a0 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l1 FROM tab1, ta
201b0 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b2, tab1 AS cor0
201c0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
201d0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 62 64  s hashing to 9bd
201e0 37 32 31 66 39 39 64 37 39 64 63 65 32 31 62 31  721f99d79dce21b1
201f0 64 65 32 38 36 30 66 64 35 31 65 64 35 0d 0a 0d  de2860fd51ed5...
20200 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20210 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 32 2e  ..SELECT - tab2.
20220 63 6f 6c 30 20 2a 20 2d 20 74 61 62 32 2e 63 6f  col0 * - tab2.co
20230 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
20240 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d  tab2..----..189.
20250 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 73  .2028..3002....s
20260 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
20270 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
20280 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
20290 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
202a0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
202b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
202c0 2b 20 31 37 20 63 6f 6c 32 20 46 52 4f 4d 20 74  + 17 col2 FROM t
202d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
202e0 2d 0d 0a 31 37 0d 0a 31 37 0d 0a 31 37 0d 0a 0d  -..17..17..17...
202f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20300 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
20310 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20  T col2 * col0 + 
20320 2b 20 30 20 2b 20 37 20 46 52 4f 4d 20 74 61 62  + 0 + 7 FROM tab
20330 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20340 0a 31 39 36 0d 0a 32 30 33 35 0d 0a 33 30 30 39  .196..2035..3009
20350 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20360 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
20370 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31  r0.col2 + + col1
20380 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
20390 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
203a0 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d  ..109..67..80...
203b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
203c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
203d0 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T - col2 * + col
203e0 32 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  2 + + col2 AS co
203f0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
20400 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 36  cor0..----..-286
20410 32 0d 0a 2d 33 31 39 32 0d 0a 2d 39 31 32 30 0d  2..-3192..-9120.
20420 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20430 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 20 2a  rt..SELECT + 3 *
20440 20 63 6f 6c 32 20 2b 20 31 38 20 2a 20 63 6f 6c   col2 + 18 * col
20450 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
20460 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 37 0d  or0..----..1647.
20470 0a 31 37 34 39 0d 0a 31 38 38 34 0d 0a 0d 0a 71  .1749..1884....q
20480 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20490 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 37 20  SELECT ALL + 97 
204a0 2a 20 63 6f 6c 31 20 2a 20 2d 20 35 32 20 46 52  * col1 * - 52 FR
204b0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
204c0 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 33 36 34 0d 0a  .----..-156364..
204d0 2d 32 39 37 35 39 36 0d 0a 2d 38 35 37 34 38 0d  -297596..-85748.
204e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
204f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
20500 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 28   cor0.col1 + - (
20510 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f   cor0.col2 ) FRO
20520 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
20530 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d 35 38 0d 0a  ----..-55..-58..
20540 2d 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -85....query I r
20550 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
20560 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a  ISTINCT + col2 *
20570 20 37 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20   70 + + col2 AS 
20580 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
20590 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
205a0 34 36 0d 0a 31 39 31 37 0d 0a 32 36 39 38 0d 0a  46..1917..2698..
205b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
205c0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
205d0 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30  r0.col0 * - cor0
205e0 2e 63 6f 6c 32 20 2b 20 2d 20 37 39 20 41 53 20  .col2 + - 79 AS 
205f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
20600 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30 37  or0..----..-2107
20610 0d 0a 2d 32 36 38 0d 0a 2d 33 30 38 31 0d 0a 0d  ..-268..-3081...
20620 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20630 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
20640 6f 6c 31 20 2b 20 2d 20 34 35 20 46 52 4f 4d 20  ol1 + - 45 FROM 
20650 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
20660 2d 2d 0d 0a 2d 31 39 0d 0a 2d 33 32 0d 0a 2d 33  --..-19..-32..-3
20670 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
20680 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
20690 6f 6c 31 20 2b 20 28 20 34 32 20 29 20 46 52 4f  ol1 + ( 42 ) FRO
206a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
206b0 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 33 33 0d 0a  ----..128..133..
206c0 31 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  139....query I r
206d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
206e0 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  LL - col0 + + co
206f0 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a  r0.col0 * col0 *
20700 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
20710 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20720 0a 2d 32 33 37 0d 0a 2d 34 31 30 32 34 0d 0a 2d  .-237..-41024..-
20730 38 33 32 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  83280....query I
20740 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20750 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
20760 2e 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col2 + cor0.col
20770 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
20780 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
20790 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
207a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
207b0 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63  ol1 * col1 + + c
207c0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
207d0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
207e0 0d 0a 33 32 37 0d 0a 33 35 30 37 0d 0a 39 38 38  ..327..3507..988
207f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20800 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
20810 2b 20 63 6f 6c 30 20 2b 20 36 37 20 46 52 4f 4d  + col0 + 67 FROM
20820 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
20830 2d 2d 2d 0d 0a 31 34 35 0d 0a 31 34 36 0d 0a 37  ---..145..146..7
20840 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
20850 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
20860 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 28 20   - - col2 + - ( 
20870 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30 20 46 52  col1 ) * col0 FR
20880 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
20890 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 35 0d 0a 2d 31  .----..-1305..-1
208a0 39 30 0d 0a 2d 34 35 37 36 0d 0a 0d 0a 6f 6e 6c  90..-4576....onl
208b0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
208c0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
208d0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
208e0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
208f0 72 74 20 6c 61 62 65 6c 2d 38 38 36 0d 0a 53 45  rt label-886..SE
20900 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
20910 63 6f 6c 32 20 2a 20 28 20 28 20 63 6f 6c 31 20  col2 * ( ( col1 
20920 29 20 29 20 44 49 56 20 2d 20 34 38 20 46 52 4f  ) ) DIV - 48 FRO
20930 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
20940 2d 0d 0a 2d 31 35 35 0d 0a 2d 32 0d 0a 2d 35 39  -..-155..-2..-59
20950 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
20960 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
20970 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
20980 72 74 20 6c 61 62 65 6c 2d 38 38 36 0d 0a 53 45  rt label-886..SE
20990 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
209a0 63 6f 6c 32 20 2a 20 28 20 28 20 63 6f 6c 31 20  col2 * ( ( col1 
209b0 29 20 29 20 2f 20 2d 20 34 38 20 46 52 4f 4d 20  ) ) / - 48 FROM 
209c0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
209d0 0a 2d 31 35 35 0d 0a 2d 32 0d 0a 2d 35 39 0d 0a  .-155..-2..-59..
209e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
209f0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
20a00 20 63 6f 6c 30 20 2a 20 74 61 62 32 2e 63 6f 6c   col0 * tab2.col
20a10 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 * col2 FROM ta
20a20 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 30 39 33  b2..----..114093
20a30 0d 0a 35 31 33 34 0d 0a 35 32 37 38 37 0d 0a 0d  ..5134..52787...
20a40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20a50 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
20a60 54 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b  T - ( + col1 ) +
20a70 20 63 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f 6c   col1 * tab0.col
20a80 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
20a90 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 37  ab0..----..0..27
20aa0 35 32 0d 0a 37 33 37 31 0d 0a 0d 0a 73 6b 69 70  52..7371....skip
20ab0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
20ac0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
20ad0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
20ae0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
20af0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
20b00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
20b10 20 33 37 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 35   37 * - col2 + 5
20b20 39 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20  9 * - col2 col2 
20b30 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
20b40 0a 2d 35 31 38 34 0d 0a 2d 35 34 37 32 0d 0a 2d  .-5184..-5472..-
20b50 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9216....query I 
20b60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20b70 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
20b80 2b 20 63 6f 6c 31 20 2b 20 2b 20 33 31 20 46 52  + col1 + + 31 FR
20b90 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
20ba0 30 37 31 0d 0a 31 30 39 0d 0a 36 37 31 0d 0a 0d  071..109..671...
20bb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20bc0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
20bd0 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  * + cor0.col0 + 
20be0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
20bf0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20c00 31 33 32 32 0d 0a 36 36 32 0d 0a 38 30 31 32 0d  1322..662..8012.
20c10 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
20c20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
20c30 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
20c40 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
20c50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
20c60 39 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  92..SELECT - col
20c70 32 20 44 49 56 20 63 6f 6c 31 20 2d 20 74 61 62  2 DIV col1 - tab
20c80 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  2.col1 FROM tab2
20c90 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 33 31  ..----..-19..-31
20ca0 0d 0a 2d 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-59....skipif 
20cb0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
20cc0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
20cd0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39  rowsort label-89
20ce0 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  2..SELECT - col2
20cf0 20 2f 20 63 6f 6c 31 20 2d 20 74 61 62 32 2e 63   / col1 - tab2.c
20d00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
20d10 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 33 31 0d 0a 2d  ---..-19..-31..-
20d20 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  59....query III 
20d30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20d40 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52  * FROM tab2 WHER
20d50 45 20 28 20 63 6f 6c 31 20 29 20 4e 4f 54 20 42  E ( col1 ) NOT B
20d60 45 54 57 45 45 4e 20 2d 20 63 6f 6c 32 20 2b 20  ETWEEN - col2 + 
20d70 2b 20 63 6f 6c 32 20 41 4e 44 20 4e 55 4c 4c 0d  + col2 AND NULL.
20d80 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
20d90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20da0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
20db0 32 20 57 48 45 52 45 20 4e 4f 54 20 28 20 4e 55  2 WHERE NOT ( NU
20dc0 4c 4c 20 29 20 4e 4f 54 20 42 45 54 57 45 45 4e  LL ) NOT BETWEEN
20dd0 20 4e 55 4c 4c 20 41 4e 44 20 63 6f 6c 32 0d 0a   NULL AND col2..
20de0 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
20df0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20e00 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col0 + + col1 * 
20e10 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
20e20 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32 34 39 0d 0a  ----..164..249..
20e30 36 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  679....query I r
20e40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
20e50 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2a   col0 * + col1 *
20e60 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41   + col1 + col2 A
20e70 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
20e80 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 31 36 0d 0a 32  ..----..13616..2
20e90 30 38 32 0d 0a 36 34 35 37 0d 0a 0d 0a 71 75 65  082..6457....que
20ea0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20eb0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
20ec0 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32  l1 * col1 + col2
20ed0 20 2d 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   - - col0 FROM t
20ee0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 32 31 0d 0a  ab1..----..221..
20ef0 33 34 35 0d 0a 37 33 33 0d 0a 0d 0a 71 75 65 72  345..733....quer
20f00 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
20f10 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
20f20 32 20 57 48 45 52 45 20 4e 4f 54 20 28 20 4e 55  2 WHERE NOT ( NU
20f30 4c 4c 20 29 20 4e 4f 54 20 49 4e 20 28 20 2b 20  LL ) NOT IN ( + 
20f40 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col2 )..----....
20f50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20f60 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
20f70 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41   + col2 + col2 A
20f80 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
20f90 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32 0d 0a 32 35 35  ..----..152..255
20fa0 0d 0a 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..99....onlyif m
20fb0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
20fc0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
20fd0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
20fe0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
20ff0 62 65 6c 2d 39 30 30 0d 0a 53 45 4c 45 43 54 20  bel-900..SELECT 
21000 2d 20 74 61 62 31 2e 63 6f 6c 31 20 44 49 56 20  - tab1.col1 DIV 
21010 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
21020 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
21030 30 0d 0a 30 0d 0a 38 0d 0a 0d 0a 73 6b 69 70 69  0..0..8....skipi
21040 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
21050 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
21060 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
21070 39 30 30 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  900..SELECT - ta
21080 62 31 2e 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 30  b1.col1 / - col0
21090 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
210a0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b1..----..0..0..
210b0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
210c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
210d0 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d  TINCT + col0 + -
210e0 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 41   col0 - - col2 A
210f0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
21100 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a  ..----..54..57..
21110 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  96....onlyif mys
21120 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
21130 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
21140 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
21150 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
21160 6c 2d 39 30 32 0d 0a 53 45 4c 45 43 54 20 63 6f  l-902..SELECT co
21170 6c 32 20 44 49 56 20 2d 20 63 6f 6c 32 20 2d 20  l2 DIV - col2 - 
21180 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
21190 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 33 36  ..----..-25..-36
211a0 0d 0a 2d 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-90....skipif 
211b0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
211c0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
211d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30  rowsort label-90
211e0 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f  2..SELECT col2 /
211f0 20 2d 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30   - col2 - + col0
21200 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
21210 0d 0a 2d 32 35 0d 0a 2d 33 36 0d 0a 2d 39 30 0d  ..-25..-36..-90.
21220 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
21230 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46  sort..SELECT * F
21240 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e  ROM tab2 WHERE N
21250 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28  OT NULL NOT IN (
21260 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2b   col1 + + col0 +
21270 20 2d 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d   - col0 )..----.
21280 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21290 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
212a0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 28  ol1 + + col2 * (
212b0 20 2d 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   - col0 ) FROM t
212c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
212d0 2d 0d 0a 2d 37 30 36 0d 0a 2d 37 32 30 37 0d 0a  -..-706..-7207..
212e0 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  62....query III 
212f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21300 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20  DISTINCT * FROM 
21310 74 61 62 32 20 57 48 45 52 45 20 63 6f 6c 31 20  tab2 WHERE col1 
21320 2b 20 2b 20 63 6f 6c 32 20 49 4e 20 28 20 2b 20  + + col2 IN ( + 
21330 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 29 0d 0a 2d  col0 + col2 )..-
21340 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
21350 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
21360 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b   col1 * - col0 +
21370 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
21380 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32 34 38  .----..1360..248
21390 0d 0a 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20  ..4661....query 
213a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
213b0 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20  T col0 + col2 + 
213c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
213d0 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a 31 34 33 0d 0a  ----..133..143..
213e0 32 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  262....query I r
213f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
21400 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a   col1 * + col2 *
21410 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
21420 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31 31 38 38 34  0..----..-611884
21430 0d 0a 2d 39 33 36 35 34 0d 0a 2d 39 37 0d 0a 0d  ..-93654..-97...
21440 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21450 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62  ..SELECT ALL tab
21460 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  0.col1 * + col0 
21470 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
21480 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39  .2064..3395..809
21490 39 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  9....query III r
214a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a  owsort..SELECT *
214b0 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
214c0 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 49 4e 20   col2 + col0 IN 
214d0 28 20 2d 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d  ( - col2 )..----
214e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
214f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
21500 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b 20  - tab2.col2 * + 
21510 74 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  tab2.col2 FROM t
21520 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 34  ab2..----..-1444
21530 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d 0a 0d 0a  ..-676..-729....
21540 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21550 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d  .SELECT col0 * -
21560 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2b   col1 + - col2 +
21570 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 41 53 20   - tab1.col2 AS 
21580 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
21590 2d 2d 2d 2d 0d 0a 2d 31 32 33 32 0d 0a 2d 31 38  ----..-1232..-18
215a0 36 0d 0a 2d 37 35 34 0d 0a 0d 0a 71 75 65 72 79  6..-754....query
215b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
215c0 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20  CT ALL + + col1 
215d0 2a 20 32 33 20 41 53 20 63 6f 6c 31 20 46 52 4f  * 23 AS col1 FRO
215e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
215f0 2d 2d 2d 2d 0d 0a 31 33 35 37 0d 0a 33 39 31 0d  ----..1357..391.
21600 0a 37 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .713....query I 
21610 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21620 2d 20 63 6f 6c 31 20 2a 20 2d 20 32 35 20 46 52  - col1 * - 25 FR
21630 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
21640 0a 2d 2d 2d 2d 0d 0a 31 34 37 35 0d 0a 34 32 35  .----..1475..425
21650 0d 0a 37 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..775....query I
21660 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21670 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 30   ALL col1 * col0
21680 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
21690 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
216a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36  or0..----..-1196
216b0 35 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35 38 35  52..-51034..-585
216c0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
216d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
216e0 6f 6c 30 20 2b 20 2b 20 38 38 20 41 53 20 63 6f  ol0 + + 88 AS co
216f0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
21700 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 0d  cor0..----..112.
21710 0a 31 32 33 0d 0a 31 37 37 0d 0a 0d 0a 71 75 65  .123..177....que
21720 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21730 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
21740 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  + cor0.col2 AS c
21750 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
21760 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36  r0..----..-7..16
21770 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..51....query I 
21780 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21790 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 31 34 20  ALL + col2 * 14 
217a0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
217b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
217c0 0a 31 31 34 38 0d 0a 31 34 0d 0a 34 36 32 0d 0a  .1148..14..462..
217d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
217e0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
217f0 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 72 30  l0 * col1 * cor0
21800 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20  .col0 FROM tab0 
21810 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
21820 31 38 38 32 35 0d 0a 34 39 35 33 36 0d 0a 37 32  18825..49536..72
21830 30 38 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0811....query I 
21840 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21850 41 4c 4c 20 34 32 20 41 53 20 63 6f 6c 30 20 46  ALL 42 AS col0 F
21860 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
21870 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  S cor0, tab1 AS 
21880 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
21890 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
218a0 20 33 32 35 61 61 64 61 32 32 33 39 62 36 66 65   325aada2239b6fe
218b0 31 66 65 32 64 38 34 33 35 31 35 61 65 38 63 35  1fe2d843515ae8c5
218c0 65 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  e....skipif post
218d0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
218e0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
218f0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
21900 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
21910 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21920 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30  ELECT ALL - cor0
21930 2e 63 6f 6c 30 20 2a 20 35 38 20 2b 20 63 6f 72  .col0 * 58 + cor
21940 30 2e 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d  0.col1 col1 FROM
21950 20 74 61 62 32 2c 20 74 61 62 32 20 63 6f 72 30   tab2, tab2 cor0
21960 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
21970 20 68 61 73 68 69 6e 67 20 74 6f 20 33 35 37 36   hashing to 3576
21980 39 33 62 31 37 32 64 35 39 30 32 34 65 61 39 30  93b172d59024ea90
21990 33 37 63 39 66 37 35 34 31 65 39 39 0d 0a 0d 0a  37c9f7541e99....
219a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
219b0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 38  .SELECT col2 * 8
219c0 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  8 AS col2 FROM t
219d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
219e0 2d 0d 0a 32 39 30 34 0d 0a 37 32 31 36 0d 0a 38  -..2904..7216..8
219f0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
21a00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
21a10 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c  TINCT col2 * col
21a20 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 + col0 FROM ta
21a30 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 38 0d 0a  b1..----..1328..
21a40 31 34 30 37 0d 0a 36 33 34 0d 0a 0d 0a 73 6b 69  1407..634....ski
21a50 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
21a60 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
21a70 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
21a80 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
21a90 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
21aa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
21ab0 28 20 2b 20 63 6f 6c 32 20 29 20 63 6f 6c 30 20  ( + col2 ) col0 
21ac0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
21ad0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a  0..----..1..33..
21ae0 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
21af0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
21b00 2d 20 63 6f 6c 32 20 2d 20 32 36 20 41 53 20 63  - col2 - 26 AS c
21b10 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
21b20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d   cor0..----..28.
21b30 0a 33 31 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79  .31..70....query
21b40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
21b50 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  CT + - col2 * - 
21b60 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col2 + + cor0.co
21b70 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
21b80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 35  cor0..----..1175
21b90 0d 0a 36 38 31 35 0d 0a 39 38 0d 0a 0d 0a 71 75  ..6815..98....qu
21ba0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21bb0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a  ELECT ALL col1 *
21bc0 20 2b 20 28 20 74 61 62 30 2e 63 6f 6c 32 20 29   + ( tab0.col2 )
21bd0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
21be0 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37  ..2838..7462..97
21bf0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21c00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
21c10 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f  cor0.col1 * + co
21c20 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63  l1 + - col0 AS c
21c30 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
21c40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
21c50 34 0d 0a 2d 32 34 39 0d 0a 2d 36 37 39 0d 0a 0d  4..-249..-679...
21c60 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
21c70 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
21c80 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
21c90 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
21ca0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
21cb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21cc0 54 20 2d 20 39 30 20 2b 20 63 6f 6c 31 20 2a 20  T - 90 + col1 * 
21cd0 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  + col2 col1 FROM
21ce0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34   tab2..----..144
21cf0 34 0d 0a 35 35 36 0d 0a 37 34 37 0d 0a 0d 0a 73  4..556..747....s
21d00 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
21d10 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
21d20 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
21d30 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
21d40 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
21d50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21d60 41 4c 4c 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  ALL col2 + + col
21d70 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0 col2 FROM tab2
21d80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21d90 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a  104..117..34....
21da0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
21db0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
21dc0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
21dd0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
21de0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33 31 0d  wsort label-931.
21df0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 20  .SELECT ALL + 7 
21e00 2b 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e  + col0 + - tab1.
21e10 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 41 53  col2 DIV col0 AS
21e20 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
21e30 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 37 31 0d 0a 38  .----..-8..71..8
21e40 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
21e50 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
21e60 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
21e70 6f 72 74 20 6c 61 62 65 6c 2d 39 33 31 0d 0a 53  ort label-931..S
21e80 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 20 2b 20  ELECT ALL + 7 + 
21e90 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e 63 6f  col0 + - tab1.co
21ea0 6c 32 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 / col0 AS col
21eb0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
21ec0 2d 0d 0a 2d 38 0d 0a 37 31 0d 0a 38 36 0d 0a 0d  -..-8..71..86...
21ed0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21ee0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
21ef0 6f 6c 31 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c  ol1 * - tab0.col
21f00 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
21f10 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d  ab0..----..2838.
21f20 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65  .7462..97....que
21f30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21f40 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
21f50 28 20 63 6f 6c 30 20 29 20 2b 20 2d 20 34 38 20  ( col0 ) + - 48 
21f60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
21f70 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
21f80 0a 2d 31 31 32 0d 0a 2d 31 32 38 0d 0a 2d 35 31  .-112..-128..-51
21f90 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
21fa0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
21fb0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
21fc0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
21fd0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
21fe0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21ff0 4c 45 43 54 20 41 4c 4c 20 2d 20 39 39 20 2a 20  LECT ALL - 99 * 
22000 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
22010 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 37 36  ab0..----..-2376
22020 0d 0a 2d 33 34 36 35 0d 0a 2d 38 38 31 31 0d 0a  ..-3465..-8811..
22030 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22040 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 32 20 41  t..SELECT + 82 A
22050 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
22060 0d 0a 2d 2d 2d 2d 0d 0a 38 32 0d 0a 38 32 0d 0a  ..----..82..82..
22070 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  82....onlyif mys
22080 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
22090 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
220a0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
220b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
220c0 6c 2d 39 33 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-936..SELECT DI
220d0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20  STINCT - col0 + 
220e0 2b 20 37 39 20 44 49 56 20 2d 20 63 6f 6c 30 20  + 79 DIV - col0 
220f0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
22100 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
22110 0a 2d 32 37 0d 0a 2d 33 37 0d 0a 2d 38 39 0d 0a  .-27..-37..-89..
22120 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
22130 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
22140 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22150 20 6c 61 62 65 6c 2d 39 33 36 0d 0a 53 45 4c 45   label-936..SELE
22160 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
22170 6c 30 20 2b 20 2b 20 37 39 20 2f 20 2d 20 63 6f  l0 + + 79 / - co
22180 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
22190 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
221a0 2d 2d 0d 0a 2d 32 37 0d 0a 2d 33 37 0d 0a 2d 38  --..-27..-37..-8
221b0 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
221c0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
221d0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
221e0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
221f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
22200 2d 39 33 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -937..SELECT - +
22210 20 63 6f 6c 31 20 44 49 56 20 35 38 20 2b 20 63   col1 DIV 58 + c
22220 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 * - col1 FRO
22230 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
22240 2d 2d 2d 2d 0d 0a 2d 31 35 33 35 0d 0a 2d 36 34  ----..-1535..-64
22250 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 73 6b 69 70 69  6..-837....skipi
22260 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
22270 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
22280 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
22290 39 33 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  937..SELECT - + 
222a0 63 6f 6c 31 20 2f 20 35 38 20 2b 20 63 6f 6c 32  col1 / 58 + col2
222b0 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
222c0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
222d0 2d 0d 0a 2d 31 35 33 35 0d 0a 2d 36 34 36 0d 0a  -..-1535..-646..
222e0 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -837....query I 
222f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22300 41 4c 4c 20 63 6f 6c 30 20 2b 20 31 33 20 41 53  ALL col0 + 13 AS
22310 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
22320 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a  cor0..----..16..
22330 37 37 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20  77..93....query 
22340 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22350 54 20 44 49 53 54 49 4e 43 54 20 2d 20 32 34 20  T DISTINCT - 24 
22360 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
22370 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
22380 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
22390 0a 2d 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-24....query I 
223a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
223b0 2b 20 63 6f 6c 32 20 2a 20 2d 20 38 33 20 2b 20  + col2 * - 83 + 
223c0 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2d 20  + tab2.col2 * - 
223d0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
223e0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
223f0 34 33 30 0d 0a 2d 34 31 38 36 0d 0a 2d 36 31 35  430..-4186..-615
22400 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
22410 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
22420 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
22430 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
22440 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
22450 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22460 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 28  ELECT col1 * - (
22470 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a   - col1 + col0 *
22480 20 63 6f 6c 31 20 29 20 63 6f 6c 31 20 46 52 4f   col1 ) col1 FRO
22490 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
224a0 2d 2d 2d 2d 0d 0a 2d 32 32 35 34 32 0d 0a 2d 32  ----..-22542..-2
224b0 36 38 30 33 37 0d 0a 2d 35 37 36 36 0d 0a 0d 0a  68037..-5766....
224c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
224d0 0a 53 45 4c 45 43 54 20 36 31 20 46 52 4f 4d 20  .SELECT 61 FROM 
224e0 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
224f0 72 30 2c 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d  r0, tab0 cor1..-
22500 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
22510 61 73 68 69 6e 67 20 74 6f 20 38 64 34 64 66 65  ashing to 8d4dfe
22520 36 34 39 34 33 33 61 35 39 39 66 63 34 62 31 30  649433a599fc4b10
22530 38 33 30 63 63 37 63 65 35 35 0d 0a 0d 0a 71 75  830cc7ce55....qu
22540 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22550 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 32 20  ELECT tab0.col2 
22560 2d 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d  - tab0.col1 FROM
22570 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33   tab0..----..-53
22580 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65  ..-9..-96....que
22590 72 79 20 49 49 49 49 49 49 20 72 6f 77 73 6f 72  ry IIIIII rowsor
225a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
225b0 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20  CT * FROM tab2, 
225c0 74 61 62 30 20 41 53 20 63 6f 72 30 20 57 48 45  tab0 AS cor0 WHE
225d0 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20 2b 20 63  RE NULL IN ( + c
225e0 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  or0.col2 * + cor
225f0 30 2e 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a  0.col1 )..----..
22600 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
22610 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
22620 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
22630 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
22640 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
22650 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22660 43 54 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f  CT ( col2 ) * co
22670 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
22680 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36  2..----..1534..6
22690 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79  46..837....query
226a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
226b0 43 54 20 2d 20 28 20 74 61 62 32 2e 63 6f 6c 32  CT - ( tab2.col2
226c0 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
226d0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  tab2..----..-26.
226e0 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65  .-27..-38....que
226f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22700 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
22710 2d 20 31 33 20 2b 20 2b 20 63 6f 6c 32 20 41 53  - 13 + + col2 AS
22720 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
22730 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
22740 31 32 0d 0a 32 30 0d 0a 36 39 0d 0a 0d 0a 71 75  12..20..69....qu
22750 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22760 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a  ELECT + - col0 *
22770 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41   - col1 + col2 A
22780 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
22790 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
227a0 32 30 39 37 0d 0a 33 33 39 36 0d 0a 38 31 38 31  2097..3396..8181
227b0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
227c0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
227d0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
227e0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
227f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
22800 39 34 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  949..SELECT - co
22810 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20  l1 DIV - col1 + 
22820 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
22830 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
22840 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 32 37  ----..11..14..27
22850 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
22860 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
22870 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
22880 72 74 20 6c 61 62 65 6c 2d 39 34 39 0d 0a 53 45  rt label-949..SE
22890 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 2d 20  LECT - col1 / - 
228a0 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63  col1 + col1 AS c
228b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
228c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d   cor0..----..11.
228d0 0a 31 34 0d 0a 32 37 0d 0a 0d 0a 71 75 65 72 79  .14..27....query
228e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
228f0 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  CT - cor0.col0 +
22900 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b   col1 * - col2 +
22910 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46   col0 * - col2 F
22920 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
22930 2d 2d 2d 0d 0a 2d 31 35 36 39 0d 0a 2d 34 32 38  ---..-1569..-428
22940 32 0d 0a 2d 39 30 30 38 0d 0a 0d 0a 71 75 65 72  2..-9008....quer
22950 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22960 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  ECT + col2 + col
22970 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  0 + col1 AS col0
22980 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
22990 0d 0a 31 33 31 0d 0a 31 38 39 0d 0a 38 33 0d 0a  ..131..189..83..
229a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
229b0 74 0d 0a 53 45 4c 45 43 54 20 34 37 20 2a 20 2b  t..SELECT 47 * +
229c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
229d0 0a 2d 2d 2d 2d 0d 0a 31 32 32 32 0d 0a 31 32 36  .----..1222..126
229e0 39 0d 0a 31 37 38 36 0d 0a 0d 0a 71 75 65 72 79  9..1786....query
229f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22a00 43 54 20 2d 20 63 6f 6c 30 20 2a 20 74 61 62 30  CT - col0 * tab0
22a10 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20  .col2 * col1 AS 
22a20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
22a30 2d 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d 36 36  ----..-3395..-66
22a40 34 31 31 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d 0a  4118..-68112....
22a50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22a60 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
22a70 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 28 20 2d   cor0.col1 * ( -
22a80 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 30   col1 ) + - col0
22a90 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
22aa0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
22ab0 0d 0a 2d 31 36 33 30 34 0d 0a 2d 33 36 35 30 37  ..-16304..-36507
22ac0 0d 0a 2d 35 37 36 34 0d 0a 0d 0a 71 75 65 72 79  ..-5764....query
22ad0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22ae0 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  CT - + col0 * - 
22af0 35 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  51 AS col1 FROM 
22b00 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
22b10 2d 2d 0d 0a 31 32 32 34 0d 0a 31 37 38 35 0d 0a  --..1224..1785..
22b20 34 35 33 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  4539....onlyif m
22b30 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
22b40 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
22b50 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
22b60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22b70 62 65 6c 2d 39 35 36 0d 0a 53 45 4c 45 43 54 20  bel-956..SELECT 
22b80 2d 20 43 41 53 54 28 20 2d 20 34 39 20 41 53 20  - CAST( - 49 AS 
22b90 53 49 47 4e 45 44 20 29 20 44 49 56 20 2b 20 63  SIGNED ) DIV + c
22ba0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
22bb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
22bc0 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
22bd0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
22be0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
22bf0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35 36  owsort label-956
22c00 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20  ..SELECT - CAST 
22c10 28 20 2d 20 34 39 20 41 53 20 49 4e 54 45 47 45  ( - 49 AS INTEGE
22c20 52 20 29 20 2f 20 2b 20 63 6f 6c 32 20 46 52 4f  R ) / + col2 FRO
22c30 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
22c40 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
22c50 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
22c60 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
22c70 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
22c80 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
22c90 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
22ca0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22cb0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
22cc0 6f 6c 31 20 2b 20 2d 20 38 35 20 2a 20 2d 20 63  ol1 + - 85 * - c
22cd0 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
22ce0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
22cf0 0d 0a 32 32 36 39 0d 0a 32 33 32 36 0d 0a 33 32  ..2269..2326..32
22d00 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  47....query I ro
22d10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
22d20 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20  STINCT + col2 + 
22d30 2b 20 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  + 0 + - col2 AS 
22d40 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
22d50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
22d60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22d70 72 74 0d 0a 53 45 4c 45 43 54 20 36 36 20 2a 20  rt..SELECT 66 * 
22d80 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
22d90 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
22da0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 32 0d  or0..----..1122.
22db0 0a 32 30 34 36 0d 0a 33 38 39 34 0d 0a 0d 0a 71  .2046..3894....q
22dc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22dd0 53 45 4c 45 43 54 20 34 20 46 52 4f 4d 20 74 61  SELECT 4 FROM ta
22de0 62 31 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  b1, tab2 cor0..-
22df0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
22e00 73 68 69 6e 67 20 74 6f 20 36 66 65 63 39 36 35  shing to 6fec965
22e10 62 36 30 62 39 38 38 35 63 34 61 66 37 33 65 38  b60b9885c4af73e8
22e20 35 34 32 32 63 66 64 39 62 0d 0a 0d 0a 71 75 65  5422cfd9b....que
22e30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22e40 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
22e50 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  l1 + - col2 * - 
22e60 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
22e70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
22e80 37 35 0d 0a 36 38 31 35 0d 0a 39 38 0d 0a 0d 0a  75..6815..98....
22e90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22ea0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
22eb0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d   + cor0.col1 * -
22ec0 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46   col2 * - col0 F
22ed0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
22ee0 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d 0a 36 36  ..----..3395..66
22ef0 34 31 31 38 0d 0a 36 38 31 31 32 0d 0a 0d 0a 71  4118..68112....q
22f00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22f10 53 45 4c 45 43 54 20 2d 20 2d 20 36 38 20 2a 20  SELECT - - 68 * 
22f20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
22f30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  S cor0..----..22
22f40 34 34 0d 0a 35 35 37 36 0d 0a 36 38 0d 0a 0d 0a  44..5576..68....
22f50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22f60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 34 20  .SELECT ALL - 4 
22f70 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
22f80 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
22f90 0a 2d 34 0d 0a 2d 34 0d 0a 2d 34 0d 0a 0d 0a 6f  .-4..-4..-4....o
22fa0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
22fb0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
22fc0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
22fd0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
22fe0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22ff0 74 20 6c 61 62 65 6c 2d 39 36 35 0d 0a 53 45 4c  t label-965..SEL
23000 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
23010 31 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54 28  1 + col2 * CAST(
23020 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
23030 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
23040 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
23050 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
23060 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
23070 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
23080 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
23090 39 36 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  965..SELECT DIST
230a0 49 4e 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 32  INCT col1 + col2
230b0 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   * CAST ( NULL A
230c0 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
230d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
230e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
230f0 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  L....onlyif mysq
23100 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
23110 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
23120 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
23130 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
23140 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36  rowsort label-96
23150 36 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  6..SELECT - CAST
23160 28 20 38 30 20 41 53 20 53 49 47 4e 45 44 20 29  ( 80 AS SIGNED )
23170 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
23180 0d 0a 2d 38 30 0d 0a 2d 38 30 0d 0a 2d 38 30 0d  ..-80..-80..-80.
23190 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
231a0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
231b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
231c0 74 20 6c 61 62 65 6c 2d 39 36 36 0d 0a 53 45 4c  t label-966..SEL
231d0 45 43 54 20 2d 20 43 41 53 54 20 28 20 38 30 20  ECT - CAST ( 80 
231e0 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
231f0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  M tab1..----..-8
23200 30 0d 0a 2d 38 30 0d 0a 2d 38 30 0d 0a 0d 0a 71  0..-80..-80....q
23210 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23220 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 39  SELECT ALL + - 9
23230 39 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  9 FROM tab1, tab
23240 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  2, tab0 AS cor0.
23250 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
23260 20 68 61 73 68 69 6e 67 20 74 6f 20 37 36 31 66   hashing to 761f
23270 35 66 31 61 31 36 36 61 30 30 64 62 39 39 33 36  5f1a166a00db9936
23280 30 31 34 31 35 36 35 61 38 35 64 61 0d 0a 0d 0a  0141565a85da....
23290 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
232a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32 30  .SELECT ALL - 20
232b0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
232c0 62 31 2c 20 74 61 62 32 20 63 6f 72 30 2c 20 74  b1, tab2 cor0, t
232d0 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab1 AS cor1, tab
232e0 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  2 AS cor2..----.
232f0 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69  .81 values hashi
23300 6e 67 20 74 6f 20 33 64 34 35 66 61 34 65 36 36  ng to 3d45fa4e66
23310 33 31 36 39 31 65 35 66 30 65 30 63 61 38 36 39  31691e5f0e0ca869
23320 38 32 65 39 63 32 0d 0a 0d 0a 73 6b 69 70 69 66  82e9c2....skipif
23330 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
23340 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
23350 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
23360 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
23370 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
23380 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
23390 30 2e 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  0.col0 col2 FROM
233a0 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
233b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
233c0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30  ues hashing to 0
233d0 39 64 38 61 39 31 32 64 65 31 62 38 61 62 37 36  9d8a912de1b8ab76
233e0 32 65 35 66 66 62 65 30 32 38 63 65 39 39 65 0d  2e5ffbe028ce99e.
233f0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
23400 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
23410 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
23420 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
23430 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
23440 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 30 0d  wsort label-970.
23450 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 63 6f  .SELECT CAST( co
23460 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l1 AS SIGNED ) *
23470 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 41 53 20   col1 - col1 AS 
23480 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
23490 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a 36 35 30 0d 0a  ----..156..650..
234a0 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  90....skipif mys
234b0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
234c0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
234d0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 30 0d 0a  sort label-970..
234e0 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 63 6f  SELECT CAST ( co
234f0 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
23500 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 41 53  * col1 - col1 AS
23510 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
23520 0a 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a 36 35 30 0d  .----..156..650.
23530 0a 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .90....onlyif my
23540 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
23550 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
23560 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
23570 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
23580 65 6c 2d 39 37 31 0d 0a 53 45 4c 45 43 54 20 63  el-971..SELECT c
23590 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 32 20 41  ol2 DIV + col2 A
235a0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
235b0 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
235c0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
235d0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
235e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
235f0 74 20 6c 61 62 65 6c 2d 39 37 31 0d 0a 53 45 4c  t label-971..SEL
23600 45 43 54 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c  ECT col2 / + col
23610 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
23620 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d  ab0..----..1..1.
23630 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
23640 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
23650 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 2d 20 38  ( - col0 ) * - 8
23660 39 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  9 FROM tab2..---
23670 2d 0d 0a 36 32 33 0d 0a 36 39 34 32 0d 0a 37 30  -..623..6942..70
23680 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
23690 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
236a0 63 6f 6c 30 20 2a 20 2d 20 28 20 33 20 2a 20 63  col0 * - ( 3 * c
236b0 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 63 6f 6c  or0.col2 ) + col
236c0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
236d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
236e0 2d 0d 0a 2d 31 30 38 38 37 0d 0a 2d 32 32 39 34  -..-10887..-2294
236f0 34 0d 0a 2d 34 33 32 0d 0a 0d 0a 71 75 65 72 79  4..-432....query
23700 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23710 43 54 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 31  CT + col1 - col1
23720 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
23730 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
23740 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
23750 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23760 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
23770 6c 30 20 2a 20 28 20 2d 20 28 20 63 6f 6c 31 20  l0 * ( - ( col1 
23780 29 20 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ) ) + col0 AS co
23790 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
237a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36  cor0..----..-126
237b0 34 0d 0a 2d 32 31 30 0d 0a 2d 34 35 32 34 0d 0a  4..-210..-4524..
237c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
237d0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
237e0 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  l0 * + col1 + co
237f0 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 36 38  l1 * - col0 * 68
23800 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
23810 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 38 38 30  r0..----..-42880
23820 0d 0a 2d 35 32 32 36 0d 0a 2d 36 39 36 38 30 0d  ..-5226..-69680.
23830 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
23840 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
23850 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
23860 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
23870 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
23880 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23890 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
238a0 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  1 + + col1 * - c
238b0 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol0 col2 FROM ta
238c0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
238d0 31 30 32 37 0d 0a 2d 35 32 0d 0a 2d 36 33 30 0d  1027..-52..-630.
238e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
238f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
23900 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b   - col2 * col2 +
23910 20 39 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   97 AS col2 FROM
23920 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
23930 2d 2d 2d 0d 0a 31 35 34 31 0d 0a 37 37 33 0d 0a  ---..1541..773..
23940 38 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  826....onlyif my
23950 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
23960 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
23970 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
23980 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
23990 65 6c 2d 39 37 39 0d 0a 53 45 4c 45 43 54 20 41  el-979..SELECT A
239a0 4c 4c 20 2b 20 63 6f 6c 32 20 44 49 56 20 28 20  LL + col2 DIV ( 
239b0 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32  col0 ) FROM tab2
239c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
239d0 30 0d 0a 30 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69  0..0..3....skipi
239e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
239f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
23a00 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
23a10 39 37 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  979..SELECT ALL 
23a20 2b 20 63 6f 6c 32 20 2f 20 28 20 63 6f 6c 30 20  + col2 / ( col0 
23a30 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
23a40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
23a50 0a 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .3....query I ro
23a60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
23a70 4c 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2d 20  L - tab1.col0 - 
23a80 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
23a90 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
23aa0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
23ab0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
23ac0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
23ad0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
23ae0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
23af0 38 31 0d 0a 53 45 4c 45 43 54 20 33 30 20 44 49  81..SELECT 30 DI
23b00 56 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20  V - col1 - col0 
23b10 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
23b20 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 38 30 0d 0a 0d  .-7..-78..-80...
23b30 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
23b40 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
23b50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
23b60 6c 61 62 65 6c 2d 39 38 31 0d 0a 53 45 4c 45 43  label-981..SELEC
23b70 54 20 33 30 20 2f 20 2d 20 63 6f 6c 31 20 2d 20  T 30 / - col1 - 
23b80 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
23b90 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d  ----..-7..-78..-
23ba0 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  80....query IIII
23bb0 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
23bc0 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
23bd0 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62   tab0, tab1, tab
23be0 31 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20  1 AS cor0 WHERE 
23bf0 4e 4f 54 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20  NOT ( cor0.col2 
23c00 29 20 3e 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d  ) >= NULL..----.
23c10 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
23c20 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
23c30 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
23c40 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
23c50 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61  SS JOIN tab2, ta
23c60 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32  b1 AS cor1, tab2
23c70 20 41 53 20 63 6f 72 32 2c 20 74 61 62 32 20 41   AS cor2, tab2 A
23c80 53 20 63 6f 72 33 0d 0a 2d 2d 2d 2d 0d 0a 33 36  S cor3..----..36
23c90 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  45 values hashin
23ca0 67 20 74 6f 20 32 63 30 33 37 30 65 65 32 64 37  g to 2c0370ee2d7
23cb0 37 32 36 61 66 66 64 65 39 63 37 63 30 64 65 31  726affde9c7c0de1
23cc0 32 61 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49  2a506....query I
23cd0 49 49 49 49 49 49 49 49 49 49 49 49 49 49 20 72  IIIIIIIIIIIIII r
23ce0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
23cf0 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 41  LL * FROM tab2 A
23d00 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
23d10 4e 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  N tab2, tab1 AS 
23d20 63 6f 72 31 2c 20 74 61 62 31 2c 20 74 61 62 32  cor1, tab1, tab2
23d30 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor2..----..364
23d40 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  5 values hashing
23d50 20 74 6f 20 38 35 65 36 63 62 37 34 37 33 38 65   to 85e6cb74738e
23d60 30 64 38 33 38 38 61 66 38 66 62 36 32 35 62 32  0d8388af8fb625b2
23d70 62 64 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  bd38....query I 
23d80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23d90 2b 20 33 32 20 46 52 4f 4d 20 74 61 62 31 2c 20  + 32 FROM tab1, 
23da0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
23db0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
23dc0 68 69 6e 67 20 74 6f 20 64 33 30 61 32 61 63 62  hing to d30a2acb
23dd0 66 33 33 63 38 38 32 37 34 34 37 34 33 30 36 39  f33c882744743069
23de0 33 36 64 33 32 32 37 62 0d 0a 0d 0a 71 75 65 72  36d3227b....quer
23df0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23e00 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  ECT cor0.col0 * 
23e10 2b 20 63 6f 72 31 2e 63 6f 6c 32 20 46 52 4f 4d  + cor1.col2 FROM
23e20 20 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53   tab1 cor0 CROSS
23e30 20 4a 4f 49 4e 20 74 61 62 31 20 63 6f 72 31 0d   JOIN tab1 cor1.
23e40 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
23e50 68 61 73 68 69 6e 67 20 74 6f 20 64 36 37 38 61  hashing to d678a
23e60 62 61 64 65 38 62 66 37 30 61 30 64 63 66 64 63  bade8bf70a0dcfdc
23e70 37 39 64 36 32 31 39 33 30 36 63 0d 0a 0d 0a 71  79d6219306c....q
23e80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23e90 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e 63 6f  SELECT + tab1.co
23ea0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
23eb0 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 0d  tab1, tab2 cor0.
23ec0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
23ed0 68 61 73 68 69 6e 67 20 74 6f 20 64 64 31 38 62  hashing to dd18b
23ee0 39 33 32 36 33 61 36 63 64 34 32 35 66 63 37 63  93263a6cd425fc7c
23ef0 63 38 34 64 39 31 33 37 38 37 30 0d 0a 0d 0a 71  c84d9137870....q
23f00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23f10 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 28 20  SELECT col0 + ( 
23f20 2d 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30  - col0 ) AS col0
23f30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
23f40 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
23f50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23f60 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  LECT col0 * col1
23f70 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 63   * cor0.col1 - c
23f80 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
23f90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 37 39 33 0d  r0..----..22793.
23fa0 0a 32 37 31 34 39 32 0d 0a 36 37 30 30 0d 0a 0d  .271492..6700...
23fb0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
23fc0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
23fd0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
23fe0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
23ff0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
24000 6f 72 74 20 6c 61 62 65 6c 2d 39 39 30 0d 0a 53  ort label-990..S
24010 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
24020 6c 30 20 2f 20 2d 20 43 41 53 54 28 20 4e 55 4c  l0 / - CAST( NUL
24030 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  L AS SIGNED ) FR
24040 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
24050 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
24060 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
24070 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
24080 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
24090 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
240a0 39 39 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  990..SELECT ALL 
240b0 2b 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 43 41 53  + + col0 / - CAS
240c0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
240d0 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20  GER ) FROM tab1 
240e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
240f0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
24100 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24110 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
24120 32 20 2b 20 28 20 63 6f 6c 30 20 29 20 41 53 20  2 + ( col0 ) AS 
24130 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
24140 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a  or0..----..104..
24150 31 31 37 0d 0a 33 34 0d 0a 0d 0a 6f 6e 6c 79 69  117..34....onlyi
24160 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
24170 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
24180 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
24190 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
241a0 20 6c 61 62 65 6c 2d 39 39 32 0d 0a 53 45 4c 45   label-992..SELE
241b0 43 54 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20  CT + - col2 DIV 
241c0 33 38 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  38 + col2 AS col
241d0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
241e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33  or0..----..1..33
241f0 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..80....skipif m
24200 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
24210 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
24220 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 32  owsort label-992
24230 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
24240 32 20 2f 20 33 38 20 2b 20 63 6f 6c 32 20 41 53  2 / 38 + col2 AS
24250 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
24260 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
24270 0d 0a 33 33 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72  ..33..80....quer
24280 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24290 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 33 37 20  ECT - col0 * 37 
242a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
242b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 39 0d 0a 2d  0..----..-259..-
242c0 32 38 38 36 0d 0a 2d 32 39 32 33 0d 0a 0d 0a 71  2886..-2923....q
242d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
242e0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
242f0 2b 20 38 36 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  + 86 * col1 FROM
24300 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
24310 2d 2d 2d 0d 0a 37 34 32 39 0d 0a 37 39 30 38 0d  ---..7429..7908.
24320 0a 38 33 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .8343....query I
24330 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24340 20 63 6f 6c 31 20 2b 20 28 20 31 32 20 29 20 2a   col1 + ( 12 ) *
24350 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
24360 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
24370 0a 2d 2d 2d 2d 0d 0a 31 31 35 39 0d 0a 33 37 34  .----..1159..374
24380 0d 0a 35 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..517....query I
24390 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
243a0 20 41 4c 4c 20 2b 20 63 6f 72 31 2e 63 6f 6c 32   ALL + cor1.col2
243b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
243c0 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
243d0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
243e0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
243f0 68 61 73 68 69 6e 67 20 74 6f 20 37 66 34 61 39  hashing to 7f4a9
24400 62 66 32 34 64 36 34 38 33 33 37 30 36 64 66 62  bf24d64833706dfb
24410 64 64 30 62 61 66 34 39 64 37 39 0d 0a 0d 0a 6f  dd0baf49d79....o
24420 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
24430 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
24440 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
24450 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
24460 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 37 0d 0a  sort label-997..
24470 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
24480 44 49 56 20 2d 20 38 35 20 2b 20 2d 20 63 6f 6c  DIV - 85 + - col
24490 30 20 2a 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20  0 * tab2.col2 * 
244a0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
244b0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
244c0 31 34 30 37 36 0d 0a 2d 35 31 30 33 0d 0a 2d 35  14076..-5103..-5
244d0 32 37 32 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  2728....skipif m
244e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
244f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
24500 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 37  owsort label-997
24510 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
24520 30 20 2f 20 2d 20 38 35 20 2b 20 2d 20 63 6f 6c  0 / - 85 + - col
24530 30 20 2a 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20  0 * tab2.col2 * 
24540 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
24550 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
24560 31 34 30 37 36 0d 0a 2d 35 31 30 33 0d 0a 2d 35  14076..-5103..-5
24570 32 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2728....query I 
24580 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24590 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62 31 2e  DISTINCT + tab1.
245a0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
245b0 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  M tab1, tab1 AS 
245c0 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
245d0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33  r1..----..10..13
245e0 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..26....query I 
245f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24600 63 6f 6c 32 20 2a 20 2b 20 30 20 2b 20 74 61 62  col2 * + 0 + tab
24610 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  0.col0 * col0 + 
24620 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63  col0 * col0 AS c
24630 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
24640 2d 2d 2d 0d 0a 31 31 35 32 0d 0a 31 35 38 34 32  ---..1152..15842
24650 0d 0a 32 34 35 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..2450....onlyif
24660 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
24670 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
24680 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
24690 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
246a0 6c 61 62 65 6c 2d 31 30 30 30 0d 0a 53 45 4c 45  label-1000..SELE
246b0 43 54 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f  CT ALL + tab1.co
246c0 6c 32 20 44 49 56 20 36 30 20 2b 20 63 6f 6c 32  l2 DIV 60 + col2
246d0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
246e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37  b1..----..54..57
246f0 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..97....skipif m
24700 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
24710 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
24720 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30  owsort label-100
24730 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  0..SELECT ALL + 
24740 74 61 62 31 2e 63 6f 6c 32 20 2f 20 36 30 20 2b  tab1.col2 / 60 +
24750 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
24760 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab1..----..5
24770 34 0d 0a 35 37 0d 0a 39 37 0d 0a 0d 0a 71 75 65  4..57..97....que
24780 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24790 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20  LECT ALL col1 + 
247a0 2d 20 31 36 20 2a 20 63 6f 6c 30 20 41 53 20 63  - 16 * col0 AS c
247b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
247c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
247d0 33 33 0d 0a 2d 32 39 38 0d 0a 2d 34 36 33 0d 0a  33..-298..-463..
247e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
247f0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
24800 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 37 36  CT + col1 + - 76
24810 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
24820 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
24830 0d 0a 2d 35 30 0d 0a 2d 36 33 0d 0a 2d 36 36 0d  ..-50..-63..-66.
24840 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24850 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
24860 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  - - col2 AS col2
24870 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
24880 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a  .----..171..36..
24890 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
248a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
248b0 4c 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63  L + + col2 + + c
248c0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
248d0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
248e0 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a  ..121..176..57..
248f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
24900 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
24910 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
24920 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
24930 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
24940 30 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  05..SELECT DISTI
24950 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  NCT cor0.col0 + 
24960 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 44 49  - col2 * col2 DI
24970 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  V col1 FROM tab0
24980 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24990 31 32 0d 0a 31 36 0d 0a 33 35 0d 0a 0d 0a 73 6b  12..16..35....sk
249a0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
249b0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
249c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
249d0 65 6c 2d 31 30 30 35 0d 0a 53 45 4c 45 43 54 20  el-1005..SELECT 
249e0 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
249f0 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l0 + - col2 * co
24a00 6c 32 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 / col1 FROM t
24a10 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
24a20 2d 0d 0a 31 32 0d 0a 31 36 0d 0a 33 35 0d 0a 0d  -..12..16..35...
24a30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24a40 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
24a50 54 20 63 6f 6c 32 20 2d 20 2b 20 28 20 28 20 63  T col2 - + ( ( c
24a60 6f 6c 30 20 29 20 29 20 2a 20 63 6f 6c 32 20 41  ol0 ) ) * col2 A
24a70 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
24a80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24a90 2d 31 36 32 0d 0a 2d 32 30 30 32 0d 0a 2d 32 39  -162..-2002..-29
24aa0 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  64....onlyif mys
24ab0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
24ac0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
24ad0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
24ae0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
24af0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
24b00 30 30 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  007..SELECT col1
24b10 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   * CAST( NULL AS
24b20 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 31 34   SIGNED ) + - 14
24b30 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   + col2 * + col2
24b40 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
24b50 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
24b60 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
24b70 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
24b80 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
24b90 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
24ba0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
24bb0 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
24bc0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
24bd0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
24be0 72 74 20 6c 61 62 65 6c 2d 31 30 30 37 0d 0a 53  rt label-1007..S
24bf0 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 43 41 53  ELECT col1 * CAS
24c00 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
24c10 47 45 52 20 29 20 2b 20 2d 20 31 34 20 2b 20 63  GER ) + - 14 + c
24c20 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c  ol2 * + col2 col
24c30 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
24c40 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
24c50 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
24c60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
24c70 6f 6c 32 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c  ol2 * - tab1.col
24c80 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  0 * + col1 + col
24c90 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
24ca0 2d 0d 0a 2d 33 36 34 37 30 0d 0a 2d 34 31 38 36  -..-36470..-4186
24cb0 0d 0a 2d 39 39 38 32 37 0d 0a 0d 0a 71 75 65 72  ..-99827....quer
24cc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24cd0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
24ce0 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  0 * + col0 + + c
24cf0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
24d00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 35 33 0d 0a  r0..----..4153..
24d10 36 33 0d 0a 36 34 39 36 0d 0a 0d 0a 73 6b 69 70  63..6496....skip
24d20 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
24d30 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
24d40 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
24d50 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
24d60 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
24d70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
24d80 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  TINCT + - cor0.c
24d90 6f 6c 30 20 2b 20 2d 20 36 35 20 2b 20 63 6f 6c  ol0 + - 65 + col
24da0 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  2 col1 FROM tab2
24db0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24dc0 2d 31 30 36 0d 0a 2d 31 31 37 0d 0a 2d 34 35 0d  -106..-117..-45.
24dd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24de0 72 74 0d 0a 53 45 4c 45 43 54 20 34 33 20 2b 20  rt..SELECT 43 + 
24df0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col0 * col1 FROM
24e00 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
24e10 2d 2d 2d 0d 0a 31 30 38 33 0d 0a 31 32 31 0d 0a  ---..1083..121..
24e20 36 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  683....onlyif my
24e30 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
24e40 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
24e50 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
24e60 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
24e70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24e80 31 30 31 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  1012..SELECT DIS
24e90 54 49 4e 43 54 20 2b 20 2b 20 43 41 53 54 28 20  TINCT + + CAST( 
24ea0 2d 20 28 20 63 6f 6c 30 20 29 20 41 53 20 53 49  - ( col0 ) AS SI
24eb0 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32  GNED ) FROM tab2
24ec0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24ed0 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a  -7..-78..-79....
24ee0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
24ef0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
24f00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
24f10 61 62 65 6c 2d 31 30 31 32 0d 0a 53 45 4c 45 43  abel-1012..SELEC
24f20 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 43  T DISTINCT + + C
24f30 41 53 54 20 28 20 2d 20 28 20 63 6f 6c 30 20 29  AST ( - ( col0 )
24f40 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
24f50 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
24f60 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a  .----..-7..-78..
24f70 2d 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -79....onlyif my
24f80 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
24f90 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
24fa0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
24fb0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
24fc0 65 6c 2d 31 30 31 33 0d 0a 53 45 4c 45 43 54 20  el-1013..SELECT 
24fd0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
24fe0 2b 20 2b 20 32 37 20 2a 20 2b 20 63 6f 6c 30 20  + + 27 * + col0 
24ff0 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  DIV col0 AS col1
25000 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
25010 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31  r0..----..105..1
25020 30 36 0d 0a 33 34 0d 0a 0d 0a 73 6b 69 70 69 66  06..34....skipif
25030 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
25040 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
25050 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
25060 30 31 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  013..SELECT DIST
25070 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  INCT + col0 + + 
25080 32 37 20 2a 20 2b 20 63 6f 6c 30 20 2f 20 63 6f  27 * + col0 / co
25090 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
250a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
250b0 2d 2d 0d 0a 31 30 35 0d 0a 31 30 36 0d 0a 33 34  --..105..106..34
250c0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
250d0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
250e0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
250f0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
25100 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
25110 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
25120 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
25130 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 35 38 20 63  cor0.col0 * 58 c
25140 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
25150 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 36   cor0..----..406
25160 0d 0a 34 35 32 34 0d 0a 34 35 38 32 0d 0a 0d 0a  ..4524..4582....
25170 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25180 0a 53 45 4c 45 43 54 20 2d 20 33 20 2b 20 2d 20  .SELECT - 3 + - 
25190 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  col1 + cor0.col2
251a0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
251b0 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 34 34 0d 0a 38  .----..25..44..8
251c0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
251d0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
251e0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
251f0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
25200 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
25210 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25220 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 33 34  ELECT ALL + + 34
25230 20 2a 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f   * col2 col1 FRO
25240 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
25250 2d 0d 0a 31 32 39 32 0d 0a 38 38 34 0d 0a 39 31  -..1292..884..91
25260 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
25270 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
25280 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
25290 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
252a0 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20  SS JOIN tab1 AS 
252b0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
252c0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
252d0 35 39 31 31 62 61 63 35 31 34 34 31 66 34 66 66  5911bac51441f4ff
252e0 36 34 30 62 32 61 32 62 37 32 31 65 61 38 65 33  640b2a2b721ea8e3
252f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25300 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
25310 49 4e 43 54 20 39 37 20 2b 20 2d 20 63 6f 6c 30  INCT 97 + - col0
25320 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41   * - cor0.col0 A
25330 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
25340 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25350 31 34 36 0d 0a 36 31 38 31 0d 0a 36 33 33 38 0d  146..6181..6338.
25360 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25370 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
25380 20 28 20 33 36 20 29 20 46 52 4f 4d 20 74 61 62   ( 36 ) FROM tab
25390 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
253a0 0a 2d 33 36 0d 0a 2d 33 36 0d 0a 2d 33 36 0d 0a  .-36..-36..-36..
253b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
253c0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f  t..SELECT - ( co
253d0 6c 31 20 29 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  l1 ) + col2 * - 
253e0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
253f0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
25400 2d 2d 2d 2d 0d 0a 2d 31 35 39 33 0d 0a 2d 36 36  ----..-1593..-66
25410 33 0d 0a 2d 38 36 38 0d 0a 0d 0a 6f 6e 6c 79 69  3..-868....onlyi
25420 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
25430 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
25440 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
25450 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25460 20 6c 61 62 65 6c 2d 31 30 32 31 0d 0a 53 45 4c   label-1021..SEL
25470 45 43 54 20 2b 20 31 31 20 2a 20 2d 20 63 6f 72  ECT + 11 * - cor
25480 30 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  0.col1 + cor0.co
25490 6c 32 20 44 49 56 20 63 6f 6c 32 20 2b 20 63 6f  l2 DIV col2 + co
254a0 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41  l2 * cor0.col2 A
254b0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
254c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
254d0 2d 31 30 36 35 0d 0a 31 34 34 0d 0a 35 37 32 34  -1065..144..5724
254e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
254f0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
25500 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
25510 72 74 20 6c 61 62 65 6c 2d 31 30 32 31 0d 0a 53  rt label-1021..S
25520 45 4c 45 43 54 20 2b 20 31 31 20 2a 20 2d 20 63  ELECT + 11 * - c
25530 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  or0.col1 + cor0.
25540 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 2b 20 63 6f  col2 / col2 + co
25550 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41  l2 * cor0.col2 A
25560 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
25570 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25580 2d 31 30 36 35 0d 0a 31 34 34 0d 0a 35 37 32 34  -1065..144..5724
25590 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
255a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
255b0 28 20 2d 20 37 38 20 29 20 41 53 20 63 6f 6c 32  ( - 78 ) AS col2
255c0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
255d0 0a 2d 2d 2d 2d 0d 0a 2d 37 38 0d 0a 2d 37 38 0d  .----..-78..-78.
255e0 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-78....query I 
255f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25600 2b 20 34 30 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  + 40 + + col1 + 
25610 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
25620 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
25630 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31 35 38 0d 0a  ----..102..158..
25640 37 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  74....onlyif mys
25650 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
25660 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
25670 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
25680 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
25690 6c 2d 31 30 32 34 0d 0a 53 45 4c 45 43 54 20 41  l-1024..SELECT A
256a0 4c 4c 20 2d 20 2b 20 34 38 20 2b 20 2d 20 63 6f  LL - + 48 + - co
256b0 6c 30 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30  l0 DIV cor0.col0
256c0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
256d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d  r0..----..-49..-
256e0 34 39 0d 0a 2d 34 39 0d 0a 0d 0a 73 6b 69 70 69  49..-49....skipi
256f0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25700 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
25710 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25720 31 30 32 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1024..SELECT ALL
25730 20 2d 20 2b 20 34 38 20 2b 20 2d 20 63 6f 6c 30   - + 48 + - col0
25740 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   / cor0.col0 FRO
25750 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
25760 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 34 39 0d 0a  ----..-49..-49..
25770 2d 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -49....query I r
25780 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
25790 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 33 33 20 2b  LL - col0 * 33 +
257a0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
257b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
257c0 0a 2d 31 30 35 38 0d 0a 2d 32 38 34 36 0d 0a 2d  .-1058..-2846..-
257d0 37 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  706....query I r
257e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
257f0 20 38 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20   82 + cor0.col0 
25800 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
25810 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36 0d 0a 31 36  0..----..146..16
25820 32 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  2..85....query I
25830 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25840 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
25850 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l0 + + cor0.col2
25860 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
25870 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
25880 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a  ..121..176..57..
25890 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
258a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
258b0 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col1 + - cor0.co
258c0 6c 31 20 2a 20 2b 20 31 35 20 46 52 4f 4d 20 74  l1 * + 15 FROM t
258d0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
258e0 2d 32 33 38 0d 0a 2d 34 33 34 0d 0a 2d 38 32 36  -238..-434..-826
258f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25900 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
25910 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53  - col1 + col0 AS
25920 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
25930 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d  cor0..----..-23.
25940 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79  .54..67....query
25950 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25960 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
25970 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 41 53  - col1 - col1 AS
25980 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
25990 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
259a0 31 34 34 0d 0a 2d 37 32 0d 0a 2d 38 39 0d 0a 0d  144..-72..-89...
259b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
259c0 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c  ..SELECT ( + col
259d0 31 20 29 20 2b 20 28 20 2d 20 31 30 20 29 20 2a  1 ) + ( - 10 ) *
259e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
259f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
25a00 34 0d 0a 2d 36 33 30 0d 0a 2d 37 38 37 0d 0a 0d  4..-630..-787...
25a10 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
25a20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
25a30 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
25a40 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
25a50 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
25a60 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 32 0d 0a  ort label-1032..
25a70 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
25a80 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20  - col2 * col0 + 
25a90 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
25aa0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
25ab0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
25ac0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
25ad0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
25ae0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
25af0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
25b00 30 33 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  032..SELECT DIST
25b10 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  INCT - col2 * co
25b20 6c 30 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55  l0 + + CAST ( NU
25b30 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
25b40 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
25b50 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
25b60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25b70 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
25b80 54 20 2b 20 31 20 41 53 20 63 6f 6c 32 20 46 52  T + 1 AS col2 FR
25b90 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
25ba0 2d 2d 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49  --..1....query I
25bb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25bc0 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 63 6f   ALL + col2 * co
25bd0 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  l1 + - col0 + co
25be0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
25bf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 0d  cor0..----..159.
25c00 0a 32 39 30 30 0d 0a 37 34 36 34 0d 0a 0d 0a 71  .2900..7464....q
25c10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25c20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
25c30 34 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  42 + - cor0.col2
25c40 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
25c50 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31 35 0d  .----..-12..-15.
25c60 0a 2d 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-54....query I 
25c70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25c80 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
25c90 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  1 * col2 AS col2
25ca0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
25cb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d  r0..----..-2838.
25cc0 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 73  .-7462..-97....s
25cd0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
25ce0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
25cf0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
25d00 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
25d10 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
25d20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25d30 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  + - col0 + cor0.
25d40 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
25d50 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
25d60 2d 0d 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d  -..-19..-62..24.
25d70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25d80 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
25d90 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 2a   - col1 - col1 *
25da0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
25db0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
25dc0 31 35 39 33 0d 0a 2d 36 36 33 0d 0a 2d 38 36 38  1593..-663..-868
25dd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25de0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
25df0 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  + + col1 * - col
25e00 31 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  1 - - cor0.col0 
25e10 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
25e20 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
25e30 0a 2d 33 36 0d 0a 2d 36 37 33 0d 0a 2d 38 39 0d  .-36..-673..-89.
25e40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25e50 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
25e60 6f 72 30 2e 63 6f 6c 31 20 2a 20 28 20 34 32 20  or0.col1 * ( 42 
25e70 29 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  ) - - col1 * - c
25e80 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
25e90 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
25ea0 2d 2d 2d 0d 0a 2d 33 36 34 30 0d 0a 33 39 37 37  ---..-3640..3977
25eb0 0d 0a 37 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..774....query I
25ec0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25ed0 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
25ee0 6f 6c 31 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 - col2 AS co
25ef0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
25f00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d  cor0..----..-21.
25f10 0a 33 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20  .33..4....query 
25f20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25f30 54 20 63 6f 6c 31 20 2a 20 2d 20 34 35 20 2d 20  T col1 * - 45 - 
25f40 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
25f50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
25f60 32 32 34 0d 0a 2d 35 30 37 0d 0a 2d 36 38 31 0d  224..-507..-681.
25f70 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
25f80 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
25f90 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
25fa0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
25fb0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
25fc0 30 34 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  043..SELECT DIST
25fd0 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  INCT cor0.col1 +
25fe0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 44   + col2 * col0 D
25ff0 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c  IV - col1 AS col
26000 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
26010 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 34 0d  or0..----..-354.
26020 0a 2d 35 37 37 0d 0a 32 30 0d 0a 0d 0a 73 6b 69  .-577..20....ski
26030 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
26040 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
26050 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
26060 6c 2d 31 30 34 33 0d 0a 53 45 4c 45 43 54 20 44  l-1043..SELECT D
26070 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c  ISTINCT cor0.col
26080 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  1 + + col2 * col
26090 30 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  0 / - col1 AS co
260a0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
260b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 34  cor0..----..-354
260c0 0d 0a 2d 35 37 37 0d 0a 32 30 0d 0a 0d 0a 71 75  ..-577..20....qu
260d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
260e0 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b  ELECT - + col1 +
260f0 20 2b 20 37 33 20 2a 20 2b 20 63 6f 6c 32 20 41   + 73 * + col2 A
26100 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
26110 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26120 31 38 33 39 0d 0a 31 39 34 30 0d 0a 32 37 35 37  1839..1940..2757
26130 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26140 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
26150 49 4e 43 54 20 32 35 20 41 53 20 63 6f 6c 31 20  INCT 25 AS col1 
26160 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
26170 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
26180 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
26190 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
261a0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
261b0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
261c0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
261d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
261e0 34 36 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  46..SELECT + CAS
261f0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
26200 44 20 29 20 2a 20 2d 20 35 34 20 41 53 20 63 6f  D ) * - 54 AS co
26210 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
26220 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
26230 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
26240 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
26250 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
26260 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
26270 6c 2d 31 30 34 36 0d 0a 53 45 4c 45 43 54 20 2b  l-1046..SELECT +
26280 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
26290 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 35 34  INTEGER ) * - 54
262a0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
262b0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b2 cor0..----..N
262c0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
262d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
262e0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
262f0 31 20 2b 20 39 31 20 46 52 4f 4d 20 74 61 62 32  1 + 91 FROM tab2
26300 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26310 31 30 38 0d 0a 31 32 32 0d 0a 31 35 30 0d 0a 0d  108..122..150...
26320 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26330 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c  ..SELECT + ( col
26340 32 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  2 ) + col0 FROM 
26350 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
26360 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d  .104..117..34...
26370 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26380 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 74  ..SELECT + ( + t
26390 61 62 30 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20  ab0.col2 ) FROM 
263a0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33  tab0..----..1..3
263b0 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  3..82....query I
263c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
263d0 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   - - col2 * + co
263e0 6c 31 20 2d 20 2b 20 34 38 20 2a 20 63 6f 6c 32  l1 - + 48 * col2
263f0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
26400 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
26410 0d 0a 31 32 35 34 0d 0a 33 35 32 36 0d 0a 34 39  ..1254..3526..49
26420 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
26430 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
26440 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
26450 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
26460 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
26470 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35  owsort label-105
26480 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
26490 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 43 41  CT - col2 + + CA
264a0 53 54 28 20 2b 20 35 30 20 41 53 20 53 49 47 4e  ST( + 50 AS SIGN
264b0 45 44 20 29 20 2a 20 63 6f 6c 30 20 2a 20 2b 20  ED ) * col0 * + 
264c0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
264d0 47 4e 45 44 20 29 20 63 6f 6c 31 20 46 52 4f 4d  GNED ) col1 FROM
264e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
264f0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
26500 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
26510 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
26520 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
26530 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
26540 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
26550 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
26560 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
26570 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 31 0d  sort label-1051.
26580 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
26590 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54   - col2 + + CAST
265a0 20 28 20 2b 20 35 30 20 41 53 20 49 4e 54 45 47   ( + 50 AS INTEG
265b0 45 52 20 29 20 2a 20 63 6f 6c 30 20 2a 20 2b 20  ER ) * col0 * + 
265c0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
265d0 4e 54 45 47 45 52 20 29 20 63 6f 6c 31 20 46 52  NTEGER ) col1 FR
265e0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
265f0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
26600 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26610 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20  SELECT col1 * - 
26620 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 31 20  ( col1 ) + col1 
26630 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
26640 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
26650 35 36 0d 0a 2d 36 35 30 0d 0a 2d 39 30 0d 0a 0d  56..-650..-90...
26660 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26670 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
26680 54 20 2b 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c  T + - col1 - col
26690 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
266a0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
266b0 2d 0d 0a 2d 31 31 38 0d 0a 2d 33 34 0d 0a 2d 36  -..-118..-34..-6
266c0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
266d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
266e0 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63  ol2 * col2 + - c
266f0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f  ol2 + - col0 FRO
26700 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
26710 2d 2d 2d 2d 0d 0a 2d 31 35 36 31 0d 0a 2d 37 36  ----..-1561..-76
26720 33 0d 0a 2d 37 38 30 0d 0a 0d 0a 73 6b 69 70 69  3..-780....skipi
26730 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
26740 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
26750 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
26760 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
26770 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
26780 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
26790 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  INCT - col1 * + 
267a0 37 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  71 col2 FROM tab
267b0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
267c0 0a 2d 31 38 34 36 0d 0a 2d 37 31 30 0d 0a 2d 39  .-1846..-710..-9
267d0 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  23....query I ro
267e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
267f0 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20  - col1 * col1 + 
26800 33 33 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  33 * col0 AS col
26810 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
26820 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 37 0d  or0..----..-577.
26830 0a 32 30 31 32 0d 0a 32 34 37 31 0d 0a 0d 0a 71  .2012..2471....q
26840 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26850 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
26860 38 35 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  85 + col0 FROM t
26870 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
26880 2d 0d 0a 32 32 38 38 0d 0a 32 33 30 32 0d 0a 33  -..2288..2302..3
26890 33 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  309....query I r
268a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
268b0 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  LL + - col2 + co
268c0 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63  l2 * - col1 AS c
268d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
268e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 30 0d  r0..----..-1560.
268f0 0a 2d 36 38 34 0d 0a 2d 38 36 34 0d 0a 0d 0a 71  .-684..-864....q
26900 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26910 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
26920 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col1 + col2 FROM
26930 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
26940 0d 0a 31 33 34 34 0d 0a 31 34 35 38 0d 0a 36 32  ..1344..1458..62
26950 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
26960 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
26970 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a  TINCT - + col2 *
26980 20 31 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53   12 FROM tab2 AS
26990 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31   cor0..----..-31
269a0 32 0d 0a 2d 33 32 34 0d 0a 2d 34 35 36 0d 0a 0d  2..-324..-456...
269b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
269c0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
269d0 2b 20 2b 20 37 34 20 46 52 4f 4d 20 74 61 62 31  + + 74 FROM tab1
269e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
269f0 31 30 30 0d 0a 38 34 0d 0a 38 37 0d 0a 0d 0a 71  100..84..87....q
26a00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26a10 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20  SELECT + + col0 
26a20 2a 20 2b 20 39 20 2b 20 2b 20 63 6f 6c 30 20 46  * + 9 + + col0 F
26a30 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26a40 0d 0a 2d 2d 2d 2d 0d 0a 33 30 0d 0a 36 34 30 0d  ..----..30..640.
26a50 0a 38 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .800....onlyif m
26a60 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
26a70 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
26a80 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
26a90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
26aa0 62 65 6c 2d 31 30 36 33 0d 0a 53 45 4c 45 43 54  bel-1063..SELECT
26ab0 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20 33 34   + + col2 DIV 34
26ac0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
26ad0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
26ae0 0a 32 36 0d 0a 32 37 0d 0a 33 39 0d 0a 0d 0a 73  .26..27..39....s
26af0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
26b00 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
26b10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
26b20 62 65 6c 2d 31 30 36 33 0d 0a 53 45 4c 45 43 54  bel-1063..SELECT
26b30 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 33 34 20 2b   + + col2 / 34 +
26b40 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
26b50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
26b60 36 0d 0a 32 37 0d 0a 33 39 0d 0a 0d 0a 71 75 65  6..27..39....que
26b70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26b80 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  LECT - - cor0.co
26b90 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  l0 + col0 * col1
26ba0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
26bb0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
26bc0 0d 0a 32 30 38 38 0d 0a 33 34 33 30 0d 0a 38 31  ..2088..3430..81
26bd0 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  88....onlyif mys
26be0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
26bf0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
26c00 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
26c10 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
26c20 6c 2d 31 30 36 35 0d 0a 53 45 4c 45 43 54 20 63  l-1065..SELECT c
26c30 6f 6c 30 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d  ol0 + col2 DIV -
26c40 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
26c50 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
26c60 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 35 39 0d 0a 37 33  .----..1..59..73
26c70 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
26c80 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
26c90 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
26ca0 72 74 20 6c 61 62 65 6c 2d 31 30 36 35 0d 0a 53  rt label-1065..S
26cb0 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c  ELECT col0 + col
26cc0 32 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  2 / - col1 AS co
26cd0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
26ce0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 35  cor0..----..1..5
26cf0 39 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49  9..73....query I
26d00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26d10 20 2b 20 2b 20 32 38 20 2b 20 2b 20 63 6f 6c 30   + + 28 + + col0
26d20 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
26d30 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
26d40 0d 0a 31 30 36 0d 0a 31 30 37 0d 0a 33 35 0d 0a  ..106..107..35..
26d50 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
26d60 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
26d70 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
26d80 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
26d90 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
26da0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 36 37 0d  sort label-1067.
26db0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
26dc0 43 41 53 54 28 20 37 38 20 41 53 20 53 49 47 4e  CAST( 78 AS SIGN
26dd0 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  ED ) FROM tab1 A
26de0 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
26df0 4e 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72  N tab1, tab2 cor
26e00 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
26e10 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 34  es hashing to c4
26e20 66 33 63 36 33 66 39 38 63 33 63 30 38 66 32 38  f3c63f98c3c08f28
26e30 34 38 66 34 36 38 35 30 61 34 37 36 64 34 0d 0a  48f46850a476d4..
26e40 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
26e50 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
26e60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26e70 20 6c 61 62 65 6c 2d 31 30 36 37 0d 0a 53 45 4c   label-1067..SEL
26e80 45 43 54 20 41 4c 4c 20 2d 20 2b 20 43 41 53 54  ECT ALL - + CAST
26e90 20 28 20 37 38 20 41 53 20 49 4e 54 45 47 45 52   ( 78 AS INTEGER
26ea0 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
26eb0 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
26ec0 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 31 0d  tab1, tab2 cor1.
26ed0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
26ee0 20 68 61 73 68 69 6e 67 20 74 6f 20 63 34 66 33   hashing to c4f3
26ef0 63 36 33 66 39 38 63 33 63 30 38 66 32 38 34 38  c63f98c3c08f2848
26f00 66 34 36 38 35 30 61 34 37 36 64 34 0d 0a 0d 0a  f46850a476d4....
26f10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26f20 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
26f30 6f 6c 32 20 2a 20 35 30 20 2b 20 2b 20 63 6f 6c  ol2 * 50 + + col
26f40 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
26f50 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 36 0d 0a 31 33  ..----..1326..13
26f60 37 37 0d 0a 31 39 33 38 0d 0a 0d 0a 71 75 65 72  77..1938....quer
26f70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26f80 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 63  ECT - - col2 + c
26f90 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 28  ol2 * col1 + + (
26fa0 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20   col0 ) AS col2 
26fb0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
26fc0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a 32 38  0..----..133..28
26fd0 39 35 0d 0a 37 36 33 33 0d 0a 0d 0a 71 75 65 72  95..7633....quer
26fe0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26ff0 45 43 54 20 39 38 20 2a 20 31 38 20 2b 20 2d 20  ECT 98 * 18 + - 
27000 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
27010 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
27020 33 38 0d 0a 31 37 35 31 0d 0a 31 37 35 34 0d 0a  38..1751..1754..
27030 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27040 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
27050 6c 31 20 2a 20 2b 20 37 30 20 2b 20 63 6f 6c 30  l1 * + 70 + col0
27060 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46   * col0 * col1 F
27070 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
27080 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 36 31 35 0d 0a  ..----..125615..
27090 35 35 35 35 36 0d 0a 37 32 37 31 38 31 0d 0a 0d  55556..727181...
270a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
270b0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 31 30 20  ..SELECT + + 10 
270c0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
270d0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 30 0d  0..----..10..10.
270e0 0a 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .10....query I r
270f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
27100 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a  ISTINCT - col1 *
27110 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63   col0 * + cor0.c
27120 6f 6c 31 20 2d 20 28 20 32 38 20 29 20 2a 20 63  ol1 - ( 28 ) * c
27130 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
27140 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
27150 39 39 31 32 0d 0a 2d 33 33 32 30 33 31 0d 0a 2d  9912..-332031..-
27160 37 33 39 35 35 37 0d 0a 0d 0a 71 75 65 72 79 20  739557....query 
27170 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27180 54 20 2b 20 2b 20 36 37 20 2a 20 63 6f 6c 32 20  T + + 67 * col2 
27190 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
271a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
271b0 33 36 32 31 0d 0a 33 38 38 33 0d 0a 36 35 31 32  3621..3883..6512
271c0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
271d0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
271e0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
271f0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
27200 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
27210 31 30 37 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63  1075..SELECT + c
27220 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 32 20 41  ol0 DIV + col2 A
27230 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
27240 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 35  ..----..0..1..35
27250 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
27260 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
27270 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
27280 72 74 20 6c 61 62 65 6c 2d 31 30 37 35 0d 0a 53  rt label-1075..S
27290 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2b  ELECT + col0 / +
272a0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
272b0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab0..----..0
272c0 0d 0a 31 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79  ..1..35....query
272d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
272e0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
272f0 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 41   * - tab2.col0 A
27300 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
27310 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d  ..----..-1343..-
27320 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75  217..-4602....qu
27330 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27340 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39  ELECT DISTINCT 9
27350 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * - col1 + + co
27360 72 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 41  r0.col0 - col2 A
27370 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
27380 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
27390 33 0d 0a 2d 32 38 35 0d 0a 2d 38 33 0d 0a 0d 0a  3..-285..-83....
273a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
273b0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
273c0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
273d0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
273e0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
273f0 72 74 20 6c 61 62 65 6c 2d 31 30 37 38 0d 0a 53  rt label-1078..S
27400 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20  ELECT ALL CAST( 
27410 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
27420 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
27430 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
27440 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
27450 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
27460 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
27470 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
27480 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
27490 6c 2d 31 30 37 38 0d 0a 53 45 4c 45 43 54 20 41  l-1078..SELECT A
274a0 4c 4c 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  LL CAST ( NULL A
274b0 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f  S INTEGER ) + co
274c0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
274d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
274e0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
274f0 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
27500 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27510 2b 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c  + + col0 - - col
27520 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  1 * col0 AS col0
27530 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
27540 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a  r0..----..1120..
27550 37 30 34 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69  704..81....skipi
27560 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
27570 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
27580 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
27590 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
275a0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
275b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
275c0 49 4e 43 54 20 2d 20 2d 20 31 20 2a 20 63 6f 6c  INCT - - 1 * col
275d0 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 34 36 20  0 + - col0 * 46 
275e0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
275f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
27600 30 38 30 0d 0a 2d 31 35 37 35 0d 0a 2d 34 30 30  080..-1575..-400
27610 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
27620 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
27630 20 2d 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f   - col2 ) * + co
27640 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
27650 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39  --..35..7298..79
27660 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
27670 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
27680 6f 6c 32 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f  ol2 ) * col1 FRO
27690 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab1..----..12
276a0 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d  48..1404..570...
276b0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
276c0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
276d0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
276e0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
276f0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
27700 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27710 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  T - col2 * col0 
27720 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
27730 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32  ----..-189..-202
27740 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 73 6b 69 70  8..-3002....skip
27750 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
27760 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
27770 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27780 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54  CT DISTINCT CAST
27790 20 28 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31   ( col0 + - col1
277a0 20 41 53 20 52 45 41 4c 20 29 20 2a 20 2d 20 63   AS REAL ) * - c
277b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
277c0 2d 2d 2d 0d 0a 31 36 34 0d 0a 32 30 34 36 0d 0a  ---..164..2046..
277d0 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
277e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
277f0 4c 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 72  L + + col2 - cor
27800 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  0.col2 AS col0 F
27810 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
27820 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
27830 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27840 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
27850 4e 43 54 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 30  NCT + - ( + col0
27860 20 29 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 38 39   ) + + col2 + 89
27870 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
27880 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31  r0..----..105..1
27890 34 30 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20  40..82....query 
278a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
278b0 54 20 44 49 53 54 49 4e 43 54 20 34 36 20 2a 20  T DISTINCT 46 * 
278c0 63 6f 6c 32 20 2b 20 36 38 20 46 52 4f 4d 20 74  col2 + 68 FROM t
278d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
278e0 2d 0d 0a 31 32 36 34 0d 0a 31 33 31 30 0d 0a 31  -..1264..1310..1
278f0 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  816....query I r
27900 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
27910 20 37 39 20 2a 20 28 20 2b 20 63 6f 6c 31 20 2a   79 * ( + col1 *
27920 20 2b 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f   + col0 ) + - co
27930 6c 32 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l2 - - col2 FROM
27940 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36   tab2..----..106
27950 30 39 37 0d 0a 31 37 31 34 33 0d 0a 33 36 33 35  097..17143..3635
27960 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
27970 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
27980 53 54 49 4e 43 54 20 28 20 33 39 20 29 20 2a 20  STINCT ( 39 ) * 
27990 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63  col2 + col0 AS c
279a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
279b0 2d 2d 2d 0d 0a 31 30 36 30 0d 0a 31 30 39 32 0d  ---..1060..1092.
279c0 0a 31 35 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .1561....query I
279d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
279e0 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 2b 20 32   tab0.col2 * + 2
279f0 34 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20 46 52  4 * tab0.col2 FR
27a00 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
27a10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
27a20 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
27a30 20 64 35 31 62 37 61 38 65 61 62 34 39 66 64 37   d51b7a8eab49fd7
27a40 30 66 39 66 38 62 63 65 33 61 66 38 35 32 63 36  0f9f8bce3af852c6
27a50 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
27a60 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
27a70 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
27a80 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
27a90 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
27aa0 2d 31 30 39 31 0d 0a 53 45 4c 45 43 54 20 63 6f  -1091..SELECT co
27ab0 6c 31 20 2a 20 63 6f 6c 32 20 44 49 56 20 74 61  l1 * col2 DIV ta
27ac0 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b1.col1 FROM tab
27ad0 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d  1..----..54..57.
27ae0 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .96....skipif my
27af0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
27b00 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
27b10 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39 31  wsort label-1091
27b20 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
27b30 63 6f 6c 32 20 2f 20 74 61 62 31 2e 63 6f 6c 31  col2 / tab1.col1
27b40 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
27b50 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a  ..54..57..96....
27b60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27b70 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
27b80 20 2a 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30   * col0 - + col0
27b90 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
27ba0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 30 0d 0a  b0..----..1190..
27bb0 35 35 32 0d 0a 37 38 33 32 0d 0a 0d 0a 71 75 65  552..7832....que
27bc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27bd0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61  LECT DISTINCT ta
27be0 62 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30  b0.col1 + + col0
27bf0 20 2a 20 63 6f 6c 31 20 2a 20 74 61 62 30 2e 63   * col1 * tab0.c
27c00 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 - + col2 AS 
27c10 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
27c20 2d 2d 2d 2d 0d 0a 31 31 38 39 32 31 0d 0a 34 39  ----..118921..49
27c30 35 38 39 0d 0a 37 32 30 38 32 30 0d 0a 0d 0a 71  589..720820....q
27c40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27c50 53 45 4c 45 43 54 20 2d 20 31 39 20 2b 20 38 38  SELECT - 19 + 88
27c60 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
27c70 62 32 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  b2, tab1 cor0..-
27c80 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
27c90 73 68 69 6e 67 20 74 6f 20 38 35 64 39 62 39 30  shing to 85d9b90
27ca0 61 30 33 62 39 64 65 66 31 36 31 38 39 31 62 31  a03b9def161891b1
27cb0 33 30 38 35 32 37 31 66 37 0d 0a 0d 0a 71 75 65  3085271f7....que
27cc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27cd0 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 28 20  LECT - col1 + ( 
27ce0 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2d 20 63 6f  cor0.col1 ) - co
27cf0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
27d00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d  cor0..----..-24.
27d10 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65  .-35..-89....que
27d20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27d30 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  LECT - col1 * co
27d40 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30  l1 + col1 + cor0
27d50 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20  .col2 FROM tab2 
27d60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34  cor0..----..-234
27d70 0d 0a 2d 33 33 39 36 0d 0a 2d 39 30 33 0d 0a 0d  ..-3396..-903...
27d80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27d90 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
27da0 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  2 * + col2 * + c
27db0 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 + - cor0.col
27dc0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
27dd0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
27de0 2d 0d 0a 31 31 34 30 33 38 0d 0a 35 30 37 36 0d  -..114038..5076.
27df0 0a 35 32 37 30 32 0d 0a 0d 0a 71 75 65 72 79 20  .52702....query 
27e00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27e10 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  T + col1 + - col
27e20 30 20 2a 20 2d 20 39 32 20 46 52 4f 4d 20 74 61  0 * - 92 FROM ta
27e30 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
27e40 0d 0a 32 32 39 34 0d 0a 33 33 31 37 0d 0a 38 32  ..2294..3317..82
27e50 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
27e60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
27e70 53 54 49 4e 43 54 20 39 36 20 2a 20 63 6f 6c 32  STINCT 96 * col2
27e80 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
27e90 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
27ea0 0d 0a 35 31 38 34 0d 0a 35 34 37 32 0d 0a 39 32  ..5184..5472..92
27eb0 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
27ec0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
27ed0 72 30 2e 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30  r0.col2 - + col0
27ee0 20 2a 20 36 20 41 53 20 63 6f 6c 32 20 46 52 4f   * 6 AS col2 FRO
27ef0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
27f00 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d 34 33 36 0d  ----..-15..-436.
27f10 0a 2d 34 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-442....query I
27f20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27f30 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   ALL col2 * col2
27f40 20 2b 20 2b 20 30 20 2a 20 2d 20 38 34 20 41 53   + + 0 * - 84 AS
27f50 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
27f60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
27f70 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d  916..3249..9216.
27f80 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
27f90 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
27fa0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
27fb0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
27fc0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
27fd0 31 30 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  102..SELECT ALL 
27fe0 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 2b 20  col1 DIV col1 + 
27ff0 2b 20 37 32 20 46 52 4f 4d 20 74 61 62 32 20 41  + 72 FROM tab2 A
28000 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  S cor0..----..73
28010 0d 0a 37 33 0d 0a 37 33 0d 0a 0d 0a 73 6b 69 70  ..73..73....skip
28020 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
28030 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
28040 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
28050 2d 31 31 30 32 0d 0a 53 45 4c 45 43 54 20 41 4c  -1102..SELECT AL
28060 4c 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 2b 20  L col1 / col1 + 
28070 2b 20 37 32 20 46 52 4f 4d 20 74 61 62 32 20 41  + 72 FROM tab2 A
28080 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  S cor0..----..73
28090 0d 0a 37 33 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72  ..73..73....quer
280a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
280b0 45 43 54 20 41 4c 4c 20 2b 20 2d 20 33 35 20 46  ECT ALL + - 35 F
280c0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
280d0 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 33 35 0d 0a 2d  ---..-35..-35..-
280e0 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
280f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
28100 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20  STINCT + col0 * 
28110 2d 20 39 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  - 9 + col1 + + c
28120 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol1 * + col2 FRO
28130 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
28140 2d 0d 0a 2d 31 32 31 0d 0a 32 37 30 38 0d 0a 36  -..-121..2708..6
28150 37 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  752....query I r
28160 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
28170 49 53 54 49 4e 43 54 20 37 37 20 41 53 20 63 6f  ISTINCT 77 AS co
28180 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
28190 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b1 AS cor0, tab2
281a0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
281b0 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  77....query I ro
281c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
281d0 74 61 62 31 2e 63 6f 6c 30 20 2d 20 63 6f 6c 32  tab1.col0 - col2
281e0 20 2a 20 2b 20 35 20 41 53 20 63 6f 6c 31 20 46   * + 5 AS col1 F
281f0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
28200 2d 32 37 33 0d 0a 2d 33 34 39 0d 0a 2d 35 36 30  -273..-349..-560
28210 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28220 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
28230 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63   * cor0.col2 * c
28240 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
28250 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
28260 2d 2d 2d 0d 0a 36 31 31 38 38 34 0d 0a 39 33 36  ---..611884..936
28270 35 34 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  54..97....query 
28280 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28290 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
282a0 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  + + col2 * + col
282b0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
282c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
282d0 2d 0d 0a 37 30 0d 0a 37 33 38 37 0d 0a 38 31 36  -..70..7387..816
282e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
282f0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
28300 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
28310 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
28320 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
28330 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28340 4c 45 43 54 20 2b 20 2d 20 36 33 20 63 6f 6c 32  LECT + - 63 col2
28350 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
28360 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 33 0d 0a 2d  r0..----..-63..-
28370 36 33 0d 0a 2d 36 33 0d 0a 0d 0a 73 6b 69 70 69  63..-63....skipi
28380 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
28390 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
283a0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
283b0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
283c0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
283d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
283e0 49 4e 43 54 20 63 6f 72 31 2e 63 6f 6c 30 20 63  INCT cor1.col0 c
283f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol0 FROM tab1, t
28400 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab1 AS cor0, tab
28410 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
28420 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71  .24..35..89....q
28430 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28440 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
28450 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  0.col1 + col0 * 
28460 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
28470 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
28480 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 36 0d 0a 2d  ..----..-1326..-
28490 31 38 36 0d 0a 2d 34 35 34 33 0d 0a 0d 0a 71 75  186..-4543....qu
284a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
284b0 45 4c 45 43 54 20 2b 20 37 30 20 2a 20 63 6f 72  ELECT + 70 * cor
284c0 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
284d0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
284e0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
284f0 61 73 68 69 6e 67 20 74 6f 20 62 65 30 30 35 39  ashing to be0059
28500 31 66 39 38 38 36 64 37 65 62 38 34 35 38 34 35  1f9886d7eb845845
28510 38 36 63 31 34 30 36 33 37 33 0d 0a 0d 0a 71 75  86c1406373....qu
28520 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28530 45 4c 45 43 54 20 2d 20 28 20 2b 20 33 37 20 29  ELECT - ( + 37 )
28540 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
28550 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
28560 33 37 0d 0a 2d 33 37 0d 0a 2d 33 37 0d 0a 0d 0a  37..-37..-37....
28570 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28580 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
28590 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 38 31  cor0.col0 * + 81
285a0 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   - + col2 AS col
285b0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
285c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 30 0d 0a  or0..----..540..
285d0 36 32 39 32 0d 0a 36 33 36 31 0d 0a 0d 0a 71 75  6292..6361....qu
285e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
285f0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
28600 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 35 39   - - col0 * + 59
28610 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
28620 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 0d 0a 33  r0..----..151..3
28630 37 36 36 0d 0a 34 37 30 37 0d 0a 0d 0a 6f 6e 6c  766..4707....onl
28640 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
28650 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
28660 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
28670 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
28680 72 74 20 6c 61 62 65 6c 2d 31 31 31 36 0d 0a 53  rt label-1116..S
28690 45 4c 45 43 54 20 41 4c 4c 20 36 31 20 2b 20 2d  ELECT ALL 61 + -
286a0 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 32   col0 DIV - col2
286b0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
286c0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
286d0 0d 0a 36 31 0d 0a 36 31 0d 0a 36 32 0d 0a 0d 0a  ..61..61..62....
286e0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
286f0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
28700 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28710 61 62 65 6c 2d 31 31 31 36 0d 0a 53 45 4c 45 43  abel-1116..SELEC
28720 54 20 41 4c 4c 20 36 31 20 2b 20 2d 20 63 6f 6c  T ALL 61 + - col
28730 30 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  0 / - col2 AS co
28740 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
28750 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a  cor0..----..61..
28760 36 31 0d 0a 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  61..62....onlyif
28770 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
28780 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
28790 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
287a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
287b0 6c 61 62 65 6c 2d 31 31 31 37 0d 0a 53 45 4c 45  label-1117..SELE
287c0 43 54 20 2b 20 28 20 63 6f 6c 31 20 29 20 44 49  CT + ( col1 ) DI
287d0 56 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  V + col1 AS col2
287e0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
287f0 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..1..1..1....ski
28800 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
28810 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
28820 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28830 6c 2d 31 31 31 37 0d 0a 53 45 4c 45 43 54 20 2b  l-1117..SELECT +
28840 20 28 20 63 6f 6c 31 20 29 20 2f 20 2b 20 63 6f   ( col1 ) / + co
28850 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
28860 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  tab1..----..1..1
28870 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..1....query I r
28880 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
28890 4c 4c 20 2d 20 36 30 20 2a 20 63 6f 6c 32 20 46  LL - 60 * col2 F
288a0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
288b0 2d 31 39 38 30 0d 0a 2d 34 39 32 30 0d 0a 2d 36  -1980..-4920..-6
288c0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
288d0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
288e0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
288f0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
28900 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
28910 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28920 45 4c 45 43 54 20 2d 20 34 31 20 2b 20 63 6f 6c  ELECT - 41 + col
28930 31 20 2a 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  1 * col2 col2 FR
28940 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28950 0a 2d 2d 2d 2d 0d 0a 31 32 30 37 0d 0a 31 33 36  .----..1207..136
28960 33 0d 0a 35 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  3..529....onlyif
28970 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
28980 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
28990 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
289a0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
289b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
289c0 65 6c 2d 31 31 32 30 0d 0a 53 45 4c 45 43 54 20  el-1120..SELECT 
289d0 41 4c 4c 20 2d 20 2b 20 28 20 63 6f 6c 31 20 29  ALL - + ( col1 )
289e0 20 2f 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   / CAST( NULL AS
289f0 20 53 49 47 4e 45 44 20 29 20 2b 20 39 38 20 46   SIGNED ) + 98 F
28a00 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
28a10 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
28a20 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
28a30 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
28a40 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
28a50 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
28a60 2d 31 31 32 30 0d 0a 53 45 4c 45 43 54 20 41 4c  -1120..SELECT AL
28a70 4c 20 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20 2f  L - + ( col1 ) /
28a80 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
28a90 49 4e 54 45 47 45 52 20 29 20 2b 20 39 38 20 46  INTEGER ) + 98 F
28aa0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
28ab0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
28ac0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
28ad0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28ae0 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  ECT - col2 * + c
28af0 6f 6c 31 20 2d 20 2b 20 36 33 20 41 53 20 63 6f  ol1 - + 63 AS co
28b00 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
28b10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39  cor0..----..-159
28b20 37 0d 0a 2d 37 30 39 0d 0a 2d 39 30 30 0d 0a 0d  7..-709..-900...
28b30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28b40 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
28b50 54 20 2b 20 2d 20 33 34 20 2d 20 63 6f 6c 32 20  T + - 34 - col2 
28b60 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  * - cor0.col1 AS
28b70 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
28b80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
28b90 35 30 30 0d 0a 36 31 32 0d 0a 38 30 33 0d 0a 0d  500..612..803...
28ba0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
28bb0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
28bc0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
28bd0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
28be0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
28bf0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28c00 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  T - col1 + - col
28c10 32 20 2a 20 28 20 63 6f 6c 31 20 29 20 63 6f 6c  2 * ( col1 ) col
28c20 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
28c30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 31  or0..----..-1261
28c40 0d 0a 2d 31 34 33 30 0d 0a 2d 35 38 30 0d 0a 0d  ..-1430..-580...
28c50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28c60 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
28c70 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  T - col0 * + col
28c80 30 20 2b 20 35 35 20 41 53 20 63 6f 6c 32 20 46  0 + 55 AS col2 F
28c90 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
28ca0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 30 0d 0a 2d  ..----..-1170..-
28cb0 35 32 31 0d 0a 2d 37 38 36 36 0d 0a 0d 0a 71 75  521..-7866....qu
28cc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28cd0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 33  ELECT DISTINCT 3
28ce0 39 20 2d 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  9 - - col0 AS co
28cf0 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
28d00 2d 2d 0d 0a 31 30 33 0d 0a 31 31 39 0d 0a 34 32  --..103..119..42
28d10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28d20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
28d30 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30  cor0.col0 + cor0
28d40 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
28d50 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
28d60 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d 0a  .----..-34..-7..
28d70 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
28d80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38  sort..SELECT - 8
28d90 38 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  8 + col1 FROM ta
28da0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 33 0d  b0..----..-2..3.
28db0 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .9....query I ro
28dc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37 38  wsort..SELECT 78
28dd0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
28de0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
28df0 0a 31 34 32 0d 0a 31 35 38 0d 0a 38 31 0d 0a 0d  .142..158..81...
28e00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28e10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 34 20  ..SELECT ALL 94 
28e20 2a 20 2b 20 63 6f 6c 32 20 2a 20 36 34 20 2b 20  * + col2 * 64 + 
28e30 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  - col1 * col2 FR
28e40 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
28e50 35 34 38 38 32 0d 0a 31 36 31 35 39 35 0d 0a 32  54882..161595..2
28e60 32 37 39 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  27962....query I
28e70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28e80 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2b 20 63   tab0.col2 + + c
28e90 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol2 * col1 AS co
28ea0 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
28eb0 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35 34 34 0d 0a  --..2871..7544..
28ec0 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
28ed0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 33  wsort..SELECT 33
28ee0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
28ef0 62 31 2c 20 74 61 62 30 2c 20 74 61 62 32 20 41  b1, tab0, tab2 A
28f00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
28f10 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
28f20 74 6f 20 37 36 64 61 38 62 63 37 63 61 65 31 38  to 76da8bc7cae18
28f30 65 63 66 38 35 36 34 33 38 66 38 37 32 34 33 30  ecf856438f872430
28f40 63 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  c80....skipif po
28f50 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
28f60 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
28f70 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
28f80 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
28f90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28fa0 0a 53 45 4c 45 43 54 20 2d 20 39 34 20 63 6f 6c  .SELECT - 94 col
28fb0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
28fc0 2d 0d 0a 2d 39 34 0d 0a 2d 39 34 0d 0a 2d 39 34  -..-94..-94..-94
28fd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28fe0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
28ff0 39 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 28 20  92 * col0 + - ( 
29000 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30  col2 ) FROM tab0
29010 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29020 32 31 37 35 0d 0a 33 32 31 39 0d 0a 38 31 30 36  2175..3219..8106
29030 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
29040 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
29050 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
29060 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
29070 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29080 31 31 33 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63  1134..SELECT + c
29090 6f 6c 32 20 44 49 56 20 2b 20 74 61 62 32 2e 63  ol2 DIV + tab2.c
290a0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
290b0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
290c0 30 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..2....skipif m
290d0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
290e0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
290f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33  owsort label-113
29100 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  4..SELECT + col2
29110 20 2f 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 41   / + tab2.col1 A
29120 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
29130 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 32 0d  ..----..0..0..2.
29140 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29150 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
29160 4e 43 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  NCT ( - cor0.col
29170 30 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  0 ) * - cor0.col
29180 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
29190 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
291a0 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38  -..2064..3395..8
291b0 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  099....query I r
291c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38  owsort..SELECT 8
291d0 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
291e0 30 20 63 6f 72 30 2c 20 74 61 62 30 20 63 6f 72  0 cor0, tab0 cor
291f0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
29200 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 39  es hashing to 99
29210 39 32 30 64 39 66 37 63 64 39 63 64 63 63 65 66  920d9f7cd9cdccef
29220 39 39 63 66 61 34 35 39 61 65 36 39 34 34 0d 0a  99cfa459ae6944..
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 2d 20 28 20 2d 20  t..SELECT - ( - 
29250 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
29260 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
29270 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31 0d 0a  or0, tab1 cor1..
29280 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
29290 68 61 73 68 69 6e 67 20 74 6f 20 65 32 35 36 38  hashing to e2568
292a0 62 30 31 64 64 34 31 31 62 35 61 32 30 36 30 36  b01dd411b5a20606
292b0 38 36 39 37 64 30 65 64 30 64 32 0d 0a 0d 0a 71  8697d0ed0d2....q
292c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
292d0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
292e0 32 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 41 53  2 + tab2.col0 AS
292f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
29300 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34 31 0d 0a  .----..-20..41..
29310 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  52....query I ro
29320 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
29330 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  - cor0.col1 FROM
29340 20 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62   tab2, tab1, tab
29350 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
29360 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
29370 6e 67 20 74 6f 20 64 34 63 36 37 33 62 37 34 34  ng to d4c673b744
29380 34 65 62 39 39 32 37 65 63 36 33 31 37 35 62 34  4eb9927ec63175b4
29390 33 63 36 62 38 34 0d 0a 0d 0a 71 75 65 72 79 20  3c6b84....query 
293a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
293b0 54 20 2d 20 38 35 20 2b 20 63 6f 6c 31 20 41 53  T - 85 + col1 AS
293c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
293d0 0a 2d 2d 2d 2d 0d 0a 2d 35 39 0d 0a 2d 37 32 0d  .----..-59..-72.
293e0 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-75....query I 
293f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29400 44 49 53 54 49 4e 43 54 20 33 34 20 2b 20 63 6f  DISTINCT 34 + co
29410 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
29420 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 0d  tab0..----..120.
29430 0a 31 32 35 0d 0a 31 33 31 0d 0a 0d 0a 71 75 65  .125..131....que
29440 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29450 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 28 20  LECT - col2 + ( 
29460 2d 20 38 34 20 2a 20 2d 20 74 61 62 32 2e 63 6f  - 84 * - tab2.co
29470 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  l1 ) FROM tab2..
29480 2d 2d 2d 2d 0d 0a 31 33 39 30 0d 0a 32 35 37 37  ----..1390..2577
29490 0d 0a 34 39 33 30 0d 0a 0d 0a 71 75 65 72 79 20  ..4930....query 
294a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
294b0 54 20 63 6f 6c 31 20 2d 20 2d 20 32 36 20 2a 20  T col1 - - 26 * 
294c0 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  + col0 * - col1 
294d0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
294e0 0a 2d 32 31 30 34 38 33 0d 0a 2d 35 33 35 37 38  .-210483..-53578
294f0 0d 0a 2d 38 38 31 37 33 0d 0a 0d 0a 73 6b 69 70  ..-88173....skip
29500 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
29510 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
29520 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
29530 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
29540 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
29550 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74  sort..SELECT - t
29560 61 62 32 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  ab2.col0 + col2 
29570 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
29580 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d 0a  ----..-41..-52..
29590 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
295a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
295b0 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  col2 * + col0 + 
295c0 63 6f 6c 30 20 2a 20 28 20 33 31 20 29 20 2b 20  col0 * ( 31 ) + 
295d0 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
295e0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
295f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 37 33  or0..----..10173
29600 0d 0a 32 38 31 0d 0a 35 36 34 32 0d 0a 0d 0a 6f  ..281..5642....o
29610 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
29620 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
29630 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
29640 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
29650 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 36 0d  sort label-1146.
29660 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44  .SELECT - col2 D
29670 49 56 20 38 33 20 46 52 4f 4d 20 74 61 62 30 20  IV 83 FROM tab0 
29680 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
29690 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
296a0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
296b0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
296c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
296d0 31 34 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  146..SELECT - co
296e0 6c 32 20 2f 20 38 33 20 46 52 4f 4d 20 74 61 62  l2 / 83 FROM tab
296f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
29700 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
29710 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29720 45 43 54 20 2d 20 33 36 20 2a 20 63 6f 6c 30 20  ECT - 36 * col0 
29730 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
29740 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d  0..----..-108..-
29750 32 33 30 34 0d 0a 2d 32 38 38 30 0d 0a 0d 0a 71  2304..-2880....q
29760 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29770 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
29780 2a 20 2d 20 34 35 20 2b 20 74 61 62 32 2e 63 6f  * - 45 + tab2.co
29790 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  l2 * + col2 * - 
297a0 36 35 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  65 FROM tab2..--
297b0 2d 2d 0d 0a 2d 34 35 31 31 30 0d 0a 2d 34 38 36  --..-45110..-486
297c0 30 30 0d 0a 2d 39 35 35 37 30 0d 0a 0d 0a 71 75  00..-95570....qu
297d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
297e0 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 31  ELECT col1 * + 1
297f0 30 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20  0 * + tab0.col0 
29800 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
29810 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 30 0d 0a  0..----..20640..
29820 33 33 39 35 30 0d 0a 38 30 39 39 30 0d 0a 0d 0a  33950..80990....
29830 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29840 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
29850 20 2d 20 63 6f 6c 32 20 2a 20 36 33 20 46 52 4f   - col2 * 63 FRO
29860 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
29870 30 37 39 0d 0a 2d 35 31 36 36 0d 0a 2d 36 33 0d  079..-5166..-63.
29880 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29890 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62  rt..SELECT + tab
298a0 30 2e 63 6f 6c 32 20 2b 20 37 38 20 2a 20 2b 20  0.col2 + 78 * + 
298b0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
298c0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  M tab0..----..26
298d0 30 37 0d 0a 36 34 37 38 0d 0a 37 39 0d 0a 0d 0a  07..6478..79....
298e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
298f0 0a 53 45 4c 45 43 54 20 36 36 20 46 52 4f 4d 20  .SELECT 66 FROM 
29900 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
29910 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
29920 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 39  es hashing to 29
29930 37 39 34 39 31 35 62 35 38 35 65 65 61 38 34 38  794915b585eea848
29940 61 64 36 37 30 30 37 35 34 35 32 63 38 38 0d 0a  ad670075452c88..
29950 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29960 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
29970 6c 31 20 2a 20 31 31 20 2b 20 63 6f 6c 32 20 41  l1 * 11 + col2 A
29980 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
29990 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
299a0 31 36 37 0d 0a 32 33 39 0d 0a 33 34 30 0d 0a 0d  167..239..340...
299b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
299c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
299d0 54 20 2d 20 2d 20 31 39 20 41 53 20 63 6f 6c 32  T - - 19 AS col2
299e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
299f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a 0d 0a  r0..----..19....
29a00 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
29a10 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
29a20 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
29a30 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
29a40 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
29a50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29a60 20 41 4c 4c 20 2d 20 28 20 2d 20 33 31 20 29 20   ALL - ( - 31 ) 
29a70 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52  * + col0 col2 FR
29a80 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
29a90 0a 2d 2d 2d 2d 0d 0a 31 30 38 35 0d 0a 32 37 35  .----..1085..275
29aa0 39 0d 0a 37 34 34 0d 0a 0d 0a 71 75 65 72 79 20  9..744....query 
29ab0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29ac0 54 20 41 4c 4c 20 2b 20 2b 20 37 33 20 2b 20 2b  T ALL + + 73 + +
29ad0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
29ae0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 0d  cor0..----..106.
29af0 0a 31 35 35 0d 0a 37 34 0d 0a 0d 0a 73 6b 69 70  .155..74....skip
29b00 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
29b10 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
29b20 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
29b30 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
29b40 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
29b50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
29b60 54 49 4e 43 54 20 2d 20 33 30 20 63 6f 6c 32 20  TINCT - 30 col2 
29b70 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
29b80 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a 0d 0a  0..----..-30....
29b90 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
29ba0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
29bb0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
29bc0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
29bd0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 38  wsort label-1158
29be0 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 33 37 20  ..SELECT - - 37 
29bf0 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  DIV col0 FROM ta
29c00 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
29c10 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..0..1..1....ski
29c20 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
29c30 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
29c40 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
29c50 6c 2d 31 31 35 38 0d 0a 53 45 4c 45 43 54 20 2d  l-1158..SELECT -
29c60 20 2d 20 33 37 20 2f 20 63 6f 6c 30 20 46 52 4f   - 37 / col0 FRO
29c70 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
29c80 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d  ----..0..1..1...
29c90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29ca0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 38  ..SELECT ALL + 8
29cb0 37 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  7 * col2 FROM ta
29cc0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
29cd0 0d 0a 32 32 36 32 0d 0a 32 33 34 39 0d 0a 33 33  ..2262..2349..33
29ce0 30 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  06....onlyif mys
29cf0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
29d00 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
29d10 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
29d20 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
29d30 6c 2d 31 31 36 30 0d 0a 53 45 4c 45 43 54 20 44  l-1160..SELECT D
29d40 49 53 54 49 4e 43 54 20 2b 20 2b 20 28 20 63 6f  ISTINCT + + ( co
29d50 6c 31 20 29 20 44 49 56 20 63 6f 72 30 2e 63 6f  l1 ) DIV cor0.co
29d60 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
29d70 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
29d80 2d 2d 0d 0a 30 0d 0a 34 0d 0a 0d 0a 73 6b 69 70  --..0..4....skip
29d90 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
29da0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
29db0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
29dc0 2d 31 31 36 30 0d 0a 53 45 4c 45 43 54 20 44 49  -1160..SELECT DI
29dd0 53 54 49 4e 43 54 20 2b 20 2b 20 28 20 63 6f 6c  STINCT + + ( col
29de0 31 20 29 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20  1 ) / cor0.col0 
29df0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
29e00 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
29e10 0a 30 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..4....query I
29e20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29e30 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
29e40 6c 31 20 2b 20 2b 20 33 30 20 41 53 20 63 6f 6c  l1 + + 30 AS col
29e50 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
29e60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d 0a  or0..----..-56..
29e70 2d 36 31 0d 0a 2d 36 37 0d 0a 0d 0a 71 75 65 72  -61..-67....quer
29e80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29e90 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  ECT - col2 + col
29ea0 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  0 * + col1 AS co
29eb0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
29ec0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 35  cor0..----..1305
29ed0 0d 0a 31 39 30 0d 0a 34 35 37 36 0d 0a 0d 0a 71  ..190..4576....q
29ee0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29ef0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
29f00 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  + cor0.col1 + + 
29f10 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col0 * col2 FROM
29f20 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
29f30 2d 2d 2d 0d 0a 31 33 32 0d 0a 37 33 38 39 0d 0a  ---..132..7389..
29f40 38 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  878....query I r
29f50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
29f60 20 33 34 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20   34 + col1 FROM 
29f70 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a  tab0..----..52..
29f80 35 37 0d 0a 36 33 0d 0a 0d 0a 71 75 65 72 79 20  57..63....query 
29f90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29fa0 54 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 63 6f  T tab2.col0 * co
29fb0 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l1 + - col2 FROM
29fc0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30   tab2..----..130
29fd0 35 0d 0a 31 39 30 0d 0a 34 35 37 36 0d 0a 0d 0a  5..190..4576....
29fe0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29ff0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
2a000 6f 6c 32 20 2a 20 2b 20 33 34 20 2b 20 2b 20 37  ol2 * + 34 + + 7
2a010 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  6 AS col1 FROM t
2a020 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2a030 2d 0d 0a 31 33 36 38 0d 0a 39 36 30 0d 0a 39 39  -..1368..960..99
2a040 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
2a050 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2a060 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2a070 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2a080 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2a090 2d 31 31 36 37 0d 0a 53 45 4c 45 43 54 20 44 49  -1167..SELECT DI
2a0a0 53 54 49 4e 43 54 20 2b 20 39 39 20 44 49 56 20  STINCT + 99 DIV 
2a0b0 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  tab0.col0 FROM t
2a0c0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d  ab0..----..1..2.
2a0d0 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .4....skipif mys
2a0e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2a0f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2a100 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 37 0d  sort label-1167.
2a110 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2a120 20 2b 20 39 39 20 2f 20 74 61 62 30 2e 63 6f 6c   + 99 / tab0.col
2a130 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2a140 2d 0d 0a 31 0d 0a 32 0d 0a 34 0d 0a 0d 0a 71 75  -..1..2..4....qu
2a150 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a160 45 4c 45 43 54 20 2d 20 37 35 20 2a 20 63 6f 6c  ELECT - 75 * col
2a170 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
2a180 2d 0d 0a 2d 35 32 35 0d 0a 2d 35 38 35 30 0d 0a  -..-525..-5850..
2a190 2d 35 39 32 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -5925....onlyif 
2a1a0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2a1b0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2a1c0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2a1d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2a1e0 61 62 65 6c 2d 31 31 36 39 0d 0a 53 45 4c 45 43  abel-1169..SELEC
2a1f0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36 35 20  T DISTINCT - 65 
2a200 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  DIV - col0 FROM 
2a210 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  tab0..----..0..1
2a220 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..2....skipif my
2a230 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2a240 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2a250 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 39  wsort label-1169
2a260 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2a270 54 20 2d 20 36 35 20 2f 20 2d 20 63 6f 6c 30 20  T - 65 / - col0 
2a280 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2a290 0a 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a 71 75 65 72  .0..1..2....quer
2a2a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a2b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2a2c0 6f 6c 31 20 2a 20 2b 20 34 34 20 2b 20 63 6f 6c  ol1 * + 44 + col
2a2d0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2a2e0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
2a2f0 33 38 31 37 0d 0a 34 30 38 36 0d 0a 34 32 36 39  3817..4086..4269
2a300 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2a310 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 32  ort..SELECT - 52
2a320 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
2a330 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
2a340 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2a350 20 39 35 30 30 61 66 65 35 36 34 36 64 36 32 30   9500afe5646d620
2a360 64 35 65 38 39 34 33 33 35 31 61 32 39 64 30 38  d5e8943351a29d08
2a370 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2a380 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
2a390 20 63 6f 6c 32 20 2a 20 2d 20 32 34 20 41 53 20   col2 * - 24 AS 
2a3a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2a3b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2a3c0 39 36 38 0d 0a 2d 32 34 0d 0a 2d 37 39 32 0d 0a  968..-24..-792..
2a3d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a3e0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
2a3f0 20 2b 20 38 20 2a 20 2d 20 63 6f 6c 30 20 46 52   + 8 * - col0 FR
2a400 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2a410 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 35 36 35  .----..-25..-565
2a420 0d 0a 2d 36 31 35 0d 0a 0d 0a 71 75 65 72 79 20  ..-615....query 
2a430 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a440 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20  T cor0.col0 + + 
2a450 28 20 2d 20 32 34 20 2a 20 63 6f 72 30 2e 63 6f  ( - 24 * cor0.co
2a460 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  l2 ) FROM tab2 A
2a470 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
2a480 34 36 0d 0a 2d 36 34 31 0d 0a 2d 38 33 33 0d 0a  46..-641..-833..
2a490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a4a0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
2a4b0 20 28 20 39 39 20 2a 20 63 6f 6c 30 20 29 20 2b   ( 99 * col0 ) +
2a4c0 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63   + col1 * cor0.c
2a4d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2a4e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33   cor0..----..123
2a4f0 38 33 0d 0a 39 31 38 31 0d 0a 39 34 31 0d 0a 0d  83..9181..941...
2a500 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a510 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2a520 54 20 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  T 0 + col1 FROM 
2a530 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a  tab0..----..86..
2a540 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  91..97....query 
2a550 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a560 54 20 41 4c 4c 20 35 39 20 2b 20 2d 20 63 6f 6c  T ALL 59 + - col
2a570 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
2a580 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a  ab1..----..-21..
2a590 2d 35 0d 0a 35 36 0d 0a 0d 0a 71 75 65 72 79 20  -5..56....query 
2a5a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a5b0 54 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 2d  T - ( col2 ) * -
2a5c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
2a5d0 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39 0d 0a  .----..1..1089..
2a5e0 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6724....query I 
2a5f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a600 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 31  ALL + + col1 + 1
2a610 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  7 AS col2 FROM t
2a620 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
2a630 32 37 0d 0a 33 30 0d 0a 34 33 0d 0a 0d 0a 71 75  27..30..43....qu
2a640 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a650 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
2a660 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   + col0 * - col0
2a670 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
2a680 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2a690 0a 2d 32 36 32 31 35 34 0d 0a 2d 35 31 32 30 31  .-262154..-51201
2a6a0 33 0d 0a 2d 35 33 0d 0a 0d 0a 71 75 65 72 79 20  3..-53....query 
2a6b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a6c0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
2a6d0 32 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  2 - + cor0.col2 
2a6e0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2a6f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2a700 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
2a710 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
2a720 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
2a730 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
2a740 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
2a750 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2a760 31 38 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  182..SELECT DIST
2a770 49 4e 43 54 20 2b 20 2b 20 43 41 53 54 28 20 4e  INCT + + CAST( N
2a780 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
2a790 2a 20 35 35 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  * 55 + + col0 * 
2a7a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
2a7b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2a7c0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2a7d0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2a7e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a7f0 74 20 6c 61 62 65 6c 2d 31 31 38 32 0d 0a 53 45  t label-1182..SE
2a800 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2a810 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
2a820 20 49 4e 54 45 47 45 52 20 29 20 2a 20 35 35 20   INTEGER ) * 55 
2a830 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  + + col0 * col0 
2a840 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
2a850 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
2a860 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2a870 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2a880 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2a890 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2a8a0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2a8b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2a8c0 20 74 61 62 30 2e 63 6f 6c 32 20 63 6f 6c 30 20   tab0.col2 col0 
2a8d0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
2a8e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
2a8f0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2a900 74 6f 20 62 35 61 34 31 30 32 31 30 37 65 35 65  to b5a4102107e5e
2a910 62 64 32 36 65 33 34 31 35 33 38 66 34 66 65 64  bd26e341538f4fed
2a920 65 31 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  e1e....query I r
2a930 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2a940 20 39 30 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29   90 + - ( col0 )
2a950 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
2a960 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2a970 0a 2d 31 31 33 30 0d 0a 2d 31 36 38 0d 0a 2d 37  .-1130..-168..-7
2a980 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
2a990 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2a9a0 4c 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 2b  L - ( + col2 ) +
2a9b0 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
2a9c0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2a9d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d  cor0..----..-21.
2a9e0 0a 33 33 0d 0a 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  .33..4....onlyif
2a9f0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2aa00 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2aa10 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2aa20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2aa30 6c 61 62 65 6c 2d 31 31 38 36 0d 0a 53 45 4c 45  label-1186..SELE
2aa40 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 34 39  CT DISTINCT + 49
2aa50 20 44 49 56 20 2d 20 36 33 20 46 52 4f 4d 20 74   DIV - 63 FROM t
2aa60 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2aa70 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  -..0....skipif m
2aa80 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2aa90 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2aaa0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38  owsort label-118
2aab0 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
2aac0 43 54 20 2b 20 34 39 20 2f 20 2d 20 36 33 20 46  CT + 49 / - 63 F
2aad0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2aae0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
2aaf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ab00 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20 39 39 20  LECT ALL ( - 99 
2ab10 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  ) + cor0.col2 FR
2ab20 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53  OM tab0, tab2 AS
2ab30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
2ab40 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2ab50 20 30 35 65 39 38 63 61 63 37 32 62 62 64 64 37   05e98cac72bbdd7
2ab60 37 39 62 61 31 36 66 64 34 32 36 65 35 65 34 63  79ba16fd426e5e4c
2ab70 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2ab80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2ab90 54 49 4e 43 54 20 2b 20 28 20 2b 20 63 6f 6c 31  TINCT + ( + col1
2aba0 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   ) + + col1 FROM
2abb0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2abc0 2d 2d 2d 0d 0a 32 30 0d 0a 32 36 0d 0a 35 32 0d  ---..20..26..52.
2abd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2abe0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2abf0 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b  NCT + + col0 * +
2ac00 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 30 20 29   col0 + ( col0 )
2ac10 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2ac20 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2ac30 0d 0a 35 36 0d 0a 36 31 36 32 0d 0a 36 33 32 30  ..56..6162..6320
2ac40 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2ac50 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2ac60 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2ac70 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2ac80 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2ac90 31 31 39 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  1190..SELECT DIS
2aca0 54 49 4e 43 54 20 32 38 20 44 49 56 20 63 6f 72  TINCT 28 DIV cor
2acb0 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  0.col0 + cor0.co
2acc0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
2acd0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2ace0 2d 2d 0d 0a 32 36 0d 0a 33 31 0d 0a 33 38 0d 0a  --..26..31..38..
2acf0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2ad00 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2ad10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ad20 20 6c 61 62 65 6c 2d 31 31 39 30 0d 0a 53 45 4c   label-1190..SEL
2ad30 45 43 54 20 44 49 53 54 49 4e 43 54 20 32 38 20  ECT DISTINCT 28 
2ad40 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f  / cor0.col0 + co
2ad50 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  r0.col2 AS col2 
2ad60 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2ad70 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 33 31 0d  0..----..26..31.
2ad80 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .38....query I r
2ad90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2ada0 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c  ISTINCT cor0.col
2adb0 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  0 * - col2 + + c
2adc0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 * + col2 AS 
2add0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
2ade0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
2adf0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ae00 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
2ae10 20 63 6f 6c 31 20 2b 20 2d 20 38 34 20 46 52 4f   col1 + - 84 FRO
2ae20 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2ae30 2d 2d 2d 2d 0d 0a 2d 31 36 31 38 0d 0a 2d 37 33  ----..-1618..-73
2ae40 30 0d 0a 2d 39 32 31 0d 0a 0d 0a 71 75 65 72 79  0..-921....query
2ae50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ae60 43 54 20 36 39 20 2b 20 28 20 63 6f 6c 32 20 29  CT 69 + ( col2 )
2ae70 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2ae80 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 0d 0a 39  b2..----..107..9
2ae90 35 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  5..96....onlyif 
2aea0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2aeb0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2aec0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2aed0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2aee0 61 62 65 6c 2d 31 31 39 34 0d 0a 53 45 4c 45 43  abel-1194..SELEC
2aef0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
2af00 31 20 44 49 56 20 63 6f 6c 31 20 2b 20 2b 20 63  1 DIV col1 + + c
2af10 6f 6c 31 20 44 49 56 20 2b 20 38 34 20 63 6f 6c  ol1 DIV + 84 col
2af20 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
2af30 2d 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -..1....skipif p
2af40 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2af50 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2af60 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2af70 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2af80 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2af90 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2afa0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2afb0 6c 61 62 65 6c 2d 31 31 39 34 0d 0a 53 45 4c 45  label-1194..SELE
2afc0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
2afd0 6c 31 20 2f 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l1 / col1 + + co
2afe0 6c 31 20 2f 20 2b 20 38 34 20 63 6f 6c 30 20 46  l1 / + 84 col0 F
2aff0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
2b000 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
2b010 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2b020 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2b030 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2b040 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2b050 2d 31 31 39 35 0d 0a 53 45 4c 45 43 54 20 2d 20  -1195..SELECT - 
2b060 32 31 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63  21 DIV col2 AS c
2b070 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
2b080 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2b090 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
2b0a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2b0b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2b0c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39  owsort label-119
2b0d0 35 0d 0a 53 45 4c 45 43 54 20 2d 20 32 31 20 2f  5..SELECT - 21 /
2b0e0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
2b0f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2b100 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
2b110 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2b120 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2b130 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2b140 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2b150 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2b160 39 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  96..SELECT - col
2b170 32 20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20  2 DIV + col0 AS 
2b180 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
2b190 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 30 0d 0a  ----..-3..0..0..
2b1a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2b1b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2b1c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b1d0 20 6c 61 62 65 6c 2d 31 31 39 36 0d 0a 53 45 4c   label-1196..SEL
2b1e0 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63  ECT - col2 / + c
2b1f0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
2b200 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   tab2..----..-3.
2b210 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
2b220 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2b230 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2b240 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2b250 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2b260 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b270 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 32 20 2b  t..SELECT - 72 +
2b280 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f   + col1 col2 FRO
2b290 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2b2a0 2d 2d 2d 2d 0d 0a 2d 34 36 0d 0a 2d 35 39 0d 0a  ----..-46..-59..
2b2b0 2d 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -62....query I r
2b2c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2b2d0 20 31 35 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20   15 * col2 FROM 
2b2e0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 30  tab1..----..1440
2b2f0 0d 0a 38 31 30 0d 0a 38 35 35 0d 0a 0d 0a 6f 6e  ..810..855....on
2b300 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2b310 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2b320 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2b330 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2b340 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 39 0d 0a  ort label-1199..
2b350 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 30  SELECT tab2.col0
2b360 20 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f   + col0 DIV + co
2b370 6c 30 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l0 - - col1 FROM
2b380 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38   tab2..----..138
2b390 0d 0a 33 39 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70  ..39..97....skip
2b3a0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2b3b0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2b3c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2b3d0 2d 31 31 39 39 0d 0a 53 45 4c 45 43 54 20 74 61  -1199..SELECT ta
2b3e0 62 32 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f  b2.col0 + col0 /
2b3f0 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 31   + col0 - - col1
2b400 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2b410 0d 0a 31 33 38 0d 0a 33 39 0d 0a 39 37 0d 0a 0d  ..138..39..97...
2b420 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b430 0d 0a 53 45 4c 45 43 54 20 32 39 20 2a 20 63 6f  ..SELECT 29 * co
2b440 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
2b450 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 35 36  cor0..----..1856
2b460 0d 0a 32 33 32 30 0d 0a 38 37 0d 0a 0d 0a 71 75  ..2320..87....qu
2b470 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b480 45 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c 30  ELECT - ( - col0
2b490 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
2b4a0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
2b4b0 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73 6b  .7..78..79....sk
2b4c0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2b4d0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2b4e0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2b4f0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2b500 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2b510 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2b520 4c 4c 20 38 34 20 2b 20 2d 20 63 6f 6c 31 20 63  LL 84 + - col1 c
2b530 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2b540 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d   cor0..----..25.
2b550 0a 35 33 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79  .53..67....query
2b560 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b570 43 54 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 31 20  CT + - ( + col1 
2b580 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  ) * cor0.col0 * 
2b590 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
2b5a0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2b5b0 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34 0d 0a 34 30 39  ..----..234..409
2b5c0 36 30 0d 0a 38 33 32 30 30 0d 0a 0d 0a 71 75 65  60..83200....que
2b5d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2b5e0 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2d 20 63 6f  LECT + col1 - co
2b5f0 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l1 * + cor0.col0
2b600 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2b610 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
2b620 31 39 37 38 0d 0a 2d 33 32 39 38 0d 0a 2d 38 30  1978..-3298..-80
2b630 30 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  08....skipif pos
2b640 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2b650 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2b660 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2b670 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2b680 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b690 53 45 4c 45 43 54 20 2b 20 31 30 20 63 6f 6c 30  SELECT + 10 col0
2b6a0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2b6b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 30  r0..----..10..10
2b6c0 0d 0a 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..10....onlyif m
2b6d0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2b6e0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2b6f0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2b700 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2b710 62 65 6c 2d 31 32 30 36 0d 0a 53 45 4c 45 43 54  bel-1206..SELECT
2b720 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
2b730 6c 30 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f  l0 - col0 DIV co
2b740 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
2b750 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2b760 2d 2d 0d 0a 32 33 0d 0a 33 34 0d 0a 38 38 0d 0a  --..23..34..88..
2b770 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2b780 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2b790 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b7a0 20 6c 61 62 65 6c 2d 31 32 30 36 0d 0a 53 45 4c   label-1206..SEL
2b7b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
2b7c0 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 2f 20 63   col0 - col0 / c
2b7d0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
2b7e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2b7f0 2d 2d 2d 0d 0a 32 33 0d 0a 33 34 0d 0a 38 38 0d  ---..23..34..88.
2b800 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b810 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
2b820 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  0.col2 * + col2 
2b830 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  - - col2 AS col2
2b840 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2b850 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 36 32 0d  r0..----..-2862.
2b860 0a 2d 33 31 39 32 0d 0a 2d 39 31 32 30 0d 0a 0d  .-3192..-9120...
2b870 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b880 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2b890 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  T - cor0.col2 AS
2b8a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2b8b0 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
2b8c0 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  IN tab2 AS cor1.
2b8d0 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a  .----..-1..-33..
2b8e0 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -82....query I r
2b8f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2b900 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol0 * col2 * col
2b910 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2b920 2d 0d 0a 31 32 32 35 0d 0a 31 39 30 30 38 0d 0a  -..1225..19008..
2b930 36 34 39 35 32 32 0d 0a 0d 0a 71 75 65 72 79 20  649522....query 
2b940 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b950 54 20 2b 20 28 20 37 30 20 29 20 46 52 4f 4d 20  T + ( 70 ) FROM 
2b960 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2b970 0a 37 30 0d 0a 37 30 0d 0a 37 30 0d 0a 0d 0a 6f  .70..70..70....o
2b980 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2b990 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2b9a0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2b9b0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2b9c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b9d0 74 20 6c 61 62 65 6c 2d 31 32 31 31 0d 0a 53 45  t label-1211..SE
2b9e0 4c 45 43 54 20 2d 20 43 41 53 54 28 20 2d 20 63  LECT - CAST( - c
2b9f0 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol2 AS SIGNED ) 
2ba00 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2ba10 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2ba20 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73  .54..57..96....s
2ba30 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2ba40 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2ba50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2ba60 62 65 6c 2d 31 32 31 31 0d 0a 53 45 4c 45 43 54  bel-1211..SELECT
2ba70 20 2d 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 32   - CAST ( - col2
2ba80 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
2ba90 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2baa0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
2bab0 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65  4..57..96....que
2bac0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2bad0 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  LECT + cor0.col0
2bae0 20 2a 20 33 31 20 41 53 20 63 6f 6c 31 20 46 52   * 31 AS col1 FR
2baf0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2bb00 0a 2d 2d 2d 2d 0d 0a 31 30 38 35 0d 0a 32 37 35  .----..1085..275
2bb10 39 0d 0a 37 34 34 0d 0a 0d 0a 71 75 65 72 79 20  9..744....query 
2bb20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bb30 54 20 63 6f 6c 32 20 2a 20 2d 20 28 20 35 37 20  T col2 * - ( 57 
2bb40 2b 20 2d 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63  + - col0 ) * + c
2bb50 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
2bb60 2d 2d 2d 0d 0a 2d 33 36 34 35 30 0d 0a 31 34 31  ---..-36450..141
2bb70 39 36 0d 0a 33 31 37 36 38 0d 0a 0d 0a 71 75 65  96..31768....que
2bb80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2bb90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2bba0 63 6f 6c 32 20 2a 20 2b 20 36 35 20 46 52 4f 4d  col2 * + 65 FROM
2bbb0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   tab2..----..-16
2bbc0 39 30 0d 0a 2d 31 37 35 35 0d 0a 2d 32 34 37 30  90..-1755..-2470
2bbd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2bbe0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2bbf0 2d 20 31 36 20 2a 20 2b 20 28 20 2b 20 74 61 62  - 16 * + ( + tab
2bc00 31 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  1.col1 ) FROM ta
2bc10 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 30 0d 0a  b1..----..-160..
2bc20 2d 32 30 38 0d 0a 2d 34 31 36 0d 0a 0d 0a 71 75  -208..-416....qu
2bc30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2bc40 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2bc50 20 39 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   96 AS col0 FROM
2bc60 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30   tab1, tab2 cor0
2bc70 0d 0a 2d 2d 2d 2d 0d 0a 39 36 0d 0a 0d 0a 6f 6e  ..----..96....on
2bc80 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2bc90 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2bca0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2bcb0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2bcc0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 37 0d 0a  ort label-1217..
2bcd0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2bce0 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 2d 20  col1 DIV col2 - 
2bcf0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
2bd00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2bd10 2d 38 34 0d 0a 2d 39 30 0d 0a 30 0d 0a 0d 0a 73  -84..-90..0....s
2bd20 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2bd30 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2bd40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2bd50 62 65 6c 2d 31 32 31 37 0d 0a 53 45 4c 45 43 54  bel-1217..SELECT
2bd60 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2f   DISTINCT col1 /
2bd70 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 46   col2 - + col1 F
2bd80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2bd90 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a 2d 39 30  ..----..-84..-90
2bda0 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
2bdb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2bdc0 4c 4c 20 2d 20 31 33 20 2b 20 63 6f 6c 31 20 2a  LL - 13 + col1 *
2bdd0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   - cor0.col1 FRO
2bde0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2bdf0 2d 2d 2d 2d 0d 0a 2d 37 34 30 39 0d 0a 2d 38 32  ----..-7409..-82
2be00 39 34 0d 0a 2d 39 34 32 32 0d 0a 0d 0a 73 6b 69  94..-9422....ski
2be10 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2be20 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2be30 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2be40 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2be50 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2be60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
2be70 62 31 2e 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 63  b1.col1 - col1 c
2be80 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
2be90 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
2bea0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2beb0 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f  .SELECT + ( + co
2bec0 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 29 20 41 53  l2 + + col0 ) AS
2bed0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
2bee0 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d  .----..121..176.
2bef0 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .57....onlyif my
2bf00 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2bf10 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2bf20 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2bf30 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2bf40 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2bf50 31 32 32 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1221..SELECT ALL
2bf60 20 43 41 53 54 28 20 2b 20 36 36 20 41 53 20 53   CAST( + 66 AS S
2bf70 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20  IGNED ) AS col2 
2bf80 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2bf90 0a 36 36 0d 0a 36 36 0d 0a 36 36 0d 0a 0d 0a 73  .66..66..66....s
2bfa0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2bfb0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2bfc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2bfd0 62 65 6c 2d 31 32 32 31 0d 0a 53 45 4c 45 43 54  bel-1221..SELECT
2bfe0 20 41 4c 4c 20 43 41 53 54 20 28 20 2b 20 36 36   ALL CAST ( + 66
2bff0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
2c000 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2c010 0a 2d 2d 2d 2d 0d 0a 36 36 0d 0a 36 36 0d 0a 36  .----..66..66..6
2c020 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2c030 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2c040 54 49 4e 43 54 20 28 20 74 61 62 32 2e 63 6f 6c  TINCT ( tab2.col
2c050 30 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  0 + col2 ) AS co
2c060 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
2c070 2d 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34  --..104..117..34
2c080 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2c090 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2c0a0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2c0b0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2c0c0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2c0d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32  owsort label-122
2c0e0 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  3..SELECT ALL - 
2c0f0 2d 20 43 41 53 54 28 20 2d 20 63 6f 6c 32 20 41  - CAST( - col2 A
2c100 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63  S SIGNED ) * + c
2c110 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  or0.col0 AS col2
2c120 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2c130 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d  r0..----..-35..-
2c140 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 73 6b  7298..-792....sk
2c150 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2c160 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2c170 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2c180 65 6c 2d 31 32 32 33 0d 0a 53 45 4c 45 43 54 20  el-1223..SELECT 
2c190 41 4c 4c 20 2d 20 2d 20 43 41 53 54 20 28 20 2d  ALL - - CAST ( -
2c1a0 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
2c1b0 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   ) * + cor0.col0
2c1c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2c1d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2c1e0 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37  ..-35..-7298..-7
2c1f0 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  92....onlyif mys
2c200 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
2c210 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
2c220 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
2c230 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
2c240 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2c250 32 32 34 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  224..SELECT - + 
2c260 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 28 20 4e  col1 + + CAST( N
2c270 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
2c280 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
2c290 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2c2a0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
2c2b0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
2c2c0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2c2d0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2c2e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2c2f0 2d 31 32 32 34 0d 0a 53 45 4c 45 43 54 20 2d 20  -1224..SELECT - 
2c300 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 20  + col1 + + CAST 
2c310 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
2c320 52 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  R ) * col0 AS co
2c330 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
2c340 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
2c350 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
2c360 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2c370 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
2c380 20 35 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   58 AS col1 FROM
2c390 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   tab2..----..-1.
2c3a0 0a 32 37 0d 0a 34 31 0d 0a 0d 0a 71 75 65 72 79  .27..41....query
2c3b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c3c0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
2c3d0 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
2c3e0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
2c3f0 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d  189..2028..3002.
2c400 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2c410 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2c420 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2c430 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2c440 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2c450 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c460 45 43 54 20 41 4c 4c 20 2d 20 31 34 20 2b 20 63  ECT ALL - 14 + c
2c470 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
2c480 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2c490 0d 0a 2d 37 0d 0a 36 34 0d 0a 36 35 0d 0a 0d 0a  ..-7..64..65....
2c4a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2c4b0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2c4c0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2c4d0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2c4e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 38  wsort label-1228
2c4f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2c500 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20 63  T - col0 DIV + c
2c510 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d  ol1 + - col1 * -
2c520 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
2c530 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2c540 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32 38  .----..7396..828
2c550 31 0d 0a 39 34 30 39 0d 0a 0d 0a 73 6b 69 70 69  1..9409....skipi
2c560 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2c570 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2c580 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2c590 31 32 32 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  1228..SELECT DIS
2c5a0 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2f 20 2b  TINCT - col0 / +
2c5b0 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a   col1 + - col1 *
2c5c0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   - col1 AS col1 
2c5d0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2c5e0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38  0..----..7396..8
2c5f0 32 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a 73 6b 69  281..9409....ski
2c600 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2c610 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2c620 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2c630 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2c640 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2c650 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2c660 28 20 63 6f 6c 31 20 29 20 2d 20 63 6f 72 30 2e  ( col1 ) - cor0.
2c670 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col2 col2 FROM t
2c680 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2c690 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a 34 0d 0a 0d  -..-21..33..4...
2c6a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c6b0 0d 0a 53 45 4c 45 43 54 20 36 32 20 2d 20 63 6f  ..SELECT 62 - co
2c6c0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2c6d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d  cor0..----..-20.
2c6e0 0a 32 39 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72 79  .29..61....query
2c6f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c700 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36 32  CT DISTINCT - 62
2c710 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20   + tab2.col0 AS 
2c720 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
2c730 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 31 36 0d 0a 31  ----..-55..16..1
2c740 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2c750 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2c760 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d  TINCT - col2 + -
2c770 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 41   col2 + - col0 A
2c780 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2c790 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 33 0d 0a 2d 33  ..----..-253..-3
2c7a0 37 0d 0a 2d 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  7..-90....onlyif
2c7b0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2c7c0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2c7d0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2c7e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2c7f0 6c 61 62 65 6c 2d 31 32 33 33 0d 0a 53 45 4c 45  label-1233..SELE
2c800 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
2c810 6c 31 20 44 49 56 20 2d 20 34 39 20 2b 20 63 6f  l1 DIV - 49 + co
2c820 6c 32 20 2a 20 2d 20 43 41 53 54 28 20 2d 20 63  l2 * - CAST( - c
2c830 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20  ol0 + + col1 AS 
2c840 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32  SIGNED ) AS col2
2c850 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2c860 0d 0a 2d 31 32 34 32 0d 0a 33 30 37 38 0d 0a 36  ..-1242..3078..6
2c870 34 33 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  432....skipif my
2c880 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2c890 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2c8a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 33  wsort label-1233
2c8b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2c8c0 54 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 34 39 20  T + col1 / - 49 
2c8d0 2b 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 20  + col2 * - CAST 
2c8e0 28 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  ( - col0 + + col
2c8f0 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  1 AS INTEGER ) A
2c900 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
2c910 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 32 0d 0a 33  ..----..-1242..3
2c920 30 37 38 0d 0a 36 34 33 32 0d 0a 0d 0a 71 75 65  078..6432....que
2c930 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c940 4c 45 43 54 20 38 39 20 2b 20 63 6f 6c 30 20 2b  LECT 89 + col0 +
2c950 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20   + tab2.col1 AS 
2c960 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
2c970 2d 2d 2d 2d 0d 0a 31 32 37 0d 0a 31 38 35 0d 0a  ----..127..185..
2c980 32 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  226....query I r
2c990 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2c9a0 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 72   cor0.col2 * cor
2c9b0 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2d 20  0.col2 + col0 - 
2c9c0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
2c9d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2c9e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 31 0d 0a 2d  ..----..-1041..-
2c9f0 36 35 34 36 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72  6546..69....quer
2ca00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ca10 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28  ECT DISTINCT + (
2ca20 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30   + ( - cor0.col0
2ca30 20 29 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f   ) ) AS col2 FRO
2ca40 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
2ca50 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39  -..-24..-35..-89
2ca60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ca70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2ca80 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  INCT - cor0.col2
2ca90 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a   * col0 + col1 *
2caa0 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
2cab0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2cac0 0a 2d 31 31 35 30 0d 0a 2d 33 32 39 31 0d 0a 2d  .-1150..-3291..-
2cad0 35 35 30 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  5509....skipif m
2cae0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2caf0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2cb00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 43  owsort..SELECT C
2cb10 41 53 54 20 28 20 2d 20 63 6f 6c 30 20 41 53 20  AST ( - col0 AS 
2cb20 52 45 41 4c 20 29 20 2a 20 2b 20 63 6f 6c 30 20  REAL ) * + col0 
2cb30 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  + + col2 * + cor
2cb40 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
2cb50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2cb60 2d 31 31 32 38 0d 0a 2d 34 35 39 0d 0a 32 32 36  -1128..-459..226
2cb70 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2cb80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37  sort..SELECT - 7
2cb90 35 20 2b 20 2d 20 37 38 20 2a 20 2d 20 63 6f 72  5 + - 78 * - cor
2cba0 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53  0.col1 * col2 AS
2cbb0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2cbc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
2cbd0 32 31 32 38 39 0d 0a 35 38 31 39 36 31 0d 0a 37  21289..581961..7
2cbe0 34 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  491....query I r
2cbf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2cc00 49 53 54 49 4e 43 54 20 28 20 2d 20 63 6f 72 30  ISTINCT ( - cor0
2cc10 2e 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20 46  .col0 ) + col0 F
2cc20 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
2cc30 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ---..0....onlyif
2cc40 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2cc50 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2cc60 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2cc70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2cc80 6c 61 62 65 6c 2d 31 32 34 31 0d 0a 53 45 4c 45  label-1241..SELE
2cc90 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
2cca0 2b 20 63 6f 6c 32 20 29 20 44 49 56 20 2d 20 63  + col2 ) DIV - c
2ccb0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2ccc0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2ccd0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
2cce0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2ccf0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2cd00 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34 31 0d 0a  ort label-1241..
2cd10 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2cd20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 2f 20 2d  - ( + col2 ) / -
2cd30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2cd40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2cd50 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..1....query I r
2cd60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2cd70 49 53 54 49 4e 43 54 20 2b 20 28 20 28 20 63 6f  ISTINCT + ( ( co
2cd80 6c 30 20 29 20 29 20 41 53 20 63 6f 6c 31 20 46  l0 ) ) AS col1 F
2cd90 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2cda0 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38  ..----..3..64..8
2cdb0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2cdc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34  sort..SELECT + 4
2cdd0 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  5 AS col1 FROM t
2cde0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
2cdf0 34 35 0d 0a 34 35 0d 0a 34 35 0d 0a 0d 0a 73 6b  45..45..45....sk
2ce00 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2ce10 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2ce20 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2ce30 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2ce40 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2ce50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2ce60 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c 31  ISTINCT ( + col1
2ce70 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   ) col0 FROM tab
2ce80 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d  1..----..10..13.
2ce90 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .26....query I r
2cea0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
2ceb0 20 2d 20 63 6f 6c 31 20 29 20 2d 20 28 20 34 35   - col1 ) - ( 45
2cec0 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d   ) FROM tab1..--
2ced0 2d 2d 0d 0a 2d 35 35 0d 0a 2d 35 38 0d 0a 2d 37  --..-55..-58..-7
2cee0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2cef0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2cf00 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 28  ol2 * + col0 * (
2cf10 20 2b 20 36 37 20 29 20 2d 20 2b 20 63 6f 6c 30   + 67 ) - + col0
2cf20 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2cf30 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 35 37  b1..----..-10857
2cf40 0d 0a 2d 32 34 34 34 38 30 0d 0a 2d 35 31 34 36  ..-244480..-5146
2cf50 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  40....skipif pos
2cf60 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2cf70 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2cf80 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2cf90 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2cfa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2cfb0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2cfc0 2d 20 74 61 62 31 2e 63 6f 6c 30 20 63 6f 6c 31  - tab1.col0 col1
2cfd0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2cfe0 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a  ..-3..-64..-80..
2cff0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d000 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2d010 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  CT + col0 * col2
2d020 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41   + + cor0.col0 A
2d030 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
2d040 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2d050 31 36 35 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d  165..3712..7760.
2d060 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d070 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
2d080 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
2d090 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2d0a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d  or0..----..-162.
2d0b0 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d  .-3648..-7680...
2d0c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d0d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2d0e0 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20  T cor0.col1 + - 
2d0f0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
2d100 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2d110 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  ----..0....query
2d120 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d130 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
2d140 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  l2 * col2 * col1
2d150 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46   + - cor0.col1 F
2d160 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2d170 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 36 33 30 0d 0a  ..----..-22630..
2d180 2d 32 34 35 36 35 0d 0a 2d 33 39 39 34 33 0d 0a  -24565..-39943..
2d190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d1a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2d1b0 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col1 * cor0.col1
2d1c0 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   + + cor0.col0 *
2d1d0 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
2d1e0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2d1f0 0a 31 38 32 0d 0a 35 33 33 32 0d 0a 36 30 31 34  .182..5332..6014
2d200 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d210 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2d220 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  INCT + col2 * - 
2d230 31 35 20 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 32  15 * col1 - col2
2d240 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2d250 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35 38 32  r0..----..-12582
2d260 0d 0a 2d 32 33 30 33 36 0d 0a 2d 39 37 32 38 0d  ..-23036..-9728.
2d270 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d280 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2d290 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   + col2 + - col2
2d2a0 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + - col0 FROM t
2d2b0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2d2c0 2d 0d 0a 2d 32 35 33 0d 0a 2d 33 37 0d 0a 2d 39  -..-253..-37..-9
2d2d0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2d2e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2d2f0 6f 6c 32 20 2a 20 28 20 2b 20 33 33 20 29 20 2b  ol2 * ( + 33 ) +
2d300 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
2d310 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2d320 0a 2d 2d 2d 2d 0d 0a 31 31 37 35 0d 0a 31 33 30  .----..1175..130
2d330 0d 0a 32 37 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..2797....onlyif
2d340 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2d350 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2d360 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2d370 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2d380 6c 61 62 65 6c 2d 31 32 35 36 0d 0a 53 45 4c 45  label-1256..SELE
2d390 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f  CT ALL col0 * co
2d3a0 6c 32 20 44 49 56 20 63 6f 6c 30 20 63 6f 6c 31  l2 DIV col0 col1
2d3b0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
2d3c0 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39  .----..54..57..9
2d3d0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
2d3e0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2d3f0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2d400 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2d410 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
2d420 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2d430 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2d440 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2d450 65 6c 2d 31 32 35 36 0d 0a 53 45 4c 45 43 54 20  el-1256..SELECT 
2d460 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  ALL col0 * col2 
2d470 2f 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  / col0 col1 FROM
2d480 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
2d490 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a  ..54..57..96....
2d4a0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2d4b0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2d4c0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2d4d0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2d4e0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2d4f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d500 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 39 33 20 2a   + col1 + - 93 *
2d510 20 2d 20 38 30 20 63 6f 6c 31 20 46 52 4f 4d 20   - 80 col1 FROM 
2d520 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2d530 2d 2d 0d 0a 37 34 35 30 0d 0a 37 34 35 33 0d 0a  --..7450..7453..
2d540 37 34 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7466....query I 
2d550 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d560 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 37 32 20  ALL col0 * + 72 
2d570 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2d580 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 34 36  0..----..216..46
2d590 30 38 0d 0a 35 37 36 30 0d 0a 0d 0a 6f 6e 6c 79  08..5760....only
2d5a0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2d5b0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2d5c0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2d5d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d5e0 74 20 6c 61 62 65 6c 2d 31 32 35 39 0d 0a 53 45  t label-1259..SE
2d5f0 4c 45 43 54 20 35 39 20 44 49 56 20 2d 20 74 61  LECT 59 DIV - ta
2d600 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  b2.col0 FROM tab
2d610 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c  2, tab1 AS cor0,
2d620 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
2d630 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
2d640 61 73 68 69 6e 67 20 74 6f 20 39 37 33 65 34 37  ashing to 973e47
2d650 32 63 35 61 65 32 35 31 38 64 62 37 38 32 39 34  2c5ae2518db78294
2d660 33 66 37 30 35 37 63 34 36 61 0d 0a 0d 0a 73 6b  3f7057c46a....sk
2d670 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2d680 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2d690 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2d6a0 65 6c 2d 31 32 35 39 0d 0a 53 45 4c 45 43 54 20  el-1259..SELECT 
2d6b0 35 39 20 2f 20 2d 20 74 61 62 32 2e 63 6f 6c 30  59 / - tab2.col0
2d6c0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
2d6d0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
2d6e0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
2d6f0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2d700 74 6f 20 39 37 33 65 34 37 32 63 35 61 65 32 35  to 973e472c5ae25
2d710 31 38 64 62 37 38 32 39 34 33 66 37 30 35 37 63  18db782943f7057c
2d720 34 36 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  46a....query I r
2d730 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2d740 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30  ISTINCT - + cor0
2d750 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20  .col2 * col2 AS 
2d760 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2d770 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
2d780 39 31 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39 32 31  916..-3249..-921
2d790 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2d7a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
2d7b0 30 20 2a 20 2d 20 34 30 20 46 52 4f 4d 20 74 61  0 * - 40 FROM ta
2d7c0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
2d7d0 31 32 30 0d 0a 2d 32 35 36 30 0d 0a 2d 33 32 30  120..-2560..-320
2d7e0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2d7f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
2d800 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
2d810 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l0 FROM tab1, ta
2d820 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2d830 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2d840 6e 67 20 74 6f 20 33 30 30 30 33 33 37 64 64 33  ng to 3000337dd3
2d850 66 31 31 65 39 63 66 64 35 61 33 31 32 62 30 31  f11e9cfd5a312b01
2d860 65 66 33 66 38 62 0d 0a 0d 0a 71 75 65 72 79 20  ef3f8b....query 
2d870 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d880 54 20 34 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  T 4 - col0 FROM 
2d890 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d  tab0..----..-20.
2d8a0 0a 2d 33 31 0d 0a 2d 38 35 0d 0a 0d 0a 73 6b 69  .-31..-85....ski
2d8b0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2d8c0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2d8d0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2d8e0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2d8f0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2d900 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2d910 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  L - - cor0.col0 
2d920 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52  + + col0 col0 FR
2d930 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2d940 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a 34 38 0d 0a  .----..178..48..
2d950 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
2d960 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2d970 4c 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  L - col2 + col1 
2d980 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  + - col2 AS col2
2d990 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2d9a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d  r0..----..-23..-
2d9b0 35 39 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  59..7....skipif 
2d9c0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2d9d0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2d9e0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2d9f0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2da00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2da10 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2da20 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  CT - - col2 * - 
2da30 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
2da40 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2da50 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d  -..-35..-7298..-
2da60 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  792....query I r
2da70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2da80 4c 4c 20 63 6f 6c 31 20 2b 20 2b 20 28 20 2b 20  LL col1 + + ( + 
2da90 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 29 20  col1 * + col0 ) 
2daa0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2dab0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  1 cor0..----..10
2dac0 34 0d 0a 31 30 35 33 0d 0a 36 35 30 0d 0a 0d 0a  4..1053..650....
2dad0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2dae0 0a 53 45 4c 45 43 54 20 2b 20 28 20 32 31 20 29  .SELECT + ( 21 )
2daf0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2db00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 32 31  r0..----..21..21
2db10 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..21....query I 
2db20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2db30 63 6f 6c 30 20 2a 20 2b 20 32 33 20 2b 20 63 6f  col0 * + 23 + co
2db40 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
2db50 2d 2d 0d 0a 31 34 38 32 0d 0a 31 38 35 33 0d 0a  --..1482..1853..
2db60 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  95....onlyif mys
2db70 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2db80 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2db90 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2dba0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2dbb0 6c 2d 31 32 37 30 0d 0a 53 45 4c 45 43 54 20 2d  l-1270..SELECT -
2dbc0 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 2b 20 39   tab1.col0 + + 9
2dbd0 20 44 49 56 20 63 6f 6c 31 20 63 6f 6c 32 20 46   DIV col1 col2 F
2dbe0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2dbf0 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a  -3..-64..-80....
2dc00 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2dc10 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2dc20 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2dc30 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2dc40 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
2dc50 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2dc60 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2dc70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2dc80 37 30 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62  70..SELECT - tab
2dc90 31 2e 63 6f 6c 30 20 2b 20 2b 20 39 20 2f 20 63  1.col0 + + 9 / c
2dca0 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol1 col2 FROM ta
2dcb0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36  b1..----..-3..-6
2dcc0 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20  4..-80....query 
2dcd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2dce0 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 31 35 20  T + col1 + + 15 
2dcf0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2dd00 31 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 32 38 0d  1..----..25..28.
2dd10 0a 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .41....query I r
2dd20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2dd30 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 34 35 20  or0.col0 + - 45 
2dd40 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2dd50 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2dd60 0a 2d 34 32 0d 0a 31 39 0d 0a 33 35 0d 0a 0d 0a  .-42..19..35....
2dd70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2dd80 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 31 20 2a  .SELECT ALL 61 *
2dd90 20 2d 20 38 37 20 46 52 4f 4d 20 74 61 62 30 2c   - 87 FROM tab0,
2dda0 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
2ddb0 6f 72 30 2c 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  or0, tab2..----.
2ddc0 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69  .81 values hashi
2ddd0 6e 67 20 74 6f 20 65 30 37 61 61 65 62 39 32 64  ng to e07aaeb92d
2dde0 38 31 38 66 34 36 62 39 32 39 33 66 65 63 35 30  818f46b9293fec50
2ddf0 65 30 37 32 39 63 0d 0a 0d 0a 6f 6e 6c 79 69 66  e0729c....onlyif
2de00 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2de10 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2de20 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2de30 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2de40 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2de50 65 6c 2d 31 32 37 34 0d 0a 53 45 4c 45 43 54 20  el-1274..SELECT 
2de60 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
2de70 44 45 43 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c  DECIMAL ) AS col
2de80 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
2de90 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2dea0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
2deb0 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34 37  g to cd7a7901e47
2dec0 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32 31  c15155404aff0d21
2ded0 36 66 65 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20  6fe0b....skipif 
2dee0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2def0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2df00 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2df10 37 34 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  74..SELECT + CAS
2df20 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c  T ( NULL AS REAL
2df30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
2df40 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
2df50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
2df60 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64  es hashing to cd
2df70 37 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34  7a7901e47c151554
2df80 30 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a  04aff0d216fe0b..
2df90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2dfa0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
2dfb0 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41  r0.col0 * col0 A
2dfc0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2dfd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2dfe0 34 30 39 36 0d 0a 36 34 30 30 0d 0a 39 0d 0a 0d  4096..6400..9...
2dff0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e000 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 39 20  ..SELECT ALL 79 
2e010 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2e020 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 39  0 cor0..----..79
2e030 0d 0a 37 39 0d 0a 37 39 0d 0a 0d 0a 6f 6e 6c 79  ..79..79....only
2e040 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2e050 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2e060 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2e070 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e080 74 20 6c 61 62 65 6c 2d 31 32 37 37 0d 0a 53 45  t label-1277..SE
2e090 4c 45 43 54 20 2b 20 38 38 20 2b 20 63 6f 6c 32  LECT + 88 + col2
2e0a0 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 30   DIV - cor0.col0
2e0b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2e0c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 38 38  r0..----..87..88
2e0d0 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..88....skipif m
2e0e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2e0f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2e100 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37  owsort label-127
2e110 37 0d 0a 53 45 4c 45 43 54 20 2b 20 38 38 20 2b  7..SELECT + 88 +
2e120 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 72 30 2e 63   col2 / - cor0.c
2e130 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2e140 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d   cor0..----..87.
2e150 0a 38 38 0d 0a 38 38 0d 0a 0d 0a 71 75 65 72 79  .88..88....query
2e160 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e170 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  CT - cor0.col2 *
2e180 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   + cor0.col1 + c
2e190 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2e1a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
2e1b0 30 38 0d 0a 2d 36 30 38 0d 0a 2d 38 31 30 0d 0a  08..-608..-810..
2e1c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e1d0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
2e1e0 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63  l2 + - col1 AS c
2e1f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2e200 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
2e210 39 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a  9..-173..-98....
2e220 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2e230 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2e240 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  l0 + cor0.col1 *
2e250 20 2b 20 32 35 20 46 52 4f 4d 20 74 61 62 32 20   + 25 FROM tab2 
2e260 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2e270 35 35 33 0d 0a 35 30 34 0d 0a 37 38 32 0d 0a 0d  553..504..782...
2e280 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e290 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
2e2a0 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  1 * - cor0.col2 
2e2b0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2e2c0 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34  ----..-2838..-74
2e2d0 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79  62..-97....query
2e2e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e2f0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39 33  CT DISTINCT + 93
2e300 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2e310 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2e320 0d 0a 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..93....onlyif m
2e330 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2e340 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2e350 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2e360 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2e370 62 65 6c 2d 31 32 38 33 0d 0a 53 45 4c 45 43 54  bel-1283..SELECT
2e380 20 2b 20 38 39 20 2b 20 2d 20 63 6f 72 30 2e 63   + 89 + - cor0.c
2e390 6f 6c 31 20 44 49 56 20 2b 20 43 41 53 54 28 20  ol1 DIV + CAST( 
2e3a0 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29  col0 AS SIGNED )
2e3b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2e3c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 38 37  r0..----..86..87
2e3d0 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..88....skipif m
2e3e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2e3f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2e400 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38  owsort label-128
2e410 33 0d 0a 53 45 4c 45 43 54 20 2b 20 38 39 20 2b  3..SELECT + 89 +
2e420 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 2b   - cor0.col1 / +
2e430 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20   CAST ( col0 AS 
2e440 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
2e450 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2e460 2d 0d 0a 38 36 0d 0a 38 37 0d 0a 38 38 0d 0a 0d  -..86..87..88...
2e470 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2e480 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2e490 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2e4a0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2e4b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38  owsort label-128
2e4c0 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  4..SELECT ALL co
2e4d0 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20  l0 + - col2 DIV 
2e4e0 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  - col2 AS col2 F
2e4f0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2e500 32 35 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 73 6b  25..36..90....sk
2e510 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2e520 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2e530 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2e540 65 6c 2d 31 32 38 34 0d 0a 53 45 4c 45 43 54 20  el-1284..SELECT 
2e550 41 4c 4c 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  ALL col0 + - col
2e560 32 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  2 / - col2 AS co
2e570 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
2e580 2d 2d 0d 0a 32 35 0d 0a 33 36 0d 0a 39 30 0d 0a  --..25..36..90..
2e590 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e5a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2e5b0 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
2e5c0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  1 cor0..----..9 
2e5d0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2e5e0 6f 20 38 62 37 35 31 33 36 62 32 62 35 31 63 37  o 8b75136b2b51c7
2e5f0 37 33 34 35 63 30 33 38 30 34 65 63 31 63 64 61  7345c03804ec1cda
2e600 35 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  5c....query I ro
2e610 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2e620 53 54 49 4e 43 54 20 36 39 20 41 53 20 63 6f 6c  STINCT 69 AS col
2e630 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
2e640 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2e650 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .69....query I r
2e660 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
2e670 20 2b 20 63 6f 6c 30 20 29 20 2a 20 74 61 62 30   + col0 ) * tab0
2e680 2e 63 6f 6c 32 20 2b 20 2b 20 28 20 2b 20 33 35  .col2 + + ( + 35
2e690 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
2e6a0 2d 2d 0d 0a 37 30 0d 0a 37 33 33 33 0d 0a 38 32  --..70..7333..82
2e6b0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2e6c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2e6d0 20 33 37 20 2d 20 2b 20 34 39 20 41 53 20 63 6f   37 - + 49 AS co
2e6e0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
2e6f0 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31 32 0d 0a 2d 31  --..-12..-12..-1
2e700 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2e710 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2e720 20 39 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   9 - col1 AS col
2e730 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
2e740 2d 0d 0a 2d 32 32 0d 0a 2d 35 30 0d 0a 2d 38 0d  -..-22..-50..-8.
2e750 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e760 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  rt..SELECT ALL (
2e770 20 2b 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 30   + col1 ) + col0
2e780 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
2e790 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2e7a0 0a 36 31 34 33 0d 0a 36 32 35 38 0d 0a 38 30 0d  .6143..6258..80.
2e7b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2e7c0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2e7d0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2e7e0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2e7f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2e800 32 39 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  291..SELECT ALL 
2e810 2d 20 31 36 20 44 49 56 20 2b 20 63 6f 6c 32 20  - 16 DIV + col2 
2e820 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2e830 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .0..0..0....skip
2e840 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2e850 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2e860 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2e870 2d 31 32 39 31 0d 0a 53 45 4c 45 43 54 20 41 4c  -1291..SELECT AL
2e880 4c 20 2d 20 31 36 20 2f 20 2b 20 63 6f 6c 32 20  L - 16 / + col2 
2e890 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2e8a0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
2e8b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e8c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
2e8d0 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 + cor0.col0 
2e8e0 2a 20 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  * ( col2 * col0 
2e8f0 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
2e900 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 30 0d  or0..----..1190.
2e910 0a 31 38 39 38 34 0d 0a 36 34 39 34 33 33 0d 0a  .18984..649433..
2e920 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e930 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 35 38  t..SELECT + + 58
2e940 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63   + col0 * cor0.c
2e950 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
2e960 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30   cor0..----..140
2e970 31 0d 0a 32 37 35 0d 0a 34 36 36 30 0d 0a 0d 0a  1..275..4660....
2e980 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2e990 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2e9a0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2e9b0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2e9c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 34  wsort label-1294
2e9d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72  ..SELECT ALL cor
2e9e0 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 44 49  0.col2 + col2 DI
2e9f0 56 20 2d 20 37 37 20 41 53 20 63 6f 6c 31 20 46  V - 77 AS col1 F
2ea00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2ea10 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a  ..----..26..27..
2ea20 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  38....skipif mys
2ea30 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2ea40 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2ea50 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 34 0d  sort label-1294.
2ea60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
2ea70 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2f 20 2d  .col2 + col2 / -
2ea80 20 37 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   77 AS col1 FROM
2ea90 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2eaa0 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d  ---..26..27..38.
2eab0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2eac0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2ead0 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  NCT + col2 * col
2eae0 30 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  0 + + col0 FROM 
2eaf0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2eb00 2d 2d 0d 0a 37 30 0d 0a 37 33 38 37 0d 0a 38 31  --..70..7387..81
2eb10 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2eb20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2eb30 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d  ol1 * + col0 + -
2eb40 20 31 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   10 AS col1 FROM
2eb50 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2eb60 2d 2d 2d 0d 0a 2d 31 33 35 33 0d 0a 2d 32 32 37  ---..-1353..-227
2eb70 0d 0a 2d 34 36 31 32 0d 0a 0d 0a 71 75 65 72 79  ..-4612....query
2eb80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2eb90 43 54 20 2d 20 31 37 20 2a 20 2d 20 63 6f 6c 31  CT - 17 * - col1
2eba0 20 2b 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63   + ( col2 ) AS c
2ebb0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
2ebc0 2d 2d 2d 0d 0a 32 32 37 0d 0a 33 31 37 0d 0a 34  ---..227..317..4
2ebd0 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
2ebe0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2ebf0 4c 20 2d 20 34 35 20 2a 20 34 37 20 46 52 4f 4d  L - 45 * 47 FROM
2ec00 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
2ec10 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 63 6f  OSS JOIN tab1 co
2ec20 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
2ec30 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 31  es hashing to 81
2ec40 36 32 66 31 30 63 31 62 61 37 66 65 62 36 61 30  62f10c1ba7feb6a0
2ec50 34 66 66 66 34 39 37 33 65 33 65 32 32 62 0d 0a  4fff4973e3e22b..
2ec60 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2ec70 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2ec80 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2ec90 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2eca0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2ecb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ecc0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38 20  CT DISTINCT - 8 
2ecd0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 30  + cor0.col2 col0
2ece0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2ecf0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 32 35  r0..----..-7..25
2ed00 0d 0a 37 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..74....onlyif m
2ed10 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2ed20 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2ed30 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2ed40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2ed50 62 65 6c 2d 31 33 30 30 0d 0a 53 45 4c 45 43 54  bel-1300..SELECT
2ed60 20 2d 20 38 35 20 2a 20 63 6f 6c 31 20 2d 20 2d   - 85 * col1 - -
2ed70 20 63 6f 6c 31 20 44 49 56 20 2b 20 31 32 20 41   col1 DIV + 12 A
2ed80 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2ed90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2eda0 2d 31 34 34 34 0d 0a 2d 32 36 33 33 0d 0a 2d 35  -1444..-2633..-5
2edb0 30 31 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  011....skipif my
2edc0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2edd0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2ede0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30 30  wsort label-1300
2edf0 0d 0a 53 45 4c 45 43 54 20 2d 20 38 35 20 2a 20  ..SELECT - 85 * 
2ee00 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 31 20 2f 20  col1 - - col1 / 
2ee10 2b 20 31 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 12 AS col2 FRO
2ee20 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2ee30 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 32 36  ----..-1444..-26
2ee40 33 33 0d 0a 2d 35 30 31 31 0d 0a 0d 0a 71 75 65  33..-5011....que
2ee50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ee60 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
2ee70 2a 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30 20  * col1 - - col0 
2ee80 2a 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63  * tab2.col1 AS c
2ee90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
2eea0 2d 2d 2d 0d 0a 2d 36 32 30 0d 0a 33 30 36 38 0d  ---..-620..3068.
2eeb0 0a 36 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .697....query I 
2eec0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2eed0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20  + col1 * col1 * 
2eee0 38 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  81 FROM tab1..--
2eef0 2d 2d 0d 0a 31 33 36 38 39 0d 0a 35 34 37 35 36  --..13689..54756
2ef00 0d 0a 38 31 30 30 0d 0a 0d 0a 71 75 65 72 79 20  ..8100....query 
2ef10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ef20 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 63  T ALL col0 * + c
2ef30 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ol1 + cor0.col2 
2ef40 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2ef50 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  2 cor0..----..13
2ef60 38 31 0d 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d  81..244..4628...
2ef70 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2ef80 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2ef90 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2efa0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2efb0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2efc0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30 34 0d 0a  ort label-1304..
2efd0 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
2efe0 6c 31 20 2a 20 2d 20 43 41 53 54 28 20 63 6f 6c  l1 * - CAST( col
2eff0 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  0 AS SIGNED ) + 
2f000 63 6f 6c 30 20 2a 20 2b 20 36 36 20 46 52 4f 4d  col0 * + 66 FROM
2f010 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2f020 2d 2d 2d 0d 0a 36 35 35 37 0d 0a 36 37 39 0d 0a  ---..6557..679..
2f030 39 37 35 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  9750....skipif m
2f040 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2f050 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2f060 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30  owsort label-130
2f070 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  4..SELECT - cor0
2f080 2e 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20 28  .col1 * - CAST (
2f090 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
2f0a0 20 29 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 36 36   ) + col0 * + 66
2f0b0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2f0c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 35 35 37 0d 0a  r0..----..6557..
2f0d0 36 37 39 0d 0a 39 37 35 30 0d 0a 0d 0a 73 6b 69  679..9750....ski
2f0e0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2f0f0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2f100 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2f110 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2f120 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2f130 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2f140 4c 20 63 6f 6c 32 20 2b 20 34 33 20 63 6f 6c 30  L col2 + 43 col0
2f150 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2f160 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 0d 0a 34  r0..----..125..4
2f170 34 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  4..76....query I
2f180 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f190 20 2d 20 39 39 20 2a 20 63 6f 6c 32 20 46 52 4f   - 99 * col2 FRO
2f1a0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab0..----..-3
2f1b0 32 36 37 0d 0a 2d 38 31 31 38 0d 0a 2d 39 39 0d  267..-8118..-99.
2f1c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f1d0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 37 20  rt..SELECT + 87 
2f1e0 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  + - col1 * - col
2f1f0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
2f200 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2f210 2d 0d 0a 31 36 32 31 0d 0a 37 33 33 0d 0a 39 32  -..1621..733..92
2f220 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2f230 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 36  sort..SELECT ( 6
2f240 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c   ) * col0 AS col
2f250 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
2f260 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 33 38 34 0d  ..----..18..384.
2f270 0a 34 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .480....query I 
2f280 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2f290 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  + ( cor0.col1 ) 
2f2a0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
2f2b0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
2f2c0 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d  ---..1248..1404.
2f2d0 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .570....query I 
2f2e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2f2f0 63 6f 6c 31 20 2b 20 2b 20 31 33 20 46 52 4f 4d  col1 + + 13 FROM
2f300 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2f310 2d 2d 2d 0d 0a 32 33 0d 0a 32 36 0d 0a 33 39 0d  ---..23..26..39.
2f320 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f330 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 35  rt..SELECT - ( 5
2f340 34 20 29 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  4 ) * + col2 FRO
2f350 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2f360 2d 2d 2d 2d 0d 0a 2d 31 34 30 34 0d 0a 2d 31 34  ----..-1404..-14
2f370 35 38 0d 0a 2d 32 30 35 32 0d 0a 0d 0a 71 75 65  58..-2052....que
2f380 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f390 4c 45 43 54 20 2d 20 36 38 20 2a 20 63 6f 72 30  LECT - 68 * cor0
2f3a0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
2f3b0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
2f3c0 2d 2d 0d 0a 2d 31 37 36 38 0d 0a 2d 36 38 30 0d  --..-1768..-680.
2f3d0 0a 2d 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .-884....query I
2f3e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f3f0 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 36 35   ALL col2 * + 65
2f400 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2f410 0d 0a 33 35 31 30 0d 0a 33 37 30 35 0d 0a 36 32  ..3510..3705..62
2f420 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  40....query I ro
2f430 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 37  wsort..SELECT 57
2f440 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2f450 62 32 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74  b2, tab0 cor0, t
2f460 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
2f470 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
2f480 68 69 6e 67 20 74 6f 20 32 32 30 61 39 33 37 30  hing to 220a9370
2f490 39 65 32 30 37 37 37 39 62 33 34 65 66 37 34 62  9e207779b34ef74b
2f4a0 35 34 34 37 36 34 61 35 0d 0a 0d 0a 6f 6e 6c 79  544764a5....only
2f4b0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2f4c0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2f4d0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2f4e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f4f0 74 20 6c 61 62 65 6c 2d 31 33 31 35 0d 0a 53 45  t label-1315..SE
2f500 4c 45 43 54 20 2d 20 28 20 63 6f 6c 30 20 29 20  LECT - ( col0 ) 
2f510 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20  + col2 DIV col0 
2f520 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2f530 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  0 cor0..----..-2
2f540 33 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 73  3..-35..-89....s
2f550 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2f560 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2f570 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f580 62 65 6c 2d 31 33 31 35 0d 0a 53 45 4c 45 43 54  bel-1315..SELECT
2f590 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f   - ( col0 ) + co
2f5a0 6c 32 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 / col0 AS col
2f5b0 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
2f5c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 33 35  ..----..-23..-35
2f5d0 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-89....query I
2f5e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f5f0 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 38 20   DISTINCT + - 8 
2f600 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * + col0 FROM ta
2f610 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2f620 0d 0a 2d 32 34 0d 0a 2d 35 31 32 0d 0a 2d 36 34  ..-24..-512..-64
2f630 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
2f640 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2f650 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2f660 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2f670 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2f680 2d 31 33 31 37 0d 0a 53 45 4c 45 43 54 20 44 49  -1317..SELECT DI
2f690 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 44 49  STINCT + col2 DI
2f6a0 56 20 36 37 20 46 52 4f 4d 20 74 61 62 31 0d 0a  V 67 FROM tab1..
2f6b0 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b  ----..0..1....sk
2f6c0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2f6d0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2f6e0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2f6f0 65 6c 2d 31 33 31 37 0d 0a 53 45 4c 45 43 54 20  el-1317..SELECT 
2f700 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
2f710 2f 20 36 37 20 46 52 4f 4d 20 74 61 62 31 0d 0a  / 67 FROM tab1..
2f720 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75  ----..0..1....qu
2f730 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f740 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  ELECT + col2 * c
2f750 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 * col0 AS co
2f760 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2f770 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36  cor0..----..1196
2f780 35 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35 39 0d  52..51034..5859.
2f790 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f7a0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
2f7b0 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol1 * col2 * col
2f7c0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
2f7d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 38 32  or0..----..10982
2f7e0 0d 0a 32 35 39 34 37 0d 0a 39 30 35 30 36 0d 0a  ..25947..90506..
2f7f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f800 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 32  t..SELECT ALL 42
2f810 20 2a 20 33 32 20 41 53 20 63 6f 6c 30 20 46 52   * 32 AS col0 FR
2f820 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
2f830 33 34 34 0d 0a 31 33 34 34 0d 0a 31 33 34 34 0d  344..1344..1344.
2f840 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f850 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  rt..SELECT ALL (
2f860 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 30 2e 63   col1 + - tab0.c
2f870 6f 6c 30 20 29 20 2a 20 63 6f 6c 30 20 41 53 20  ol0 ) * col0 AS 
2f880 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
2f890 2d 2d 2d 2d 0d 0a 31 34 38 38 0d 0a 31 37 38 0d  ----..1488..178.
2f8a0 0a 32 31 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .2170....onlyif 
2f8b0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2f8c0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2f8d0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2f8e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2f8f0 61 62 65 6c 2d 31 33 32 32 0d 0a 53 45 4c 45 43  abel-1322..SELEC
2f900 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 63  T - col2 DIV + c
2f910 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
2f920 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2f930 0d 0a 2d 32 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  ..-2..0..0....sk
2f940 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2f950 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2f960 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2f970 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2f980 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
2f990 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2f9a0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2f9b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 32  wsort label-1322
2f9c0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
2f9d0 2f 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52  / + col1 col1 FR
2f9e0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2f9f0 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d 0a 30 0d  .----..-2..0..0.
2fa00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2fa10 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 34 20  rt..SELECT - 54 
2fa20 2a 20 74 61 62 30 2e 63 6f 6c 31 20 2d 20 2b 20  * tab0.col1 - + 
2fa30 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  tab0.col0 AS col
2fa40 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2fa50 2d 0d 0a 2d 34 36 36 38 0d 0a 2d 35 30 30 33 0d  -..-4668..-5003.
2fa60 0a 2d 35 32 37 33 0d 0a 0d 0a 71 75 65 72 79 20  .-5273....query 
2fa70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2fa80 54 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2d 20  T tab0.col2 + - 
2fa90 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  tab0.col0 AS col
2faa0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
2fab0 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d  -..-34..-7..9...
2fac0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2fad0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2fae0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2faf0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2fb00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32  owsort label-132
2fb10 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
2fb20 43 54 20 2d 20 32 20 44 49 56 20 63 6f 72 31 2e  CT - 2 DIV cor1.
2fb30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
2fb40 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
2fb50 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  N tab2 AS cor1..
2fb60 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ----..0....skipi
2fb70 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2fb80 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2fb90 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2fba0 31 33 32 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  1325..SELECT DIS
2fbb0 54 49 4e 43 54 20 2d 20 32 20 2f 20 63 6f 72 31  TINCT - 2 / cor1
2fbc0 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20  .col0 FROM tab0 
2fbd0 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
2fbe0 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  IN tab2 AS cor1.
2fbf0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .----..0....quer
2fc00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2fc10 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  ECT cor0.col0 * 
2fc20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col2 + col0 FROM
2fc30 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2fc40 2d 2d 2d 0d 0a 37 30 0d 0a 37 33 38 37 0d 0a 38  ---..70..7387..8
2fc50 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
2fc60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2fc70 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
2fc80 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20  + cor0.col1 * + 
2fc90 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52  col1 * + col1 FR
2fca0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
2fcb0 2d 2d 0d 0a 36 33 35 39 37 30 0d 0a 37 35 33 34  --..635970..7534
2fcc0 38 30 0d 0a 39 31 32 35 37 36 0d 0a 0d 0a 71 75  80..912576....qu
2fcd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2fce0 45 4c 45 43 54 20 41 4c 4c 20 32 35 20 41 53 20  ELECT ALL 25 AS 
2fcf0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2fd00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35  S cor0..----..25
2fd10 0d 0a 32 35 0d 0a 32 35 0d 0a 0d 0a 6f 6e 6c 79  ..25..25....only
2fd20 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2fd30 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
2fd40 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
2fd50 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
2fd60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2fd70 61 62 65 6c 2d 31 33 32 39 0d 0a 53 45 4c 45 43  abel-1329..SELEC
2fd80 54 20 44 49 53 54 49 4e 43 54 20 33 33 20 2b 20  T DISTINCT 33 + 
2fd90 2b 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28  + col0 * + CAST(
2fda0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
2fdb0 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  ) col2 FROM tab1
2fdc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2fdd0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  NULL....skipif p
2fde0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2fdf0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2fe00 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2fe10 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2fe20 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2fe30 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2fe40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2fe50 6c 61 62 65 6c 2d 31 33 32 39 0d 0a 53 45 4c 45  label-1329..SELE
2fe60 43 54 20 44 49 53 54 49 4e 43 54 20 33 33 20 2b  CT DISTINCT 33 +
2fe70 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54   + col0 * + CAST
2fe80 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
2fe90 45 52 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ER ) col2 FROM t
2fea0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2feb0 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  -..NULL....query
2fec0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2fed0 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20 63 6f 72  CT ALL + ( - cor
2fee0 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30  0.col1 ) AS col0
2fef0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2ff00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d  r0..----..-17..-
2ff10 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71 75 65 72 79  31..-59....query
2ff20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ff30 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  CT - col0 * + co
2ff40 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
2ff50 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2ff60 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37  .-1040..-640..-7
2ff70 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2ff80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2ff90 20 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   1 + col2 AS col
2ffa0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2ffb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 34  or0..----..2..34
2ffc0 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..83....query I 
2ffd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ffe0 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ALL - col2 * col
2fff0 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 74 61 62  2 + + col2 * tab
30000 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2.col2 FROM tab2
30010 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
30020 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
30030 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
30040 4e 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c 32 20  NCT - cor1.col2 
30050 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 20 43  FROM tab1 cor0 C
30060 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20  ROSS JOIN tab0, 
30070 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
30080 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33  --..-26..-27..-3
30090 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
300a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
300b0 6f 6c 32 20 2a 20 2b 20 28 20 2d 20 28 20 74 61  ol2 * + ( - ( ta
300c0 62 30 2e 63 6f 6c 32 20 29 20 29 20 46 52 4f 4d  b0.col2 ) ) FROM
300d0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
300e0 31 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a 71 75  1089..6724....qu
300f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30100 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
30110 32 20 2a 20 32 32 20 46 52 4f 4d 20 74 61 62 32  2 * 22 FROM tab2
30120 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30130 35 37 32 0d 0a 35 39 34 0d 0a 38 33 36 0d 0a 0d  572..594..836...
30140 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30150 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
30160 63 6f 6c 32 20 2a 20 2b 20 34 35 20 46 52 4f 4d  col2 * + 45 FROM
30170 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
30180 2d 2d 2d 0d 0a 31 35 31 38 0d 0a 33 37 37 32 0d  ---..1518..3772.
30190 0a 34 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .46....onlyif my
301a0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
301b0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
301c0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
301d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
301e0 65 6c 2d 31 33 33 38 0d 0a 53 45 4c 45 43 54 20  el-1338..SELECT 
301f0 2d 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  - - col1 + - col
30200 30 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f  0 DIV col1 AS co
30210 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
30220 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a  cor0..----..86..
30230 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  91..97....skipif
30240 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
30250 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
30260 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
30270 33 33 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  338..SELECT - - 
30280 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2f 20  col1 + - col0 / 
30290 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
302a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
302b0 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37  ----..86..91..97
302c0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
302d0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
302e0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
302f0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
30300 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
30310 31 33 33 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1339..SELECT col
30320 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  2 + - cor0.col0 
30330 2a 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  * - col2 DIV - c
30340 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
30350 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
30360 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d 0a 39 0d  ---..-34..-7..9.
30370 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
30380 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
30390 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
303a0 74 20 6c 61 62 65 6c 2d 31 33 33 39 0d 0a 53 45  t label-1339..SE
303b0 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  LECT col2 + - co
303c0 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32  r0.col0 * - col2
303d0 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   / - col2 AS col
303e0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
303f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a  or0..----..-34..
30400 2d 37 0d 0a 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -7..9....onlyif 
30410 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
30420 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
30430 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
30440 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
30450 61 62 65 6c 2d 31 33 34 30 0d 0a 53 45 4c 45 43  abel-1340..SELEC
30460 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 34 36 20  T + col1 * - 46 
30470 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  + + col2 + + col
30480 30 20 44 49 56 20 2d 20 36 34 20 46 52 4f 4d 20  0 DIV - 64 FROM 
30490 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
304a0 2d 2d 0d 0a 2d 31 33 39 39 0d 0a 2d 32 36 38 39  --..-1399..-2689
304b0 0d 0a 2d 37 34 35 0d 0a 0d 0a 73 6b 69 70 69 66  ..-745....skipif
304c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
304d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
304e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
304f0 33 34 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  340..SELECT + co
30500 6c 31 20 2a 20 2d 20 34 36 20 2b 20 2b 20 63 6f  l1 * - 46 + + co
30510 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 2d 20  l2 + + col0 / - 
30520 36 34 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  64 FROM tab2 AS 
30530 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39  cor0..----..-139
30540 39 0d 0a 2d 32 36 38 39 0d 0a 2d 37 34 35 0d 0a  9..-2689..-745..
30550 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30560 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
30570 43 54 20 2d 20 2b 20 28 20 2d 20 28 20 2d 20 63  CT - + ( - ( - c
30580 6f 72 30 2e 63 6f 6c 31 20 29 20 29 20 2b 20 28  or0.col1 ) ) + (
30590 20 39 32 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41   92 ) * + col1 A
305a0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
305b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
305c0 37 38 32 36 0d 0a 38 32 38 31 0d 0a 38 38 32 37  7826..8281..8827
305d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
305e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 30 20 41 53  ort..SELECT 0 AS
305f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
30600 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
30610 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
30620 6e 67 20 74 6f 20 38 62 37 35 31 33 36 62 32 62  ng to 8b75136b2b
30630 35 31 63 37 37 33 34 35 63 30 33 38 30 34 65 63  51c77345c03804ec
30640 31 63 64 61 35 63 0d 0a 0d 0a 71 75 65 72 79 20  1cda5c....query 
30650 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30660 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
30670 6f 6c 31 20 2a 20 28 20 63 6f 6c 31 20 29 20 46  ol1 * ( col1 ) F
30680 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
30690 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39  ..----..100..169
306a0 0d 0a 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..676....query I
306b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
306c0 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b 20   ALL + col0 + + 
306d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
306e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31  or0..----..14..1
306f0 35 36 0d 0a 31 35 38 0d 0a 0d 0a 71 75 65 72 79  56..158....query
30700 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30710 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
30720 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col1 * cor0.col1
30730 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
30740 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
30750 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a 36 37 36 0d  ..100..169..676.
30760 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
30770 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
30780 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
30790 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
307a0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
307b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34 36  wsort label-1346
307c0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
307d0 2a 20 2b 20 43 41 53 54 28 20 63 6f 6c 31 20 41  * + CAST( col1 A
307e0 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
307f0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
30800 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a  --..-100..-169..
30810 2d 36 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  -676....skipif m
30820 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
30830 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
30840 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34  owsort label-134
30850 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  6..SELECT - col1
30860 20 2a 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 31   * + CAST ( col1
30870 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
30880 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
30890 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 36  .----..-100..-16
308a0 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 71 75 65 72 79  9..-676....query
308b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
308c0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
308d0 20 2b 20 2d 20 36 20 41 53 20 63 6f 6c 31 20 46   + - 6 AS col1 F
308e0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
308f0 2d 2d 2d 0d 0a 32 30 0d 0a 32 31 0d 0a 33 32 0d  ---..20..21..32.
30900 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
30910 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
30920 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
30930 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
30940 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
30950 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34 38  wsort label-1348
30960 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
30970 30 20 2b 20 2d 20 43 41 53 54 28 20 63 6f 72 30  0 + - CAST( cor0
30980 2e 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20  .col1 AS SIGNED 
30990 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
309a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d  or0..----..-2..-
309b0 36 32 0d 0a 2d 36 32 0d 0a 0d 0a 73 6b 69 70 69  62..-62....skipi
309c0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
309d0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
309e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
309f0 31 33 34 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1348..SELECT ALL
30a00 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 20 28   col0 + - CAST (
30a10 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 49 4e   cor0.col1 AS IN
30a20 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
30a30 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
30a40 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d  .-2..-62..-62...
30a50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30a60 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
30a70 30 20 2a 20 2b 20 39 38 20 2a 20 2d 20 63 6f 6c  0 * + 98 * - col
30a80 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  2 + + col0 FROM 
30a90 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
30aa0 2d 2d 0d 0a 2d 31 35 38 37 33 0d 0a 2d 33 35 37  --..-15873..-357
30ab0 34 34 30 0d 0a 2d 37 35 32 35 36 30 0d 0a 0d 0a  440..-752560....
30ac0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
30ad0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
30ae0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
30af0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
30b00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35 30  wsort label-1350
30b10 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
30b20 54 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  T col2 * cor0.co
30b30 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 44 49 56 20  l2 - + col0 DIV 
30b40 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
30b50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30b60 32 39 31 36 0d 0a 33 32 35 35 0d 0a 39 32 32 32  2916..3255..9222
30b70 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
30b80 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
30b90 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
30ba0 72 74 20 6c 61 62 65 6c 2d 31 33 35 30 0d 0a 53  rt label-1350..S
30bb0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
30bc0 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 * cor0.col2 
30bd0 2d 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  - + col0 / - col
30be0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
30bf0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 36 0d  or0..----..2916.
30c00 0a 33 32 35 35 0d 0a 39 32 32 32 0d 0a 0d 0a 71  .3255..9222....q
30c10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30c20 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
30c30 31 20 2a 20 33 37 20 46 52 4f 4d 20 74 61 62 32  1 * 37 FROM tab2
30c40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30c50 2d 31 31 34 37 0d 0a 2d 32 31 38 33 0d 0a 2d 36  -1147..-2183..-6
30c60 32 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  29....skipif pos
30c70 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
30c80 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
30c90 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
30ca0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
30cb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30cc0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
30cd0 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52  + - col1 col1 FR
30ce0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
30cf0 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35  --..-17..-31..-5
30d00 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  9....skipif post
30d10 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
30d20 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
30d30 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
30d40 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
30d50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30d60 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 63 6f 6c  ELECT col2 - col
30d70 32 20 2a 20 2b 20 28 20 34 37 20 2b 20 63 6f 6c  2 * + ( 47 + col
30d80 30 20 2a 20 28 20 2d 20 74 61 62 32 2e 63 6f 6c  0 * ( - tab2.col
30d90 30 20 29 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20  0 ) ) col0 FROM 
30da0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 39  tab2..----..1569
30db0 38 38 0d 0a 32 33 35 34 31 30 0d 0a 38 31 0d 0a  88..235410..81..
30dc0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
30dd0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
30de0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
30df0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
30e00 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
30e10 35 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  54..SELECT DISTI
30e20 4e 43 54 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b  NCT + col2 DIV +
30e30 20 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72   2 FROM tab2 cor
30e40 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 31 39 0d  0..----..13..19.
30e50 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
30e60 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
30e70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30e80 74 20 6c 61 62 65 6c 2d 31 33 35 34 0d 0a 53 45  t label-1354..SE
30e90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
30ea0 63 6f 6c 32 20 2f 20 2b 20 32 20 46 52 4f 4d 20  col2 / + 2 FROM 
30eb0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
30ec0 0a 31 33 0d 0a 31 39 0d 0a 0d 0a 71 75 65 72 79  .13..19....query
30ed0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30ee0 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  CT - col1 * col1
30ef0 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 74 61   + + col1 * - ta
30f00 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  b2.col0 AS col0 
30f10 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
30f20 0a 2d 31 31 37 38 0d 0a 2d 31 36 33 32 0d 0a 2d  .-1178..-1632..-
30f30 38 30 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8083....query I 
30f40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30f50 63 6f 72 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor1.col2 AS col
30f60 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
30f70 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
30f80 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
30f90 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
30fa0 69 6e 67 20 74 6f 20 38 30 63 61 30 61 31 63 63  ing to 80ca0a1cc
30fb0 33 33 37 61 37 37 31 34 61 38 39 39 30 61 37 36  337a7714a8990a76
30fc0 34 63 66 64 62 31 37 0d 0a 0d 0a 73 6b 69 70 69  4cfdb17....skipi
30fd0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
30fe0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
30ff0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
31000 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
31010 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
31020 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
31030 49 4e 43 54 20 63 6f 6c 31 20 2a 20 31 31 20 63  INCT col1 * 11 c
31040 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
31050 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30   cor0..----..100
31060 31 0d 0a 31 30 36 37 0d 0a 39 34 36 0d 0a 0d 0a  1..1067..946....
31070 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31080 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
31090 6f 6c 30 20 2b 20 2d 20 33 20 46 52 4f 4d 20 74  ol0 + - 3 FROM t
310a0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
310b0 2d 0d 0a 34 0d 0a 37 35 0d 0a 37 36 0d 0a 0d 0a  -..4..75..76....
310c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
310d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
310e0 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f 72 30 2e  col2 * ( - cor0.
310f0 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20 46 52  col0 ) + col0 FR
31100 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
31110 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31 32 0d 0a 37  --..165..3712..7
31120 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  760....query I r
31130 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
31140 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30  ISTINCT - + cor0
31150 2e 63 6f 6c 31 20 2a 20 28 20 38 39 20 29 20 2b  .col1 * ( 89 ) +
31160 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30 20 46   col1 - - col0 F
31170 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
31180 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 34 0d 0a 2d  ..----..-1064..-
31190 32 32 38 35 0d 0a 2d 38 31 36 0d 0a 0d 0a 6f 6e  2285..-816....on
311a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
311b0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
311c0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
311d0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
311e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
311f0 20 6c 61 62 65 6c 2d 31 33 36 31 0d 0a 53 45 4c   label-1361..SEL
31200 45 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20  ECT + tab2.col1 
31210 2b 20 2d 20 43 41 53 54 28 20 2b 20 38 36 20 41  + - CAST( + 86 A
31220 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
31230 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d  tab2..----..-27.
31240 0a 2d 35 35 0d 0a 2d 36 39 0d 0a 0d 0a 73 6b 69  .-55..-69....ski
31250 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
31260 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
31270 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
31280 6c 2d 31 33 36 31 0d 0a 53 45 4c 45 43 54 20 2b  l-1361..SELECT +
31290 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20 2d 20 43   tab2.col1 + - C
312a0 41 53 54 20 28 20 2b 20 38 36 20 41 53 20 49 4e  AST ( + 86 AS IN
312b0 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
312c0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 2d 35  2..----..-27..-5
312d0 35 0d 0a 2d 36 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  5..-69....onlyif
312e0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
312f0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
31300 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
31310 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
31320 6c 61 62 65 6c 2d 31 33 36 32 0d 0a 53 45 4c 45  label-1362..SELE
31330 43 54 20 33 38 20 44 49 56 20 63 6f 72 30 2e 63  CT 38 DIV cor0.c
31340 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
31350 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
31360 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
31370 69 6e 67 20 74 6f 20 38 62 37 35 31 33 36 62 32  ing to 8b75136b2
31380 62 35 31 63 37 37 33 34 35 63 30 33 38 30 34 65  b51c77345c03804e
31390 63 31 63 64 61 35 63 0d 0a 0d 0a 73 6b 69 70 69  c1cda5c....skipi
313a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
313b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
313c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
313d0 31 33 36 32 0d 0a 53 45 4c 45 43 54 20 33 38 20  1362..SELECT 38 
313e0 2f 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  / cor0.col2 FROM
313f0 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
31400 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
31410 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
31420 62 37 35 31 33 36 62 32 62 35 31 63 37 37 33 34  b75136b2b51c7734
31430 35 63 30 33 38 30 34 65 63 31 63 64 61 35 63 0d  5c03804ec1cda5c.
31440 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31450 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
31460 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 28 20 2b  NCT col1 + - ( +
31470 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 31   col1 ) + + col1
31480 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
31490 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a  ..86..91..97....
314a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
314b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
314c0 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20   + + ( + col0 ) 
314d0 2a 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  * - ( + cor0.col
314e0 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  1 ) FROM tab1 AS
314f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
31500 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d  40..-640..-78...
31510 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
31520 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
31530 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
31540 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
31550 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36  owsort label-136
31560 35 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  5..SELECT - col0
31570 20 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20 63 6f   DIV + col2 + co
31580 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30  r0.col1 * - col0
31590 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
315a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
315b0 2d 0d 0a 2d 32 31 35 30 0d 0a 2d 33 35 32 37 0d  -..-2150..-3527.
315c0 0a 2d 38 31 39 31 0d 0a 0d 0a 73 6b 69 70 69 66  .-8191....skipif
315d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
315e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
315f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
31600 33 36 35 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  365..SELECT - co
31610 6c 30 20 2f 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  l0 / + col2 + co
31620 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30  r0.col1 * - col0
31630 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
31640 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
31650 2d 0d 0a 2d 32 31 35 30 0d 0a 2d 33 35 32 37 0d  -..-2150..-3527.
31660 0a 2d 38 31 39 31 0d 0a 0d 0a 71 75 65 72 79 20  .-8191....query 
31670 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31680 54 20 32 38 20 2a 20 63 6f 6c 32 20 41 53 20 63  T 28 * col2 AS c
31690 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
316a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 39   cor0..----..229
316b0 36 0d 0a 32 38 0d 0a 39 32 34 0d 0a 0d 0a 6f 6e  6..28..924....on
316c0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
316d0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
316e0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
316f0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
31700 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31710 20 6c 61 62 65 6c 2d 31 33 36 37 0d 0a 53 45 4c   label-1367..SEL
31720 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20 35 32  ECT ALL CAST( 52
31730 20 2a 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45   * col2 AS SIGNE
31740 44 20 29 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c  D ) + - tab1.col
31750 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
31760 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30 35 0d  ab1..----..2805.
31770 0a 32 39 30 30 0d 0a 34 39 31 32 0d 0a 0d 0a 73  .2900..4912....s
31780 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
31790 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
317a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
317b0 62 65 6c 2d 31 33 36 37 0d 0a 53 45 4c 45 43 54  bel-1367..SELECT
317c0 20 41 4c 4c 20 43 41 53 54 20 28 20 35 32 20 2a   ALL CAST ( 52 *
317d0 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
317e0 20 29 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 30   ) + - tab1.col0
317f0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
31800 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30 35 0d 0a  b1..----..2805..
31810 32 39 30 30 0d 0a 34 39 31 32 0d 0a 0d 0a 71 75  2900..4912....qu
31820 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31830 45 4c 45 43 54 20 2b 20 36 39 20 2a 20 63 6f 6c  ELECT + 69 * col
31840 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
31850 2d 0d 0a 31 31 37 33 0d 0a 32 31 33 39 0d 0a 34  -..1173..2139..4
31860 30 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  071....query I r
31870 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
31880 49 53 54 49 4e 43 54 20 31 37 20 2b 20 2b 20 63  ISTINCT 17 + + c
31890 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d  ol0 * + col2 * -
318a0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
318b0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
318c0 31 33 30 36 0d 0a 2d 31 35 38 31 36 37 0d 0a 2d  1306..-158167..-
318d0 32 33 37 31 34 31 0d 0a 0d 0a 71 75 65 72 79 20  237141....query 
318e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
318f0 54 20 2b 20 36 31 20 41 53 20 63 6f 6c 32 20 46  T + 61 AS col2 F
31900 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 63  ROM tab2, tab0 c
31910 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
31920 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
31930 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 64  es hashing to 8d
31940 34 64 66 65 36 34 39 34 33 33 61 35 39 39 66 63  4dfe649433a599fc
31950 34 62 31 30 38 33 30 63 63 37 63 65 35 35 0d 0a  4b10830cc7ce55..
31960 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31970 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39 30 20 2b  t..SELECT - 90 +
31980 20 63 6f 6c 30 20 2a 20 2d 20 38 34 20 46 52 4f   col0 * - 84 FRO
31990 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  M tab2..----..-6
319a0 36 34 32 0d 0a 2d 36 37 32 36 0d 0a 2d 36 37 38  642..-6726..-678
319b0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
319c0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
319d0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
319e0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
319f0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
31a00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37  owsort label-137
31a10 32 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f  2..SELECT - ( co
31a20 6c 32 20 29 20 2a 20 2d 20 43 41 53 54 28 20 4e  l2 ) * - CAST( N
31a30 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
31a40 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
31a50 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
31a60 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
31a70 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
31a80 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
31a90 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
31aa0 33 37 32 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  372..SELECT - ( 
31ab0 63 6f 6c 32 20 29 20 2a 20 2d 20 43 41 53 54 20  col2 ) * - CAST 
31ac0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
31ad0 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  R ) FROM tab1 co
31ae0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
31af0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
31b00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31b10 45 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f 72 30  ELECT ALL ( cor0
31b20 2e 63 6f 6c 32 20 29 20 2a 20 2d 20 28 20 63 6f  .col2 ) * - ( co
31b30 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l0 ) AS col0 FRO
31b40 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
31b50 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34  ----..-162..-364
31b60 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72  8..-7680....quer
31b70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31b80 45 43 54 20 2d 20 36 34 20 46 52 4f 4d 20 74 61  ECT - 64 FROM ta
31b90 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b2, tab0 AS cor0
31ba0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  , tab0 AS cor1..
31bb0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
31bc0 68 61 73 68 69 6e 67 20 74 6f 20 31 30 30 63 36  hashing to 100c6
31bd0 32 35 65 34 35 37 31 35 63 32 30 33 36 38 35 35  25e45715c2036855
31be0 31 39 38 39 35 31 34 62 61 36 34 0d 0a 0d 0a 71  1989514ba64....q
31bf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31c00 53 45 4c 45 43 54 20 2d 20 37 35 20 46 52 4f 4d  SELECT - 75 FROM
31c10 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
31c20 0d 0a 2d 37 35 0d 0a 2d 37 35 0d 0a 2d 37 35 0d  ..-75..-75..-75.
31c30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31c40 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
31c50 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  0.col0 + + col2 
31c60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
31c70 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
31c80 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71  .-7..16..51....q
31c90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31ca0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31cb0 2b 20 2d 20 35 31 20 41 53 20 63 6f 6c 30 20 46  + - 51 AS col0 F
31cc0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
31cd0 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d 0a 0d 0a 73  ..----..-51....s
31ce0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
31cf0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
31d00 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
31d10 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
31d20 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
31d30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31d40 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  ALL + col0 * - c
31d50 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 31 20 46 52  or0.col1 col1 FR
31d60 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
31d70 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32  .----..-1343..-2
31d80 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65  17..-4602....que
31d90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31da0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
31db0 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  - col2 * - col2 
31dc0 2b 20 39 36 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  + 96 * cor0.col1
31dd0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
31de0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
31df0 0d 0a 32 30 31 32 0d 0a 37 31 36 37 0d 0a 39 33  ..2012..7167..93
31e00 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  11....query I ro
31e10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
31e20 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20  STINCT - - col2 
31e30 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  * + col1 AS col2
31e40 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
31e50 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36  .----..2838..746
31e60 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  2..97....query I
31e70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31e80 20 44 49 53 54 49 4e 43 54 20 2d 20 34 39 20 2a   DISTINCT - 49 *
31e90 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
31ea0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
31eb0 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 0d 0a 2d 33 31  .----..-147..-31
31ec0 33 36 0d 0a 2d 33 39 32 30 0d 0a 0d 0a 71 75 65  36..-3920....que
31ed0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31ee0 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
31ef0 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 37 39 20  + - col0 * - 79 
31f00 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
31f10 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 33 0d 0a 35 30  0..----..263..50
31f20 36 36 0d 0a 36 33 33 33 0d 0a 0d 0a 71 75 65 72  66..6333....quer
31f30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31f40 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d  ECT ALL col2 * -
31f50 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   ( col1 ) FROM t
31f60 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
31f70 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39  -2838..-7462..-9
31f80 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
31f90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
31fa0 54 49 4e 43 54 20 39 30 20 46 52 4f 4d 20 74 61  TINCT 90 FROM ta
31fb0 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
31fc0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
31fd0 2d 2d 2d 2d 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72  ----..90....quer
31fe0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31ff0 45 43 54 20 2b 20 34 32 20 2a 20 2b 20 28 20 63  ECT + 42 * + ( c
32000 6f 6c 32 20 2b 20 35 37 20 29 20 46 52 4f 4d 20  ol2 + 57 ) FROM 
32010 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 34 38 36  tab2..----..3486
32020 0d 0a 33 35 32 38 0d 0a 33 39 39 30 0d 0a 0d 0a  ..3528..3990....
32030 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
32040 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
32050 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
32060 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
32070 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
32080 72 74 20 6c 61 62 65 6c 2d 31 33 38 36 0d 0a 53  rt label-1386..S
32090 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
320a0 20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   - CAST( col1 AS
320b0 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63 6f   SIGNED ) * + co
320c0 6c 32 20 2b 20 34 36 20 46 52 4f 4d 20 74 61 62  l2 + 46 FROM tab
320d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
320e0 0a 31 34 33 0d 0a 32 38 38 34 0d 0a 37 35 30 38  .143..2884..7508
320f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
32100 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
32110 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
32120 72 74 20 6c 61 62 65 6c 2d 31 33 38 36 0d 0a 53  rt label-1386..S
32130 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
32140 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41   - CAST ( col1 A
32150 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20  S INTEGER ) * + 
32160 63 6f 6c 32 20 2b 20 34 36 20 46 52 4f 4d 20 74  col2 + 46 FROM t
32170 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
32180 2d 0d 0a 31 34 33 0d 0a 32 38 38 34 0d 0a 37 35  -..143..2884..75
32190 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  08....query I ro
321a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
321b0 4c 20 2d 20 2b 20 36 34 20 2d 20 63 6f 6c 30 20  L - + 64 - col0 
321c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
321d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
321e0 0a 2d 31 34 32 0d 0a 2d 31 34 33 0d 0a 2d 37 31  .-142..-143..-71
321f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32200 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 35  ort..SELECT + 45
32210 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
32220 62 32 2c 20 74 61 62 30 2c 20 74 61 62 32 20 41  b2, tab0, tab2 A
32230 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
32240 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
32250 74 6f 20 31 34 63 65 63 38 37 31 65 64 63 33 37  to 14cec871edc37
32260 62 35 30 35 36 63 64 61 30 31 63 38 33 33 31 66  b5056cda01c8331f
32270 64 63 61 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  dca....onlyif my
32280 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
32290 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
322a0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
322b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
322c0 65 6c 2d 31 33 38 39 0d 0a 53 45 4c 45 43 54 20  el-1389..SELECT 
322d0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
322e0 44 49 56 20 32 35 20 2b 20 2d 20 74 61 62 31 2e  DIV 25 + - tab1.
322f0 63 6f 6c 32 20 2a 20 31 20 41 53 20 63 6f 6c 32  col2 * 1 AS col2
32300 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
32310 0d 0a 2d 35 34 0d 0a 2d 35 39 0d 0a 2d 39 39 0d  ..-54..-59..-99.
32320 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
32330 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
32340 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32350 74 20 6c 61 62 65 6c 2d 31 33 38 39 0d 0a 53 45  t label-1389..SE
32360 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
32370 63 6f 6c 30 20 2f 20 32 35 20 2b 20 2d 20 74 61  col0 / 25 + - ta
32380 62 31 2e 63 6f 6c 32 20 2a 20 31 20 41 53 20 63  b1.col2 * 1 AS c
32390 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
323a0 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 39 0d 0a 2d  ---..-54..-59..-
323b0 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
323c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
323d0 53 54 49 4e 43 54 20 2b 20 74 61 62 32 2e 63 6f  STINCT + tab2.co
323e0 6c 30 20 2b 20 2b 20 34 38 20 46 52 4f 4d 20 74  l0 + + 48 FROM t
323f0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 0d 0a  ab2..----..126..
32400 31 32 37 0d 0a 35 35 0d 0a 0d 0a 71 75 65 72 79  127..55....query
32410 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32420 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
32430 6c 32 20 2a 20 2b 20 34 32 20 2a 20 74 61 62 31  l2 * + 42 * tab1
32440 2e 63 6f 6c 32 20 2b 20 2b 20 28 20 37 20 2a 20  .col2 + + ( 7 * 
32450 2d 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32  - col0 ) AS col2
32460 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
32470 0d 0a 31 32 32 34 35 31 0d 0a 31 33 36 30 31 30  ..122451..136010
32480 0d 0a 33 38 36 35 31 32 0d 0a 0d 0a 71 75 65 72  ..386512....quer
32490 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
324a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
324b0 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 74   - tab2.col1 * t
324c0 61 62 32 2e 63 6f 6c 31 20 29 20 2b 20 28 20 74  ab2.col1 ) + ( t
324d0 61 62 32 2e 63 6f 6c 30 20 29 20 2a 20 63 6f 6c  ab2.col0 ) * col
324e0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
324f0 2d 0d 0a 31 30 31 30 0d 0a 36 35 33 30 0d 0a 39  -..1010..6530..9
32500 35 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  565....query I r
32510 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
32520 20 63 6f 6c 31 20 2a 20 2b 20 32 33 20 41 53 20   col1 * + 23 AS 
32530 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
32540 2d 2d 2d 2d 0d 0a 31 33 35 37 0d 0a 33 39 31 0d  ----..1357..391.
32550 0a 37 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .713....query I 
32560 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32570 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  ALL + col2 + col
32580 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
32590 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
325a0 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a  121..176..57....
325b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
325c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
325d0 20 63 6f 6c 31 20 2b 20 37 37 20 46 52 4f 4d 20   col1 + 77 FROM 
325e0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
325f0 2d 2d 0d 0a 31 30 38 0d 0a 31 33 36 0d 0a 39 34  --..108..136..94
32600 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
32610 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
32620 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
32630 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
32640 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
32650 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32660 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LECT - col0 * co
32670 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l1 col2 FROM tab
32680 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
32690 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d  .-2064..-3395..-
326a0 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
326b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
326c0 44 49 53 54 49 4e 43 54 20 2b 20 35 35 20 2d 20  DISTINCT + 55 - 
326d0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
326e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
326f0 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 32 32 0d 0a 35  ----..-27..22..5
32700 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
32710 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
32720 20 36 20 2d 20 33 33 20 46 52 4f 4d 20 74 61 62   6 - 33 FROM tab
32730 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
32740 0a 2d 33 39 0d 0a 2d 33 39 0d 0a 2d 33 39 0d 0a  .-39..-39..-39..
32750 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32760 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
32770 43 54 20 2d 20 35 38 20 2a 20 2d 20 63 6f 6c 32  CT - 58 * - col2
32780 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
32790 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38 0d 0a  r0..----..1508..
327a0 31 35 36 36 0d 0a 32 32 30 34 0d 0a 0d 0a 6f 6e  1566..2204....on
327b0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
327c0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
327d0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
327e0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
327f0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30 30 0d 0a  ort label-1400..
32800 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f  SELECT col0 * co
32810 6c 31 20 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20  l1 DIV + col2 + 
32820 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  + cor0.col2 * + 
32830 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
32840 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
32850 2d 2d 2d 2d 0d 0a 32 39 30 30 0d 0a 33 34 39 32  ----..2900..3492
32860 0d 0a 37 35 36 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..7560....skipif
32870 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
32880 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
32890 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
328a0 34 30 30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  400..SELECT col0
328b0 20 2a 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 32   * col1 / + col2
328c0 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   + + cor0.col2 *
328d0 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
328e0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
328f0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 30 30 0d 0a 33  0..----..2900..3
32900 34 39 32 0d 0a 37 35 36 30 0d 0a 0d 0a 71 75 65  492..7560....que
32910 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32920 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  LECT - col2 * - 
32930 63 6f 6c 31 20 2b 20 2d 20 28 20 2d 20 28 20 63  col1 + - ( - ( c
32940 6f 6c 32 20 29 20 29 20 41 53 20 63 6f 6c 32 20  ol2 ) ) AS col2 
32950 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
32960 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30 0d 0a 36  0..----..1560..6
32970 38 34 0d 0a 38 36 34 0d 0a 0d 0a 6f 6e 6c 79 69  84..864....onlyi
32980 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
32990 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
329a0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
329b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
329c0 20 6c 61 62 65 6c 2d 31 34 30 32 0d 0a 53 45 4c   label-1402..SEL
329d0 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ECT - cor0.col1 
329e0 2a 20 2d 20 63 6f 6c 30 20 2b 20 38 30 20 44 49  * - col0 + 80 DI
329f0 56 20 34 20 46 52 4f 4d 20 74 61 62 32 20 41 53  V 4 FROM tab2 AS
32a00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36   cor0..----..136
32a10 33 0d 0a 32 33 37 0d 0a 34 36 32 32 0d 0a 0d 0a  3..237..4622....
32a20 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
32a30 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
32a40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
32a50 61 62 65 6c 2d 31 34 30 32 0d 0a 53 45 4c 45 43  abel-1402..SELEC
32a60 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  T - cor0.col1 * 
32a70 2d 20 63 6f 6c 30 20 2b 20 38 30 20 2f 20 34 20  - col0 + 80 / 4 
32a80 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
32a90 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 33 0d 0a 32  0..----..1363..2
32aa0 33 37 0d 0a 34 36 32 32 0d 0a 0d 0a 71 75 65 72  37..4622....quer
32ab0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32ac0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
32ad0 20 63 6f 6c 30 20 2a 20 2d 20 31 35 20 46 52 4f   col0 * - 15 FRO
32ae0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
32af0 2d 2d 2d 2d 0d 0a 2d 31 32 34 36 0d 0a 2d 33 33  ----..-1246..-33
32b00 36 0d 0a 2d 34 39 30 0d 0a 0d 0a 73 6b 69 70 69  6..-490....skipi
32b10 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
32b20 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
32b30 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
32b40 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
32b50 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
32b60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
32b70 2b 20 35 36 20 2a 20 63 6f 6c 30 20 63 6f 6c 32  + 56 * col0 col2
32b80 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
32b90 0a 2d 2d 2d 2d 0d 0a 33 39 32 0d 0a 34 33 36 38  .----..392..4368
32ba0 0d 0a 34 34 32 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..4424....skipif
32bb0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
32bc0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
32bd0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
32be0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
32bf0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
32c00 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
32c10 4e 43 54 20 2d 20 33 32 20 2a 20 2d 20 63 6f 6c  NCT - 32 * - col
32c20 31 20 2b 20 37 35 20 2a 20 35 30 20 63 6f 6c 30  1 + 75 * 50 col0
32c30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
32c40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 37 30 0d 0a  r0..----..4070..
32c50 34 31 36 36 0d 0a 34 35 38 32 0d 0a 0d 0a 71 75  4166..4582....qu
32c60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32c70 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b  ELECT + col2 * +
32c80 20 63 6f 6c 30 20 2b 20 28 20 2b 20 63 6f 6c 32   col0 + ( + col2
32c90 20 29 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 31 35   ) * col2 * - 15
32ca0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
32cb0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
32cc0 0d 0a 2d 31 35 35 34 33 0d 0a 2d 39 33 35 36 32  ..-15543..-93562
32cd0 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..20....query I 
32ce0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32cf0 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  - + col1 * + col
32d00 30 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  0 + col2 * - col
32d10 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
32d20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 38 37  or0..----..-2787
32d30 0d 0a 2d 35 32 37 38 0d 0a 2d 39 34 36 0d 0a 0d  ..-5278..-946...
32d40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32d50 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
32d60 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 35 31 20  T + col1 * - 51 
32d70 2b 20 63 6f 6c 30 20 2a 20 2d 20 38 36 20 41 53  + col0 * - 86 AS
32d80 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
32d90 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 34 0d 0a 2d 36  .----..-1584..-6
32da0 30 31 34 0d 0a 2d 37 35 34 33 0d 0a 0d 0a 71 75  014..-7543....qu
32db0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32dc0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 38  ELECT DISTINCT 8
32dd0 35 20 2a 20 74 61 62 31 2e 63 6f 6c 30 20 41 53  5 * tab1.col0 AS
32de0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c   col0 FROM tab1,
32df0 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
32e00 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
32e10 31 0d 0a 2d 2d 2d 2d 0d 0a 32 35 35 0d 0a 35 34  1..----..255..54
32e20 34 30 0d 0a 36 38 30 30 0d 0a 0d 0a 6f 6e 6c 79  40..6800....only
32e30 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
32e40 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
32e50 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
32e60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32e70 74 20 6c 61 62 65 6c 2d 31 34 31 30 0d 0a 53 45  t label-1410..SE
32e80 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
32e90 63 6f 6c 30 20 44 49 56 20 2b 20 28 20 2b 20 63  col0 DIV + ( + c
32ea0 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20 2a 20 2d  ol2 ) + col1 * -
32eb0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
32ec0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
32ed0 31 33 32 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36  132..-2838..-746
32ee0 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
32ef0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
32f00 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
32f10 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 30 0d 0a  ort label-1410..
32f20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
32f30 2d 20 63 6f 6c 30 20 2f 20 2b 20 28 20 2b 20 63  - col0 / + ( + c
32f40 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20 2a 20 2d  ol2 ) + col1 * -
32f50 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
32f60 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
32f70 31 33 32 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36  132..-2838..-746
32f80 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
32f90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
32fa0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c   cor0.col1 + col
32fb0 31 20 2a 20 31 33 20 41 53 20 63 6f 6c 32 20 46  1 * 13 AS col2 F
32fc0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
32fd0 0d 0a 2d 2d 2d 2d 0d 0a 32 33 38 0d 0a 34 33 34  ..----..238..434
32fe0 0d 0a 38 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..826....query I
32ff0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33000 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 72 30   + col2 - - cor0
33010 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
33020 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
33030 2d 2d 0d 0a 31 36 34 0d 0a 32 0d 0a 36 36 0d 0a  --..164..2..66..
33040 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33050 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
33060 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  l2 + + col0 * co
33070 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
33080 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 36  cor0..----..1136
33090 0d 0a 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a 71 75  ..132..697....qu
330a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
330b0 45 4c 45 43 54 20 2d 20 35 39 20 2a 20 63 6f 6c  ELECT - 59 * col
330c0 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 33 30 20  0 * - col2 + 30 
330d0 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  * + cor0.col1 * 
330e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
330f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33  S cor0..----..23
33100 32 33 33 32 0d 0a 34 39 30 35 36 30 0d 0a 35 31  2332..490560..51
33110 36 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  678....query I r
33120 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
33130 20 63 6f 6c 32 20 2d 20 2b 20 28 20 63 6f 6c 31   col2 - + ( col1
33140 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
33150 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39  cor0..----..-119
33160 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a 6f  ..-173..-98....o
33170 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
33180 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
33190 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
331a0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
331b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
331c0 74 20 6c 61 62 65 6c 2d 31 34 31 36 0d 0a 53 45  t label-1416..SE
331d0 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 43 41 53  LECT ALL - + CAS
331e0 54 28 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20  T( cor0.col1 AS 
331f0 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c  SIGNED ) * - col
33200 32 20 2b 20 37 34 20 46 52 4f 4d 20 74 61 62 32  2 + 74 FROM tab2
33210 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30   cor0..----..160
33220 38 0d 0a 37 32 30 0d 0a 39 31 31 0d 0a 0d 0a 73  8..720..911....s
33230 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
33240 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
33250 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
33260 62 65 6c 2d 31 34 31 36 0d 0a 53 45 4c 45 43 54  bel-1416..SELECT
33270 20 41 4c 4c 20 2d 20 2b 20 43 41 53 54 20 28 20   ALL - + CAST ( 
33280 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 49 4e 54  cor0.col1 AS INT
33290 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 32 20  EGER ) * - col2 
332a0 2b 20 37 34 20 46 52 4f 4d 20 74 61 62 32 20 63  + 74 FROM tab2 c
332b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 38 0d  or0..----..1608.
332c0 0a 37 32 30 0d 0a 39 31 31 0d 0a 0d 0a 71 75 65  .720..911....que
332d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
332e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
332f0 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  col0 - col1 * - 
33300 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
33310 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
33320 35 36 0d 0a 35 36 37 0d 0a 38 33 30 0d 0a 0d 0a  56..567..830....
33330 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33340 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
33350 6c 31 20 2a 20 2b 20 38 35 20 46 52 4f 4d 20 74  l1 * + 85 FROM t
33360 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 35  ab1..----..-1105
33370 0d 0a 2d 32 32 31 30 0d 0a 2d 38 35 30 0d 0a 0d  ..-2210..-850...
33380 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33390 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 38 36 20  ..SELECT - - 86 
333a0 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
333b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
333c0 0d 0a 36 30 0d 0a 37 33 0d 0a 37 36 0d 0a 0d 0a  ..60..73..76....
333d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
333e0 0a 53 45 4c 45 43 54 20 2d 20 32 31 20 2a 20 2d  .SELECT - 21 * -
333f0 20 63 6f 6c 31 20 2b 20 2b 20 38 34 20 46 52 4f   col1 + + 84 FRO
33400 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
33410 2d 2d 2d 2d 0d 0a 32 39 34 0d 0a 33 35 37 0d 0a  ----..294..357..
33420 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  630....query I r
33430 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
33440 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2d 20 2b  ISTINCT col0 - +
33450 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
33460 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
33470 32 30 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 71 75  20..41..52....qu
33480 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33490 45 4c 45 43 54 20 2b 20 2d 20 33 39 20 2a 20 63  ELECT + - 39 * c
334a0 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol2 * col1 AS co
334b0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
334c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 32  cor0..----..-222
334d0 33 30 0d 0a 2d 34 38 36 37 32 0d 0a 2d 35 34 37  30..-48672..-547
334e0 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  56....query I ro
334f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
33500 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20  ( col2 ) + col1 
33510 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
33520 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33  0..----..-21..33
33530 0d 0a 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..4....onlyif my
33540 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
33550 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
33560 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
33570 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
33580 65 6c 2d 31 34 32 34 0d 0a 53 45 4c 45 43 54 20  el-1424..SELECT 
33590 2d 20 2d 20 39 32 20 2b 20 2d 20 63 6f 6c 30 20  - - 92 + - col0 
335a0 44 49 56 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20  DIV ( cor0.col2 
335b0 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
335c0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
335d0 39 31 0d 0a 39 32 0d 0a 39 32 0d 0a 0d 0a 73 6b  91..92..92....sk
335e0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
335f0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
33600 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
33610 65 6c 2d 31 34 32 34 0d 0a 53 45 4c 45 43 54 20  el-1424..SELECT 
33620 2d 20 2d 20 39 32 20 2b 20 2d 20 63 6f 6c 30 20  - - 92 + - col0 
33630 2f 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  / ( cor0.col2 ) 
33640 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
33650 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 31  1 cor0..----..91
33660 0d 0a 39 32 0d 0a 39 32 0d 0a 0d 0a 73 6b 69 70  ..92..92....skip
33670 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
33680 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
33690 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
336a0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
336b0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
336c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
336d0 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c  TINCT col0 + col
336e0 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  2 * - col1 + - c
336f0 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
33700 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
33710 31 31 38 31 0d 0a 2d 31 34 32 37 0d 0a 2d 35 31  1181..-1427..-51
33720 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
33730 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
33740 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63   col0 * - cor0.c
33750 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 2d  ol2 * + col2 - -
33760 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
33770 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
33780 32 30 37 38 37 32 0d 0a 2d 37 33 37 32 30 30 0d  207872..-737200.
33790 0a 2d 38 37 34 35 0d 0a 0d 0a 71 75 65 72 79 20  .-8745....query 
337a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
337b0 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2b  T ALL + col1 * +
337c0 20 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   0 * + col0 FROM
337d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
337e0 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
337f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33800 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
33810 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63   cor0.col2 + - c
33820 6f 6c 30 20 2a 20 2b 20 36 35 20 41 53 20 63 6f  ol0 * + 65 AS co
33830 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
33840 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 31  cor0..----..-141
33850 0d 0a 2d 34 31 30 33 0d 0a 2d 35 31 30 34 0d 0a  ..-4103..-5104..
33860 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
33870 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
33880 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
33890 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
338a0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
338b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
338c0 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20  CT ALL - + col1 
338d0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32  + cor0.col0 col2
338e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
338f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31  r0..----..-24..1
33900 39 0d 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  9..62....skipif 
33910 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
33920 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
33930 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
33940 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
33950 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33960 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
33970 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  CT + col0 + + co
33980 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f  r0.col2 col1 FRO
33990 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
339a0 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35  ----..171..36..5
339b0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
339c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33  sort..SELECT + 3
339d0 38 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  8 FROM tab0, tab
339e0 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  1 AS cor0, tab2 
339f0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
33a00 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
33a10 20 74 6f 20 61 37 38 32 37 61 37 39 32 34 38 65   to a7827a79248e
33a20 65 37 62 66 32 63 65 65 39 31 35 61 36 33 31 64  e7bf2cee915a631d
33a30 30 32 63 62 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  02cb....onlyif m
33a40 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
33a50 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
33a60 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
33a70 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
33a80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
33a90 2d 31 34 33 32 0d 0a 53 45 4c 45 43 54 20 2b 20  -1432..SELECT + 
33aa0 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 4e 55 4c  col1 + CAST( NUL
33ab0 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  L AS SIGNED ) + 
33ac0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
33ad0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
33ae0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
33af0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
33b00 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
33b10 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
33b20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
33b30 33 32 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  32..SELECT + col
33b40 31 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  1 + CAST ( NULL 
33b50 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b  AS INTEGER ) + +
33b60 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
33b70 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
33b80 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
33b90 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
33ba0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33bb0 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72  DISTINCT + - cor
33bc0 30 2e 63 6f 6c 30 20 2b 20 2b 20 38 33 20 41 53  0.col0 + + 83 AS
33bd0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
33be0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
33bf0 39 0d 0a 33 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72  9..3..80....quer
33c00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33c10 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  ECT col1 + col0 
33c20 2a 20 2d 20 35 37 20 46 52 4f 4d 20 74 61 62 30  * - 57 FROM tab0
33c30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33c40 2d 31 32 38 32 0d 0a 2d 31 38 39 38 0d 0a 2d 34  -1282..-1898..-4
33c50 39 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  982....skipif po
33c60 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
33c70 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
33c80 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
33c90 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
33ca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33cb0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
33cc0 72 30 2e 63 6f 6c 31 20 2a 20 37 35 20 2b 20 2b  r0.col1 * 75 + +
33cd0 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 31 20   cor0.col1 col1 
33ce0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
33cf0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 36 0d 0a 37  0..----..1976..7
33d00 36 30 0d 0a 39 38 38 0d 0a 0d 0a 71 75 65 72 79  60..988....query
33d10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33d20 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
33d30 63 6f 6c 32 20 2b 20 2b 20 32 37 20 46 52 4f 4d  col2 + + 27 FROM
33d40 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
33d50 2d 2d 2d 0d 0a 31 32 33 0d 0a 38 31 0d 0a 38 34  ---..123..81..84
33d60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33d70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
33d80 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f  INCT - + cor0.co
33d90 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46  l1 * cor0.col0 F
33da0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
33db0 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39  ---..-2064..-339
33dc0 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72  5..-8099....quer
33dd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33de0 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2d  ECT - - col0 + -
33df0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41   col1 * + col0 A
33e00 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
33e10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33e20 2d 35 37 36 0d 0a 2d 37 35 0d 0a 2d 39 36 30 0d  -576..-75..-960.
33e30 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
33e40 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
33e50 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
33e60 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
33e70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
33e80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33e90 45 43 54 20 2d 20 33 35 20 2a 20 63 6f 6c 32 20  ECT - 35 * col2 
33ea0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
33eb0 2d 2d 2d 2d 0d 0a 2d 31 33 33 30 0d 0a 2d 39 31  ----..-1330..-91
33ec0 30 0d 0a 2d 39 34 35 0d 0a 0d 0a 71 75 65 72 79  0..-945....query
33ed0 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49   IIIIIIIIIIIIIII
33ee0 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
33ef0 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  ECT * FROM tab0 
33f00 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
33f10 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
33f20 72 31 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41  r1, tab1, tab0 A
33f30 53 20 63 6f 72 32 2c 20 74 61 62 32 0d 0a 2d 2d  S cor2, tab2..--
33f40 2d 2d 0d 0a 31 33 31 32 32 20 76 61 6c 75 65 73  --..13122 values
33f50 20 68 61 73 68 69 6e 67 20 74 6f 20 63 33 32 66   hashing to c32f
33f60 65 36 30 37 38 30 31 63 39 35 33 64 39 39 62 35  e607801c953d99b5
33f70 66 64 65 65 30 32 31 65 61 34 31 36 0d 0a 0d 0a  fdee021ea416....
33f80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33f90 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
33fa0 20 2b 20 2b 20 37 31 20 46 52 4f 4d 20 74 61 62   + + 71 FROM tab
33fb0 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  0 AS cor0 CROSS 
33fc0 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72  JOIN tab2 AS cor
33fd0 31 0d 0a 2d 2d 2d 2d 0d 0a 37 31 0d 0a 0d 0a 71  1..----..71....q
33fe0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33ff0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20  SELECT + col0 + 
34000 2d 20 37 36 20 46 52 4f 4d 20 74 61 62 31 0d 0a  - 76 FROM tab1..
34010 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 37 33 0d 0a  ----..-12..-73..
34020 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
34030 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
34040 20 63 6f 6c 31 20 2a 20 28 20 2d 20 63 6f 6c 32   col1 * ( - col2
34050 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
34060 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38  cor0..----..2838
34070 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75  ..7462..97....qu
34080 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34090 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 28  ELECT + col1 + (
340a0 20 2d 20 34 33 20 29 20 46 52 4f 4d 20 74 61 62   - 43 ) FROM tab
340b0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
340c0 37 0d 0a 2d 33 30 0d 0a 2d 33 33 0d 0a 0d 0a 6f  7..-30..-33....o
340d0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
340e0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
340f0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
34100 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
34110 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34120 74 20 6c 61 62 65 6c 2d 31 34 34 35 0d 0a 53 45  t label-1445..SE
34130 4c 45 43 54 20 43 41 53 54 28 20 2b 20 34 35 20  LECT CAST( + 45 
34140 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f  AS SIGNED ) * co
34150 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
34160 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
34170 2d 2d 0d 0a 31 34 38 35 0d 0a 33 36 39 30 0d 0a  --..1485..3690..
34180 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  45....skipif mys
34190 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
341a0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
341b0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34 35 0d  sort label-1445.
341c0 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 2b  .SELECT CAST ( +
341d0 20 34 35 20 41 53 20 49 4e 54 45 47 45 52 20 29   45 AS INTEGER )
341e0 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   * col2 AS col1 
341f0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
34200 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 35 0d 0a 33  0..----..1485..3
34210 36 39 30 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72 79  690..45....query
34220 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34230 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2d 20 2d 20  CT + - col1 - - 
34240 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
34250 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
34260 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33  ----..28..47..83
34270 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34280 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
34290 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 30 20 41 53  col0 ) * col0 AS
342a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
342b0 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35 37 36  .----..1225..576
342c0 0d 0a 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20  ..7921....query 
342d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
342e0 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20 63  T ALL col2 * - c
342f0 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol1 + col1 * col
34300 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
34310 2d 0d 0a 2d 31 33 32 36 0d 0a 2d 32 30 38 0d 0a  -..-1326..-208..
34320 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
34330 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
34340 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20  STINCT + col2 + 
34350 2d 20 63 6f 6c 30 20 2a 20 2b 20 28 20 63 6f 6c  - col0 * + ( col
34360 32 20 2a 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  2 * col2 ) AS co
34370 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
34380 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37  cor0..----..-207
34390 38 37 39 0d 0a 2d 37 33 37 31 38 34 0d 0a 2d 38  879..-737184..-8
343a0 36 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  694....onlyif my
343b0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
343c0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
343d0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
343e0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
343f0 65 6c 2d 31 34 35 30 0d 0a 53 45 4c 45 43 54 20  el-1450..SELECT 
34400 41 4c 4c 20 2d 20 37 35 20 44 49 56 20 2b 20 63  ALL - 75 DIV + c
34410 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
34420 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
34430 0d 0a 2d 32 0d 0a 2d 37 35 0d 0a 30 0d 0a 0d 0a  ..-2..-75..0....
34440 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
34450 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
34460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
34470 61 62 65 6c 2d 31 34 35 30 0d 0a 53 45 4c 45 43  abel-1450..SELEC
34480 54 20 41 4c 4c 20 2d 20 37 35 20 2f 20 2b 20 63  T ALL - 75 / + c
34490 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
344a0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
344b0 0d 0a 2d 32 0d 0a 2d 37 35 0d 0a 30 0d 0a 0d 0a  ..-2..-75..0....
344c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
344d0 0a 53 45 4c 45 43 54 20 2b 20 35 38 20 2b 20 2d  .SELECT + 58 + -
344e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
344f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
34500 32 30 0d 0a 2d 32 31 0d 0a 35 31 0d 0a 0d 0a 71  20..-21..51....q
34510 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34520 53 45 4c 45 43 54 20 34 30 20 2a 20 2d 20 63 6f  SELECT 40 * - co
34530 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
34540 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
34550 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 31 30 38 30  --..-1040..-1080
34560 0d 0a 2d 31 35 32 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..-1520....onlyi
34570 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
34580 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
34590 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
345a0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
345b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
345c0 62 65 6c 2d 31 34 35 33 0d 0a 53 45 4c 45 43 54  bel-1453..SELECT
345d0 20 2d 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   - + CAST( NULL 
345e0 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2a 20 2b  AS DECIMAL ) * +
345f0 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a   col1 + - col0 *
34600 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20   col0 * col2 AS 
34610 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
34620 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
34630 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
34640 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
34650 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
34660 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
34670 62 65 6c 2d 31 34 35 33 0d 0a 53 45 4c 45 43 54  bel-1453..SELECT
34680 20 2d 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c   - + CAST ( NULL
34690 20 41 53 20 52 45 41 4c 20 29 20 2a 20 2b 20 63   AS REAL ) * + c
346a0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63  ol1 + - col0 * c
346b0 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
346c0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
346d0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
346e0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
346f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34700 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
34710 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  * - col1 + col1 
34720 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
34730 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32  0..----..1360..2
34740 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 71 75 65 72  48..4661....quer
34750 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34760 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28  ECT DISTINCT + (
34770 20 2b 20 63 6f 6c 32 20 29 20 2d 20 63 6f 6c 32   + col2 ) - col2
34780 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
34790 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b2 cor0..----..0
347a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
347b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
347c0 2b 20 34 38 20 2a 20 63 6f 6c 30 20 41 53 20 63  + 48 * col0 AS c
347d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
347e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35   cor0..----..115
347f0 32 0d 0a 31 36 38 30 0d 0a 34 32 37 32 0d 0a 0d  2..1680..4272...
34800 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34810 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
34820 54 20 2b 20 34 39 20 2a 20 63 6f 6c 31 20 46 52  T + 49 * col1 FR
34830 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
34840 0a 2d 2d 2d 2d 0d 0a 31 32 37 34 0d 0a 34 39 30  .----..1274..490
34850 0d 0a 36 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..637....query I
34860 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34870 20 41 4c 4c 20 2b 20 35 30 20 2a 20 38 20 46 52   ALL + 50 * 8 FR
34880 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
34890 0a 2d 2d 2d 2d 0d 0a 34 30 30 0d 0a 34 30 30 0d  .----..400..400.
348a0 0a 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .400....query I 
348b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
348c0 2b 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2d 20 63  + col2 * + ( - c
348d0 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 32 20 2a  ol1 ) + + col2 *
348e0 20 31 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f   10 FROM tab0 co
348f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 30 38 0d  r0..----..-2508.
34900 0a 2d 36 36 34 32 0d 0a 2d 38 37 0d 0a 0d 0a 71  .-6642..-87....q
34910 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34920 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
34930 31 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29  1 + - ( - col2 )
34940 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
34950 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
34960 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a  ..-53..-9..-96..
34970 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34980 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
34990 2d 20 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f  - ( col0 ) AS co
349a0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
349b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33  0..----..-24..-3
349c0 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20  5..-89....query 
349d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
349e0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
349f0 2b 20 38 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 82 AS col2 FRO
34a00 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
34a10 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 39 32 0d 0a 39  ----..108..92..9
34a20 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
34a30 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
34a40 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
34a50 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
34a60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
34a70 2d 31 34 36 33 0d 0a 53 45 4c 45 43 54 20 41 4c  -1463..SELECT AL
34a80 4c 20 2d 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d  L - - col1 DIV -
34a90 20 37 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   75 AS col0 FROM
34aa0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
34ab0 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
34ac0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
34ad0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
34ae0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
34af0 61 62 65 6c 2d 31 34 36 33 0d 0a 53 45 4c 45 43  abel-1463..SELEC
34b00 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2f  T ALL - - col1 /
34b10 20 2d 20 37 35 20 41 53 20 63 6f 6c 30 20 46 52   - 75 AS col0 FR
34b20 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
34b30 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
34b40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34b50 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 39 20 2b  t..SELECT + 89 +
34b60 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
34b70 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
34b80 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a 37 0d 0a  0..----..56..7..
34b90 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
34ba0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
34bb0 4c 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20 2d  L - ( - col1 ) -
34bc0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
34bd0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
34be0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
34bf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34c00 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
34c10 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30  CT col0 * + col0
34c20 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
34c30 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
34c40 0a 36 31 31 30 0d 0a 36 32 37 39 0d 0a 37 36 0d  .6110..6279..76.
34c50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34c60 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
34c70 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2b  NCT - - col0 + +
34c80 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20   col0 * col2 AS 
34c90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
34ca0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
34cb0 35 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d  5..3712..7760...
34cc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34cd0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 20 41  ..SELECT ALL 9 A
34ce0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
34cf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 0d 0a   cor0..----..9..
34d00 39 0d 0a 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  9..9....onlyif m
34d10 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
34d20 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
34d30 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
34d40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
34d50 62 65 6c 2d 31 34 36 39 0d 0a 53 45 4c 45 43 54  bel-1469..SELECT
34d60 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   - - col2 + + co
34d70 6c 30 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63  l0 DIV col1 AS c
34d80 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
34d90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d  r0..----..1..33.
34da0 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .82....skipif my
34db0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
34dc0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
34dd0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 39  wsort label-1469
34de0 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
34df0 32 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c  2 + + col0 / col
34e00 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
34e10 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
34e20 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 6f 6e 6c  1..33..82....onl
34e30 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
34e40 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
34e50 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
34e60 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
34e70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
34e80 6c 61 62 65 6c 2d 31 34 37 30 0d 0a 53 45 4c 45  label-1470..SELE
34e90 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54  CT DISTINCT CAST
34ea0 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ( + col2 AS SIGN
34eb0 45 44 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52  ED ) * - col2 FR
34ec0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
34ed0 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36  .----..-1444..-6
34ee0 37 36 0d 0a 2d 37 32 39 0d 0a 0d 0a 73 6b 69 70  76..-729....skip
34ef0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
34f00 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
34f10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
34f20 2d 31 34 37 30 0d 0a 53 45 4c 45 43 54 20 44 49  -1470..SELECT DI
34f30 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 2b 20  STINCT CAST ( + 
34f40 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
34f50 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  ) * - col2 FROM 
34f60 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
34f70 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37 36 0d  --..-1444..-676.
34f80 0a 2d 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .-729....query I
34f90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34fa0 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
34fb0 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  l1 * col2 * - co
34fc0 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l0 + - col1 FROM
34fd0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
34fe0 2d 2d 2d 0d 0a 31 31 39 35 39 33 0d 0a 35 31 30  ---..119593..510
34ff0 31 37 0d 0a 35 38 32 38 0d 0a 0d 0a 73 6b 69 70  17..5828....skip
35000 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
35010 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
35020 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
35030 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
35040 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
35050 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
35060 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a  TINCT - - col0 *
35070 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f   - col2 col2 FRO
35080 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
35090 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32  ----..-189..-202
350a0 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65 72  8..-3002....quer
350b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
350c0 45 43 54 20 36 34 20 2b 20 2d 20 63 6f 72 30 2e  ECT 64 + - cor0.
350d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
350e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
350f0 36 0d 0a 30 0d 0a 36 31 0d 0a 0d 0a 6f 6e 6c 79  6..0..61....only
35100 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
35110 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
35120 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
35130 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35140 74 20 6c 61 62 65 6c 2d 31 34 37 34 0d 0a 53 45  t label-1474..SE
35150 4c 45 43 54 20 41 4c 4c 20 34 39 20 44 49 56 20  LECT ALL 49 DIV 
35160 63 6f 6c 31 20 2b 20 2b 20 35 32 20 46 52 4f 4d  col1 + + 52 FROM
35170 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
35180 2d 2d 2d 0d 0a 35 32 0d 0a 35 32 0d 0a 35 32 0d  ---..52..52..52.
35190 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
351a0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
351b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
351c0 74 20 6c 61 62 65 6c 2d 31 34 37 34 0d 0a 53 45  t label-1474..SE
351d0 4c 45 43 54 20 41 4c 4c 20 34 39 20 2f 20 63 6f  LECT ALL 49 / co
351e0 6c 31 20 2b 20 2b 20 35 32 20 46 52 4f 4d 20 74  l1 + + 52 FROM t
351f0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
35200 2d 0d 0a 35 32 0d 0a 35 32 0d 0a 35 32 0d 0a 0d  -..52..52..52...
35210 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35220 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
35230 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53  + col0 * col1 AS
35240 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
35250 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
35260 30 34 30 0d 0a 33 33 36 30 0d 0a 38 30 31 30 0d  040..3360..8010.
35270 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35280 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
35290 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b   col2 * + col1 +
352a0 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
352b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
352c0 0a 31 34 35 36 0d 0a 35 36 37 0d 0a 38 33 30 0d  .1456..567..830.
352d0 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
352e0 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
352f0 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
35300 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  1, tab0 AS cor0 
35310 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c  CROSS JOIN tab2,
35320 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab1 cor1..----
35330 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73  ..972 values has
35340 68 69 6e 67 20 74 6f 20 39 33 36 34 65 66 37 35  hing to 9364ef75
35350 34 35 62 30 37 63 36 37 37 36 37 64 63 65 62 37  45b07c67767dceb7
35360 30 66 30 32 63 36 34 33 0d 0a 0d 0a 71 75 65 72  0f02c643....quer
35370 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35380 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b  ECT + + col0 * +
35390 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
353a0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
353b0 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38  .----..189..2028
353c0 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20  ..3002....query 
353d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
353e0 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20  T ALL cor0.col1 
353f0 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52  + col0 + col2 FR
35400 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
35410 0a 2d 2d 2d 2d 0d 0a 31 33 34 0d 0a 31 36 33 0d  .----..134..163.
35420 0a 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .65....query I r
35430 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
35440 4c 4c 20 2d 20 34 32 20 46 52 4f 4d 20 74 61 62  LL - 42 FROM tab
35450 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  2, tab0 AS cor0,
35460 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
35470 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
35480 61 73 68 69 6e 67 20 74 6f 20 35 36 66 38 36 66  ashing to 56f86f
35490 66 30 31 63 64 39 36 61 33 35 31 31 61 63 64 34  f01cd96a3511acd4
354a0 36 65 30 65 38 31 31 65 32 37 0d 0a 0d 0a 73 6b  6e0e811e27....sk
354b0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
354c0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
354d0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
354e0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
354f0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
35500 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
35510 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 31 20   cor0.col1 col1 
35520 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
35530 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
35540 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
35550 74 6f 20 33 36 36 65 63 35 33 39 61 66 30 66 33  to 366ec539af0f3
35560 37 62 64 31 35 31 39 62 63 35 36 38 66 33 64 36  7bd1519bc568f3d6
35570 37 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  775....query I r
35580 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
35590 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 41   - col0 - col1 A
355a0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
355b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
355c0 2d 32 39 0d 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d  -29..-74..-93...
355d0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
355e0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
355f0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
35600 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
35610 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38  owsort label-148
35620 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  3..SELECT ALL + 
35630 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 44 49 56 20  col2 * col1 DIV 
35640 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
35650 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
35660 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d  ---..26..27..38.
35670 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
35680 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
35690 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
356a0 74 20 6c 61 62 65 6c 2d 31 34 38 33 0d 0a 53 45  t label-1483..SE
356b0 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
356c0 2a 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20  * col1 / + col1 
356d0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
356e0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  2 cor0..----..26
356f0 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72  ..27..38....quer
35700 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35710 45 43 54 20 63 6f 6c 31 20 2d 20 2b 20 74 61 62  ECT col1 - + tab
35720 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0.col2 FROM tab0
35730 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39  ..----..53..9..9
35740 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
35750 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
35760 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31   + col0 + + col1
35770 20 2b 20 2b 20 34 38 20 2a 20 63 6f 6c 31 20 41   + + 48 * col1 A
35780 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
35790 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 37 0d 0a 35 35  ..----..1277..55
357a0 34 0d 0a 37 31 37 0d 0a 0d 0a 71 75 65 72 79 20  4..717....query 
357b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
357c0 54 20 41 4c 4c 20 2d 20 28 20 2b 20 35 30 20 29  T ALL - ( + 50 )
357d0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
357e0 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
357f0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
35800 20 68 61 73 68 69 6e 67 20 74 6f 20 63 37 34 33   hashing to c743
35810 32 61 39 36 38 63 38 33 35 32 63 31 32 39 39 36  2a968c8352c12996
35820 64 66 61 35 34 64 64 34 62 39 65 38 0d 0a 0d 0a  dfa54dd4b9e8....
35830 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
35840 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
35850 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
35860 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
35870 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
35880 72 74 20 6c 61 62 65 6c 2d 31 34 38 37 0d 0a 53  rt label-1487..S
35890 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
358a0 20 2a 20 43 41 53 54 28 20 63 6f 6c 30 20 2a 20   * CAST( col0 * 
358b0 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
358c0 20 2b 20 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 30   + ( col2 * col0
358d0 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d   ) FROM tab2..--
358e0 2d 2d 0d 0a 2d 31 31 33 34 0d 0a 2d 31 35 36 31  --..-1134..-1561
358f0 35 36 0d 0a 2d 32 33 34 31 35 36 0d 0a 0d 0a 73  56..-234156....s
35900 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
35910 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
35920 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
35930 62 65 6c 2d 31 34 38 37 0d 0a 53 45 4c 45 43 54  bel-1487..SELECT
35940 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 43 41   ALL - col0 * CA
35950 53 54 20 28 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  ST ( col0 * col2
35960 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
35970 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 29 20  ( col2 * col0 ) 
35980 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
35990 0a 2d 31 31 33 34 0d 0a 2d 31 35 36 31 35 36 0d  .-1134..-156156.
359a0 0a 2d 32 33 34 31 35 36 0d 0a 0d 0a 71 75 65 72  .-234156....quer
359b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
359c0 45 43 54 20 32 38 20 41 53 20 63 6f 6c 32 20 46  ECT 28 AS col2 F
359d0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 63  ROM tab1, tab0 c
359e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
359f0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61  ues hashing to a
35a00 61 64 33 32 32 33 32 63 34 32 38 62 33 65 63 62  ad32232c428b3ecb
35a10 35 61 64 61 36 33 66 37 65 39 62 30 61 39 37 0d  5ada63f7e9b0a97.
35a20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35a30 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
35a40 6f 6c 31 20 2a 20 38 32 20 2b 20 39 35 20 41 53  ol1 * 82 + 95 AS
35a50 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
35a60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
35a70 31 32 39 39 0d 0a 2d 32 34 34 37 0d 0a 2d 34 37  1299..-2447..-47
35a80 34 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  43....onlyif mys
35a90 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
35aa0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
35ab0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
35ac0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
35ad0 6c 2d 31 34 39 30 0d 0a 53 45 4c 45 43 54 20 2b  l-1490..SELECT +
35ae0 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63   col1 * col0 + c
35af0 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 46 52 4f  ol2 DIV col0 FRO
35b00 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
35b10 2d 2d 2d 2d 0d 0a 31 30 34 31 0d 0a 36 34 30 0d  ----..1041..640.
35b20 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .96....skipif my
35b30 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
35b40 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
35b50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 30  wsort label-1490
35b60 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
35b70 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2f 20  * col0 + col2 / 
35b80 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
35b90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
35ba0 34 31 0d 0a 36 34 30 0d 0a 39 36 0d 0a 0d 0a 6f  41..640..96....o
35bb0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
35bc0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
35bd0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
35be0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
35bf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35c00 74 20 6c 61 62 65 6c 2d 31 34 39 31 0d 0a 53 45  t label-1491..SE
35c10 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 72  LECT ALL + + cor
35c20 30 2e 63 6f 6c 32 20 2d 20 43 41 53 54 28 20 63  0.col2 - CAST( c
35c30 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 53 49  ol1 + col0 AS SI
35c40 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31  GNED ) FROM tab1
35c50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35c60 2d 31 37 0d 0a 32 35 0d 0a 33 0d 0a 0d 0a 73 6b  -17..25..3....sk
35c70 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
35c80 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
35c90 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
35ca0 65 6c 2d 31 34 39 31 0d 0a 53 45 4c 45 43 54 20  el-1491..SELECT 
35cb0 41 4c 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ALL + + cor0.col
35cc0 32 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 31 20  2 - CAST ( col1 
35cd0 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  + col0 AS INTEGE
35ce0 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  R ) FROM tab1 AS
35cf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
35d00 0d 0a 32 35 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79  ..25..3....query
35d10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35d20 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2b  CT + tab2.col0 +
35d30 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46   - col1 * col2 F
35d40 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
35d50 2d 31 34 35 36 0d 0a 2d 35 36 37 0d 0a 2d 38 33  -1456..-567..-83
35d60 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
35d70 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
35d80 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
35d90 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
35da0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
35db0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
35dc0 39 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  93..SELECT ALL c
35dd0 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c  ol0 * CAST( NULL
35de0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d   AS SIGNED ) + -
35df0 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 63 6f   ( - col0 ) * co
35e00 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l0 + col2 AS col
35e10 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
35e20 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
35e30 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
35e40 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
35e50 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
35e60 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 33  wsort label-1493
35e70 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
35e80 30 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  0 * CAST ( NULL 
35e90 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d  AS INTEGER ) + -
35ea0 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 63 6f   ( - col0 ) * co
35eb0 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l0 + col2 AS col
35ec0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
35ed0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
35ee0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
35ef0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
35f00 4c 4c 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a  LL col1 + col1 *
35f10 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
35f20 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a 31 34 33  .----..1261..143
35f30 30 0d 0a 35 38 30 0d 0a 0d 0a 71 75 65 72 79 20  0..580....query 
35f40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35f50 54 20 35 39 20 41 53 20 63 6f 6c 31 20 46 52 4f  T 59 AS col1 FRO
35f60 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
35f70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
35f80 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
35f90 61 39 62 39 39 36 36 64 37 34 39 64 31 62 32 63  a9b9966d749d1b2c
35fa0 65 35 39 35 35 65 64 31 32 33 39 34 66 39 62 63  e5955ed12394f9bc
35fb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35fc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
35fd0 63 6f 6c 32 20 2a 20 34 34 20 2b 20 63 6f 6c 30  col2 * 44 + col0
35fe0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
35ff0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 36 0d  r0..----..-1066.
36000 0a 2d 31 31 38 31 0d 0a 2d 31 35 39 33 0d 0a 0d  .-1181..-1593...
36010 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
36020 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
36030 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
36040 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
36050 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39  owsort label-149
36060 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  7..SELECT + - co
36070 6c 31 20 44 49 56 20 38 35 20 41 53 20 63 6f 6c  l1 DIV 85 AS col
36080 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
36090 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
360a0 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
360b0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
360c0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
360d0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 37 0d  sort label-1497.
360e0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31  .SELECT + - col1
360f0 20 2f 20 38 35 20 41 53 20 63 6f 6c 32 20 46 52   / 85 AS col2 FR
36100 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
36110 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
36120 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
36130 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
36140 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
36150 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
36160 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
36170 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36180 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 2a  CT - cor1.col1 *
36190 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 30 20   cor0.col1 col0 
361a0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 20 43  FROM tab0 cor0 C
361b0 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 63  ROSS JOIN tab1 c
361c0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
361d0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36  ues hashing to 6
361e0 30 31 63 31 32 39 63 35 34 65 34 39 32 38 36 62  01c129c54e49286b
361f0 39 65 64 65 64 61 38 39 32 38 31 32 31 66 63 0d  9ededa8928121fc.
36200 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
36210 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63  rt..SELECT - ( c
36220 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 2b 20 63  ol1 ) * col2 + c
36230 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
36240 2d 2d 2d 0d 0a 2d 31 31 35 32 0d 0a 2d 31 33 35  ---..-1152..-135
36250 30 0d 0a 2d 35 31 33 0d 0a 0d 0a 71 75 65 72 79  0..-513....query
36260 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36270 43 54 20 38 36 20 2a 20 2b 20 63 6f 6c 30 20 46  CT 86 * + col0 F
36280 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
36290 32 30 36 34 0d 0a 33 30 31 30 0d 0a 37 36 35 34  2064..3010..7654
362a0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
362b0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
362c0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
362d0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
362e0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
362f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30  owsort label-150
36300 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41  1..SELECT ALL CA
36310 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
36320 45 44 20 29 20 2a 20 28 20 2b 20 63 6f 6c 30 20  ED ) * ( + col0 
36330 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
36340 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
36350 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
36360 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
36370 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
36380 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 31  wsort label-1501
36390 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53  ..SELECT ALL CAS
363a0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
363b0 47 45 52 20 29 20 2a 20 28 20 2b 20 63 6f 6c 30  GER ) * ( + col0
363c0 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
363d0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
363e0 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
363f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36400 2d 20 35 36 20 2b 20 28 20 2b 20 63 6f 6c 31 20  - 56 + ( + col1 
36410 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
36420 2d 0d 0a 33 30 0d 0a 33 35 0d 0a 34 31 0d 0a 0d  -..30..35..41...
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 2b 20 31 32 20 2a 20  ..SELECT + 12 * 
36450 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  - col0 FROM tab2
36460 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a 2d 39 33  ..----..-84..-93
36470 36 0d 0a 2d 39 34 38 0d 0a 0d 0a 71 75 65 72 79  6..-948....query
36480 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36490 43 54 20 2d 20 35 36 20 2a 20 38 31 20 46 52 4f  CT - 56 * 81 FRO
364a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
364b0 2d 2d 2d 2d 0d 0a 2d 34 35 33 36 0d 0a 2d 34 35  ----..-4536..-45
364c0 33 36 0d 0a 2d 34 35 33 36 0d 0a 0d 0a 71 75 65  36..-4536....que
364d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
364e0 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  LECT - cor0.col2
364f0 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41   + + cor0.col0 A
36500 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
36510 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
36520 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
36530 61 73 68 69 6e 67 20 74 6f 20 34 36 34 36 65 64  ashing to 4646ed
36540 38 37 65 38 63 63 35 61 61 63 62 35 31 66 39 62  87e8cc5aacb51f9b
36550 34 65 34 37 32 63 33 63 34 62 0d 0a 0d 0a 71 75  4e472c3c4b....qu
36560 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36570 45 4c 45 43 54 20 33 38 20 2a 20 2d 20 33 33 20  ELECT 38 * - 33 
36580 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
36590 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
365a0 2d 31 33 34 30 0d 0a 2d 31 33 34 35 0d 0a 2d 31  -1340..-1345..-1
365b0 33 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  351....query I r
365c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
365d0 49 53 54 49 4e 43 54 20 2d 20 2b 20 35 34 20 2b  ISTINCT - + 54 +
365e0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2a   col2 * + col1 *
365f0 20 2b 20 35 33 20 46 52 4f 4d 20 74 61 62 30 20   + 53 FROM tab0 
36600 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
36610 35 30 33 36 30 0d 0a 33 39 35 34 33 32 0d 0a 35  50360..395432..5
36620 30 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  087....query I r
36630 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
36640 20 32 30 20 2a 20 38 37 20 2b 20 2b 20 63 6f 72   20 * 87 + + cor
36650 30 2e 63 6f 6c 32 20 2a 20 28 20 2b 20 63 6f 6c  0.col2 * ( + col
36660 30 20 2a 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f  0 * - col2 ) FRO
36670 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
36680 2d 2d 2d 2d 0d 0a 2d 32 30 36 31 39 36 0d 0a 2d  ----..-206196..-
36690 37 30 30 38 0d 0a 2d 37 33 35 35 34 30 0d 0a 0d  7008..-735540...
366a0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
366b0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
366c0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
366d0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
366e0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
366f0 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 39 0d 0a  ort label-1509..
36700 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
36710 2d 20 43 41 53 54 28 20 28 20 63 6f 6c 32 20 29  - CAST( ( col2 )
36720 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
36730 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
36740 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a  ----..-54..-57..
36750 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -96....skipif my
36760 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
36770 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
36780 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 39  wsort label-1509
36790 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
367a0 54 20 2d 20 43 41 53 54 20 28 20 28 20 63 6f 6c  T - CAST ( ( col
367b0 32 20 29 20 41 53 20 49 4e 54 45 47 45 52 20 29  2 ) AS INTEGER )
367c0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
367d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d  r0..----..-54..-
367e0 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79  57..-96....query
367f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36800 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37 31  CT DISTINCT - 71
36810 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30   FROM tab0, tab0
36820 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
36830 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor1..----..-7
36840 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
36850 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
36860 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
36870 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
36880 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
36890 2d 31 35 31 31 0d 0a 53 45 4c 45 43 54 20 2d 20  -1511..SELECT - 
368a0 2d 20 30 20 2a 20 2b 20 63 6f 6c 31 20 44 49 56  - 0 * + col1 DIV
368b0 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f   - col0 col1 FRO
368c0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
368d0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
368e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
368f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
36900 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
36910 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
36920 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
36930 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
36940 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
36950 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
36960 35 31 31 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  511..SELECT - - 
36970 30 20 2a 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 63  0 * + col1 / - c
36980 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
36990 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
369a0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
369b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
369c0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
369d0 34 35 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41  45 * cor0.col2 A
369e0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
369f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38   cor0..----..148
36a00 35 0d 0a 33 36 39 30 0d 0a 34 35 0d 0a 0d 0a 73  5..3690..45....s
36a10 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
36a20 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
36a30 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
36a40 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
36a50 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
36a60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36a70 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
36a80 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52  * - col2 col1 FR
36a90 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
36aa0 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36  .----..-1444..-6
36ab0 37 36 0d 0a 2d 37 32 39 0d 0a 0d 0a 6f 6e 6c 79  76..-729....only
36ac0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
36ad0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
36ae0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
36af0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36b00 74 20 6c 61 62 65 6c 2d 31 35 31 34 0d 0a 53 45  t label-1514..SE
36b10 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
36b20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 30 20  col1 DIV - col0 
36b30 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
36b40 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36b50 0d 0a 2d 31 37 0d 0a 2d 33 35 0d 0a 2d 35 39 0d  ..-17..-35..-59.
36b60 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
36b70 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
36b80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36b90 74 20 6c 61 62 65 6c 2d 31 35 31 34 0d 0a 53 45  t label-1514..SE
36ba0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
36bb0 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 30 20 2b 20  col1 / - col0 + 
36bc0 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
36bd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36be0 2d 31 37 0d 0a 2d 33 35 0d 0a 2d 35 39 0d 0a 0d  -17..-35..-59...
36bf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36c00 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
36c10 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  or0.col0 + col0 
36c20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
36c30 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
36c40 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38  ..----..1..33..8
36c50 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
36c60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
36c70 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30   + col2 + - cor0
36c80 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20  .col0 FROM tab2 
36c90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
36ca0 34 31 0d 0a 2d 35 32 0d 0a 32 30 0d 0a 0d 0a 6f  41..-52..20....o
36cb0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
36cc0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
36cd0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
36ce0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
36cf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36d00 74 20 6c 61 62 65 6c 2d 31 35 31 37 0d 0a 53 45  t label-1517..SE
36d10 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
36d20 2a 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 2a  * CAST( + col1 *
36d30 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 41   col1 + + col0 A
36d40 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
36d50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
36d60 2d 2d 0d 0a 2d 31 37 38 30 38 30 0d 0a 2d 33 33  --..-178080..-33
36d70 30 35 34 30 0d 0a 2d 37 34 34 39 33 30 0d 0a 0d  0540..-744930...
36d80 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
36d90 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
36da0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
36db0 6c 61 62 65 6c 2d 31 35 31 37 0d 0a 53 45 4c 45  label-1517..SELE
36dc0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
36dd0 43 41 53 54 20 28 20 2b 20 63 6f 6c 31 20 2a 20  CAST ( + col1 * 
36de0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 41 53  col1 + + col0 AS
36df0 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
36e00 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
36e10 2d 2d 0d 0a 2d 31 37 38 30 38 30 0d 0a 2d 33 33  --..-178080..-33
36e20 30 35 34 30 0d 0a 2d 37 34 34 39 33 30 0d 0a 0d  0540..-744930...
36e30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36e40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72  ..SELECT ALL cor
36e50 30 2e 63 6f 6c 31 20 2b 20 2d 20 33 34 20 41 53  0.col1 + - 34 AS
36e60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
36e70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  cor0..----..-17.
36e80 0a 2d 33 0d 0a 32 35 0d 0a 0d 0a 71 75 65 72 79  .-3..25....query
36e90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36ea0 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 2b 20  CT ALL col1 + + 
36eb0 39 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  91 AS col1 FROM 
36ec0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
36ed0 0a 31 37 37 0d 0a 31 38 32 0d 0a 31 38 38 0d 0a  .177..182..188..
36ee0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36ef0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
36f00 20 38 37 20 2b 20 34 38 20 41 53 20 63 6f 6c 31   87 + 48 AS col1
36f10 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
36f20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 0d 0a 31  r0..----..145..1
36f30 34 38 0d 0a 31 36 31 0d 0a 0d 0a 71 75 65 72 79  48..161....query
36f40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36f50 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
36f60 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 38 34 20 41  cor0.col2 + 84 A
36f70 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
36f80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36f90 34 36 0d 0a 35 37 0d 0a 35 38 0d 0a 0d 0a 71 75  46..57..58....qu
36fa0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36fb0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b  ELECT - col2 + +
36fc0 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
36fd0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
36fe0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35  0..----..-16..-5
36ff0 31 0d 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  1..7....onlyif m
37000 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
37010 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
37020 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
37030 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37040 62 65 6c 2d 31 35 32 33 0d 0a 53 45 4c 45 43 54  bel-1523..SELECT
37050 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31   + col0 * - col1
37060 20 44 49 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d   DIV - col1 FROM
37070 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
37080 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d  ---..24..35..89.
37090 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
370a0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
370b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
370c0 74 20 6c 61 62 65 6c 2d 31 35 32 33 0d 0a 53 45  t label-1523..SE
370d0 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  LECT + col0 * - 
370e0 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31 20 46 52  col1 / - col1 FR
370f0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
37100 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38  .----..24..35..8
37110 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
37120 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
37130 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63   col0 + - cor0.c
37140 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
37150 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
37160 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36  ---..-2..-62..-6
37170 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
37180 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
37190 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
371a0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
371b0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
371c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
371d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
371e0 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 28   cor0.col1 * - (
371f0 20 63 6f 6c 32 20 29 20 63 6f 6c 30 20 46 52 4f   col2 ) col0 FRO
37200 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
37210 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33  -..1534..646..83
37220 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
37230 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
37240 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
37250 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
37260 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
37270 2d 31 35 32 36 0d 0a 53 45 4c 45 43 54 20 44 49  -1526..SELECT DI
37280 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20  STINCT - col0 + 
37290 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  + col0 + - col2 
372a0 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  DIV + cor0.col2 
372b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
372c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 73  0..----..-1....s
372d0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
372e0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
372f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37300 62 65 6c 2d 31 35 32 36 0d 0a 53 45 4c 45 43 54  bel-1526..SELECT
37310 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
37320 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   + + col0 + - co
37330 6c 32 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l2 / + cor0.col2
37340 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
37350 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a  r0..----..-1....
37360 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
37370 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
37380 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
37390 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
373a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 32 37  wsort label-1527
373b0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
373c0 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20 39  + - col0 DIV - 9
373d0 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  4 FROM tab0 AS c
373e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a  or0..----..-24..
373f0 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b 69 70  -35..-89....skip
37400 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
37410 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
37420 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
37430 2d 31 35 32 37 0d 0a 53 45 4c 45 43 54 20 2d 20  -1527..SELECT - 
37440 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2f 20  col0 + - col0 / 
37450 2d 20 39 34 20 46 52 4f 4d 20 74 61 62 30 20 41  - 94 FROM tab0 A
37460 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
37470 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71  4..-35..-89....q
37480 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37490 53 45 4c 45 43 54 20 2b 20 39 30 20 41 53 20 63  SELECT + 90 AS c
374a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
374b0 2d 2d 2d 0d 0a 39 30 0d 0a 39 30 0d 0a 39 30 0d  ---..90..90..90.
374c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
374d0 72 74 0d 0a 53 45 4c 45 43 54 20 35 30 20 2a 20  rt..SELECT 50 * 
374e0 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  - col1 * - col0 
374f0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
37500 31 0d 0a 2d 2d 2d 2d 0d 0a 33 32 30 30 30 0d 0a  1..----..32000..
37510 33 39 30 30 0d 0a 35 32 30 30 30 0d 0a 0d 0a 71  3900..52000....q
37520 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37530 53 45 4c 45 43 54 20 2d 20 35 37 20 2a 20 63 6f  SELECT - 57 * co
37540 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
37550 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a 2d  0..----..-171..-
37560 33 36 34 38 0d 0a 2d 34 35 36 30 0d 0a 0d 0a 71  3648..-4560....q
37570 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37580 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
37590 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  0 * - cor0.col2 
375a0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
375b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
375c0 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a  .35..7298..792..
375d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
375e0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
375f0 43 54 20 2d 20 37 30 20 2a 20 2b 20 63 6f 72 30  CT - 70 * + cor0
37600 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
37610 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
37620 0a 2d 2d 2d 2d 0d 0a 2d 31 38 32 30 0d 0a 2d 31  .----..-1820..-1
37630 38 39 30 0d 0a 2d 32 36 36 30 0d 0a 0d 0a 71 75  890..-2660....qu
37640 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37650 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b  ELECT + - col1 +
37660 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46   - col0 + col2 F
37670 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
37680 2d 2d 2d 0d 0a 2d 31 33 31 0d 0a 2d 37 37 0d 0a  ---..-131..-77..
37690 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  -98....query III
376a0 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72  IIIIIIIII rowsor
376b0 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
376c0 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
376d0 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
376e0 61 62 31 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a  ab1, tab2 cor1..
376f0 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73  ----..972 values
37700 20 68 61 73 68 69 6e 67 20 74 6f 20 30 31 61 35   hashing to 01a5
37710 39 33 31 63 63 63 63 33 64 61 64 38 37 39 32 61  931cccc3dad8792a
37720 31 62 63 36 64 66 30 39 63 36 31 34 0d 0a 0d 0a  1bc6df09c614....
37730 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37740 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
37750 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 74 61  tab1.col1 * - ta
37760 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  b1.col2 AS col2 
37770 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c  FROM tab1, tab2,
37780 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
37790 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
377a0 61 73 68 69 6e 67 20 74 6f 20 66 38 38 39 34 65  ashing to f8894e
377b0 33 66 33 33 39 36 32 63 64 61 35 39 30 31 65 31  3f33962cda5901e1
377c0 63 32 63 65 36 35 64 35 62 30 0d 0a 0d 0a 71 75  c2ce65d5b0....qu
377d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
377e0 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c  ELECT col0 + col
377f0 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  0 * - col0 AS co
37800 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
37810 2d 2d 0d 0a 2d 34 32 0d 0a 2d 36 30 30 36 0d 0a  --..-42..-6006..
37820 2d 36 31 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -6162....query I
37830 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37840 20 2b 20 32 39 20 46 52 4f 4d 20 74 61 62 32 2c   + 29 FROM tab2,
37850 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61 62 32   tab0 cor0, tab2
37860 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
37870 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
37880 67 20 74 6f 20 34 63 35 36 32 38 35 39 39 32 62  g to 4c56285992b
37890 63 62 37 36 65 31 61 61 63 32 32 65 36 64 32 33  cb76e1aac22e6d23
378a0 64 31 33 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  d1318....skipif 
378b0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
378c0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
378d0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
378e0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
378f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37900 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 32 20 2a  t..SELECT + 82 *
37910 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 30 20   cor0.col0 col0 
37920 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
37930 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
37940 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
37950 74 6f 20 35 65 64 36 37 34 62 38 36 62 63 36 36  to 5ed674b86bc66
37960 32 32 30 34 35 31 36 36 36 31 34 35 62 63 64 32  220451666145bcd2
37970 35 66 64 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  5fd....onlyif my
37980 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
37990 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
379a0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
379b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
379c0 65 6c 2d 31 35 33 39 0d 0a 53 45 4c 45 43 54 20  el-1539..SELECT 
379d0 63 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f  col2 DIV cor0.co
379e0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
379f0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
37a00 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a  --..0..1..18....
37a10 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
37a20 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
37a30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
37a40 61 62 65 6c 2d 31 35 33 39 0d 0a 53 45 4c 45 43  abel-1539..SELEC
37a50 54 20 63 6f 6c 32 20 2f 20 63 6f 72 30 2e 63 6f  T col2 / cor0.co
37a60 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
37a70 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
37a80 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a  --..0..1..18....
37a90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37aa0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
37ab0 20 2a 20 2b 20 33 34 20 2b 20 63 6f 6c 30 20 2a   * + 34 + col0 *
37ac0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   + cor0.col2 AS 
37ad0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
37ae0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 38 36  or0..----..10086
37af0 0d 0a 31 39 31 34 0d 0a 36 39 0d 0a 0d 0a 71 75  ..1914..69....qu
37b00 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
37b10 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
37b20 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c  ECT * FROM tab1,
37b30 20 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62 30   tab1 cor0, tab0
37b40 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30 2c 20   AS cor1, tab0, 
37b50 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab2 AS cor2..--
37b60 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20  --..3645 values 
37b70 68 61 73 68 69 6e 67 20 74 6f 20 37 31 31 38 30  hashing to 71180
37b80 66 39 66 33 65 66 61 64 66 30 65 65 33 61 37 66  f9f3efadf0ee3a7f
37b90 65 63 39 36 37 38 32 30 38 61 64 0d 0a 0d 0a 6f  ec9678208ad....o
37ba0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
37bb0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
37bc0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
37bd0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
37be0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 32 0d  sort label-1542.
37bf0 0a 53 45 4c 45 43 54 20 2d 20 2b 20 31 34 20 44  .SELECT - + 14 D
37c00 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f  IV cor0.col0 FRO
37c10 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
37c20 2d 0d 0a 2d 32 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  -..-2..0..0....s
37c30 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
37c40 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
37c50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37c60 62 65 6c 2d 31 35 34 32 0d 0a 53 45 4c 45 43 54  bel-1542..SELECT
37c70 20 2d 20 2b 20 31 34 20 2f 20 63 6f 72 30 2e 63   - + 14 / cor0.c
37c80 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
37c90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d  r0..----..-2..0.
37ca0 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
37cb0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
37cc0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
37cd0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
37ce0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
37cf0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
37d00 35 34 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  543..SELECT + + 
37d10 43 41 53 54 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  CAST( - cor0.col
37d20 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  2 AS SIGNED ) FR
37d30 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
37d40 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d  .----..-26..-27.
37d50 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-38....skipif m
37d60 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
37d70 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
37d80 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34  owsort label-154
37d90 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 43 41  3..SELECT + + CA
37da0 53 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  ST ( - cor0.col2
37db0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
37dc0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
37dd0 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d  .----..-26..-27.
37de0 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-38....query I 
37df0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37e00 2d 20 2b 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c  - + col0 + ( col
37e10 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  0 + + col2 * + c
37e20 6f 72 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f  or0.col1 ) AS co
37e30 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
37e40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38  cor0..----..1248
37e50 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71  ..1404..570....q
37e60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37e70 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20  SELECT + col1 * 
37e80 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b 20  - col1 + col0 + 
37e90 34 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  42 FROM tab2 AS 
37ea0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 38  cor0..----..-168
37eb0 0d 0a 2d 33 33 36 31 0d 0a 2d 39 31 32 0d 0a 0d  ..-3361..-912...
37ec0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
37ed0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
37ee0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
37ef0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
37f00 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
37f10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37f20 54 20 2d 20 35 37 20 2a 20 63 6f 72 30 2e 63 6f  T - 57 * cor0.co
37f30 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
37f40 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
37f50 34 38 32 0d 0a 2d 35 37 30 0d 0a 2d 37 34 31 0d  482..-570..-741.
37f60 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
37f70 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
37f80 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
37f90 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
37fa0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
37fb0 35 34 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  547..SELECT - co
37fc0 6c 30 20 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f  l0 DIV col1 + co
37fd0 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
37fe0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
37ff0 0a 32 36 0d 0a 34 0d 0a 37 0d 0a 0d 0a 73 6b 69  .26..4..7....ski
38000 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
38010 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
38020 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
38030 6c 2d 31 35 34 37 0d 0a 53 45 4c 45 43 54 20 2d  l-1547..SELECT -
38040 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 2b 20 63   col0 / col1 + c
38050 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
38060 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
38070 0d 0a 32 36 0d 0a 34 0d 0a 37 0d 0a 0d 0a 71 75  ..26..4..7....qu
38080 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38090 45 4c 45 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c  ELECT - tab2.col
380a0 30 20 2a 20 2d 20 28 20 2d 20 74 61 62 32 2e 63  0 * - ( - tab2.c
380b0 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41  ol2 ) * - col1 A
380c0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
380d0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 35 32 0d 0a  ..----..119652..
380e0 35 31 30 33 34 0d 0a 35 38 35 39 0d 0a 0d 0a 6f  51034..5859....o
380f0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
38100 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
38110 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
38120 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
38130 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 39 0d  sort label-1549.
38140 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
38150 20 74 61 62 32 2e 63 6f 6c 32 20 44 49 56 20 74   tab2.col2 DIV t
38160 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  ab2.col1 AS col0
38170 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
38180 0d 0a 30 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..2....skipif
38190 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
381a0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
381b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
381c0 35 34 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  549..SELECT DIST
381d0 49 4e 43 54 20 74 61 62 32 2e 63 6f 6c 32 20 2f  INCT tab2.col2 /
381e0 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f   tab2.col1 AS co
381f0 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
38200 2d 2d 0d 0a 30 0d 0a 32 0d 0a 0d 0a 71 75 65 72  --..0..2....quer
38210 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
38220 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 33  ECT DISTINCT - 3
38230 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  2 + col0 FROM ta
38240 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 34  b2..----..-25..4
38250 36 0d 0a 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49  6..47....query I
38260 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38270 20 28 20 63 6f 6c 30 20 29 20 2b 20 2d 20 74 61   ( col0 ) + - ta
38280 62 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46  b0.col1 * col0 F
38290 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
382a0 2d 32 30 34 30 0d 0a 2d 33 33 36 30 0d 0a 2d 38  -2040..-3360..-8
382b0 30 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  010....query I r
382c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
382d0 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 31   ( col2 ) * col1
382e0 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
382f0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 34 30  ab0..----..-2440
38300 36 38 0d 0a 2d 36 37 39 30 34 32 0d 0a 2d 39 34  68..-679042..-94
38310 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  09....onlyif mys
38320 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
38330 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
38340 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
38350 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
38360 6c 2d 31 35 35 33 0d 0a 53 45 4c 45 43 54 20 41  l-1553..SELECT A
38370 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20  LL - ( + col0 ) 
38380 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  * + col2 + + col
38390 30 20 44 49 56 20 2b 20 63 6f 6c 32 20 46 52 4f  0 DIV + col2 FRO
383a0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab0..----..-7
383b0 32 39 37 0d 0a 2d 37 39 32 0d 0a 30 0d 0a 0d 0a  297..-792..0....
383c0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
383d0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
383e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
383f0 61 62 65 6c 2d 31 35 35 33 0d 0a 53 45 4c 45 43  abel-1553..SELEC
38400 54 20 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 30  T ALL - ( + col0
38410 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b 20   ) * + col2 + + 
38420 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 32 20 46 52  col0 / + col2 FR
38430 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
38440 37 32 39 37 0d 0a 2d 37 39 32 0d 0a 30 0d 0a 0d  7297..-792..0...
38450 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
38460 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
38470 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
38480 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
38490 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
384a0 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 34 0d 0a  ort label-1554..
384b0 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 2d  SELECT - CAST( -
384c0 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20   col0 AS SIGNED 
384d0 29 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 46 52  ) + tab0.col0 FR
384e0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
384f0 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 73 6b  78..48..70....sk
38500 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
38510 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
38520 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
38530 65 6c 2d 31 35 35 34 0d 0a 53 45 4c 45 43 54 20  el-1554..SELECT 
38540 2d 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 30 20  - CAST ( - col0 
38550 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 74  AS INTEGER ) + t
38560 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab0.col0 FROM ta
38570 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a 34  b0..----..178..4
38580 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  8..70....query I
38590 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
385a0 20 41 4c 4c 20 2b 20 38 30 20 41 53 20 63 6f 6c   ALL + 80 AS col
385b0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
385c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 30 0d 0a 38  or0..----..80..8
385d0 30 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  0..80....query I
385e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
385f0 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   - - col1 * - co
38600 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l2 + + cor0.col2
38610 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
38620 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 38 0d  r0..----..-1508.
38630 0a 2d 36 30 38 0d 0a 2d 38 31 30 0d 0a 0d 0a 71  .-608..-810....q
38640 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
38650 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20  SELECT col2 + + 
38660 39 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  97 AS col2 FROM 
38670 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
38680 0a 31 33 30 0d 0a 31 37 39 0d 0a 39 38 0d 0a 0d  .130..179..98...
38690 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
386a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34  ..SELECT ALL + 4
386b0 39 20 2a 20 2d 20 63 6f 6c 32 20 2d 20 2b 20 63  9 * - col2 - + c
386c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
386d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
386e0 33 30 0d 0a 2d 31 33 35 32 0d 0a 2d 31 39 34 31  30..-1352..-1941
386f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
38700 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
38710 49 4e 43 54 20 28 20 2d 20 36 32 20 29 20 46 52  INCT ( - 62 ) FR
38720 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
38730 2d 2d 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72 79  --..-62....query
38740 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38750 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  CT + - col1 * - 
38760 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  col0 + cor0.col0
38770 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
38780 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
38790 0d 0a 32 30 38 38 0d 0a 33 34 33 30 0d 0a 38 31  ..2088..3430..81
387a0 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  88....onlyif mys
387b0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
387c0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
387d0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
387e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
387f0 6c 2d 31 35 36 31 0d 0a 53 45 4c 45 43 54 20 31  l-1561..SELECT 1
38800 20 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20 2b 20   DIV + col2 + + 
38810 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col1 col1 FROM t
38820 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
38830 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d  -..10..13..26...
38840 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
38850 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
38860 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
38870 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
38880 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
38890 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
388a0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
388b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
388c0 35 36 31 0d 0a 53 45 4c 45 43 54 20 31 20 2f 20  561..SELECT 1 / 
388d0 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  + col2 + + col1 
388e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
388f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
38900 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72  ..13..26....quer
38910 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
38920 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
38930 20 36 33 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20   63 + col0 FROM 
38940 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
38950 2d 2d 0d 0a 31 35 32 0d 0a 38 37 0d 0a 39 38 0d  --..152..87..98.
38960 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
38970 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
38980 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a   + col0 + col1 *
38990 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
389a0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
389b0 2d 2d 0d 0a 31 31 32 30 0d 0a 37 30 34 0d 0a 38  --..1120..704..8
389c0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
389d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39  sort..SELECT - 9
389e0 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  5 AS col2 FROM t
389f0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
38a00 2d 39 35 0d 0a 2d 39 35 0d 0a 2d 39 35 0d 0a 0d  -95..-95..-95...
38a10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38a20 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
38a30 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  T - col1 + col2 
38a40 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  * - cor0.col1 FR
38a50 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
38a60 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 31 0d 0a 2d 31  .----..-1261..-1
38a70 34 33 30 0d 0a 2d 35 38 30 0d 0a 0d 0a 71 75 65  430..-580....que
38a80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38a90 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20  LECT - - col0 + 
38aa0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
38ab0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d   cor0..----..29.
38ac0 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79  .74..93....query
38ad0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38ae0 43 54 20 41 4c 4c 20 32 30 20 2a 20 63 6f 6c 30  CT ALL 20 * col0
38af0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
38b00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 30 0d 0a  r0..----..1780..
38b10 34 38 30 0d 0a 37 30 30 0d 0a 0d 0a 71 75 65 72  480..700....quer
38b20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
38b30 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
38b40 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b   col1 * + col1 +
38b50 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31   - col0 + - col1
38b60 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
38b70 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
38b80 0d 0a 37 32 38 36 0d 0a 38 31 30 31 0d 0a 39 32  ..7286..8101..92
38b90 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  77....query I ro
38ba0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
38bb0 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  col2 - col1 * co
38bc0 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l0 * - col0 AS c
38bd0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
38be0 2d 2d 2d 0d 0a 31 31 38 38 32 36 0d 0a 34 39 35  ---..118826..495
38bf0 36 39 0d 0a 37 32 30 38 39 33 0d 0a 0d 0a 71 75  69..720893....qu
38c00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38c10 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b  ELECT ALL col2 +
38c20 20 2d 20 37 35 20 41 53 20 63 6f 6c 31 20 46 52   - 75 AS col1 FR
38c30 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
38c40 34 32 0d 0a 2d 37 34 0d 0a 37 0d 0a 0d 0a 71 75  42..-74..7....qu
38c50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a