sqllogictest
Hex Artifact Content
Not logged in

Artifact 3aa58b9151530dc8d6d4366cfdd514ee0147c884:


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 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
02d0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
02e0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
02f0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
0300: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
0310: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0320: 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  ECT - col0 + col
0330: 32 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20  2 * + col2 col1 
0340: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
0350: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 33 0d 0a 33  0..----..2913..3
0360: 31 38 35 0d 0a 39 31 33 36 0d 0a 0d 0a 71 75 65  185..9136....que
0370: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0380: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
0390: 33 36 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 31 34  36 + - col1 + 14
03a0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
03b0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 31 39  r0..----..-9..19
03c0: 0d 0a 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..33....query I 
03d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
03e0: 41 4c 4c 20 2b 20 35 36 20 2b 20 63 6f 72 30 2e  ALL + 56 + cor0.
03f0: 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col2 * + cor0.co
0400: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
0410: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
0420: 2d 2d 0d 0a 31 33 30 34 0d 0a 31 34 36 30 0d 0a  --..1304..1460..
0430: 36 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  626....query I r
0440: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38  owsort..SELECT 8
0450: 35 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  5 - col2 FROM ta
0460: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 37 0d 0a 35 38  b2..----..47..58
0470: 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..59....query I 
0480: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0490: 41 4c 4c 20 63 6f 6c 31 20 2b 20 2d 20 35 36 20  ALL col1 + - 56 
04a0: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
04b0: 2d 2d 2d 2d 0d 0a 33 30 0d 0a 33 35 0d 0a 34 31  ----..30..35..41
04c0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
04d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
04e0: 6c 30 20 2b 20 2d 20 31 39 20 41 53 20 63 6f 6c  l0 + - 19 AS col
04f0: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
0500: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 35  or0..----..16..5
0510: 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..70....query I 
0520: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0530: 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
0540: 30 20 2b 20 37 34 20 41 53 20 63 6f 6c 32 20 46  0 + 74 AS col2 F
0550: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
0560: 2d 2d 2d 0d 0a 2d 31 35 0d 0a 33 39 0d 0a 35 30  ---..-15..39..50
0570: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0580: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
0590: 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  INCT + - col0 + 
05a0: 2d 20 28 20 2b 20 38 32 20 29 20 46 52 4f 4d 20  - ( + 82 ) FROM 
05b0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
05c0: 2d 2d 0d 0a 2d 31 30 36 0d 0a 2d 31 31 37 0d 0a  --..-106..-117..
05d0: 2d 31 37 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -171....onlyif m
05e0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
05f0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
0600: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
0610: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
0620: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
0630: 2d 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  -8..SELECT ALL c
0640: 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28 20 34 31  ol1 * - CAST( 41
0650: 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
0660: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
0670: 2d 2d 2d 2d 0d 0a 2d 33 35 32 36 0d 0a 2d 33 37  ----..-3526..-37
0680: 33 31 0d 0a 2d 33 39 37 37 0d 0a 0d 0a 73 6b 69  31..-3977....ski
0690: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
06a0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
06b0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
06c0: 6c 2d 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  l-8..SELECT ALL 
06d0: 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20 28 20  col1 * - CAST ( 
06e0: 34 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  41 AS INTEGER ) 
06f0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
0700: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 32 36 0d 0a  0..----..-3526..
0710: 2d 33 37 33 31 0d 0a 2d 33 39 37 37 0d 0a 0d 0a  -3731..-3977....
0720: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0730: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
0740: 6c 30 20 2b 20 34 20 41 53 20 63 6f 6c 30 20 46  l0 + 4 AS col0 F
0750: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
0760: 0d 0a 2d 2d 2d 2d 0d 0a 36 38 0d 0a 37 0d 0a 38  ..----..68..7..8
0770: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
0780: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
0790: 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63  TINCT col0 * - c
07a0: 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  or0.col0 + + col
07b0: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
07c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a  or0..----..-18..
07d0: 2d 36 30 32 35 0d 0a 2d 36 32 32 34 0d 0a 0d 0a  -6025..-6224....
07e0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
07f0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
0800: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
0810: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
0820: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 0d 0a  wsort label-11..
0830: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
0840: 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  DIV - cor0.col2 
0850: 2b 20 39 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74  + 90 col1 FROM t
0860: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
0870: 2d 0d 0a 35 35 0d 0a 38 39 0d 0a 39 30 0d 0a 0d  -..55..89..90...
0880: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
0890: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
08a0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
08b0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
08c0: 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
08d0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
08e0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
08f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
0900: 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  1..SELECT ALL co
0910: 6c 30 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l0 / - cor0.col2
0920: 20 2b 20 39 30 20 63 6f 6c 31 20 46 52 4f 4d 20   + 90 col1 FROM 
0930: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
0940: 2d 2d 0d 0a 35 35 0d 0a 38 39 0d 0a 39 30 0d 0a  --..55..89..90..
0950: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
0960: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
0970: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
0980: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
0990: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
09a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
09b0: 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f  CT ALL + cor0.co
09c0: 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
09d0: 30 2c 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f  0, tab2, tab1 co
09e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r0..----..27 val
09f0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
0a00: 37 38 62 35 30 35 37 35 61 39 62 39 31 34 34 38  78b50575a9b91448
0a10: 31 31 39 65 65 30 65 65 31 61 39 63 34 34 66 0d  119ee0ee1a9c44f.
0a20: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
0a30: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
0a40: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
0a50: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
0a60: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
0a70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0a80: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b  ECT ALL + col2 +
0a90: 20 2d 20 63 6f 6c 32 20 2a 20 38 34 20 2d 20 39   - col2 * 84 - 9
0aa0: 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  1 col1 FROM tab0
0ab0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 34 0d 0a 2d 32  ..----..-174..-2
0ac0: 38 33 30 0d 0a 2d 36 38 39 37 0d 0a 0d 0a 6f 6e  830..-6897....on
0ad0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
0ae0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
0af0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
0b00: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
0b10: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0b20: 20 6c 61 62 65 6c 2d 31 34 0d 0a 53 45 4c 45 43   label-14..SELEC
0b30: 54 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 2b 20  T tab1.col2 * + 
0b40: 74 61 62 31 2e 63 6f 6c 30 20 2d 20 2d 20 43 41  tab1.col0 - - CA
0b50: 53 54 28 20 2d 20 63 6f 6c 30 20 41 53 20 53 49  ST( - col0 AS SI
0b60: 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46  GNED ) AS col1 F
0b70: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
0b80: 31 35 39 0d 0a 33 35 38 34 0d 0a 37 36 30 30 0d  159..3584..7600.
0b90: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
0ba0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
0bb0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0bc0: 74 20 6c 61 62 65 6c 2d 31 34 0d 0a 53 45 4c 45  t label-14..SELE
0bd0: 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 2b  CT tab1.col2 * +
0be0: 20 74 61 62 31 2e 63 6f 6c 30 20 2d 20 2d 20 43   tab1.col0 - - C
0bf0: 41 53 54 20 28 20 2d 20 63 6f 6c 30 20 41 53 20  AST ( - col0 AS 
0c00: 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
0c10: 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
0c20: 2d 0d 0a 31 35 39 0d 0a 33 35 38 34 0d 0a 37 36  -..159..3584..76
0c30: 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
0c40: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
0c50: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f  - cor0.col1 * co
0c60: 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l2 + - col1 FROM
0c70: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
0c80: 2d 2d 2d 0d 0a 30 0d 0a 32 37 35 32 0d 0a 37 33  ---..0..2752..73
0c90: 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  71....query I ro
0ca0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
0cb0: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
0cc0: 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  - col0 + - col1 
0cd0: 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  * col1 FROM tab2
0ce0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
0cf0: 2d 31 34 35 33 0d 0a 2d 37 37 32 0d 0a 32 37 31  -1453..-772..271
0d00: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
0d10: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
0d20: 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b  TINCT - - col0 +
0d30: 20 2d 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f   - ( col1 ) + co
0d40: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
0d50: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d  0..----..24..35.
0d60: 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .89....query I r
0d70: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
0d80: 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 32 35  LL + col0 + + 25
0d90: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
0da0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
0db0: 0d 0a 31 31 34 0d 0a 34 39 0d 0a 36 30 0d 0a 0d  ..114..49..60...
0dc0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
0dd0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
0de0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
0df0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
0e00: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 0d  owsort label-19.
0e10: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
0e20: 6f 6c 30 20 2a 20 28 20 63 6f 6c 32 20 29 20 2b  ol0 * ( col2 ) +
0e30: 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31   col2 DIV + col1
0e40: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
0e50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a  r0..----..-189..
0e60: 2d 32 30 32 38 0d 0a 2d 33 30 30 30 0d 0a 0d 0a  -2028..-3000....
0e70: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
0e80: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
0e90: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
0ea0: 61 62 65 6c 2d 31 39 0d 0a 53 45 4c 45 43 54 20  abel-19..SELECT 
0eb0: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 28 20  - cor0.col0 * ( 
0ec0: 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 32 20 2f 20  col2 ) + col2 / 
0ed0: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
0ee0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
0ef0: 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30  -189..-2028..-30
0f00: 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
0f10: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
0f20: 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20  STINCT + - col0 
0f30: 2b 20 2b 20 38 30 20 46 52 4f 4d 20 74 61 62 32  + + 80 FROM tab2
0f40: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
0f50: 31 0d 0a 32 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72  1..2..73....quer
0f60: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0f70: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b  ECT ALL - col0 +
0f80: 20 2d 20 63 6f 6c 32 20 2b 20 35 30 20 41 53 20   - col2 + 50 AS 
0f90: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
0fa0: 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a  ----..-54..-67..
0fb0: 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  16....onlyif mys
0fc0: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
0fd0: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
0fe0: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
0ff0: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
1000: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
1010: 32 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 43 41  2..SELECT + + CA
1020: 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
1030: 45 44 20 29 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  ED ) * - col1 + 
1040: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
1050: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1060: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
1070: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
1080: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1090: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
10a0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
10b0: 32 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 43 41  2..SELECT + + CA
10c0: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
10d0: 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 31 20  EGER ) * - col1 
10e0: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
10f0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1100: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1110: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  LL..NULL....only
1120: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1130: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1140: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1150: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1160: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1170: 61 62 65 6c 2d 32 33 0d 0a 53 45 4c 45 43 54 20  abel-23..SELECT 
1180: 2d 20 43 41 53 54 28 20 33 38 20 41 53 20 53 49  - CAST( 38 AS SI
1190: 47 4e 45 44 20 29 20 2a 20 63 6f 6c 32 20 41 53  GNED ) * col2 AS
11a0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
11b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35  cor0..----..-205
11c0: 32 0d 0a 2d 32 31 36 36 0d 0a 2d 33 36 34 38 0d  2..-2166..-3648.
11d0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
11e0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
11f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1200: 74 20 6c 61 62 65 6c 2d 32 33 0d 0a 53 45 4c 45  t label-23..SELE
1210: 43 54 20 2d 20 43 41 53 54 20 28 20 33 38 20 41  CT - CAST ( 38 A
1220: 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f  S INTEGER ) * co
1230: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
1240: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1250: 0a 2d 32 30 35 32 0d 0a 2d 32 31 36 36 0d 0a 2d  .-2052..-2166..-
1260: 33 36 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49  3648....query II
1270: 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
1280: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1290: 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20  NCT * FROM tab2 
12a0: 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
12b0: 49 4e 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  IN tab1, tab1 AS
12c0: 20 63 6f 72 31 2c 20 74 61 62 30 20 63 6f 72 32   cor1, tab0 cor2
12d0: 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75  ..----..972 valu
12e0: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 30  es hashing to 90
12f0: 39 62 37 65 62 61 62 36 32 61 66 66 38 66 36 39  9b7ebab62aff8f69
1300: 64 63 34 32 63 63 62 62 35 63 32 65 61 65 0d 0a  dc42ccbb5c2eae..
1310: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1320: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20  t..SELECT + ( - 
1330: 28 20 2d 20 63 6f 6c 30 20 29 20 29 20 46 52 4f  ( - col0 ) ) FRO
1340: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1350: 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39  ----..24..35..89
1360: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1370: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 30  ort..SELECT + 30
1380: 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + - col1 AS col
1390: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
13a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d 0a  or0..----..-56..
13b0: 2d 36 31 0d 0a 2d 36 37 0d 0a 0d 0a 71 75 65 72  -61..-67....quer
13c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13d0: 45 43 54 20 2b 20 34 39 20 2b 20 2d 20 63 6f 6c  ECT + 49 + - col
13e0: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
13f0: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
1400: 31 31 0d 0a 32 32 0d 0a 32 33 0d 0a 0d 0a 71 75  11..22..23....qu
1410: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1420: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1430: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
1440: 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
1450: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
1460: 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39  ----..17..31..59
1470: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1480: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
1490: 6c 32 20 2a 20 2d 20 36 31 20 41 53 20 63 6f 6c  l2 * - 61 AS col
14a0: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
14b0: 2d 0d 0a 32 30 31 33 0d 0a 35 30 30 32 0d 0a 36  -..2013..5002..6
14c0: 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
14d0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
14e0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
14f0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1500: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1510: 2d 33 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  -30..SELECT DIST
1520: 49 4e 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20  INCT - col2 DIV 
1530: 39 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  91 col1 FROM tab
1540: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a  1..----..-1..0..
1550: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1560: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1570: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1580: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1590: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
15a0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
15b0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
15c0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
15d0: 33 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  30..SELECT DISTI
15e0: 4e 43 54 20 2d 20 63 6f 6c 32 20 2f 20 39 31 20  NCT - col2 / 91 
15f0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
1600: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 71  ----..-1..0....q
1610: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1620: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20  SELECT + + col2 
1630: 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20  + col2 * col2 + 
1640: 2d 20 28 20 39 31 20 2a 20 2d 20 63 6f 6c 30 20  - ( 91 * - col0 
1650: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
1660: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1670: 2d 0d 0a 31 33 39 33 0d 0a 37 38 30 30 0d 0a 38  -..1393..7800..8
1680: 36 37 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  671....onlyif my
1690: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
16a0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
16b0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
16c0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
16d0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
16e0: 33 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  32..SELECT - - c
16f0: 6f 72 30 2e 63 6f 6c 32 20 2a 20 28 20 2b 20 63  or0.col2 * ( + c
1700: 6f 6c 32 20 29 20 2a 20 43 41 53 54 28 20 4e 55  ol2 ) * CAST( NU
1710: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  LL AS SIGNED ) +
1720: 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30   - col2 + + cor0
1730: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
1740: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
1750: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
1760: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1770: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1780: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1790: 74 20 6c 61 62 65 6c 2d 33 32 0d 0a 53 45 4c 45  t label-32..SELE
17a0: 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  CT - - cor0.col2
17b0: 20 2a 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20   * ( + col2 ) * 
17c0: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
17d0: 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c  NTEGER ) + - col
17e0: 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  2 + + cor0.col2 
17f0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1800: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
1810: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
1820: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1830: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1840: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20  + col0 * col2 + 
1850: 2d 20 63 6f 6c 31 20 2b 20 36 37 20 2a 20 2d 20  - col1 + 67 * - 
1860: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
1870: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1880: 2d 2d 2d 2d 0d 0a 2d 36 35 0d 0a 2d 36 35 30 0d  ----..-65..-650.
1890: 0a 32 33 30 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  .2307....skipif 
18a0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
18b0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
18c0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
18d0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
18e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18f0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
1900: 20 2a 20 32 32 20 63 6f 6c 32 20 46 52 4f 4d 20   * 22 col2 FROM 
1910: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 30  tab0..----..-180
1920: 34 0d 0a 2d 32 32 0d 0a 2d 37 32 36 0d 0a 0d 0a  4..-22..-726....
1930: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1940: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
1950: 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 32 32 20 46   - col0 * - 22 F
1960: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1970: 31 37 35 35 0d 0a 31 37 37 35 0d 0a 31 38 35 0d  1755..1775..185.
1980: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1990: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
19a0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
19b0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
19c0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
19d0: 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  6..SELECT ALL co
19e0: 6c 30 20 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20  l0 DIV + col2 + 
19f0: 31 39 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  19 col2 FROM tab
1a00: 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a 31 39 0d  1..----..19..19.
1a10: 0a 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .20....skipif po
1a20: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1a30: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1a40: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1a50: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1a60: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1a70: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1a80: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1a90: 61 62 65 6c 2d 33 36 0d 0a 53 45 4c 45 43 54 20  abel-36..SELECT 
1aa0: 41 4c 4c 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c  ALL col0 / + col
1ab0: 32 20 2b 20 31 39 20 63 6f 6c 32 20 46 52 4f 4d  2 + 19 col2 FROM
1ac0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d   tab1..----..19.
1ad0: 0a 31 39 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79  .19..20....query
1ae0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1af0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
1b00: 37 36 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  76 + + cor0.col0
1b10: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1b20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d  r0..----..-12..-
1b30: 37 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49  73..4....query I
1b40: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b50: 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   ALL cor0.col2 +
1b60: 20 63 6f 6c 30 20 2a 20 32 30 20 46 52 4f 4d 20   col0 * 20 FROM 
1b70: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1b80: 2d 2d 0d 0a 31 31 34 0d 0a 31 33 33 37 0d 0a 31  --..114..1337..1
1b90: 36 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  696....onlyif my
1ba0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1bb0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1bc0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1bd0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1be0: 65 6c 2d 33 39 0d 0a 53 45 4c 45 43 54 20 41 4c  el-39..SELECT AL
1bf0: 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  L - + cor0.col1 
1c00: 2a 20 2d 20 28 20 2d 20 32 37 20 29 20 2b 20 2b  * - ( - 27 ) + +
1c10: 20 63 6f 6c 32 20 44 49 56 20 39 20 46 52 4f 4d   col2 DIV 9 FROM
1c20: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1c30: 2d 2d 2d 0d 0a 2d 31 35 39 31 0d 0a 2d 34 35 35  ---..-1591..-455
1c40: 0d 0a 2d 38 33 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..-834....skipif
1c50: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1c60: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1c70: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
1c80: 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  9..SELECT ALL - 
1c90: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  + cor0.col1 * - 
1ca0: 28 20 2d 20 32 37 20 29 20 2b 20 2b 20 63 6f 6c  ( - 27 ) + + col
1cb0: 32 20 2f 20 39 20 46 52 4f 4d 20 74 61 62 32 20  2 / 9 FROM tab2 
1cc0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1cd0: 31 35 39 31 0d 0a 2d 34 35 35 0d 0a 2d 38 33 34  1591..-455..-834
1ce0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1cf0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1d00: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1d10: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1d20: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1d30: 34 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  40..SELECT DISTI
1d40: 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2d 20 28  NCT + - col1 - (
1d50: 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c   col0 + cor0.col
1d60: 31 20 29 20 44 49 56 20 2d 20 35 31 20 46 52 4f  1 ) DIV - 51 FRO
1d70: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1d80: 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 33 31 0d 0a  ----..-16..-31..
1d90: 2d 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -57....skipif my
1da0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1db0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1dc0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 0d 0a  wsort label-40..
1dd0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1de0: 2b 20 2d 20 63 6f 6c 31 20 2d 20 28 20 63 6f 6c  + - col1 - ( col
1df0: 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  0 + cor0.col1 ) 
1e00: 2f 20 2d 20 35 31 20 46 52 4f 4d 20 74 61 62 32  / - 51 FROM tab2
1e10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e20: 2d 31 36 0d 0a 2d 33 31 0d 0a 2d 35 37 0d 0a 0d  -16..-31..-57...
1e30: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e40: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1e50: 54 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a 20  T col0 - col1 * 
1e60: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
1e70: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1e80: 2d 0d 0a 2d 32 38 31 34 0d 0a 2d 36 32 0d 0a 2d  -..-2814..-62..-
1e90: 37 33 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7373....query I 
1ea0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1eb0: 2d 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  - - col0 * - col
1ec0: 32 20 2d 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  2 - - col0 FROM 
1ed0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1ee0: 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d 33 35 38 34 0d  --..-159..-3584.
1ef0: 0a 2d 37 36 30 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-7600....skipif
1f00: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1f10: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1f20: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1f30: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1f40: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
1f50: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1f60: 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  ol1 + col2 * - c
1f70: 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
1f80: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1f90: 0d 0a 2d 31 30 30 33 0d 0a 2d 36 36 33 33 0d 0a  ..-1003..-6633..
1fa0: 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
1fb0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1fc0: 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  + col1 * + col0 
1fd0: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
1fe0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ff0: 31 33 36 30 0d 0a 32 34 38 0d 0a 34 36 36 31 0d  1360..248..4661.
2000: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2010: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2020: 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  NCT cor0.col2 + 
2030: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  + cor0.col1 FROM
2040: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2050: 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39  ---..119..173..9
2060: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2070: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2080: 54 49 4e 43 54 20 2b 20 37 35 20 2b 20 2b 20 63  TINCT + 75 + + c
2090: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
20a0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
20b0: 2d 2d 2d 0d 0a 31 36 31 0d 0a 31 36 36 0d 0a 31  ---..161..166..1
20c0: 37 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  72....onlyif mys
20d0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
20e0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
20f0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2100: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2110: 6c 2d 34 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  l-47..SELECT col
2120: 30 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20  0 DIV cor0.col0 
2130: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
2140: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
2150: 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..1....skipif 
2160: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2170: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2180: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2190: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
21a0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
21b0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
21c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21d0: 20 6c 61 62 65 6c 2d 34 37 0d 0a 53 45 4c 45 43   label-47..SELEC
21e0: 54 20 63 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f  T col0 / cor0.co
21f0: 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
2200: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2210: 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .1..1..1....quer
2220: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2230: 45 43 54 20 41 4c 4c 20 2b 20 2b 20 34 38 20 2a  ECT ALL + + 48 *
2240: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
2250: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2260: 0a 2d 33 33 36 0d 0a 2d 33 37 34 34 0d 0a 2d 33  .-336..-3744..-3
2270: 37 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  792....skipif po
2280: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2290: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
22a0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
22b0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
22c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22d0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
22e0: 20 2d 20 33 30 20 2a 20 2d 20 63 6f 6c 30 20 2b   - 30 * - col0 +
22f0: 20 63 6f 6c 32 20 2b 20 2d 20 31 35 20 2a 20 63   col2 + - 15 * c
2300: 6f 6c 32 20 2a 20 63 6f 6c 32 20 63 6f 6c 31 20  ol2 * col2 col1 
2310: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2320: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 37 34 34  0..----..-135744
2330: 0d 0a 2d 34 33 35 39 36 0d 0a 2d 34 36 37 35 38  ..-43596..-46758
2340: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2350: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 30 20 2b 20  ort..SELECT 0 + 
2360: 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab2.col1 AS col
2370: 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
2380: 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
2390: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
23a0: 20 68 61 73 68 69 6e 67 20 74 6f 20 37 35 39 39   hashing to 7599
23b0: 62 34 38 30 31 32 35 64 65 35 32 31 65 66 65 64  b480125de521efed
23c0: 37 31 62 35 62 32 34 31 33 63 37 64 0d 0a 0d 0a  71b5b2413c7d....
23d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23e0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
23f0: 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2d 20 28   tab2.col2 * - (
2400: 20 33 35 20 29 20 2b 20 63 6f 6c 30 20 2b 20 2d   35 ) + col0 + -
2410: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
2420: 0a 2d 2d 2d 2d 0d 0a 31 30 35 30 37 30 0d 0a 36  .----..105070..6
2430: 36 31 35 0d 0a 37 30 39 38 30 0d 0a 0d 0a 6f 6e  615..70980....on
2440: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2450: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2460: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2470: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2480: 6f 72 74 20 6c 61 62 65 6c 2d 35 32 0d 0a 53 45  ort label-52..SE
2490: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
24a0: 44 49 56 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  DIV col1 + - col
24b0: 31 20 2a 20 63 6f 6c 32 20 2a 20 43 41 53 54 28  1 * col2 * CAST(
24c0: 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45   + col0 AS SIGNE
24d0: 44 20 29 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c  D ) + - col0 col
24e0: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
24f0: 2d 0d 0a 2d 31 31 39 37 33 30 0d 0a 2d 35 31 31  -..-119730..-511
2500: 31 35 0d 0a 2d 35 38 36 36 0d 0a 0d 0a 73 6b 69  15..-5866....ski
2510: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2520: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2530: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2540: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2550: 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
2560: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2570: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2580: 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32 0d 0a 53  sort label-52..S
2590: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
25a0: 20 2f 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31   / col1 + - col1
25b0: 20 2a 20 63 6f 6c 32 20 2a 20 43 41 53 54 20 28   * col2 * CAST (
25c0: 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   + col0 AS INTEG
25d0: 45 52 20 29 20 2b 20 2d 20 63 6f 6c 30 20 63 6f  ER ) + - col0 co
25e0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
25f0: 2d 2d 0d 0a 2d 31 31 39 37 33 30 0d 0a 2d 35 31  --..-119730..-51
2600: 31 31 35 0d 0a 2d 35 38 36 36 0d 0a 0d 0a 71 75  115..-5866....qu
2610: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2620: 45 4c 45 43 54 20 2d 20 36 39 20 2b 20 2d 20 63  ELECT - 69 + - c
2630: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
2640: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2650: 2d 2d 2d 0d 0a 2d 31 32 33 0d 0a 2d 31 32 36 0d  ---..-123..-126.
2660: 0a 2d 31 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .-165....query I
2670: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2680: 20 2b 20 33 37 20 2b 20 2b 20 63 6f 6c 32 20 46   + 37 + + col2 F
2690: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
26a0: 31 31 39 0d 0a 33 38 0d 0a 37 30 0d 0a 0d 0a 71  119..38..70....q
26b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26c0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26d0: 28 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c  ( col2 ) * - col
26e0: 32 20 2a 20 2b 20 28 20 63 6f 6c 30 20 29 20 46  2 * + ( col0 ) F
26f0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2700: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39 33 36 0d  ..----..-207936.
2710: 0a 2d 37 33 37 32 38 30 0d 0a 2d 38 37 34 38 0d  .-737280..-8748.
2720: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2730: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2740: 4e 43 54 20 2b 20 36 34 20 46 52 4f 4d 20 74 61  NCT + 64 FROM ta
2750: 62 30 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  b0, tab1 cor0..-
2760: 2d 2d 2d 0d 0a 36 34 0d 0a 0d 0a 71 75 65 72 79  ---..64....query
2770: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2780: 43 54 20 63 6f 6c 30 20 2b 20 31 37 20 46 52 4f  CT col0 + 17 FRO
2790: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
27a0: 2d 2d 2d 2d 0d 0a 32 34 0d 0a 39 35 0d 0a 39 36  ----..24..95..96
27b0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
27c0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
27d0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
27e0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
27f0: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2800: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38 0d  owsort label-58.
2810: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54  .SELECT ALL CAST
2820: 28 20 33 34 20 41 53 20 53 49 47 4e 45 44 20 29  ( 34 AS SIGNED )
2830: 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
2840: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2850: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 33 36 0d 0a 31  0..----..1836..1
2860: 39 33 38 0d 0a 33 32 36 34 0d 0a 0d 0a 73 6b 69  938..3264....ski
2870: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2880: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2890: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28a0: 6c 2d 35 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  l-58..SELECT ALL
28b0: 20 43 41 53 54 20 28 20 33 34 20 41 53 20 49 4e   CAST ( 34 AS IN
28c0: 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 32 20 41  TEGER ) * col2 A
28d0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
28e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28f0: 31 38 33 36 0d 0a 31 39 33 38 0d 0a 33 32 36 34  1836..1938..3264
2900: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2910: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2920: 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  - col2 * col1 + 
2930: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
2940: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2950: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 32 0d 0a 2d  ..----..-1152..-
2960: 31 33 35 30 0d 0a 2d 35 31 33 0d 0a 0d 0a 6f 6e  1350..-513....on
2970: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2980: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2990: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
29a0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
29b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29c0: 20 6c 61 62 65 6c 2d 36 30 0d 0a 53 45 4c 45 43   label-60..SELEC
29d0: 54 20 41 4c 4c 20 2b 20 2d 20 43 41 53 54 28 20  T ALL + - CAST( 
29e0: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
29f0: 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 32   * + col0 - col2
2a00: 20 2f 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   / CAST( NULL AS
2a10: 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
2a20: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
2a30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2a40: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
2a50: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2a60: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2a70: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2a80: 62 65 6c 2d 36 30 0d 0a 53 45 4c 45 43 54 20 41  bel-60..SELECT A
2a90: 4c 4c 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55  LL + - CAST ( NU
2aa0: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
2ab0: 2a 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20  * + col0 - col2 
2ac0: 2f 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  / CAST ( NULL AS
2ad0: 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
2ae0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2af0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
2b00: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
2b10: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b20: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
2b30: 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   + col0 * - col0
2b40: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2b50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d  r0..----..-18..-
2b60: 36 30 32 35 0d 0a 2d 36 32 32 34 0d 0a 0d 0a 6f  6025..-6224....o
2b70: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2b80: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2b90: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2ba0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2bb0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2bc0: 74 20 6c 61 62 65 6c 2d 36 32 0d 0a 53 45 4c 45  t label-62..SELE
2bd0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
2be0: 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ST( col2 AS SIGN
2bf0: 45 44 20 29 20 2a 20 2b 20 63 6f 6c 30 20 46 52  ED ) * + col0 FR
2c00: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2c10: 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38  .----..162..3648
2c20: 0d 0a 37 36 38 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..7680....skipif
2c30: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2c40: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2c50: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
2c60: 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
2c70: 43 54 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 32  CT + CAST ( col2
2c80: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
2c90: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
2ca0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2cb0: 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d  162..3648..7680.
2cc0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2cd0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2ce0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2cf0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2d00: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2d10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d20: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 35 30 20 2a  ECT ALL - + 50 *
2d30: 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 30 20 29   col2 + ( col0 )
2d40: 20 2a 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f   * col2 col2 FRO
2d50: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2d60: 2d 2d 2d 2d 0d 0a 2d 31 31 36 31 0d 0a 31 31 30  ----..-1161..110
2d70: 32 0d 0a 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20  2..728....query 
2d80: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d90: 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63  T ALL - + cor0.c
2da0: 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ol2 + - col2 AS 
2db0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
2dc0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
2dd0: 32 0d 0a 2d 35 34 0d 0a 2d 37 36 0d 0a 0d 0a 73  2..-54..-76....s
2de0: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2df0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2e00: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2e10: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2e20: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2e30: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e40: 41 4c 4c 20 2b 20 36 33 20 2b 20 2d 20 63 6f 6c  ALL + 63 + - col
2e50: 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0 col1 FROM tab1
2e60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e70: 2d 31 0d 0a 2d 31 37 0d 0a 36 30 0d 0a 0d 0a 71  -1..-17..60....q
2e80: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e90: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2ea0: 2d 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 46  - + ( + col0 ) F
2eb0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2ec0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d  ..----..-7..-78.
2ed0: 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-79....query I 
2ee0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ef0: 2b 20 63 6f 6c 31 20 2d 20 2b 20 28 20 38 39 20  + col1 - + ( 89 
2f00: 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
2f10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 33 0d 0a  or0..----..-63..
2f20: 2d 37 36 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72  -76..-79....quer
2f30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2f40: 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20 28 20 2d  ECT col1 + + ( -
2f50: 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 72 30   col2 ) * + cor0
2f60: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20  .col2 FROM tab1 
2f70: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2f80: 32 38 39 30 0d 0a 2d 33 32 33 39 0d 0a 2d 39 32  2890..-3239..-92
2f90: 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  03....query I ro
2fa0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2fb0: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
2fc0: 31 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20 41 53  1 * tab0.col1 AS
2fd0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
2fe0: 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32 0d  .----..172..182.
2ff0: 0a 31 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .194....query I 
3000: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3010: 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  ALL col0 + + col
3020: 30 20 2a 20 35 31 20 46 52 4f 4d 20 74 61 62 31  0 * 51 FROM tab1
3030: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a 33 33 32  ..----..156..332
3040: 38 0d 0a 34 31 36 30 0d 0a 0d 0a 71 75 65 72 79  8..4160....query
3050: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3060: 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30  CT col0 * - col0
3070: 20 2b 20 2b 20 35 20 41 53 20 63 6f 6c 31 20 46   + + 5 AS col1 F
3080: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
3090: 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 34 30 39 31 0d 0a  ---..-4..-4091..
30a0: 2d 36 33 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -6395....onlyif 
30b0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
30c0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
30d0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
30e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
30f0: 61 62 65 6c 2d 37 32 0d 0a 53 45 4c 45 43 54 20  abel-72..SELECT 
3100: 41 4c 4c 20 2d 20 63 6f 6c 32 20 44 49 56 20 33  ALL - col2 DIV 3
3110: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
3120: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30  or0..----..-1..0
3130: 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
3140: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
3150: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
3160: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 0d 0a  wsort label-72..
3170: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
3180: 32 20 2f 20 33 31 20 46 52 4f 4d 20 74 61 62 32  2 / 31 FROM tab2
3190: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31a0: 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  -1..0..0....quer
31b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31c0: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 38  ECT ALL col1 * 8
31d0: 34 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  4 * cor0.col1 + 
31e0: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
31f0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
3200: 2d 2d 2d 2d 0d 0a 36 32 31 32 39 37 0d 0a 36 39  ----..621297..69
3210: 35 36 38 36 0d 0a 37 39 30 33 35 37 0d 0a 0d 0a  5686..790357....
3220: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3230: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
3240: 63 6f 6c 31 20 2b 20 34 38 20 2a 20 2d 20 35 35  col1 + 48 * - 55
3250: 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
3260: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
3270: 0a 2d 31 36 38 39 37 30 0d 0a 2d 32 31 31 32 31  .-168970..-21121
3280: 33 0d 0a 2d 37 39 34 36 0d 0a 0d 0a 71 75 65 72  3..-7946....quer
3290: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32a0: 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ECT - cor0.col1 
32b0: 2a 20 28 20 33 36 20 29 20 2d 20 2b 20 63 6f 6c  * ( 36 ) - + col
32c0: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
32d0: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
32e0: 2d 34 31 37 0d 0a 2d 35 36 34 0d 0a 2d 39 39 30  -417..-564..-990
32f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3300: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
3310: 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20  INCT - + col0 * 
3320: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
3330: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33  or0..----..-1343
3340: 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d  ..-217..-4602...
3350: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
3360: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
3370: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
3380: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
3390: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
33a0: 6f 72 74 20 6c 61 62 65 6c 2d 37 37 0d 0a 53 45  ort label-77..SE
33b0: 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 28  LECT ALL + CAST(
33c0: 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
33d0: 20 29 20 2a 20 2d 20 32 36 20 46 52 4f 4d 20 74   ) * - 26 FROM t
33e0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
33f0: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
3400: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
3410: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
3420: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
3430: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 0d 0a  wsort label-77..
3440: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53  SELECT ALL + CAS
3450: 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c  T ( NULL AS REAL
3460: 20 29 20 2a 20 2d 20 32 36 20 46 52 4f 4d 20 74   ) * - 26 FROM t
3470: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3480: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
3490: 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
34a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
34b0: 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20  LL + col0 * - ( 
34c0: 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46  col0 ) AS col0 F
34d0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
34e0: 2d 34 30 39 36 0d 0a 2d 36 34 30 30 0d 0a 2d 39  -4096..-6400..-9
34f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3500: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
3510: 49 4e 43 54 20 36 35 20 41 53 20 63 6f 6c 31 20  INCT 65 AS col1 
3520: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
3530: 30 0d 0a 2d 2d 2d 2d 0d 0a 36 35 0d 0a 0d 0a 71  0..----..65....q
3540: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3550: 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20  SELECT + - col1 
3560: 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72  + - col1 * + cor
3570: 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
3580: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
3590: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 30 0d 0a 2d  ..----..-1360..-
35a0: 32 34 38 0d 0a 2d 34 36 36 31 0d 0a 0d 0a 6f 6e  248..-4661....on
35b0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
35c0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
35d0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
35e0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
35f0: 6f 72 74 20 6c 61 62 65 6c 2d 38 31 0d 0a 53 45  ort label-81..SE
3600: 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
3610: 32 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f  2 DIV col1 AS co
3620: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
3630: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35  cor0..----..2..5
3640: 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..7....skipif my
3650: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
3660: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
3670: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 0d 0a  wsort label-81..
3680: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
3690: 6f 6c 32 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f  ol2 / col1 AS co
36a0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
36b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35  cor0..----..2..5
36c0: 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..7....query I r
36d0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
36e0: 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20 63 6f   col0 * - ( + co
36f0: 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l0 ) AS col1 FRO
3700: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
3710: 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38 34  ----..-49..-6084
3720: 0d 0a 2d 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79  ..-6241....query
3730: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3740: 43 54 20 2b 20 2b 20 36 20 2a 20 2d 20 63 6f 6c  CT + + 6 * - col
3750: 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  0 + - cor0.col2 
3760: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
3770: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 31 0d 0a 2d  0..----..-441..-
3780: 35 37 36 0d 0a 2d 37 32 0d 0a 0d 0a 71 75 65 72  576..-72....quer
3790: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37a0: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63  ECT ALL col1 * c
37b0: 6f 6c 31 20 2b 20 35 20 41 53 20 63 6f 6c 30 20  ol1 + 5 AS col0 
37c0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
37d0: 0a 32 39 34 0d 0a 33 34 38 36 0d 0a 39 36 36 0d  .294..3486..966.
37e0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
37f0: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
3800: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
3810: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
3820: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
3830: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35 0d 0a  wsort label-85..
3840: 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 32  SELECT tab1.col2
3850: 20 2d 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20   - - CAST( NULL 
3860: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
3870: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
3880: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
3890: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
38a0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
38b0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
38c0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35  rowsort label-85
38d0: 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f  ..SELECT tab1.co
38e0: 6c 32 20 2d 20 2d 20 43 41 53 54 20 28 20 4e 55  l2 - - CAST ( NU
38f0: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
3900: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
3910: 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  1..----..NULL..N
3920: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ULL..NULL....onl
3930: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
3940: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
3950: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
3960: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
3970: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
3980: 6c 61 62 65 6c 2d 38 36 0d 0a 53 45 4c 45 43 54  label-86..SELECT
3990: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
39a0: 20 2b 20 43 41 53 54 28 20 63 6f 6c 32 20 2b 20   + CAST( col2 + 
39b0: 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44  + col0 AS SIGNED
39c0: 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
39d0: 2d 2d 0d 0a 2d 32 39 0d 0a 2d 36 31 0d 0a 38 30  --..-29..-61..80
39e0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
39f0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
3a00: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
3a10: 72 74 20 6c 61 62 65 6c 2d 38 36 0d 0a 53 45 4c  rt label-86..SEL
3a20: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
3a30: 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 63 6f 6c  ol1 + CAST ( col
3a40: 32 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e  2 + + col0 AS IN
3a50: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
3a60: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 36  0..----..-29..-6
3a70: 31 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  1..80....onlyif 
3a80: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
3a90: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
3aa0: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
3ab0: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
3ac0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
3ad0: 6c 2d 38 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  l-87..SELECT col
3ae0: 30 20 2a 20 43 41 53 54 28 20 2d 20 63 6f 6c 31  0 * CAST( - col1
3af0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d   AS SIGNED ) + -
3b00: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
3b10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
3b20: 31 31 33 36 0d 0a 2d 31 33 32 0d 0a 2d 36 39 37  1136..-132..-697
3b30: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
3b40: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
3b50: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
3b60: 72 74 20 6c 61 62 65 6c 2d 38 37 0d 0a 53 45 4c  rt label-87..SEL
3b70: 45 43 54 20 63 6f 6c 30 20 2a 20 43 41 53 54 20  ECT col0 * CAST 
3b80: 28 20 2d 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  ( - col1 AS INTE
3b90: 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c 32 20 46  GER ) + - col2 F
3ba0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
3bb0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 36 0d 0a 2d  ..----..-1136..-
3bc0: 31 33 32 0d 0a 2d 36 39 37 0d 0a 0d 0a 73 6b 69  132..-697....ski
3bd0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
3be0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
3bf0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
3c00: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
3c10: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
3c20: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
3c30: 4c 20 2b 20 35 31 20 63 6f 6c 31 20 46 52 4f 4d  L + 51 col1 FROM
3c40: 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
3c50: 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
3c60: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
3c70: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 32  es hashing to 02
3c80: 61 37 64 65 39 34 33 36 35 62 38 63 62 35 62 35  a7de94365b8cb5b5
3c90: 63 62 39 32 63 34 62 31 64 31 65 37 63 35 0d 0a  cb92c4b1d1e7c5..
3ca0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
3cb0: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
3cc0: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
3cd0: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
3ce0: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
3cf0: 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 0d 0a 53  sort label-89..S
3d00: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d  ELECT - col1 * -
3d10: 20 43 41 53 54 28 20 2b 20 39 38 20 41 53 20 53   CAST( + 98 AS S
3d20: 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
3d30: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
3d40: 0a 38 34 32 38 0d 0a 38 39 31 38 0d 0a 39 35 30  .8428..8918..950
3d50: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
3d60: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
3d70: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
3d80: 6f 72 74 20 6c 61 62 65 6c 2d 38 39 0d 0a 53 45  ort label-89..SE
3d90: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  LECT - col1 * - 
3da0: 43 41 53 54 20 28 20 2b 20 39 38 20 41 53 20 49  CAST ( + 98 AS I
3db0: 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
3dc0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
3dd0: 0d 0a 38 34 32 38 0d 0a 38 39 31 38 0d 0a 39 35  ..8428..8918..95
3de0: 30 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  06....onlyif mys
3df0: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
3e00: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
3e10: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
3e20: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
3e30: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
3e40: 30 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 63 6f  0..SELECT ( - co
3e50: 6c 31 20 29 20 2a 20 2d 20 43 41 53 54 28 20 4e  l1 ) * - CAST( N
3e60: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
3e70: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
3e80: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
3e90: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
3ea0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
3eb0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
3ec0: 6f 72 74 20 6c 61 62 65 6c 2d 39 30 0d 0a 53 45  ort label-90..SE
3ed0: 4c 45 43 54 20 28 20 2d 20 63 6f 6c 31 20 29 20  LECT ( - col1 ) 
3ee0: 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  * - CAST ( NULL 
3ef0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
3f00: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab0..----..NU
3f10: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
3f20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3f30: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
3f40: 43 54 20 2d 20 34 36 20 41 53 20 63 6f 6c 31 20  CT - 46 AS col1 
3f50: 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
3f60: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
3f70: 34 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  46....onlyif mys
3f80: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
3f90: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
3fa0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
3fb0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
3fc0: 6c 2d 39 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-92..SELECT DIS
3fd0: 54 49 4e 43 54 20 63 6f 6c 32 20 44 49 56 20 28  TINCT col2 DIV (
3fe0: 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   + col2 ) FROM t
3ff0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a  ab1..----..1....
4000: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
4010: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
4020: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4030: 61 62 65 6c 2d 39 32 0d 0a 53 45 4c 45 43 54 20  abel-92..SELECT 
4040: 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2f 20  DISTINCT col2 / 
4050: 28 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  ( + col2 ) FROM 
4060: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d  tab1..----..1...
4070: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4080: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35 31 20  ..SELECT ALL 51 
4090: 2b 20 2b 20 37 38 20 2b 20 63 6f 72 30 2e 63 6f  + + 78 + cor0.co
40a0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
40b0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
40c0: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
40d0: 6e 67 20 74 6f 20 34 31 33 38 34 31 62 36 62 35  ng to 413841b6b5
40e0: 39 65 62 62 30 63 34 37 33 66 35 63 39 38 66 39  9ebb0c473f5c98f9
40f0: 36 66 31 30 33 39 0d 0a 0d 0a 71 75 65 72 79 20  6f1039....query 
4100: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4110: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
4120: 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol0 + col0 AS co
4130: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
4140: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36  0..----..14..156
4150: 0d 0a 31 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..158....query I
4160: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4170: 20 2d 20 63 6f 6c 30 20 2a 20 28 20 2b 20 63 6f   - col0 * ( + co
4180: 72 30 2e 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f  r0.col0 ) + + co
4190: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
41a0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d  cor0..----..-18.
41b0: 0a 2d 36 30 32 35 0d 0a 2d 36 32 32 34 0d 0a 0d  .-6025..-6224...
41c0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
41d0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
41e0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
41f0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
4200: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36 0d  owsort label-96.
4210: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
4220: 6c 32 20 2a 20 2d 20 28 20 63 6f 72 30 2e 63 6f  l2 * - ( cor0.co
4230: 6c 31 20 29 20 44 49 56 20 2d 20 63 6f 6c 31 20  l1 ) DIV - col1 
4240: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
4250: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  1 cor0..----..-5
4260: 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 73  4..-57..-96....s
4270: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
4280: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
4290: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
42a0: 62 65 6c 2d 39 36 0d 0a 53 45 4c 45 43 54 20 41  bel-96..SELECT A
42b0: 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 28 20  LL - col2 * - ( 
42c0: 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2f 20 2d 20  cor0.col1 ) / - 
42d0: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
42e0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
42f0: 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36  -..-54..-57..-96
4300: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
4310: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
4320: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
4330: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
4340: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
4350: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 0d  owsort label-97.
4360: 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55  .SELECT CAST( NU
4370: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  LL AS SIGNED ) +
4380: 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29   + ( cor0.col1 )
4390: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
43a0: 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b2, tab1 AS cor0
43b0: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
43c0: 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61   hashing to cd7a
43d0: 37 39 30 31 65 34 37 63 31 35 31 35 35 34 30 34  7901e47c15155404
43e0: 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a  aff0d216fe0b....
43f0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
4400: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
4410: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4420: 61 62 65 6c 2d 39 37 0d 0a 53 45 4c 45 43 54 20  abel-97..SELECT 
4430: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
4440: 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 28 20 63  NTEGER ) + + ( c
4450: 6f 72 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f  or0.col1 ) AS co
4460: 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
4470: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
4480: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
4490: 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34  ng to cd7a7901e4
44a0: 37 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32  7c15155404aff0d2
44b0: 31 36 66 65 30 62 0d 0a 0d 0a 71 75 65 72 79 20  16fe0b....query 
44c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
44d0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
44e0: 31 20 2a 20 28 20 63 6f 6c 30 20 29 20 41 53 20  1 * ( col0 ) AS 
44f0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
4500: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33  or0..----..-1343
4510: 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d  ..-217..-4602...
4520: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4530: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
4540: 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  T cor0.col1 + + 
4550: 28 20 2d 20 33 37 20 29 20 46 52 4f 4d 20 74 61  ( - 37 ) FROM ta
4560: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
4570: 0d 0a 34 39 0d 0a 35 34 0d 0a 36 30 0d 0a 0d 0a  ..49..54..60....
4580: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4590: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30  .SELECT + + col0
45a0: 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   * + col2 + col0
45b0: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
45c0: 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 33 38 37 0d  .----..70..7387.
45d0: 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .816....query I 
45e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
45f0: 41 4c 4c 20 2b 20 28 20 2b 20 31 31 20 29 20 2b  ALL + ( + 11 ) +
4600: 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
4610: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
4620: 0a 2d 32 32 0d 0a 2d 37 31 0d 0a 31 30 0d 0a 0d  .-22..-71..10...
4630: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4640: 0d 0a 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f  ..SELECT tab2.co
4650: 6c 30 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 31  l0 + + tab2.col1
4660: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
4670: 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d  ..137..38..96...
4680: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
4690: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
46a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
46b0: 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28  .SELECT - CAST (
46c0: 20 39 36 20 41 53 20 52 45 41 4c 20 29 20 2a 20   96 AS REAL ) * 
46d0: 2b 20 63 6f 6c 32 20 2b 20 2d 20 32 35 20 41 53  + col2 + - 25 AS
46e0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
46f0: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 33 31  .----..-121..-31
4700: 39 33 0d 0a 2d 37 38 39 37 0d 0a 0d 0a 71 75 65  93..-7897....que
4710: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4720: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  LECT + col0 + co
4730: 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  l0 * col0 + + co
4740: 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63  l1 * - col1 AS c
4750: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
4760: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37   cor0..----..-27
4770: 31 0d 0a 2d 36 37 39 36 0d 0a 2d 38 31 34 39 0d  1..-6796..-8149.
4780: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4790: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
47a0: 30 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 31 20 2a  0 + + ( - col1 *
47b0: 20 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 72 30   col0 ) + + cor0
47c0: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
47d0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
47e0: 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32  .----..-1343..-2
47f0: 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65  17..-4602....que
4800: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4810: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
4820: 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l0 * col1 + + co
4830: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
4840: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d  cor0..----..104.
4850: 0a 31 30 35 33 0d 0a 36 35 30 0d 0a 0d 0a 73 6b  .1053..650....sk
4860: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
4870: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
4880: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
4890: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
48a0: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
48b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
48c0: 20 63 6f 6c 32 20 2a 20 35 32 20 2b 20 63 6f 6c   col2 * 52 + col
48d0: 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0 col0 FROM tab2
48e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
48f0: 31 34 31 31 0d 0a 31 34 33 30 0d 0a 32 30 35 35  1411..1430..2055
4900: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4910: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
4920: 62 30 2e 63 6f 6c 31 20 2a 20 2d 20 35 35 20 41  b0.col1 * - 55 A
4930: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
4940: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20  , tab2 AS cor0, 
4950: 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
4960: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
4970: 73 68 69 6e 67 20 74 6f 20 66 31 61 61 62 62 62  shing to f1aabbb
4980: 66 65 61 33 66 61 36 65 65 62 36 34 33 66 36 66  fea3fa6eeb643f6f
4990: 37 66 36 64 31 32 33 64 36 0d 0a 0d 0a 6f 6e 6c  7f6d123d6....onl
49a0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
49b0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
49c0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
49d0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
49e0: 72 74 20 6c 61 62 65 6c 2d 31 30 39 0d 0a 53 45  rt label-109..SE
49f0: 4c 45 43 54 20 28 20 2b 20 63 6f 6c 30 20 29 20  LECT ( + col0 ) 
4a00: 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  DIV col0 AS col1
4a10: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
4a20: 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..1..1..1....ski
4a30: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
4a40: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
4a50: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
4a60: 6c 2d 31 30 39 0d 0a 53 45 4c 45 43 54 20 28 20  l-109..SELECT ( 
4a70: 2b 20 63 6f 6c 30 20 29 20 2f 20 63 6f 6c 30 20  + col0 ) / col0 
4a80: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
4a90: 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31  1..----..1..1..1
4aa0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4ab0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
4ac0: 6c 31 20 2a 20 35 32 20 2b 20 63 6f 6c 30 20 2d  l1 * 52 + col0 -
4ad0: 20 2d 20 33 31 20 46 52 4f 4d 20 74 61 62 32 20   - 31 FROM tab2 
4ae0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
4af0: 31 35 37 34 0d 0a 2d 32 39 35 39 0d 0a 2d 37 37  1574..-2959..-77
4b00: 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
4b10: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
4b20: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
4b30: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
4b40: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4b50: 2d 31 31 31 0d 0a 53 45 4c 45 43 54 20 44 49 53  -111..SELECT DIS
4b60: 54 49 4e 43 54 20 2b 20 2b 20 28 20 63 6f 6c 32  TINCT + + ( col2
4b70: 20 29 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d   ) DIV col0 FROM
4b80: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
4b90: 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69  ---..0..1....ski
4ba0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
4bb0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
4bc0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
4bd0: 6c 2d 31 31 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-111..SELECT DI
4be0: 53 54 49 4e 43 54 20 2b 20 2b 20 28 20 63 6f 6c  STINCT + + ( col
4bf0: 32 20 29 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20  2 ) / col0 FROM 
4c00: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
4c10: 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72  --..0..1....quer
4c20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4c30: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b  ECT ALL - col0 +
4c40: 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41   col0 * - col2 A
4c50: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
4c60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4c70: 2d 31 36 35 0d 0a 2d 33 37 31 32 0d 0a 2d 37 37  -165..-3712..-77
4c80: 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
4c90: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
4ca0: 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2b 20  STINCT col2 + + 
4cb0: 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20 63 6f 6c  col0 * - ( + col
4cc0: 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  0 ) AS col2 FROM
4cd0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
4ce0: 2d 2d 2d 0d 0a 2d 31 32 32 34 0d 0a 2d 35 34 33  ---..-1224..-543
4cf0: 0d 0a 2d 37 38 33 39 0d 0a 0d 0a 71 75 65 72 79  ..-7839....query
4d00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4d10: 43 54 20 41 4c 4c 20 2d 20 34 33 20 2a 20 63 6f  CT ALL - 43 * co
4d20: 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  l2 + - col2 * + 
4d30: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
4d40: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
4d50: 30 38 32 34 0d 0a 2d 32 32 31 31 0d 0a 2d 37 38  0824..-2211..-78
4d60: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4d70: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
4d80: 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col1 * - cor0.co
4d90: 6c 31 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l1 - col0 * - co
4da0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
4db0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 36 30 34 0d 0a  0..----..-6604..
4dc0: 2d 39 33 37 34 0d 0a 2d 39 38 33 0d 0a 0d 0a 71  -9374..-983....q
4dd0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4de0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 37 20  SELECT ALL + 97 
4df0: 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2b 20  * col1 + col1 + 
4e00: 39 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  90 AS col1 FROM 
4e10: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
4e20: 2d 2d 0d 0a 31 30 37 30 0d 0a 31 33 36 34 0d 0a  --..1070..1364..
4e30: 32 36 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2638....query I 
4e40: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4e50: 44 49 53 54 49 4e 43 54 20 2d 20 31 34 20 2b 20  DISTINCT - 14 + 
4e60: 63 6f 6c 30 20 2d 20 37 39 20 46 52 4f 4d 20 74  col0 - 79 FROM t
4e70: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
4e80: 2d 31 34 0d 0a 2d 31 35 0d 0a 2d 38 36 0d 0a 0d  -14..-15..-86...
4e90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4ea0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
4eb0: 20 39 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53   96 FROM tab0 AS
4ec0: 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
4ed0: 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
4ee0: 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
4ef0: 73 68 69 6e 67 20 74 6f 20 63 38 39 62 35 34 35  shing to c89b545
4f00: 33 34 36 66 39 39 37 31 33 38 38 38 61 37 39 33  346f99713888a793
4f10: 34 65 34 63 61 61 35 33 39 0d 0a 0d 0a 6f 6e 6c  4e4caa539....onl
4f20: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
4f30: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
4f40: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
4f50: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
4f60: 72 74 20 6c 61 62 65 6c 2d 31 31 39 0d 0a 53 45  rt label-119..SE
4f70: 4c 45 43 54 20 41 4c 4c 20 2d 20 35 32 20 44 49  LECT ALL - 52 DI
4f80: 56 20 63 6f 6c 30 20 2b 20 2d 20 28 20 2b 20 63  V col0 + - ( + c
4f90: 6f 6c 30 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 ) col1 FROM 
4fa0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
4fb0: 2d 2d 0d 0a 2d 32 30 0d 0a 2d 36 34 0d 0a 2d 38  --..-20..-64..-8
4fc0: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
4fd0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
4fe0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
4ff0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
5000: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
5010: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
5020: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
5030: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
5040: 65 6c 2d 31 31 39 0d 0a 53 45 4c 45 43 54 20 41  el-119..SELECT A
5050: 4c 4c 20 2d 20 35 32 20 2f 20 63 6f 6c 30 20 2b  LL - 52 / col0 +
5060: 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 63 6f   - ( + col0 ) co
5070: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
5080: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d  cor0..----..-20.
5090: 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c  .-64..-80....onl
50a0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
50b0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
50c0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
50d0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
50e0: 72 74 20 6c 61 62 65 6c 2d 31 32 30 0d 0a 53 45  rt label-120..SE
50f0: 4c 45 43 54 20 33 31 20 2b 20 2d 20 63 6f 6c 32  LECT 31 + - col2
5100: 20 44 49 56 20 2b 20 33 37 20 46 52 4f 4d 20 74   DIV + 37 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 32 39 0d 0a 33 31 0d 0a 33 31 0d 0a 0d  -..29..31..31...
5130: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
5140: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
5150: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
5160: 6c 61 62 65 6c 2d 31 32 30 0d 0a 53 45 4c 45 43  label-120..SELEC
5170: 54 20 33 31 20 2b 20 2d 20 63 6f 6c 32 20 2f 20  T 31 + - col2 / 
5180: 2b 20 33 37 20 46 52 4f 4d 20 74 61 62 30 20 41  + 37 FROM tab0 A
5190: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39  S cor0..----..29
51a0: 0d 0a 33 31 0d 0a 33 31 0d 0a 0d 0a 71 75 65 72  ..31..31....quer
51b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
51c0: 45 43 54 20 41 4c 4c 20 2b 20 34 38 20 2a 20 63  ECT ALL + 48 * c
51d0: 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
51e0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
51f0: 0d 0a 31 34 38 38 0d 0a 32 38 33 32 0d 0a 38 31  ..1488..2832..81
5200: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
5210: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
5220: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
5230: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
5240: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
5250: 2d 31 32 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -122..SELECT ALL
5260: 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f   + col2 DIV - co
5270: 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
5280: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
5290: 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  .-1..0..0....ski
52a0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
52b0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
52c0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
52d0: 6c 2d 31 32 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-122..SELECT AL
52e0: 4c 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 72  L + col2 / - cor
52f0: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
5300: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
5310: 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  -1..0..0....quer
5320: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5330: 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  ECT col0 + col1 
5340: 2a 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  * ( + cor0.col2 
5350: 29 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ) * + col0 AS co
5360: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
5370: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 37  cor0..----..1197
5380: 33 30 0d 0a 35 31 31 31 33 0d 0a 35 38 36 36 0d  30..51113..5866.
5390: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
53a0: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
53b0: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
53c0: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
53d0: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
53e0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34 0d  wsort label-124.
53f0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
5400: 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 43 41 53   cor0.col2 * CAS
5410: 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45  T( col0 AS SIGNE
5420: 44 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  D ) col0 FROM ta
5430: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
5440: 0d 0a 37 30 0d 0a 37 33 38 37 0d 0a 38 31 36 0d  ..70..7387..816.
5450: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
5460: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
5470: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
5480: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
5490: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
54a0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
54b0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
54c0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
54d0: 2d 31 32 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -124..SELECT + c
54e0: 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ol0 + cor0.col2 
54f0: 2a 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53  * CAST ( col0 AS
5500: 20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 30 20   INTEGER ) col0 
5510: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
5520: 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 33 38  0..----..70..738
5530: 37 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20  7..816....query 
5540: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5550: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36 33 20  T DISTINCT - 63 
5560: 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 35 39 20  - - col1 * - 59 
5570: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
5580: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
5590: 0a 2d 35 31 33 37 0d 0a 2d 35 34 33 32 0d 0a 2d  .-5137..-5432..-
55a0: 35 37 38 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  5786....onlyif m
55b0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
55c0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
55d0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
55e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
55f0: 62 65 6c 2d 31 32 36 0d 0a 53 45 4c 45 43 54 20  bel-126..SELECT 
5600: 63 6f 6c 30 20 44 49 56 20 63 6f 72 30 2e 63 6f  col0 DIV cor0.co
5610: 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l1 + - cor0.col0
5620: 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
5630: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
5640: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 36  0..----..-29..-6
5650: 38 0d 0a 2d 38 37 0d 0a 0d 0a 73 6b 69 70 69 66  8..-87....skipif
5660: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
5670: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
5680: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
5690: 32 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  26..SELECT col0 
56a0: 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20  / cor0.col1 + - 
56b0: 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c 31  cor0.col0 - col1
56c0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
56d0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
56e0: 0d 0a 2d 32 39 0d 0a 2d 36 38 0d 0a 2d 38 37 0d  ..-29..-68..-87.
56f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5700: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
5710: 4e 43 54 20 2b 20 35 38 20 2a 20 2b 20 63 6f 6c  NCT + 58 * + col
5720: 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
5730: 2d 0d 0a 33 31 33 32 0d 0a 33 33 30 36 0d 0a 35  -..3132..3306..5
5740: 35 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  568....query I r
5750: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
5760: 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d  ISTINCT col0 * -
5770: 20 63 6f 6c 31 20 2b 20 2d 20 39 35 20 41 53 20   col1 + - 95 AS 
5780: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
5790: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
57a0: 34 33 38 0d 0a 2d 33 31 32 0d 0a 2d 34 36 39 37  438..-312..-4697
57b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
57c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
57d0: 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  col1 + col0 * + 
57e0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
57f0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
5800: 32 0d 0a 37 30 36 0d 0a 37 32 30 37 0d 0a 0d 0a  2..706..7207....
5810: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
5820: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
5830: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
5840: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
5850: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
5860: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5870: 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c   - cor0.col2 col
5880: 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
5890: 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  0, tab0 AS cor0.
58a0: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
58b0: 20 68 61 73 68 69 6e 67 20 74 6f 20 36 61 34 33   hashing to 6a43
58c0: 65 37 66 31 35 31 39 34 61 66 37 33 66 65 31 63  e7f15194af73fe1c
58d0: 38 33 33 38 35 65 36 65 62 65 62 63 0d 0a 0d 0a  83385e6ebebc....
58e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
58f0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
5900: 20 2b 20 63 6f 6c 31 20 2a 20 31 33 20 2b 20 2b   + col1 * 13 + +
5910: 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 72 30 2e 63   col1 - - cor0.c
5920: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
5930: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
5940: 2d 2d 2d 0d 0a 31 33 36 37 0d 0a 32 33 30 36 0d  ---..1367..2306.
5950: 0a 38 38 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .8868....query I
5960: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5970: 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   + + col0 * - co
5980: 6c 31 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  l1 + col2 + + co
5990: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
59a0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
59b0: 2d 2d 0d 0a 2d 31 32 36 37 0d 0a 2d 31 36 33 0d  --..-1267..-163.
59c0: 0a 2d 34 35 35 30 0d 0a 0d 0a 71 75 65 72 79 20  .-4550....query 
59d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
59e0: 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  T col2 * + col1 
59f0: 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  + - col0 AS col0
5a00: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
5a10: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 36 0d 0a  r0..----..1456..
5a20: 35 36 37 0d 0a 38 33 30 0d 0a 0d 0a 71 75 65 72  567..830....quer
5a30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5a40: 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72  ECT - col1 + cor
5a50: 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  0.col2 AS col0 F
5a60: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
5a70: 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39  ---..-53..-9..-9
5a80: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
5a90: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
5aa0: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
5ab0: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
5ac0: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
5ad0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
5ae0: 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  5..SELECT col2 +
5af0: 20 2b 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   + CAST( col1 AS
5b00: 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 30 20 46   SIGNED ) col0 F
5b10: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
5b20: 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a  ..----..55..58..
5b30: 38 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  85....skipif pos
5b40: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
5b50: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
5b60: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
5b70: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
5b80: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
5b90: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
5ba0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
5bb0: 62 65 6c 2d 31 33 35 0d 0a 53 45 4c 45 43 54 20  bel-135..SELECT 
5bc0: 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54 20 28 20  col2 + + CAST ( 
5bd0: 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
5be0: 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  ) col0 FROM tab2
5bf0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
5c00: 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 6f 6e  55..58..85....on
5c10: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
5c20: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
5c30: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
5c40: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
5c50: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5c60: 20 6c 61 62 65 6c 2d 31 33 36 0d 0a 53 45 4c 45   label-136..SELE
5c70: 43 54 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54  CT col2 * + CAST
5c80: 28 20 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e  ( + col1 AS SIGN
5c90: 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  ED ) FROM tab2 A
5ca0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
5cb0: 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a  34..646..837....
5cc0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
5cd0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
5ce0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5cf0: 61 62 65 6c 2d 31 33 36 0d 0a 53 45 4c 45 43 54  abel-136..SELECT
5d00: 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 20 28   col2 * + CAST (
5d10: 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   + col1 AS INTEG
5d20: 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  ER ) FROM tab2 A
5d30: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
5d40: 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a  34..646..837....
5d50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5d60: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
5d70: 20 2b 20 36 30 20 2a 20 2d 20 63 6f 6c 30 20 46   + 60 * - col0 F
5d80: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
5d90: 2d 31 34 34 30 0d 0a 2d 32 31 30 30 0d 0a 2d 35  -1440..-2100..-5
5da0: 33 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  340....query I r
5db0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
5dc0: 20 2b 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f   + col2 * ( - co
5dd0: 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l0 + - col2 * co
5de0: 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l1 ) AS col2 FRO
5df0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
5e00: 2d 2d 2d 2d 0d 0a 2d 32 32 37 38 38 0d 0a 2d 32  ----..-22788..-2
5e10: 37 35 35 30 0d 0a 2d 34 31 39 31 32 0d 0a 0d 0a  7550..-41912....
5e20: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5e30: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b  .SELECT + col2 +
5e40: 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 2b   - tab0.col2 * +
5e50: 20 32 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   23 AS col0 FROM
5e60: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   tab0..----..-18
5e70: 30 34 0d 0a 2d 32 32 0d 0a 2d 37 32 36 0d 0a 0d  04..-22..-726...
5e80: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
5e90: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
5ea0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
5eb0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
5ec0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
5ed0: 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30 0d 0a 53  ort label-140..S
5ee0: 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 34 38  ELECT + CAST( 48
5ef0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
5f00: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
5f10: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34   cor0..----..144
5f20: 0d 0a 33 30 37 32 0d 0a 33 38 34 30 0d 0a 0d 0a  ..3072..3840....
5f30: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
5f40: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
5f50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5f60: 61 62 65 6c 2d 31 34 30 0d 0a 53 45 4c 45 43 54  abel-140..SELECT
5f70: 20 2b 20 43 41 53 54 20 28 20 34 38 20 41 53 20   + CAST ( 48 AS 
5f80: 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30  INTEGER ) * col0
5f90: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
5fa0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 0d 0a 33  r0..----..144..3
5fb0: 30 37 32 0d 0a 33 38 34 30 0d 0a 0d 0a 6f 6e 6c  072..3840....onl
5fc0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
5fd0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
5fe0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
5ff0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
6000: 72 74 20 6c 61 62 65 6c 2d 31 34 31 0d 0a 53 45  rt label-141..SE
6010: 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20 2b 20  LECT col1 DIV + 
6020: 34 38 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  48 FROM tab0 AS 
6030: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  cor0..----..1..1
6040: 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..2....skipif my
6050: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
6060: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
6070: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 0d  wsort label-141.
6080: 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20 2b  .SELECT col1 / +
6090: 20 34 38 20 46 52 4f 4d 20 74 61 62 30 20 41 53   48 FROM tab0 AS
60a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
60b0: 31 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..2....query I 
60c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
60d0: 2d 20 34 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  - 42 * cor0.col1
60e0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
60f0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
6100: 0d 0a 2d 31 30 39 32 0d 0a 2d 34 32 30 0d 0a 2d  ..-1092..-420..-
6110: 35 34 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  546....onlyif my
6120: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
6130: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
6140: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
6150: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
6160: 65 6c 2d 31 34 33 0d 0a 53 45 4c 45 43 54 20 44  el-143..SELECT D
6170: 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63  ISTINCT + cor0.c
6180: 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30 20 41  ol1 DIV + col0 A
6190: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
61a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
61b0: 30 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..4....skipif m
61c0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
61d0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
61e0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33  owsort label-143
61f0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
6200: 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20  T + cor0.col1 / 
6210: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
6220: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
6230: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 34 0d 0a 0d 0a  ..----..0..4....
6240: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6250: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
6260: 20 2d 20 35 34 20 41 53 20 63 6f 6c 31 20 46 52   - 54 AS col1 FR
6270: 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  OM tab2, tab0 AS
6280: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   cor0..----..-54
6290: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
62a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
62b0: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 37 36 20 41  cor0.col2 + 76 A
62c0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
62d0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
62e0: 31 33 30 0d 0a 31 33 33 0d 0a 31 37 32 0d 0a 0d  130..133..172...
62f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6300: 0d 0a 53 45 4c 45 43 54 20 28 20 28 20 63 6f 72  ..SELECT ( ( cor
6310: 30 2e 63 6f 6c 31 20 29 20 29 20 46 52 4f 4d 20  0.col1 ) ) FROM 
6320: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
6330: 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a  --..17..31..59..
6340: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6350: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
6360: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   - cor0.col0 AS 
6370: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
6380: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
6390: 30 34 0d 0a 2d 31 31 37 0d 0a 2d 33 34 0d 0a 0d  04..-117..-34...
63a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
63b0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
63c0: 54 20 2b 20 34 34 20 2a 20 2b 20 74 61 62 30 2e  T + 44 * + tab0.
63d0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
63e0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
63f0: 2d 2d 0d 0a 31 30 35 36 0d 0a 31 35 34 30 0d 0a  --..1056..1540..
6400: 33 39 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3916....onlyif m
6410: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
6420: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
6430: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
6440: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
6450: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
6460: 2d 31 34 39 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -149..SELECT - +
6470: 20 32 30 20 2a 20 28 20 63 6f 6c 32 20 29 20 2b   20 * ( col2 ) +
6480: 20 2d 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53   - CAST( col2 AS
6490: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
64a0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
64b0: 2d 0d 0a 2d 31 31 33 34 0d 0a 2d 31 31 39 37 0d  -..-1134..-1197.
64c0: 0a 2d 32 30 31 36 0d 0a 0d 0a 73 6b 69 70 69 66  .-2016....skipif
64d0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
64e0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
64f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
6500: 34 39 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 32  49..SELECT - + 2
6510: 30 20 2a 20 28 20 63 6f 6c 32 20 29 20 2b 20 2d  0 * ( col2 ) + -
6520: 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20   CAST ( col2 AS 
6530: 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
6540: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
6550: 2d 0d 0a 2d 31 31 33 34 0d 0a 2d 31 31 39 37 0d  -..-1134..-1197.
6560: 0a 2d 32 30 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-2016....onlyif
6570: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
6580: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
6590: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
65a0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
65b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
65c0: 65 6c 2d 31 35 30 0d 0a 53 45 4c 45 43 54 20 41  el-150..SELECT A
65d0: 4c 4c 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53  LL CAST( NULL AS
65e0: 20 44 45 43 49 4d 41 4c 20 29 20 2a 20 2b 20 63   DECIMAL ) * + c
65f0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
6600: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
6610: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
6620: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
6630: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
6640: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6650: 6c 61 62 65 6c 2d 31 35 30 0d 0a 53 45 4c 45 43  label-150..SELEC
6660: 54 20 41 4c 4c 20 43 41 53 54 20 28 20 4e 55 4c  T ALL CAST ( NUL
6670: 4c 20 41 53 20 52 45 41 4c 20 29 20 2a 20 2b 20  L AS REAL ) * + 
6680: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
6690: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
66a0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
66b0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
66c0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
66d0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
66e0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
66f0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
6700: 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  1..SELECT - cor0
6710: 2e 63 6f 6c 32 20 44 49 56 20 2b 20 39 30 20 46  .col2 DIV + 90 F
6720: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
6730: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
6740: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
6750: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
6760: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6770: 74 20 6c 61 62 65 6c 2d 31 35 31 0d 0a 53 45 4c  t label-151..SEL
6780: 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT - cor0.col2 
6790: 2f 20 2b 20 39 30 20 46 52 4f 4d 20 74 61 62 30  / + 90 FROM tab0
67a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
67b0: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
67c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
67d0: 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  CT + - col0 * + 
67e0: 28 20 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c  ( col0 ) + + col
67f0: 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 * + col1 FROM 
6800: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
6810: 2d 2d 0d 0a 2d 31 31 32 38 0d 0a 2d 34 35 39 0d  --..-1128..-459.
6820: 0a 32 32 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .2262....query I
6830: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6840: 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f   DISTINCT - + co
6850: 6c 31 20 2a 20 2b 20 28 20 36 39 20 29 20 46 52  l1 * + ( 69 ) FR
6860: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
6870: 0a 2d 2d 2d 2d 0d 0a 2d 35 39 33 34 0d 0a 2d 36  .----..-5934..-6
6880: 32 37 39 0d 0a 2d 36 36 39 33 0d 0a 0d 0a 71 75  279..-6693....qu
6890: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
68a0: 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63  ELECT + + cor0.c
68b0: 6f 6c 31 20 2b 20 28 20 35 36 20 29 20 41 53 20  ol1 + ( 56 ) AS 
68c0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
68d0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
68e0: 32 0d 0a 31 34 37 0d 0a 31 35 33 0d 0a 0d 0a 71  2..147..153....q
68f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6900: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
6910: 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  - col2 + col2 * 
6920: 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  - col0 * + col0 
6930: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
6940: 2d 2d 2d 2d 0d 0a 2d 31 33 35 30 0d 0a 2d 31 35  ----..-1350..-15
6950: 38 32 31 30 0d 0a 2d 32 33 37 31 39 36 0d 0a 0d  8210..-237196...
6960: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
6970: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
6980: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
6990: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
69a0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 36  owsort label-156
69b0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
69c0: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 44   col2 + - col2 D
69d0: 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41  IV - cor0.col0 A
69e0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
69f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6a00: 35 37 0d 0a 37 32 0d 0a 39 37 0d 0a 0d 0a 73 6b  57..72..97....sk
6a10: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
6a20: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
6a30: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
6a40: 65 6c 2d 31 35 36 0d 0a 53 45 4c 45 43 54 20 41  el-156..SELECT A
6a50: 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2d 20  LL - - col2 + - 
6a60: 63 6f 6c 32 20 2f 20 2d 20 63 6f 72 30 2e 63 6f  col2 / - cor0.co
6a70: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
6a80: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
6a90: 2d 2d 0d 0a 35 37 0d 0a 37 32 0d 0a 39 37 0d 0a  --..57..72..97..
6aa0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6ab0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
6ac0: 20 2a 20 34 33 20 41 53 20 63 6f 6c 32 20 46 52   * 43 AS col2 FR
6ad0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
6ae0: 0a 2d 2d 2d 2d 0d 0a 32 33 32 32 0d 0a 32 34 35  .----..2322..245
6af0: 31 0d 0a 34 31 32 38 0d 0a 0d 0a 6f 6e 6c 79 69  1..4128....onlyi
6b00: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
6b10: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
6b20: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
6b30: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6b40: 20 6c 61 62 65 6c 2d 31 35 38 0d 0a 53 45 4c 45   label-158..SELE
6b50: 43 54 20 41 4c 4c 20 63 6f 6c 31 20 44 49 56 20  CT ALL col1 DIV 
6b60: 2b 20 28 20 2d 20 39 31 20 29 20 46 52 4f 4d 20  + ( - 91 ) FROM 
6b70: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab1..----..0..0
6b80: 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
6b90: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
6ba0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
6bb0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 38 0d  wsort label-158.
6bc0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
6bd0: 20 2f 20 2b 20 28 20 2d 20 39 31 20 29 20 46 52   / + ( - 91 ) FR
6be0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab1..----..0
6bf0: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..0..0....onlyif
6c00: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
6c10: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
6c20: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
6c30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6c40: 6c 61 62 65 6c 2d 31 35 39 0d 0a 53 45 4c 45 43  label-159..SELEC
6c50: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
6c60: 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 28 20 2d  or0.col2 DIV ( -
6c70: 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 29 20 46   col2 * col1 ) F
6c80: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
6c90: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..----..0....ski
6ca0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
6cb0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
6cc0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
6cd0: 6c 2d 31 35 39 0d 0a 53 45 4c 45 43 54 20 44 49  l-159..SELECT DI
6ce0: 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e  STINCT - + cor0.
6cf0: 63 6f 6c 32 20 2f 20 28 20 2d 20 63 6f 6c 32 20  col2 / ( - col2 
6d00: 2a 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  * col1 ) FROM ta
6d10: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
6d20: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
6d30: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
6d40: 49 53 54 49 4e 43 54 20 2d 20 2b 20 34 33 20 2a  ISTINCT - + 43 *
6d50: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
6d60: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
6d70: 31 34 31 39 0d 0a 2d 33 35 32 36 0d 0a 2d 34 33  1419..-3526..-43
6d80: 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
6d90: 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
6da0: 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
6db0: 62 31 2c 20 74 61 62 30 20 63 6f 72 30 20 43 52  b1, tab0 cor0 CR
6dc0: 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74  OSS JOIN tab0, t
6dd0: 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor1..----..
6de0: 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68 69  972 values hashi
6df0: 6e 67 20 74 6f 20 39 61 66 36 37 64 36 66 39 38  ng to 9af67d6f98
6e00: 30 31 30 34 36 34 61 66 35 64 35 36 30 62 66 39  010464af5d560bf9
6e10: 34 39 64 34 38 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  49d487....onlyif
6e20: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
6e30: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
6e40: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
6e50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6e60: 6c 61 62 65 6c 2d 31 36 32 0d 0a 53 45 4c 45 43  label-162..SELEC
6e70: 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 31 2e  T DISTINCT tab1.
6e80: 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 2b 20  col1 DIV col0 + 
6e90: 38 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  81 FROM tab1..--
6ea0: 2d 2d 0d 0a 38 31 0d 0a 38 39 0d 0a 0d 0a 73 6b  --..81..89....sk
6eb0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
6ec0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
6ed0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
6ee0: 65 6c 2d 31 36 32 0d 0a 53 45 4c 45 43 54 20 44  el-162..SELECT D
6ef0: 49 53 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c  ISTINCT tab1.col
6f00: 31 20 2f 20 63 6f 6c 30 20 2b 20 38 31 20 46 52  1 / col0 + 81 FR
6f10: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38  OM tab1..----..8
6f20: 31 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  1..89....query I
6f30: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6f40: 20 44 49 53 54 49 4e 43 54 20 35 39 20 2b 20 2b   DISTINCT 59 + +
6f50: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
6f60: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
6f70: 32 33 0d 0a 31 33 39 0d 0a 36 32 0d 0a 0d 0a 71  23..139..62....q
6f80: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6f90: 53 45 4c 45 43 54 20 2b 20 38 20 41 53 20 63 6f  SELECT + 8 AS co
6fa0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l0 FROM tab2, ta
6fb0: 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b1 AS cor0, tab0
6fc0: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
6fd0: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
6fe0: 67 20 74 6f 20 33 33 30 36 39 61 64 63 33 63 31  g to 33069adc3c1
6ff0: 31 34 32 64 33 31 35 31 31 65 63 38 38 66 63 66  142d31511ec88fcf
7000: 61 34 30 61 66 0d 0a 0d 0a 71 75 65 72 79 20 49  a40af....query I
7010: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7020: 20 2b 20 33 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   + 3 + col1 FROM
7030: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
7040: 2d 2d 2d 0d 0a 31 33 0d 0a 31 36 0d 0a 32 39 0d  ---..13..16..29.
7050: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7060: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 33  rt..SELECT - + 3
7070: 33 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  3 * + cor0.col1 
7080: 2d 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  - - col0 FROM ta
7090: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
70a0: 0d 0a 2d 32 36 36 0d 0a 2d 33 34 39 0d 0a 2d 38  ..-266..-349..-8
70b0: 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  55....query I ro
70c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
70d0: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
70e0: 2d 20 63 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f  - col1 + tab1.co
70f0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
7100: 2d 2d 0d 0a 31 32 36 31 0d 0a 31 34 33 30 0d 0a  --..1261..1430..
7110: 35 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  580....query I r
7120: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
7130: 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32  LL col0 * - col2
7140: 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   - - col2 FROM t
7150: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
7160: 2d 0d 0a 2d 31 36 32 0d 0a 2d 32 30 30 32 0d 0a  -..-162..-2002..
7170: 2d 32 39 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -2964....query I
7180: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7190: 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   + + col2 * col1
71a0: 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + + col2 FROM t
71b0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
71c0: 2d 0d 0a 31 35 36 30 0d 0a 36 38 34 0d 0a 38 36  -..1560..684..86
71d0: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
71e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
71f0: 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2d 20 2d  TINCT + col1 - -
7200: 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
7210: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
7220: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a  cor0..----..20..
7230: 32 36 0d 0a 35 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  26..52....onlyif
7240: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
7250: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
7260: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
7270: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
7280: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
7290: 65 6c 2d 31 37 31 0d 0a 53 45 4c 45 43 54 20 41  el-171..SELECT A
72a0: 4c 4c 20 2b 20 43 41 53 54 28 20 32 32 20 41 53  LL + CAST( 22 AS
72b0: 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f   SIGNED ) * - co
72c0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
72d0: 2d 2d 0d 0a 2d 31 31 38 38 0d 0a 2d 31 32 35 34  --..-1188..-1254
72e0: 0d 0a 2d 32 31 31 32 0d 0a 0d 0a 73 6b 69 70 69  ..-2112....skipi
72f0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
7300: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
7310: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7320: 31 37 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  171..SELECT ALL 
7330: 2b 20 43 41 53 54 20 28 20 32 32 20 41 53 20 49  + CAST ( 22 AS I
7340: 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c  NTEGER ) * - col
7350: 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
7360: 2d 0d 0a 2d 31 31 38 38 0d 0a 2d 31 32 35 34 0d  -..-1188..-1254.
7370: 0a 2d 32 31 31 32 0d 0a 0d 0a 71 75 65 72 79 20  .-2112....query 
7380: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7390: 54 20 2d 20 63 6f 6c 30 20 2b 20 35 20 2a 20 2b  T - col0 + 5 * +
73a0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
73b0: 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 31 35 0d  .----..-14..-15.
73c0: 0a 31 32 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .127....onlyif m
73d0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
73e0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
73f0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
7400: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
7410: 62 65 6c 2d 31 37 33 0d 0a 53 45 4c 45 43 54 20  bel-173..SELECT 
7420: 41 4c 4c 20 28 20 2b 20 63 6f 6c 31 20 29 20 44  ALL ( + col1 ) D
7430: 49 56 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 32  IV col1 - + col2
7440: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
7450: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d  b1..----..-53..-
7460: 35 36 0d 0a 2d 39 35 0d 0a 0d 0a 73 6b 69 70 69  56..-95....skipi
7470: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
7480: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
7490: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
74a0: 31 37 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  173..SELECT ALL 
74b0: 28 20 2b 20 63 6f 6c 31 20 29 20 2f 20 63 6f 6c  ( + col1 ) / col
74c0: 31 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 - + col2 AS co
74d0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
74e0: 2d 2d 0d 0a 2d 35 33 0d 0a 2d 35 36 0d 0a 2d 39  --..-53..-56..-9
74f0: 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
7500: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
7510: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
7520: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
7530: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
7540: 2d 31 37 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -174..SELECT ALL
7550: 20 2b 20 39 20 44 49 56 20 63 6f 72 30 2e 63 6f   + 9 DIV cor0.co
7560: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
7570: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
7580: 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
7590: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
75a0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
75b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
75c0: 62 65 6c 2d 31 37 34 0d 0a 53 45 4c 45 43 54 20  bel-174..SELECT 
75d0: 41 4c 4c 20 2b 20 39 20 2f 20 63 6f 72 30 2e 63  ALL + 9 / cor0.c
75e0: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
75f0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
7600: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
7610: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7620: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
7630: 20 2d 20 2d 20 38 31 20 41 53 20 63 6f 6c 32 20   - - 81 AS col2 
7640: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
7650: 2d 2d 2d 2d 0d 0a 38 31 0d 0a 0d 0a 6f 6e 6c 79  ----..81....only
7660: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
7670: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
7680: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
7690: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
76a0: 74 20 6c 61 62 65 6c 2d 31 37 36 0d 0a 53 45 4c  t label-176..SEL
76b0: 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31  ECT ALL + + col1
76c0: 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c   DIV col1 AS col
76d0: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
76e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d  or0..----..1..1.
76f0: 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
7700: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
7710: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
7720: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 36 0d 0a  sort label-176..
7730: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
7740: 6f 6c 31 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 / col1 AS co
7750: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
7760: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  cor0..----..1..1
7770: 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..1....skipif po
7780: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
7790: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
77a0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
77b0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
77c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
77d0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
77e0: 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 31  l0 * + col1 col1
77f0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
7800: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a  r0..----..1343..
7810: 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65  217..4602....que
7820: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7830: 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72  LECT ALL + - cor
7840: 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  0.col1 * - col1 
7850: 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  + - col1 AS col0
7860: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
7870: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a 36  r0..----..156..6
7880: 35 30 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66  50..90....skipif
7890: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
78a0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
78b0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
78c0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
78d0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
78e0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
78f0: 6f 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 63 6f 6c  ol0 - + col1 col
7900: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
7910: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a  or0..----..-23..
7920: 35 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20  54..67....query 
7930: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7940: 54 20 2d 20 33 36 20 2b 20 63 6f 6c 32 20 2a 20  T - 36 + col2 * 
7950: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
7960: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7970: 2d 31 35 37 30 0d 0a 2d 36 38 32 0d 0a 2d 38 37  -1570..-682..-87
7980: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
7990: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 32  sort..SELECT ( 2
79a0: 39 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  9 ) AS col0 FROM
79b0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d   tab2..----..29.
79c0: 0a 32 39 0d 0a 32 39 0d 0a 0d 0a 71 75 65 72 79  .29..29....query
79d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
79e0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
79f0: 74 61 62 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32  tab0.col2 + col2
7a00: 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
7a10: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34  tab0..----..-164
7a20: 0d 0a 2d 32 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65  ..-2..-66....que
7a30: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7a40: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
7a50: 6c 31 20 2d 20 28 20 2d 20 74 61 62 31 2e 63 6f  l1 - ( - tab1.co
7a60: 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l1 ) AS col2 FRO
7a70: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 30  M tab1..----..20
7a80: 0d 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72  ..26..52....quer
7a90: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7aa0: 45 43 54 20 2d 20 31 39 20 41 53 20 63 6f 6c 32  ECT - 19 AS col2
7ab0: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
7ac0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7ad0: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
7ae0: 20 74 6f 20 33 33 39 63 39 64 36 32 31 34 33 62   to 339c9d62143b
7af0: 66 32 66 37 35 36 36 62 38 39 61 31 62 35 36 65  f2f7566b89a1b56e
7b00: 65 65 62 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  eeb4....query I 
7b10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7b20: 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 31 35 20  DISTINCT - + 15 
7b30: 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  * col1 AS col0 F
7b40: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
7b50: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 0d 0a 2d 31  ..----..-150..-1
7b60: 39 35 0d 0a 2d 33 39 30 0d 0a 0d 0a 71 75 65 72  95..-390....quer
7b70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7b80: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  ECT cor0.col2 * 
7b90: 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  col1 + col2 * - 
7ba0: 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col1 + - cor0.co
7bb0: 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l2 * - col0 AS c
7bc0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
7bd0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39   cor0..----..189
7be0: 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a  ..2028..3002....
7bf0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7c00: 0a 53 45 4c 45 43 54 20 2d 20 36 37 20 2d 20 63  .SELECT - 67 - c
7c10: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
7c20: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
7c30: 2d 2d 2d 0d 0a 2d 31 30 35 0d 0a 2d 39 33 0d 0a  ---..-105..-93..
7c40: 2d 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -94....onlyif my
7c50: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
7c60: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
7c70: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
7c80: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
7c90: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7ca0: 31 38 38 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  188..SELECT + ( 
7cb0: 2b 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 31 20  + col1 ) * col1 
7cc0: 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
7cd0: 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
7ce0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7cf0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
7d00: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
7d10: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
7d20: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
7d30: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38 38 0d 0a  sort label-188..
7d40: 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c  SELECT + ( + col
7d50: 31 20 29 20 2a 20 63 6f 6c 31 20 2d 20 43 41 53  1 ) * col1 - CAS
7d60: 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
7d70: 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20  GER ) FROM tab0 
7d80: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
7d90: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
7da0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7db0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
7dc0: 4e 43 54 20 2b 20 2b 20 36 36 20 2a 20 2b 20 63  NCT + + 66 * + c
7dd0: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
7de0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7df0: 0d 0a 31 35 38 34 0d 0a 32 33 31 30 0d 0a 35 38  ..1584..2310..58
7e00: 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
7e10: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
7e20: 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 39 33 20 2a  cor0.col0 + 93 *
7e30: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
7e40: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
7e50: 2d 0d 0a 31 35 30 32 0d 0a 32 38 37 36 0d 0a 35  -..1502..2876..5
7e60: 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  409....query I r
7e70: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
7e80: 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c   tab2.col1 * col
7e90: 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  2 + + col1 * col
7ea0: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
7eb0: 2d 0d 0a 31 32 39 32 0d 0a 31 36 37 34 0d 0a 33  -..1292..1674..3
7ec0: 30 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  068....query I r
7ed0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
7ee0: 49 53 54 49 4e 43 54 20 37 36 20 46 52 4f 4d 20  ISTINCT 76 FROM 
7ef0: 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
7f00: 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
7f10: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a  , tab2 AS cor2..
7f20: 2d 2d 2d 2d 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72  ----..76....quer
7f30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7f40: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
7f50: 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  2 + + col2 * col
7f60: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
7f70: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34 0d  ab2..----..2054.
7f80: 0a 32 31 36 0d 0a 33 30 34 30 0d 0a 0d 0a 6f 6e  .216..3040....on
7f90: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
7fa0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
7fb0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
7fc0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
7fd0: 6f 72 74 20 6c 61 62 65 6c 2d 31 39 34 0d 0a 53  ort label-194..S
7fe0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 33  ELECT DISTINCT 3
7ff0: 20 44 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63   DIV - col2 AS c
8000: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
8010: 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ---..0....skipif
8020: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
8030: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
8040: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
8050: 39 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  94..SELECT DISTI
8060: 4e 43 54 20 33 20 2f 20 2d 20 63 6f 6c 32 20 41  NCT 3 / - col2 A
8070: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
8080: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
8090: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
80a0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
80b0: 6c 32 20 2a 20 35 36 20 46 52 4f 4d 20 74 61 62  l2 * 56 FROM tab
80c0: 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 36 0d 0a 31  2..----..1456..1
80d0: 35 31 32 0d 0a 32 31 32 38 0d 0a 0d 0a 71 75 65  512..2128....que
80e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
80f0: 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 74 61  LECT col2 * + ta
8100: 62 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41  b0.col1 * col0 A
8110: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
8120: 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d 0a 36 36  ..----..3395..66
8130: 34 31 31 38 0d 0a 36 38 31 31 32 0d 0a 0d 0a 6f  4118..68112....o
8140: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
8150: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
8160: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
8170: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
8180: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8190: 74 20 6c 61 62 65 6c 2d 31 39 37 0d 0a 53 45 4c  t label-197..SEL
81a0: 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 63 6f  ECT ALL - ( - co
81b0: 6c 31 20 29 20 2a 20 63 6f 6c 31 20 2b 20 43 41  l1 ) * col1 + CA
81c0: 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
81d0: 45 44 20 29 20 2f 20 74 61 62 32 2e 63 6f 6c 32  ED ) / tab2.col2
81e0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
81f0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
8200: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
8210: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
8220: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
8230: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 37 0d 0a  sort label-197..
8240: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d  SELECT ALL - ( -
8250: 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 31 20 2b   col1 ) * col1 +
8260: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
8270: 49 4e 54 45 47 45 52 20 29 20 2f 20 74 61 62 32  INTEGER ) / tab2
8280: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d  .col2 FROM tab2.
8290: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
82a0: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
82b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
82c0: 43 54 20 28 20 2b 20 36 20 2a 20 2b 20 63 6f 6c  CT ( + 6 * + col
82d0: 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  0 ) AS col1 FROM
82e0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34   tab0..----..144
82f0: 0d 0a 32 31 30 0d 0a 35 33 34 0d 0a 0d 0a 6f 6e  ..210..534....on
8300: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
8310: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
8320: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
8330: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
8340: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8350: 20 6c 61 62 65 6c 2d 31 39 39 0d 0a 53 45 4c 45   label-199..SELE
8360: 43 54 20 2b 20 43 41 53 54 28 20 63 6f 6c 32 20  CT + CAST( col2 
8370: 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  * col2 + - col1 
8380: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
8390: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
83a0: 2d 2d 2d 0d 0a 32 38 39 30 0d 0a 33 32 33 39 0d  ---..2890..3239.
83b0: 0a 39 32 30 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  .9203....skipif 
83c0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
83d0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
83e0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39  rowsort label-19
83f0: 39 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54  9..SELECT + CAST
8400: 20 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b   ( col2 * col2 +
8410: 20 2d 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   - col1 AS INTEG
8420: 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ER ) AS col0 FRO
8430: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38  M tab1..----..28
8440: 39 30 0d 0a 33 32 33 39 0d 0a 39 32 30 33 0d 0a  90..3239..9203..
8450: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
8460: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
8470: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
8480: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
8490: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
84a0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30 30 0d 0a  sort label-200..
84b0: 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e  SELECT + CAST( N
84c0: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
84d0: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
84e0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
84f0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
8500: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
8510: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
8520: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8530: 2d 32 30 30 0d 0a 53 45 4c 45 43 54 20 2b 20 43  -200..SELECT + C
8540: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
8550: 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 30 20 46  TEGER ) + col0 F
8560: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
8570: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
8580: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8590: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 35 20 2a  ort..SELECT 85 *
85a0: 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 46 52   - ( + col2 ) FR
85b0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
85c0: 32 32 31 30 0d 0a 2d 32 32 39 35 0d 0a 2d 33 32  2210..-2295..-32
85d0: 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
85e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
85f0: 53 54 49 4e 43 54 20 2b 20 34 35 20 2a 20 2b 20  STINCT + 45 * + 
8600: 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f  tab1.col1 + - co
8610: 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
8620: 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  1, tab1 AS cor0.
8630: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
8640: 68 61 73 68 69 6e 67 20 74 6f 20 66 38 38 34 64  hashing to f884d
8650: 36 35 36 62 66 33 62 64 37 62 38 66 35 66 38 33  656bf3bd7b8f5f83
8660: 39 36 63 65 34 37 63 63 64 30 65 0d 0a 0d 0a 73  96ce47ccd0e....s
8670: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
8680: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
8690: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
86a0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
86b0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
86c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
86d0: 35 37 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  57 col2 FROM tab
86e0: 31 2c 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  1, tab0, tab1 AS
86f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
8700: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
8710: 6f 20 32 32 30 61 39 33 37 30 39 65 32 30 37 37  o 220a93709e2077
8720: 37 39 62 33 34 65 66 37 34 62 35 34 34 37 36 34  79b34ef74b544764
8730: 61 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  a5....onlyif mys
8740: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
8750: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
8760: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
8770: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
8780: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
8790: 30 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43  04..SELECT ALL C
87a0: 41 53 54 28 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  AST( + col2 * - 
87b0: 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29  col1 AS SIGNED )
87c0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
87d0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d  b0..----..-2838.
87e0: 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 73  .-7462..-97....s
87f0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
8800: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
8810: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
8820: 62 65 6c 2d 32 30 34 0d 0a 53 45 4c 45 43 54 20  bel-204..SELECT 
8830: 41 4c 4c 20 43 41 53 54 20 28 20 2b 20 63 6f 6c  ALL CAST ( + col
8840: 32 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 49 4e  2 * - col1 AS IN
8850: 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20  TEGER ) AS col1 
8860: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
8870: 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d  .-2838..-7462..-
8880: 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
8890: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
88a0: 4c 20 2b 20 34 20 41 53 20 63 6f 6c 31 20 46 52  L + 4 AS col1 FR
88b0: 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
88c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
88d0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
88e0: 20 36 66 65 63 39 36 35 62 36 30 62 39 38 38 35   6fec965b60b9885
88f0: 63 34 61 66 37 33 65 38 35 34 32 32 63 66 64 39  c4af73e85422cfd9
8900: 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  b....query I row
8910: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 35 20  sort..SELECT 85 
8920: 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  + - col0 AS col0
8930: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
8940: 0d 0a 2d 34 0d 0a 35 30 0d 0a 36 31 0d 0a 0d 0a  ..-4..50..61....
8950: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8960: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b  .SELECT + col2 +
8970: 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20   + tab1.col1 AS 
8980: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
8990: 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38  ----..109..67..8
89a0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
89b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
89c0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   + cor0.col1 * c
89d0: 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  ol1 + col0 + - c
89e0: 6f 6c 32 20 2a 20 28 20 34 20 2a 20 63 6f 6c 31  ol2 * ( 4 * col1
89f0: 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
8a00: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
8a10: 2d 2d 0d 0a 2d 32 32 31 36 0d 0a 2d 32 33 38 30  --..-2216..-2380
8a20: 0d 0a 2d 32 35 37 37 0d 0a 0d 0a 73 6b 69 70 69  ..-2577....skipi
8a30: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
8a40: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
8a50: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
8a60: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
8a70: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
8a80: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
8a90: 2d 20 28 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  - ( col2 + col1 
8aa0: 29 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20  ) * - col2 col2 
8ab0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
8ac0: 0a 31 35 36 36 0d 0a 32 30 39 30 0d 0a 32 32 31  .1566..2090..221
8ad0: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
8ae0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
8af0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
8b00: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
8b10: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8b20: 2d 32 31 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  -210..SELECT DIS
8b30: 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 44 49 56  TINCT + col1 DIV
8b40: 20 2d 20 37 39 20 2b 20 63 6f 6c 30 20 41 53 20   - 79 + col0 AS 
8b50: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
8b60: 2d 2d 2d 2d 0d 0a 32 33 0d 0a 33 34 0d 0a 38 38  ----..23..34..88
8b70: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
8b80: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
8b90: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
8ba0: 72 74 20 6c 61 62 65 6c 2d 32 31 30 0d 0a 53 45  rt label-210..SE
8bb0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
8bc0: 63 6f 6c 31 20 2f 20 2d 20 37 39 20 2b 20 63 6f  col1 / - 79 + co
8bd0: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
8be0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a  tab0..----..23..
8bf0: 33 34 0d 0a 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  34..88....onlyif
8c00: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
8c10: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
8c20: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
8c30: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
8c40: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
8c50: 65 6c 2d 32 31 31 0d 0a 53 45 4c 45 43 54 20 41  el-211..SELECT A
8c60: 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 43 41 53 54  LL + col0 * CAST
8c70: 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41  ( NULL AS DECIMA
8c80: 4c 20 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  L ) + col0 AS co
8c90: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
8ca0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
8cb0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
8cc0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
8cd0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
8ce0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
8cf0: 61 62 65 6c 2d 32 31 31 0d 0a 53 45 4c 45 43 54  abel-211..SELECT
8d00: 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 43 41   ALL + col0 * CA
8d10: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
8d20: 4c 20 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  L ) + col0 AS co
8d30: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
8d40: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
8d50: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
8d60: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
8d70: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
8d80: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
8d90: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
8da0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
8db0: 72 74 20 6c 61 62 65 6c 2d 32 31 32 0d 0a 53 45  rt label-212..SE
8dc0: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
8dd0: 2a 20 2b 20 43 41 53 54 28 20 63 6f 6c 31 20 41  * + CAST( col1 A
8de0: 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63  S SIGNED ) + - c
8df0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
8e00: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
8e10: 32 37 35 32 0d 0a 37 33 37 31 0d 0a 0d 0a 73 6b  2752..7371....sk
8e20: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
8e30: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
8e40: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
8e50: 65 6c 2d 32 31 32 0d 0a 53 45 4c 45 43 54 20 41  el-212..SELECT A
8e60: 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 43 41  LL + col2 * + CA
8e70: 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54  ST ( col1 AS INT
8e80: 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c 31 20  EGER ) + - col1 
8e90: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
8ea0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 37 35 32  0..----..0..2752
8eb0: 0d 0a 37 33 37 31 0d 0a 0d 0a 71 75 65 72 79 20  ..7371....query 
8ec0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8ed0: 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 36 36 20  T + col2 + - 66 
8ee0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
8ef0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
8f00: 0a 2d 32 38 0d 0a 2d 33 39 0d 0a 2d 34 30 0d 0a  .-28..-39..-40..
8f10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8f20: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
8f30: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b   + cor0.col0 * +
8f40: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
8f50: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
8f60: 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 33 38 37 0d  .----..70..7387.
8f70: 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .816....query I 
8f80: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8f90: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
8fa0: 63 6f 6c 30 20 2b 20 2d 20 37 20 46 52 4f 4d 20  col0 + - 7 FROM 
8fb0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
8fc0: 2d 2d 0d 0a 2d 33 31 0d 0a 2d 34 32 0d 0a 2d 39  --..-31..-42..-9
8fd0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
8fe0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
8ff0: 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2b 20 35  TINCT col2 + + 5
9000: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
9010: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
9020: 37 38 0d 0a 37 39 0d 0a 39 30 0d 0a 0d 0a 71 75  78..79..90....qu
9030: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9040: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
9050: 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c   cor0.col0 + col
9060: 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  1 * + col0 AS co
9070: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
9080: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 38  cor0..----..2088
9090: 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d 0a  ..3430..8188....
90a0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
90b0: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
90c0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
90d0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
90e0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
90f0: 72 74 20 6c 61 62 65 6c 2d 32 31 38 0d 0a 53 45  rt label-218..SE
9100: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
9110: 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
9120: 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32  SIGNED ) AS col2
9130: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
9140: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
9150: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
9160: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
9170: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
9180: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
9190: 65 6c 2d 32 31 38 0d 0a 53 45 4c 45 43 54 20 41  el-218..SELECT A
91a0: 4c 4c 20 2d 20 63 6f 6c 31 20 2d 20 43 41 53 54  LL - col1 - CAST
91b0: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
91c0: 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ER ) AS col2 FRO
91d0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
91e0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
91f0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
9200: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9210: 54 20 2d 20 31 36 20 41 53 20 63 6f 6c 32 20 46  T - 16 AS col2 F
9220: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
9230: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
9240: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
9250: 6f 20 62 65 32 32 61 63 37 36 62 34 32 63 36 66  o be22ac76b42c6f
9260: 37 32 31 32 65 63 63 30 62 61 37 63 38 39 65 62  7212ecc0ba7c89eb
9270: 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
9280: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
9290: 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32  STINCT cor0.col2
92a0: 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   + - col1 * - co
92b0: 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
92c0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
92d0: 0a 31 33 34 34 0d 0a 31 34 35 38 0d 0a 36 32 37  .1344..1458..627
92e0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
92f0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
9300: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
9310: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
9320: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
9330: 32 32 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  221..SELECT - co
9340: 6c 30 20 44 49 56 20 28 20 63 6f 6c 31 20 29 20  l0 DIV ( col1 ) 
9350: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
9360: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 34 0d  0..----..-1..-4.
9370: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
9380: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
9390: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
93a0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 31 0d 0a  sort label-221..
93b0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2f 20  SELECT - col0 / 
93c0: 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  ( col1 ) FROM ta
93d0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
93e0: 0d 0a 2d 31 0d 0a 2d 34 0d 0a 30 0d 0a 0d 0a 71  ..-1..-4..0....q
93f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9400: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
9410: 63 6f 6c 32 20 2a 20 2b 20 39 35 20 46 52 4f 4d  col2 * + 95 FROM
9420: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
9430: 0d 0a 32 34 37 30 0d 0a 32 35 36 35 0d 0a 33 36  ..2470..2565..36
9440: 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
9450: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
9460: 2d 20 31 38 20 2d 20 2b 20 63 6f 6c 30 20 2a 20  - 18 - + col0 * 
9470: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
9480: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
9490: 33 0d 0a 2d 37 33 31 36 0d 0a 2d 38 31 30 0d 0a  3..-7316..-810..
94a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
94b0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38 37 20 2b  t..SELECT - 87 +
94c0: 20 33 35 20 46 52 4f 4d 20 74 61 62 31 20 41 53   35 FROM tab1 AS
94d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32   cor0..----..-52
94e0: 0d 0a 2d 35 32 0d 0a 2d 35 32 0d 0a 0d 0a 6f 6e  ..-52..-52....on
94f0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
9500: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
9510: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
9520: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
9530: 6f 72 74 20 6c 61 62 65 6c 2d 32 32 35 0d 0a 53  ort label-225..S
9540: 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 44 49 56  ELECT + col2 DIV
9550: 20 32 36 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63   26 + col0 + - c
9560: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol2 * + col0 AS 
9570: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
9580: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
9590: 38 31 0d 0a 2d 31 39 34 39 0d 0a 2d 32 39 32 32  81..-1949..-2922
95a0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
95b0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
95c0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
95d0: 72 74 20 6c 61 62 65 6c 2d 32 32 35 0d 0a 53 45  rt label-225..SE
95e0: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2f 20 32 36  LECT + col2 / 26
95f0: 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32   + col0 + - col2
9600: 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * + col0 AS col
9610: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
9620: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 31 0d  or0..----..-181.
9630: 0a 2d 31 39 34 39 0d 0a 2d 32 39 32 32 0d 0a 0d  .-1949..-2922...
9640: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
9650: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
9660: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
9670: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
9680: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
9690: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
96a0: 54 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29  T + + ( + col1 )
96b0: 20 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46   + + col1 col1 F
96c0: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
96d0: 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32 0d 0a 31  ---..172..182..1
96e0: 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  94....query I ro
96f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
9700: 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20 63 6f  cor0.col1 + ( co
9710: 72 30 2e 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c  r0.col0 ) AS col
9720: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
9730: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a  or0..----..137..
9740: 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  38..96....query 
9750: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9760: 54 20 41 4c 4c 20 39 39 20 2a 20 63 6f 72 30 2e  T ALL 99 * cor0.
9770: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
9780: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
9790: 2d 2d 2d 2d 0d 0a 32 39 37 0d 0a 36 33 33 36 0d  ----..297..6336.
97a0: 0a 37 39 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .7920....query I
97b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
97c0: 20 38 30 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b   80 + + col0 + +
97d0: 20 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   0 AS col1 FROM 
97e0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
97f0: 2d 2d 0d 0a 31 35 38 0d 0a 31 35 39 0d 0a 38 37  --..158..159..87
9800: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
9810: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
9820: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
9830: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
9840: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
9850: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9860: 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  LECT + - cor0.co
9870: 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 35 38  l0 * + col2 + 58
9880: 20 2a 20 2b 20 31 36 20 2b 20 63 6f 6c 32 20 63   * + 16 + col2 c
9890: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
98a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   cor0..----..-26
98b0: 36 33 0d 0a 2d 36 36 35 36 0d 0a 38 32 30 0d 0a  63..-6656..820..
98c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
98d0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
98e0: 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 39 36  l1 + + col2 * 96
98f0: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
9900: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
9910: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 36 38 0d 0a 37  0..----..3168..7
9920: 38 37 32 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  872..96....query
9930: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9940: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
9950: 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  l1 * + col2 * + 
9960: 31 34 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  14 FROM tab1 AS 
9970: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 34 37  cor0..----..1747
9980: 32 0d 0a 31 39 36 35 36 0d 0a 37 39 38 30 0d 0a  2..19656..7980..
9990: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
99a0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
99b0: 33 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  32 * - col0 FROM
99c0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
99d0: 2d 2d 2d 0d 0a 32 30 34 38 0d 0a 32 35 36 30 0d  ---..2048..2560.
99e0: 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .96....onlyif my
99f0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
9a00: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
9a10: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
9a20: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
9a30: 65 6c 2d 32 33 34 0d 0a 53 45 4c 45 43 54 20 44  el-234..SELECT D
9a40: 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30  ISTINCT + - col0
9a50: 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   DIV + col1 FROM
9a60: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
9a70: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 34 0d 0a 30 0d 0a  ---..-1..-4..0..
9a80: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
9a90: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
9aa0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9ab0: 20 6c 61 62 65 6c 2d 32 33 34 0d 0a 53 45 4c 45   label-234..SELE
9ac0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
9ad0: 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 31 20 46 52  col0 / + col1 FR
9ae0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
9af0: 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 34 0d 0a 30  .----..-1..-4..0
9b00: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
9b10: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
9b20: 2d 20 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  - 1 AS col0 FROM
9b30: 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30   tab1, tab2 cor0
9b40: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
9b50: 20 68 61 73 68 69 6e 67 20 74 6f 20 36 30 66 64   hashing to 60fd
9b60: 64 36 39 32 34 62 62 37 36 33 64 36 61 63 61 30  d6924bb763d6aca0
9b70: 30 62 61 37 34 39 33 35 65 66 34 62 0d 0a 0d 0a  0ba74935ef4b....
9b80: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9b90: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
9ba0: 20 2b 20 34 31 20 41 53 20 63 6f 6c 30 20 46 52   + 41 AS col0 FR
9bb0: 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53  OM tab0, tab2 AS
9bc0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 0d   cor0..----..41.
9bd0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9be0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
9bf0: 30 2e 63 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 6c  0.col0 * - ( col
9c00: 30 20 29 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  0 ) * + col1 FRO
9c10: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
9c20: 2d 2d 2d 2d 0d 0a 32 33 34 0d 0a 34 30 39 36 30  ----..234..40960
9c30: 0d 0a 38 33 32 30 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..83200....onlyi
9c40: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
9c50: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
9c60: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
9c70: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9c80: 20 6c 61 62 65 6c 2d 32 33 38 0d 0a 53 45 4c 45   label-238..SELE
9c90: 43 54 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30  CT col0 DIV col0
9ca0: 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20   + + ( - col2 ) 
9cb0: 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
9cc0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 33 0d  b2..----..-1443.
9cd0: 0a 2d 36 37 35 0d 0a 2d 37 32 38 0d 0a 0d 0a 73  .-675..-728....s
9ce0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
9cf0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
9d00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9d10: 62 65 6c 2d 32 33 38 0d 0a 53 45 4c 45 43 54 20  bel-238..SELECT 
9d20: 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2b 20 2b 20  col0 / col0 + + 
9d30: 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63  ( - col2 ) * + c
9d40: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
9d50: 2d 2d 2d 0d 0a 2d 31 34 34 33 0d 0a 2d 36 37 35  ---..-1443..-675
9d60: 0d 0a 2d 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20  ..-728....query 
9d70: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9d80: 54 20 41 4c 4c 20 31 30 20 2a 20 74 61 62 31 2e  T ALL 10 * tab1.
9d90: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 46 52  col1 + + col1 FR
9da0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
9db0: 31 30 0d 0a 31 34 33 0d 0a 32 38 36 0d 0a 0d 0a  10..143..286....
9dc0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
9dd0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
9de0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
9df0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
9e00: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 30 0d  wsort label-240.
9e10: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
9e20: 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31   + col2 + + col1
9e30: 20 44 49 56 20 2b 20 33 33 20 46 52 4f 4d 20 74   DIV + 33 FROM t
9e40: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 33  ab2..----..27..3
9e50: 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
9e60: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
9e70: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
9e80: 6f 72 74 20 6c 61 62 65 6c 2d 32 34 30 0d 0a 53  ort label-240..S
9e90: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
9ea0: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2f   col2 + + col1 /
9eb0: 20 2b 20 33 33 20 46 52 4f 4d 20 74 61 62 32 0d   + 33 FROM tab2.
9ec0: 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 33 38 0d 0a 0d  .----..27..38...
9ed0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9ee0: 0d 0a 53 45 4c 45 43 54 20 39 34 20 2b 20 63 6f  ..SELECT 94 + co
9ef0: 6c 32 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l2 - col2 AS col
9f00: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
9f10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 34 0d 0a 39  or0..----..94..9
9f20: 34 0d 0a 39 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..94....skipif 
9f30: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
9f40: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
9f50: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
9f60: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
9f70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9f80: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
9f90: 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c 30  l2 + + col2 col0
9fa0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
9fb0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35 34  r0..----..52..54
9fc0: 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..76....query I 
9fd0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9fe0: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 36 36 20 2b  cor0.col2 * 66 +
9ff0: 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
a000: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
a010: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 36 37  cor0..----..3567
a020: 0d 0a 33 38 32 36 0d 0a 36 34 31 36 0d 0a 0d 0a  ..3826..6416....
a030: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a040: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b  .SELECT col2 + +
a050: 20 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   7 AS col1 FROM 
a060: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
a070: 2d 2d 0d 0a 34 30 0d 0a 38 0d 0a 38 39 0d 0a 0d  --..40..8..89...
a080: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
a090: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
a0a0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
a0b0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
a0c0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
a0d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a0e0: 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 28 20 63  T ALL col0 * ( c
a0f0: 6f 6c 30 20 2a 20 63 6f 6c 31 20 29 20 63 6f 6c  ol0 * col1 ) col
a100: 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
a110: 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34 0d 0a 34 30 39  ..----..234..409
a120: 36 30 0d 0a 38 33 32 30 30 0d 0a 0d 0a 6f 6e 6c  60..83200....onl
a130: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
a140: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
a150: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
a160: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
a170: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
a180: 6c 61 62 65 6c 2d 32 34 36 0d 0a 53 45 4c 45 43  label-246..SELEC
a190: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
a1a0: 30 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  0 + + CAST( NULL
a1b0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
a1c0: 6f 6c 31 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 / col0 FROM 
a1d0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
a1e0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
a1f0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
a200: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
a210: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
a220: 2d 32 34 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  -246..SELECT DIS
a230: 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b  TINCT - col0 + +
a240: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
a250: 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 31  INTEGER ) * col1
a260: 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
a270: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a280: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
a290: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a2a0: 20 41 4c 4c 20 63 6f 6c 31 20 2d 20 37 37 20 41   ALL col1 - 77 A
a2b0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
a2c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
a2d0: 0d 0a 2d 34 36 0d 0a 2d 36 30 0d 0a 0d 0a 6f 6e  ..-46..-60....on
a2e0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
a2f0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
a300: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
a310: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
a320: 6f 72 74 20 6c 61 62 65 6c 2d 32 34 38 0d 0a 53  ort label-248..S
a330: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
a340: 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20   + + ( - col1 ) 
a350: 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  DIV + col2 AS co
a360: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
a370: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a  cor0..----..-3..
a380: 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70  -64..-80....skip
a390: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
a3a0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
a3b0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
a3c0: 2d 32 34 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -248..SELECT ALL
a3d0: 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2d 20   - col0 + + ( - 
a3e0: 63 6f 6c 31 20 29 20 2f 20 2b 20 63 6f 6c 32 20  col1 ) / + col2 
a3f0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
a400: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a410: 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d  .-3..-64..-80...
a420: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a430: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
a440: 54 20 63 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 6c  T col2 + - ( col
a450: 30 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  0 ) * col2 AS co
a460: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
a470: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38  cor0..----..-108
a480: 0d 0a 2d 33 35 39 31 0d 0a 2d 37 35 38 34 0d 0a  ..-3591..-7584..
a490: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a4a0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
a4b0: 2b 20 63 6f 6c 32 20 2d 20 39 36 20 2a 20 63 6f  + col2 - 96 * co
a4c0: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
a4d0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
a4e0: 2d 2d 0d 0a 2d 33 32 30 31 0d 0a 2d 37 39 35 34  --..-3201..-7954
a4f0: 0d 0a 2d 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-97....onlyif 
a500: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
a510: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
a520: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
a530: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
a540: 61 62 65 6c 2d 32 35 31 0d 0a 53 45 4c 45 43 54  abel-251..SELECT
a550: 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
a560: 6c 30 20 2b 20 32 34 20 44 49 56 20 2d 20 63 6f  l0 + 24 DIV - co
a570: 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
a580: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
a590: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 33 35 0d  0..----..23..35.
a5a0: 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .89....skipif my
a5b0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
a5c0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
a5d0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 31 0d  wsort label-251.
a5e0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
a5f0: 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 32 34 20 2f   + + col0 + 24 /
a600: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   - cor0.col0 AS 
a610: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
a620: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33  S cor0..----..23
a630: 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70  ..35..89....skip
a640: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
a650: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
a660: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
a670: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
a680: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
a690: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
a6a0: 20 2b 20 63 6f 6c 30 20 2b 20 28 20 2d 20 63 6f   + col0 + ( - co
a6b0: 72 30 2e 63 6f 6c 32 20 29 20 63 6f 6c 31 20 46  r0.col2 ) col1 F
a6c0: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
a6d0: 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34 31 0d 0a 35 32  ---..-20..41..52
a6e0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
a6f0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
a700: 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31  r0.col0 * + col1
a710: 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   + - col0 * - co
a720: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
a730: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
a740: 2d 2d 0d 0a 34 37 33 36 0d 0a 37 34 34 30 0d 0a  --..4736..7440..
a750: 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  87....query I ro
a760: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
a770: 35 39 20 2b 20 34 38 20 2d 20 2d 20 63 6f 6c 32  59 + 48 - - col2
a780: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
a790: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 31 36  r0..----..15..16
a7a0: 0d 0a 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..27....query I 
a7b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a7c0: 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  + - col1 + + col
a7d0: 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  2 * - col2 FROM 
a7e0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
a7f0: 2d 2d 0d 0a 2d 32 39 34 32 0d 0a 2d 33 32 35 39  --..-2942..-3259
a800: 0d 0a 2d 39 32 32 39 0d 0a 0d 0a 71 75 65 72 79  ..-9229....query
a810: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a820: 43 54 20 34 36 20 2b 20 2b 20 63 6f 6c 32 20 41  CT 46 + + col2 A
a830: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
a840: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a850: 31 32 38 0d 0a 34 37 0d 0a 37 39 0d 0a 0d 0a 71  128..47..79....q
a860: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a870: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
a880: 63 6f 6c 32 20 2a 20 2d 20 31 30 20 2d 20 74 61  col2 * - 10 - ta
a890: 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  b0.col0 AS col1 
a8a0: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
a8b0: 0a 2d 33 35 34 0d 0a 2d 34 35 0d 0a 2d 39 30 39  .-354..-45..-909
a8c0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
a8d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 32  ort..SELECT tab2
a8e0: 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a  .col2 + - col2 *
a8f0: 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 46 52 4f   - tab2.col2 FRO
a900: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34  M tab2..----..14
a910: 38 32 0d 0a 37 30 32 0d 0a 37 35 36 0d 0a 0d 0a  82..702..756....
a920: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a930: 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 31 39  .SELECT - ( - 19
a940: 20 29 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63   ) + + col0 AS c
a950: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
a960: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d   cor0..----..26.
a970: 0a 39 37 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79  .97..98....query
a980: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a990: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
a9a0: 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  l0 * col2 + col0
a9b0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
a9c0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
a9d0: 36 35 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a  65..3712..7760..
a9e0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
a9f0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
aa00: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
aa10: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
aa20: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36  rowsort label-26
aa30: 31 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 36 38  1..SELECT - + 68
aa40: 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c   DIV col1 AS col
aa50: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
aa60: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
aa70: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
aa80: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
aa90: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
aaa0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 31 0d 0a  sort label-261..
aab0: 53 45 4c 45 43 54 20 2d 20 2b 20 36 38 20 2f 20  SELECT - + 68 / 
aac0: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
aad0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
aae0: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
aaf0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ab00: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
ab10: 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  or0.col2 + col0 
ab20: 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  * col0 FROM tab2
ab30: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ab40: 32 32 0d 0a 36 30 35 38 0d 0a 36 32 30 33 0d 0a  22..6058..6203..
ab50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ab60: 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 37 39  t..SELECT ( + 79
ab70: 20 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   ) * - col0 FROM
ab80: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
ab90: 2d 2d 2d 0d 0a 2d 32 33 37 0d 0a 2d 35 30 35 36  ---..-237..-5056
aba0: 0d 0a 2d 36 33 32 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..-6320....onlyi
abb0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
abc0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
abd0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
abe0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
abf0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
ac00: 62 65 6c 2d 32 36 34 0d 0a 53 45 4c 45 43 54 20  bel-264..SELECT 
ac10: 2b 20 2d 20 43 41 53 54 28 20 2d 20 63 6f 6c 31  + - CAST( - col1
ac20: 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
ac30: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
ac40: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39  or0..----..86..9
ac50: 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..97....skipif 
ac60: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
ac70: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
ac80: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36  rowsort label-26
ac90: 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 43 41  4..SELECT + - CA
aca0: 53 54 20 28 20 2d 20 63 6f 6c 31 20 41 53 20 49  ST ( - col1 AS I
acb0: 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32  NTEGER ) AS col2
acc0: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
acd0: 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39  .----..86..91..9
ace0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
acf0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
ad00: 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 35 36   - + col2 * + 56
ad10: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
ad20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 34 38 0d  r0..----..-1848.
ad30: 0a 2d 34 35 39 32 0d 0a 2d 35 36 0d 0a 0d 0a 6f  .-4592..-56....o
ad40: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
ad50: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
ad60: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
ad70: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
ad80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ad90: 74 20 6c 61 62 65 6c 2d 32 36 36 0d 0a 53 45 4c  t label-266..SEL
ada0: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 63  ECT ALL col1 + c
adb0: 6f 6c 32 20 2d 20 2d 20 43 41 53 54 28 20 2b 20  ol2 - - CAST( + 
adc0: 37 34 20 2a 20 63 6f 6c 31 20 41 53 20 53 49 47  74 * col1 AS SIG
add0: 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20  NED ) FROM tab0 
ade0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  AS cor0..----..6
adf0: 34 38 33 0d 0a 36 39 30 37 0d 0a 37 32 37 36 0d  483..6907..7276.
ae00: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
ae10: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
ae20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ae30: 74 20 6c 61 62 65 6c 2d 32 36 36 0d 0a 53 45 4c  t label-266..SEL
ae40: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 63  ECT ALL col1 + c
ae50: 6f 6c 32 20 2d 20 2d 20 43 41 53 54 20 28 20 2b  ol2 - - CAST ( +
ae60: 20 37 34 20 2a 20 63 6f 6c 31 20 41 53 20 49 4e   74 * col1 AS IN
ae70: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
ae80: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
ae90: 0a 36 34 38 33 0d 0a 36 39 30 37 0d 0a 37 32 37  .6483..6907..727
aea0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
aeb0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
aec0: 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 35   col2 + col1 * 5
aed0: 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  5 FROM tab2 AS c
aee0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 33 32 0d  or0..----..1732.
aef0: 0a 33 32 37 31 0d 0a 39 37 33 0d 0a 0d 0a 71 75  .3271..973....qu
af00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
af10: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
af20: 20 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab2.col1 FROM 
af30: 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
af40: 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
af50: 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a  ..----..17..31..
af60: 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  59....query I ro
af70: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
af80: 4c 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  L - + col0 * + c
af90: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
afa0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
afb0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d  r0..----..-1343.
afc0: 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a  .-217..-4602....
afd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
afe0: 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63  .SELECT col1 * c
aff0: 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 28 20 2d  or0.col2 + - ( -
b000: 20 63 6f 6c 32 20 29 20 2d 20 2d 20 63 6f 6c 31   col2 ) - - col1
b010: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
b020: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
b030: 0d 0a 31 33 35 37 0d 0a 31 34 38 34 0d 0a 36 33  ..1357..1484..63
b040: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
b050: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
b060: 20 28 20 63 6f 6c 32 20 29 20 2b 20 2b 20 63 6f   ( col2 ) + + co
b070: 6c 32 20 2b 20 2b 20 33 31 20 2a 20 2b 20 63 6f  l2 + + 31 * + co
b080: 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  l1 * + col0 AS c
b090: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
b0a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 39   cor0..----..199
b0b0: 35 34 0d 0a 32 35 32 36 0d 0a 33 32 34 33 32 0d  54..2526..32432.
b0c0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
b0d0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
b0e0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
b0f0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
b100: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
b110: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b120: 45 43 54 20 44 49 53 54 49 4e 43 54 20 32 35 20  ECT DISTINCT 25 
b130: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
b140: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 0d  or0..----..25...
b150: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
b160: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
b170: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
b180: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
b190: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
b1a0: 6f 72 74 20 6c 61 62 65 6c 2d 32 37 33 0d 0a 53  ort label-273..S
b1b0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
b1c0: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54   + col1 * + CAST
b1d0: 28 20 31 31 20 41 53 20 53 49 47 4e 45 44 20 29  ( 11 AS SIGNED )
b1e0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
b1f0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
b200: 0d 0a 31 34 39 0d 0a 33 31 34 0d 0a 36 32 33 0d  ..149..314..623.
b210: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
b220: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
b230: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b240: 74 20 6c 61 62 65 6c 2d 32 37 33 0d 0a 53 45 4c  t label-273..SEL
b250: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b  ECT ALL - col2 +
b260: 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20 28   col1 * + CAST (
b270: 20 31 31 20 41 53 20 49 4e 54 45 47 45 52 20 29   11 AS INTEGER )
b280: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
b290: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
b2a0: 0d 0a 31 34 39 0d 0a 33 31 34 0d 0a 36 32 33 0d  ..149..314..623.
b2b0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
b2c0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
b2d0: 31 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  1 * col1 * + col
b2e0: 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  0 + - col0 FROM 
b2f0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
b300: 2d 2d 0d 0a 31 33 34 34 30 0d 0a 32 30 32 35 0d  --..13440..2025.
b310: 0a 36 33 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  .6336....skipif 
b320: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
b330: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
b340: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
b350: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
b360: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b370: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
b380: 43 54 20 2d 20 36 38 20 63 6f 6c 30 20 46 52 4f  CT - 68 col0 FRO
b390: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
b3a0: 2d 2d 2d 2d 0d 0a 2d 36 38 0d 0a 0d 0a 71 75 65  ----..-68....que
b3b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b3c0: 4c 45 43 54 20 41 4c 4c 20 2d 20 38 31 20 2b 20  LECT ALL - 81 + 
b3d0: 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
b3e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
b3f0: 2d 31 33 35 0d 0a 2d 31 33 38 0d 0a 2d 31 37 37  -135..-138..-177
b400: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
b410: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 38 20 2a  ort..SELECT 48 *
b420: 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f   col1 + col0 FRO
b430: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34  M tab2..----..14
b440: 39 35 0d 0a 32 39 31 30 0d 0a 38 39 35 0d 0a 0d  95..2910..895...
b450: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
b460: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
b470: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
b480: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
b490: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 38  owsort label-278
b4a0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34  ..SELECT ALL + 4
b4b0: 35 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20  5 DIV cor0.col1 
b4c0: 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + + col2 FROM ta
b4d0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
b4e0: 0d 0a 35 35 0d 0a 36 31 0d 0a 39 39 0d 0a 0d 0a  ..55..61..99....
b4f0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
b500: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
b510: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
b520: 61 62 65 6c 2d 32 37 38 0d 0a 53 45 4c 45 43 54  abel-278..SELECT
b530: 20 41 4c 4c 20 2b 20 34 35 20 2f 20 63 6f 72 30   ALL + 45 / cor0
b540: 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 46  .col1 + + col2 F
b550: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
b560: 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 36 31 0d 0a  ..----..55..61..
b570: 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
b580: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
b590: 2b 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c  + col0 ) * + col
b5a0: 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  0 + cor0.col1 AS
b5b0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
b5c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  AS cor0..----..6
b5d0: 31 34 33 0d 0a 36 32 35 38 0d 0a 38 30 0d 0a 0d  143..6258..80...
b5e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b5f0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 31 20  ..SELECT ALL 71 
b600: 2a 20 2b 20 63 6f 6c 30 20 2a 20 34 35 20 46 52  * + col0 * 45 FR
b610: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
b620: 0a 2d 2d 2d 2d 0d 0a 32 32 33 36 35 0d 0a 32 34  .----..22365..24
b630: 39 32 31 30 0d 0a 32 35 32 34 30 35 0d 0a 0d 0a  9210..252405....
b640: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
b650: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
b660: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
b670: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
b680: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
b690: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b6a0: 20 35 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   52 col1 FROM ta
b6b0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
b6c0: 0d 0a 35 32 0d 0a 35 32 0d 0a 35 32 0d 0a 0d 0a  ..52..52..52....
b6d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b6e0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
b6f0: 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b   + col0 + col0 +
b700: 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
b710: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
b720: 2d 0d 0a 31 38 32 0d 0a 31 39 36 0d 0a 34 31 0d  -..182..196..41.
b730: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
b740: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
b750: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
b760: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
b770: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
b780: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b790: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a  ECT ALL + col1 *
b7a0: 20 2d 20 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63   - col0 + tab1.c
b7b0: 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
b7c0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d  b1..----..-24..-
b7d0: 35 38 33 0d 0a 2d 39 34 34 0d 0a 0d 0a 71 75 65  583..-944....que
b7e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b7f0: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2d 20 2b 20  LECT - col0 - + 
b800: 63 6f 6c 31 20 2a 20 2b 20 28 20 2b 20 63 6f 6c  col1 * + ( + col
b810: 31 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  1 ) FROM tab2 AS
b820: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35   cor0..----..-35
b830: 35 39 0d 0a 2d 33 36 38 0d 0a 2d 39 36 38 0d 0a  59..-368..-968..
b840: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b850: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 31  t..SELECT ALL 81
b860: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
b870: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
b880: 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 31 36 0d 0a  ----..105..116..
b890: 31 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  170....onlyif my
b8a0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
b8b0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
b8c0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
b8d0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
b8e0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
b8f0: 32 38 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  286..SELECT DIST
b900: 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  INCT - cor0.col1
b910: 20 2a 20 63 6f 6c 30 20 2b 20 43 41 53 54 28 20   * col0 + CAST( 
b920: 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20  ( col2 ) * col2 
b930: 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
b940: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
b950: 2d 2d 2d 0d 0a 32 36 30 39 0d 0a 32 38 33 38 0d  ---..2609..2838.
b960: 0a 38 31 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  .8176....skipif 
b970: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
b980: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
b990: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38  rowsort label-28
b9a0: 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
b9b0: 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  CT - cor0.col1 *
b9c0: 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 28   col0 + CAST ( (
b9d0: 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20 41   col2 ) * col2 A
b9e0: 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
b9f0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
ba00: 2d 2d 2d 0d 0a 32 36 30 39 0d 0a 32 38 33 38 0d  ---..2609..2838.
ba10: 0a 38 31 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .8176....query I
ba20: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ba30: 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29   - ( cor0.col2 )
ba40: 20 2b 20 2b 20 31 30 20 41 53 20 63 6f 6c 31 20   + + 10 AS col1 
ba50: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
ba60: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 31  0..----..-16..-1
ba70: 37 0d 0a 2d 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  7..-28....onlyif
ba80: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
ba90: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
baa0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
bab0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
bac0: 6c 61 62 65 6c 2d 32 38 38 0d 0a 53 45 4c 45 43  label-288..SELEC
bad0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
bae0: 32 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20  2 + + tab1.col2 
baf0: 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  DIV + col2 AS co
bb00: 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
bb10: 2d 2d 0d 0a 2d 35 33 0d 0a 2d 35 36 0d 0a 2d 39  --..-53..-56..-9
bb20: 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
bb30: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
bb40: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
bb50: 6f 72 74 20 6c 61 62 65 6c 2d 32 38 38 0d 0a 53  ort label-288..S
bb60: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
bb70: 20 63 6f 6c 32 20 2b 20 2b 20 74 61 62 31 2e 63   col2 + + tab1.c
bb80: 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20  ol2 / + col2 AS 
bb90: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
bba0: 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 35 36 0d 0a  ----..-53..-56..
bbb0: 2d 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -95....onlyif my
bbc0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
bbd0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
bbe0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
bbf0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
bc00: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
bc10: 32 38 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  289..SELECT ALL 
bc20: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 28 20  + cor0.col2 * ( 
bc30: 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 4e 55 4c  col1 + CAST( NUL
bc40: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 29 20  L AS SIGNED ) ) 
bc50: 2f 20 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f  / ( col0 ) AS co
bc60: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
bc70: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
bc80: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
bc90: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
bca0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
bcb0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
bcc0: 6c 2d 32 38 39 0d 0a 53 45 4c 45 43 54 20 41 4c  l-289..SELECT AL
bcd0: 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  L + cor0.col2 * 
bce0: 28 20 63 6f 6c 31 20 2b 20 43 41 53 54 20 28 20  ( col1 + CAST ( 
bcf0: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
bd00: 29 20 29 20 2f 20 28 20 63 6f 6c 30 20 29 20 41  ) ) / ( col0 ) A
bd10: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
bd20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
bd30: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
bd40: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
bd50: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
bd60: 54 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29  T + - ( - col2 )
bd70: 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
bd80: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
bd90: 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d  .121..176..57...
bda0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
bdb0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
bdc0: 54 20 2b 20 38 32 20 2a 20 2b 20 63 6f 72 30 2e  T + 82 * + cor0.
bdd0: 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col2 + col2 FROM
bde0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
bdf0: 2d 2d 2d 0d 0a 32 37 33 39 0d 0a 36 38 30 36 0d  ---..2739..6806.
be00: 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .83....query I r
be10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
be20: 4c 4c 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f  LL - ( - cor0.co
be30: 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  l1 ) + + col2 * 
be40: 28 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  ( + col1 * + col
be50: 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  2 ) FROM tab0 AS
be60: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34   cor0..----..194
be70: 0d 0a 36 31 31 39 37 35 0d 0a 39 33 37 34 30 0d  ..611975..93740.
be80: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
be90: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
bea0: 32 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 41  2 * ( - col2 ) A
beb0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
bec0: 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33 32  ..----..2916..32
bed0: 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a 71 75 65 72  49..9216....quer
bee0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
bef0: 45 43 54 20 2b 20 36 37 20 2a 20 2d 20 63 6f 72  ECT + 67 * - cor
bf00: 31 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 31 2e  1.col0 * - cor1.
bf10: 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
bf20: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43  M tab2 AS cor0 C
bf30: 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20  ROSS JOIN tab2, 
bf40: 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
bf50: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
bf60: 73 68 69 6e 67 20 74 6f 20 34 63 35 35 38 34 61  shing to 4c5584a
bf70: 35 66 33 31 36 36 36 64 62 35 38 62 66 63 62 62  5f31666db58bfcbb
bf80: 31 35 31 39 31 39 33 36 37 0d 0a 0d 0a 71 75 65  151919367....que
bf90: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
bfa0: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  LECT + col0 * + 
bfb0: 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 41 53  col0 + - col0 AS
bfc0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
bfd0: 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 36 30 30 36 0d  .----..42..6006.
bfe0: 0a 36 31 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .6162....query I
bff0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c000: 20 41 4c 4c 20 39 32 20 2a 20 35 37 20 41 53 20   ALL 92 * 57 AS 
c010: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
c020: 2d 2d 2d 2d 0d 0a 35 32 34 34 0d 0a 35 32 34 34  ----..5244..5244
c030: 0d 0a 35 32 34 34 0d 0a 0d 0a 71 75 65 72 79 20  ..5244....query 
c040: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c050: 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
c060: 31 20 2a 20 2b 20 37 34 20 46 52 4f 4d 20 74 61  1 * + 74 FROM ta
c070: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
c080: 0d 0a 2d 31 39 32 34 0d 0a 2d 37 34 30 0d 0a 2d  ..-1924..-740..-
c090: 39 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  962....onlyif my
c0a0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
c0b0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
c0c0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
c0d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
c0e0: 65 6c 2d 32 39 38 0d 0a 53 45 4c 45 43 54 20 44  el-298..SELECT D
c0f0: 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20 63 6f  ISTINCT - ( - co
c100: 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  l0 ) * - col0 + 
c110: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30  cor0.col0 * col0
c120: 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c   DIV col1 AS col
c130: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
c140: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 33  or0..----..-1213
c150: 0d 0a 2d 35 37 30 0d 0a 2d 37 38 33 34 0d 0a 0d  ..-570..-7834...
c160: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
c170: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
c180: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
c190: 6c 61 62 65 6c 2d 32 39 38 0d 0a 53 45 4c 45 43  label-298..SELEC
c1a0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2d  T DISTINCT - ( -
c1b0: 20 63 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 30   col0 ) * - col0
c1c0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   + cor0.col0 * c
c1d0: 6f 6c 30 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 / col1 AS co
c1e0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
c1f0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31  cor0..----..-121
c200: 33 0d 0a 2d 35 37 30 0d 0a 2d 37 38 33 34 0d 0a  3..-570..-7834..
c210: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c220: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
c230: 39 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  96 AS col0 FROM 
c240: 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
c250: 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
c260: 2c 20 74 61 62 31 20 41 53 20 63 6f 72 32 0d 0a  , tab1 AS cor2..
c270: 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20  ----..81 values 
c280: 68 61 73 68 69 6e 67 20 74 6f 20 65 30 33 30 38  hashing to e0308
c290: 30 32 31 32 65 33 33 34 35 64 38 62 33 37 65 36  0212e3345d8b37e6
c2a0: 34 65 33 32 36 34 30 31 39 63 34 0d 0a 0d 0a 71  4e3264019c4....q
c2b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c2c0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
c2d0: 2b 20 38 31 20 2a 20 38 39 20 46 52 4f 4d 20 74  + 81 * 89 FROM t
c2e0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
c2f0: 2d 0d 0a 37 32 30 39 0d 0a 0d 0a 6f 6e 6c 79 69  -..7209....onlyi
c300: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
c310: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
c320: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
c330: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c340: 20 6c 61 62 65 6c 2d 33 30 31 0d 0a 53 45 4c 45   label-301..SELE
c350: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20  CT ALL - col1 * 
c360: 2b 20 39 37 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  + 97 + + col1 * 
c370: 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2b 20  cor0.col0 DIV + 
c380: 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
c390: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
c3a0: 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 32 34 39 36 0d  -..-1248..-2496.
c3b0: 0a 2d 39 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-960....skipif 
c3c0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
c3d0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
c3e0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
c3f0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
c400: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
c410: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
c420: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c430: 20 6c 61 62 65 6c 2d 33 30 31 0d 0a 53 45 4c 45   label-301..SELE
c440: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20  CT ALL - col1 * 
c450: 2b 20 39 37 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  + 97 + + col1 * 
c460: 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 2b 20 63 6f  cor0.col0 / + co
c470: 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
c480: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
c490: 0a 2d 31 32 34 38 0d 0a 2d 32 34 39 36 0d 0a 2d  .-1248..-2496..-
c4a0: 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  960....query I r
c4b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
c4c0: 20 31 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53   11 FROM tab0 AS
c4d0: 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
c4e0: 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
c4f0: 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
c500: 73 68 69 6e 67 20 74 6f 20 66 34 64 31 39 39 35  shing to f4d1995
c510: 38 34 62 34 34 37 33 32 66 31 61 38 39 37 65 36  84b44732f1a897e6
c520: 36 39 31 62 34 65 61 30 30 0d 0a 0d 0a 71 75 65  691b4ea00....que
c530: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c540: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
c550: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20  - cor0.col1 * + 
c560: 32 34 20 2b 20 2d 20 33 31 20 41 53 20 63 6f 6c  24 + - 31 AS col
c570: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
c580: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 33 33 0d  or0..----..2033.
c590: 0a 32 31 35 33 0d 0a 32 32 39 37 0d 0a 0d 0a 71  .2153..2297....q
c5a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c5b0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
c5c0: 32 20 2b 20 33 30 20 2a 20 32 32 20 46 52 4f 4d  2 + 30 * 22 FROM
c5d0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
c5e0: 2d 2d 2d 0d 0a 36 36 31 0d 0a 36 39 33 0d 0a 37  ---..661..693..7
c5f0: 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  42....query I ro
c600: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
c610: 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 33  L + - col1 * + 3
c620: 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  6 AS col0 FROM t
c630: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
c640: 2d 0d 0a 2d 33 30 39 36 0d 0a 2d 33 32 37 36 0d  -..-3096..-3276.
c650: 0a 2d 33 34 39 32 0d 0a 0d 0a 71 75 65 72 79 20  .-3492....query 
c660: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c670: 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T + cor0.col2 * 
c680: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
c690: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
c6a0: 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a  ---..189..2028..
c6b0: 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3002....query I 
c6c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c6d0: 2d 20 63 6f 6c 32 20 2b 20 35 36 20 2a 20 2b 20  - col2 + 56 * + 
c6e0: 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
c6f0: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
c700: 2d 0d 0a 31 37 30 39 0d 0a 33 32 37 38 0d 0a 39  -..1709..3278..9
c710: 31 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  14....onlyif mys
c720: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
c730: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
c740: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
c750: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
c760: 6c 2d 33 30 38 0d 0a 53 45 4c 45 43 54 20 2d 20  l-308..SELECT - 
c770: 63 6f 6c 30 20 44 49 56 20 2b 20 39 32 20 41 53  col0 DIV + 92 AS
c780: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
c790: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
c7a0: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
c7b0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
c7c0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
c7d0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
c7e0: 30 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  08..SELECT - col
c7f0: 30 20 2f 20 2b 20 39 32 20 41 53 20 63 6f 6c 30  0 / + 92 AS col0
c800: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
c810: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
c820: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
c830: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
c840: 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a  TINCT - - col0 *
c850: 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30   + col0 + - col0
c860: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
c870: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 30 0d 0a  r0..----..1190..
c880: 35 35 32 0d 0a 37 38 33 32 0d 0a 0d 0a 71 75 65  552..7832....que
c890: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c8a0: 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 33 30  LECT col2 * + 30
c8b0: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
c8c0: 0a 2d 2d 2d 2d 0d 0a 32 34 36 30 0d 0a 33 30 0d  .----..2460..30.
c8d0: 0a 39 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .990....onlyif m
c8e0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
c8f0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
c900: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
c910: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
c920: 62 65 6c 2d 33 31 31 0d 0a 53 45 4c 45 43 54 20  bel-311..SELECT 
c930: 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
c940: 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l1 + + cor0.col0
c950: 20 44 49 56 20 63 6f 6c 31 20 63 6f 6c 30 20 46   DIV col1 col0 F
c960: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
c970: 2d 2d 2d 0d 0a 32 31 0d 0a 33 31 0d 0a 36 30 0d  ---..21..31..60.
c980: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
c990: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
c9a0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
c9b0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
c9c0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
c9d0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
c9e0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
c9f0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
ca00: 2d 33 31 31 0d 0a 53 45 4c 45 43 54 20 44 49 53  -311..SELECT DIS
ca10: 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20  TINCT cor0.col1 
ca20: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20  + + cor0.col0 / 
ca30: 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col1 col0 FROM t
ca40: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
ca50: 32 31 0d 0a 33 31 0d 0a 36 30 0d 0a 0d 0a 71 75  21..31..60....qu
ca60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ca70: 45 4c 45 43 54 20 2d 20 32 36 20 2a 20 2d 20 63  ELECT - 26 * - c
ca80: 6f 72 30 2e 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c  or0.col0 - + col
ca90: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
caa0: 0d 0a 2d 2d 2d 2d 0d 0a 32 32 33 32 0d 0a 35 39  ..----..2232..59
cab0: 31 0d 0a 39 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  1..909....onlyif
cac0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
cad0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
cae0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
caf0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
cb00: 6c 61 62 65 6c 2d 33 31 33 0d 0a 53 45 4c 45 43  label-313..SELEC
cb10: 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  T + col0 + + col
cb20: 30 20 44 49 56 20 2d 20 28 20 63 6f 6c 30 20 29  0 DIV - ( col0 )
cb30: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
cb40: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 33 34  r0..----..23..34
cb50: 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..88....skipif m
cb60: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
cb70: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
cb80: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31 33  owsort label-313
cb90: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
cba0: 2b 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 28 20 63  + + col0 / - ( c
cbb0: 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol0 ) FROM tab0 
cbc0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
cbd0: 33 0d 0a 33 34 0d 0a 38 38 0d 0a 0d 0a 71 75 65  3..34..88....que
cbe0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
cbf0: 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  LECT col0 + + co
cc00: 6c 30 20 2a 20 2d 20 38 34 20 46 52 4f 4d 20 74  l0 * - 84 FROM t
cc10: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
cc20: 2d 0d 0a 2d 35 38 31 0d 0a 2d 36 34 37 34 0d 0a  -..-581..-6474..
cc30: 2d 36 35 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  -6557....skipif 
cc40: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
cc50: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
cc60: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
cc70: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
cc80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cc90: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
cca0: 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 30  l2 * - col1 col0
ccb0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
ccc0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d  r0..----..-2838.
ccd0: 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71  .-7462..-97....q
cce0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ccf0: 53 45 4c 45 43 54 20 2b 20 2b 20 38 31 20 2a 20  SELECT + + 81 * 
cd00: 63 6f 6c 30 20 2a 20 2d 20 36 36 20 41 53 20 63  col0 * - 66 AS c
cd10: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
cd20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37   cor0..----..-37
cd30: 34 32 32 0d 0a 2d 34 31 36 39 38 38 0d 0a 2d 34  422..-416988..-4
cd40: 32 32 33 33 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  22334....skipif 
cd50: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
cd60: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
cd70: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
cd80: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
cd90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cda0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 38 20 2b  t..SELECT - 38 +
cdb0: 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20   col1 col1 FROM 
cdc0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 34 38 0d 0a  tab0..----..48..
cdd0: 35 33 0d 0a 35 39 0d 0a 0d 0a 73 6b 69 70 69 66  53..59....skipif
cde0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
cdf0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
ce00: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
ce10: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
ce20: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
ce30: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
ce40: 4e 43 54 20 2b 20 34 36 20 63 6f 6c 31 20 46 52  NCT + 46 col1 FR
ce50: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 34  OM tab0..----..4
ce60: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
ce70: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
ce80: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
ce90: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
cea0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
ceb0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
cec0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 38  ELECT DISTINCT 8
ced0: 37 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 30 20  7 * - col0 col0 
cee0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
cef0: 0a 2d 36 30 39 0d 0a 2d 36 37 38 36 0d 0a 2d 36  .-609..-6786..-6
cf00: 38 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  873....query I r
cf10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
cf20: 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 32 35 20 46   - col1 * + 25 F
cf30: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
cf40: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 35 30 0d 0a 2d  ..----..-2150..-
cf50: 32 32 37 35 0d 0a 2d 32 34 32 35 0d 0a 0d 0a 6f  2275..-2425....o
cf60: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
cf70: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
cf80: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
cf90: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
cfa0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cfb0: 74 20 6c 61 62 65 6c 2d 33 32 31 0d 0a 53 45 4c  t label-321..SEL
cfc0: 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28 20  ECT ALL - CAST( 
cfd0: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
cfe0: 20 2b 20 28 20 2d 20 74 61 62 30 2e 63 6f 6c 31   + ( - tab0.col1
cff0: 20 29 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61   ) FROM tab0, ta
d000: 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b1 AS cor0, tab0
d010: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
d020: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
d030: 67 20 74 6f 20 31 36 62 65 38 38 36 38 61 31 65  g to 16be8868a1e
d040: 36 66 34 65 38 38 35 30 35 30 39 66 39 33 32 37  6f4e8850509f9327
d050: 61 66 65 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  afe90....skipif 
d060: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
d070: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
d080: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32  rowsort label-32
d090: 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  1..SELECT ALL - 
d0a0: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
d0b0: 4e 54 45 47 45 52 20 29 20 2b 20 28 20 2d 20 74  NTEGER ) + ( - t
d0c0: 61 62 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20  ab0.col1 ) FROM 
d0d0: 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
d0e0: 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
d0f0: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
d100: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 36 62  s hashing to 16b
d110: 65 38 38 36 38 61 31 65 36 66 34 65 38 38 35 30  e8868a1e6f4e8850
d120: 35 30 39 66 39 33 32 37 61 66 65 39 30 0d 0a 0d  509f9327afe90...
d130: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d140: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37  ..SELECT ALL - 7
d150: 33 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20 46 52  3 * tab2.col1 FR
d160: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
d170: 31 32 34 31 0d 0a 2d 32 32 36 33 0d 0a 2d 34 33  1241..-2263..-43
d180: 30 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  07....skipif pos
d190: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
d1a0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
d1b0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
d1c0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
d1d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d1e0: 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 32  SELECT tab2.col2
d1f0: 20 2a 20 36 32 20 63 6f 6c 30 20 46 52 4f 4d 20   * 62 col0 FROM 
d200: 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
d210: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
d220: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 66  es hashing to ff
d230: 61 30 62 61 36 62 63 32 66 30 30 34 36 32 63 34  a0ba6bc2f00462c4
d240: 66 63 63 35 31 32 37 30 31 38 34 65 38 63 0d 0a  fcc51270184e8c..
d250: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d260: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 30  t..SELECT - tab0
d270: 2e 63 6f 6c 31 20 2a 20 2b 20 31 32 20 2b 20 2d  .col1 * + 12 + -
d280: 20 32 34 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   24 FROM tab0, t
d290: 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
d2a0: 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
d2b0: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
d2c0: 6e 67 20 74 6f 20 61 62 33 32 31 32 35 66 34 34  ng to ab32125f44
d2d0: 36 64 38 33 36 35 39 66 36 64 65 64 63 33 31 31  6d83659f6dedc311
d2e0: 35 64 65 62 61 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  5deba1....onlyif
d2f0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
d300: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
d310: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
d320: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
d330: 6c 61 62 65 6c 2d 33 32 35 0d 0a 53 45 4c 45 43  label-325..SELEC
d340: 54 20 2b 20 32 35 20 44 49 56 20 28 20 63 6f 6c  T + 25 DIV ( col
d350: 31 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 29 20  1 * tab1.col1 ) 
d360: 2b 20 33 34 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  + 34 + - col1 * 
d370: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
d380: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 36 0d 0a 2d  ..----..-1006..-
d390: 34 34 0d 0a 2d 36 30 36 0d 0a 0d 0a 73 6b 69 70  44..-606....skip
d3a0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
d3b0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
d3c0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
d3d0: 2d 33 32 35 0d 0a 53 45 4c 45 43 54 20 2b 20 32  -325..SELECT + 2
d3e0: 35 20 2f 20 28 20 63 6f 6c 31 20 2a 20 74 61 62  5 / ( col1 * tab
d3f0: 31 2e 63 6f 6c 31 20 29 20 2b 20 33 34 20 2b 20  1.col1 ) + 34 + 
d400: 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  - col1 * + col0 
d410: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
d420: 0a 2d 31 30 30 36 0d 0a 2d 34 34 0d 0a 2d 36 30  .-1006..-44..-60
d430: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
d440: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
d450: 54 49 4e 43 54 20 2b 20 28 20 2b 20 28 20 2d 20  TINCT + ( + ( - 
d460: 63 6f 6c 30 20 29 20 29 20 46 52 4f 4d 20 74 61  col0 ) ) FROM ta
d470: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37  b2..----..-7..-7
d480: 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20  8..-79....query 
d490: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d4a0: 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  T + col0 * col2 
d4b0: 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  * + col0 AS col2
d4c0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
d4d0: 0d 0a 31 32 32 35 0d 0a 31 39 30 30 38 0d 0a 36  ..1225..19008..6
d4e0: 34 39 35 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49  49522....query I
d4f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
d500: 20 2b 20 38 36 20 2a 20 63 6f 6c 32 20 41 53 20   + 86 * col2 AS 
d510: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
d520: 2d 2d 2d 2d 0d 0a 34 36 34 34 0d 0a 34 39 30 32  ----..4644..4902
d530: 0d 0a 38 32 35 36 0d 0a 0d 0a 71 75 65 72 79 20  ..8256....query 
d540: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d550: 54 20 2d 20 2d 20 32 35 20 2b 20 2b 20 63 6f 6c  T - - 25 + + col
d560: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
d570: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
d580: 2d 0d 0a 31 31 34 0d 0a 34 39 0d 0a 36 30 0d 0a  -..114..49..60..
d590: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d5a0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 33 20 2b  t..SELECT - 53 +
d5b0: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
d5c0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
d5d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 30 0d 0a 31 31  0..----..-50..11
d5e0: 0d 0a 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..27....query I 
d5f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
d600: 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + + col2 * - col
d610: 30 20 2b 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63  0 + + ( - cor0.c
d620: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 29 20 41  ol0 + - col1 ) A
d630: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
d640: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d650: 2d 31 36 37 0d 0a 2d 37 34 37 38 0d 0a 2d 39 30  -167..-7478..-90
d660: 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
d670: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
d680: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
d690: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
d6a0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
d6b0: 2d 33 33 32 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -332..SELECT + c
d6c0: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63  ol2 * + col1 + c
d6d0: 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 41 53 20  ol1 DIV col0 AS 
d6e0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
d6f0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  S cor0..----..28
d700: 34 31 0d 0a 37 34 36 33 0d 0a 39 39 0d 0a 0d 0a  41..7463..99....
d710: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
d720: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
d730: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
d740: 61 62 65 6c 2d 33 33 32 0d 0a 53 45 4c 45 43 54  abel-332..SELECT
d750: 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   + col2 * + col1
d760: 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 41   + col1 / col0 A
d770: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
d780: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d790: 32 38 34 31 0d 0a 37 34 36 33 0d 0a 39 39 0d 0a  2841..7463..99..
d7a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d7b0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
d7c0: 43 54 20 2b 20 28 20 38 32 20 29 20 46 52 4f 4d  CT + ( 82 ) FROM
d7d0: 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63   tab2, tab2 AS c
d7e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 32 0d 0a 0d  or0..----..82...
d7f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d800: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28  ..SELECT ALL + (
d810: 20 2b 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 30   + col1 ) + col0
d820: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
d830: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
d840: 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a  10..132..180....
d850: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d860: 0a 53 45 4c 45 43 54 20 2d 20 33 38 20 2b 20 2b  .SELECT - 38 + +
d870: 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
d880: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
d890: 2d 2d 0d 0a 2d 33 35 0d 0a 32 36 0d 0a 34 32 0d  --..-35..26..42.
d8a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
d8b0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33  rt..SELECT ALL 3
d8c0: 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
d8d0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
d8e0: 0a 32 34 36 0d 0a 33 0d 0a 39 39 0d 0a 0d 0a 71  .246..3..99....q
d8f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d900: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 34 39 20  SELECT ALL - 49 
d910: 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  + - cor0.col1 FR
d920: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
d930: 0a 2d 2d 2d 2d 0d 0a 2d 35 39 0d 0a 2d 36 32 0d  .----..-59..-62.
d940: 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-75....query I 
d950: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
d960: 41 4c 4c 20 2d 20 63 6f 6c 32 20 2d 20 74 61 62  ALL - col2 - tab
d970: 30 2e 63 6f 6c 32 20 2a 20 2d 20 38 31 20 46 52  0.col2 * - 81 FR
d980: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
d990: 36 34 30 0d 0a 36 35 36 30 0d 0a 38 30 0d 0a 0d  640..6560..80...
d9a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d9b0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
d9c0: 54 20 63 6f 6c 31 20 2d 20 28 20 34 35 20 29 20  T col1 - ( 45 ) 
d9d0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
d9e0: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 32  2..----..-14..-2
d9f0: 38 0d 0a 31 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  8..14....onlyif 
da00: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
da10: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
da20: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
da30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
da40: 61 62 65 6c 2d 33 34 30 0d 0a 53 45 4c 45 43 54  abel-340..SELECT
da50: 20 41 4c 4c 20 2d 20 35 39 20 44 49 56 20 2d 20   ALL - 59 DIV - 
da60: 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 63 6f 6c 31  col0 + col2 col1
da70: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
da80: 0d 0a 32 36 0d 0a 33 35 0d 0a 33 38 0d 0a 0d 0a  ..26..35..38....
da90: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
daa0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
dab0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
dac0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
dad0: 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
dae0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
daf0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
db00: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34  rowsort label-34
db10: 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  0..SELECT ALL - 
db20: 35 39 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  59 / - col0 + co
db30: 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
db40: 32 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 33 35 0d  2..----..26..35.
db50: 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .38....query I r
db60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
db70: 20 2d 20 32 32 20 29 20 2a 20 63 6f 6c 30 20 2b   - 22 ) * col0 +
db80: 20 2b 20 36 32 20 46 52 4f 4d 20 74 61 62 31 20   + 62 FROM tab1 
db90: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
dba0: 31 33 34 36 0d 0a 2d 31 36 39 38 0d 0a 2d 34 0d  1346..-1698..-4.
dbb0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
dbc0: 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e  rt..SELECT tab0.
dbd0: 63 6f 6c 31 20 2a 20 2d 20 32 31 20 2b 20 63 6f  col1 * - 21 + co
dbe0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
dbf0: 2d 2d 0d 0a 2d 31 37 32 30 0d 0a 2d 31 38 32 30  --..-1720..-1820
dc00: 0d 0a 2d 31 39 34 30 0d 0a 0d 0a 71 75 65 72 79  ..-1940....query
dc10: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
dc20: 43 54 20 2d 20 2b 20 28 20 2b 20 63 6f 72 30 2e  CT - + ( + cor0.
dc30: 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46  col0 ) AS col1 F
dc40: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
dc50: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d  ..----..-3..-64.
dc60: 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-80....onlyif m
dc70: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
dc80: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
dc90: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
dca0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
dcb0: 62 65 6c 2d 33 34 34 0d 0a 53 45 4c 45 43 54 20  bel-344..SELECT 
dcc0: 41 4c 4c 20 2d 20 2b 20 36 33 20 44 49 56 20 34  ALL - + 63 DIV 4
dcd0: 35 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  5 - - col2 AS co
dce0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
dcf0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 33  cor0..----..0..3
dd00: 32 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  2..81....skipif 
dd10: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
dd20: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
dd30: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34  rowsort label-34
dd40: 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  4..SELECT ALL - 
dd50: 2b 20 36 33 20 2f 20 34 35 20 2d 20 2d 20 63 6f  + 63 / 45 - - co
dd60: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
dd70: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
dd80: 2d 2d 0d 0a 30 0d 0a 33 32 0d 0a 38 31 0d 0a 0d  --..0..32..81...
dd90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
dda0: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 36 39 20  ..SELECT - - 69 
ddb0: 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f  * cor0.col2 + co
ddc0: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
ddd0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
dde0: 2d 2d 0d 0a 33 37 38 30 0d 0a 33 39 39 30 0d 0a  --..3780..3990..
ddf0: 36 37 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  6720....onlyif m
de00: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
de10: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
de20: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
de30: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
de40: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
de50: 2d 33 34 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  -346..SELECT DIS
de60: 54 49 4e 43 54 20 2d 20 2b 20 43 41 53 54 28 20  TINCT - + CAST( 
de70: 2d 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  - col2 AS SIGNED
de80: 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30   ) * - cor0.col0
de90: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
dea0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
deb0: 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d  ..-162..-3648..-
dec0: 37 36 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7680....skipif m
ded0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
dee0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
def0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34 36  owsort label-346
df00: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
df10: 54 20 2d 20 2b 20 43 41 53 54 20 28 20 2d 20 63  T - + CAST ( - c
df20: 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
df30: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41   * - cor0.col0 A
df40: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
df50: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
df60: 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36  -162..-3648..-76
df70: 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  80....onlyif mys
df80: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
df90: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
dfa0: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
dfb0: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
dfc0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
dfd0: 34 37 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28  47..SELECT CAST(
dfe0: 20 2d 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45   - col2 AS SIGNE
dff0: 44 20 29 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20  D ) + - col1 AS 
e000: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
e010: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
e020: 31 39 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d  19..-173..-98...
e030: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
e040: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
e050: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
e060: 6c 61 62 65 6c 2d 33 34 37 0d 0a 53 45 4c 45 43  label-347..SELEC
e070: 54 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20  T CAST ( - col2 
e080: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d  AS INTEGER ) + -
e090: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
e0a0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
e0b0: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d 31 37  .----..-119..-17
e0c0: 33 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20  3..-98....query 
e0d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e0e0: 54 20 44 49 53 54 49 4e 43 54 20 32 37 20 2a 20  T DISTINCT 27 * 
e0f0: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
e100: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
e110: 32 32 31 34 0d 0a 32 37 0d 0a 38 39 31 0d 0a 0d  2214..27..891...
e120: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
e130: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
e140: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
e150: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
e160: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34 39  owsort label-349
e170: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
e180: 54 20 2b 20 63 6f 6c 30 20 2a 20 31 20 2b 20 2d  T + col0 * 1 + -
e190: 20 63 6f 6c 30 20 44 49 56 20 32 33 20 2b 20 63   col0 DIV 23 + c
e1a0: 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  or0.col1 * col0 
e1b0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
e1c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
e1d0: 38 37 0d 0a 33 34 32 39 0d 0a 38 31 38 35 0d 0a  87..3429..8185..
e1e0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
e1f0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
e200: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
e210: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
e220: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
e230: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
e240: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
e250: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
e260: 33 34 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  349..SELECT DIST
e270: 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 31 20  INCT + col0 * 1 
e280: 2b 20 2d 20 63 6f 6c 30 20 2f 20 32 33 20 2b 20  + - col0 / 23 + 
e290: 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30  cor0.col1 * col0
e2a0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
e2b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
e2c0: 30 38 37 0d 0a 33 34 32 39 0d 0a 38 31 38 35 0d  087..3429..8185.
e2d0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
e2e0: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
e2f0: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
e300: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
e310: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
e320: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35 30 0d  wsort label-350.
e330: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
e340: 20 2b 20 2d 20 43 41 53 54 28 20 2d 20 34 31 20   + - CAST( - 41 
e350: 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20  AS SIGNED ) + - 
e360: 63 6f 6c 30 20 2a 20 43 41 53 54 28 20 2d 20 63  col0 * CAST( - c
e370: 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol0 AS SIGNED ) 
e380: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
e390: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
e3a0: 0a 34 31 33 37 0d 0a 35 30 0d 0a 36 34 34 31 0d  .4137..50..6441.
e3b0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
e3c0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
e3d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e3e0: 74 20 6c 61 62 65 6c 2d 33 35 30 0d 0a 53 45 4c  t label-350..SEL
e3f0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
e400: 20 43 41 53 54 20 28 20 2d 20 34 31 20 41 53 20   CAST ( - 41 AS 
e410: 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f  INTEGER ) + - co
e420: 6c 30 20 2a 20 43 41 53 54 20 28 20 2d 20 63 6f  l0 * CAST ( - co
e430: 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
e440: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
e450: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
e460: 0a 34 31 33 37 0d 0a 35 30 0d 0a 36 34 34 31 0d  .4137..50..6441.
e470: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e480: 72 74 0d 0a 53 45 4c 45 43 54 20 33 34 20 2a 20  rt..SELECT 34 * 
e490: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53  + col1 + col2 AS
e4a0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
e4b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
e4c0: 39 35 37 0d 0a 33 31 37 36 0d 0a 33 32 39 39 0d  957..3176..3299.
e4d0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
e4e0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
e4f0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
e500: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
e510: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
e520: 35 32 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63  52..SELECT - ( c
e530: 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 31 20 44  ol0 ) + - col1 D
e540: 49 56 20 35 36 20 46 52 4f 4d 20 74 61 62 32 20  IV 56 FROM tab2 
e550: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
e560: 37 0d 0a 2d 37 39 0d 0a 2d 37 39 0d 0a 0d 0a 73  7..-79..-79....s
e570: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
e580: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
e590: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
e5a0: 62 65 6c 2d 33 35 32 0d 0a 53 45 4c 45 43 54 20  bel-352..SELECT 
e5b0: 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63  - ( col0 ) + - c
e5c0: 6f 6c 31 20 2f 20 35 36 20 46 52 4f 4d 20 74 61  ol1 / 56 FROM ta
e5d0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
e5e0: 0d 0a 2d 37 0d 0a 2d 37 39 0d 0a 2d 37 39 0d 0a  ..-7..-79..-79..
e5f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e600: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
e610: 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41   * col2 * col1 A
e620: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
e630: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
e640: 2d 31 36 32 32 34 0d 0a 2d 33 36 35 30 34 0d 0a  -16224..-36504..
e650: 2d 35 37 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -5700....onlyif 
e660: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
e670: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
e680: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
e690: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
e6a0: 61 62 65 6c 2d 33 35 34 0d 0a 53 45 4c 45 43 54  abel-354..SELECT
e6b0: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
e6c0: 20 44 49 56 20 63 6f 6c 31 20 2d 20 2b 20 63 6f   DIV col1 - + co
e6d0: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
e6e0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
e6f0: 2d 2d 0d 0a 2d 37 0d 0a 2d 37 37 0d 0a 2d 37 38  --..-7..-77..-78
e700: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
e710: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
e720: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
e730: 72 74 20 6c 61 62 65 6c 2d 33 35 34 0d 0a 53 45  rt label-354..SE
e740: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
e750: 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 2d 20 2b 20  col2 / col1 - + 
e760: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
e770: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
e780: 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 37 0d 0a 2d  ----..-7..-77..-
e790: 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  78....query I ro
e7a0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
e7b0: 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32  STINCT cor0.col2
e7c0: 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   * + col0 * + co
e7d0: 6c 30 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 - col1 FROM t
e7e0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
e7f0: 2d 0d 0a 31 31 32 38 0d 0a 31 38 39 32 32 0d 0a  -..1128..18922..
e800: 36 34 39 34 33 31 0d 0a 0d 0a 71 75 65 72 79 20  649431....query 
e810: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e820: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
e830: 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  * col0 + + col1 
e840: 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
e850: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
e860: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 39 37 0d 0a 32  ..----..15397..2
e870: 38 35 36 0d 0a 33 34 33 30 0d 0a 0d 0a 71 75 65  856..3430....que
e880: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
e890: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
e8a0: 63 6f 6c 30 20 2a 20 2d 20 39 38 20 46 52 4f 4d  col0 * - 98 FROM
e8b0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
e8c0: 2d 2d 2d 0d 0a 36 38 36 0d 0a 37 36 34 34 0d 0a  ---..686..7644..
e8d0: 37 37 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7742....query I 
e8e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e8f0: 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 36  ALL - + col2 + 6
e900: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
e910: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
e920: 2d 0d 0a 2d 32 32 0d 0a 32 37 0d 0a 35 39 0d 0a  -..-22..27..59..
e930: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e940: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
e950: 43 54 20 2b 20 63 6f 6c 31 20 2b 20 34 30 20 41  CT + col1 + 40 A
e960: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
e970: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
e980: 35 37 0d 0a 37 31 0d 0a 39 39 0d 0a 0d 0a 71 75  57..71..99....qu
e990: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
e9a0: 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 28  ELECT + col2 * (
e9b0: 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   + col1 ) AS col
e9c0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
e9d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d  or0..----..1248.
e9e0: 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75  .1404..570....qu
e9f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ea00: 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 28 20 2d  ELECT col2 * ( -
ea10: 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c   col2 * cor0.col
ea20: 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  0 ) AS col1 FROM
ea30: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
ea40: 2d 2d 2d 0d 0a 2d 31 31 34 30 37 36 0d 0a 2d 35  ---..-114076..-5
ea50: 31 30 33 0d 0a 2d 35 32 37 32 38 0d 0a 0d 0a 71  103..-52728....q
ea60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ea70: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
ea80: 30 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  0 * col2 + - col
ea90: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
eaa0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
eab0: 2d 0d 0a 33 34 0d 0a 37 32 31 36 0d 0a 37 35 39  -..34..7216..759
eac0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ead0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
eae0: 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f 6c 31 20  col1 + + ( col1 
eaf0: 2b 20 2b 20 63 6f 6c 30 20 29 20 2a 20 2d 20 28  + + col0 ) * - (
eb00: 20 2d 20 34 31 20 29 20 46 52 4f 4d 20 74 61 62   - 41 ) FROM tab
eb10: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
eb20: 0a 31 35 38 39 0d 0a 33 39 35 33 0d 0a 35 36 37  .1589..3953..567
eb30: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
eb40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
eb50: 6f 6c 31 20 2b 20 34 20 46 52 4f 4d 20 74 61 62  ol1 + 4 FROM tab
eb60: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
eb70: 0a 2d 38 32 0d 0a 2d 38 37 0d 0a 2d 39 33 0d 0a  .-82..-87..-93..
eb80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
eb90: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
eba0: 63 6f 6c 31 20 2a 20 32 39 20 41 53 20 63 6f 6c  col1 * 29 AS col
ebb0: 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
ebc0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 31 0d 0a 2d  ..----..-1711..-
ebd0: 34 39 33 0d 0a 2d 38 39 39 0d 0a 0d 0a 73 6b 69  493..-899....ski
ebe0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
ebf0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
ec00: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
ec10: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
ec20: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
ec30: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
ec40: 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  - col0 + cor0.co
ec50: 6c 31 20 2a 20 63 6f 6c 30 20 63 6f 6c 31 20 46  l1 * col0 col1 F
ec60: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
ec70: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a 37 30  ..----..1120..70
ec80: 34 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..81....skipif 
ec90: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
eca0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
ecb0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
ecc0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
ecd0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ece0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
ecf0: 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 31 20  CT - col0 + + 1 
ed00: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
ed10: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
ed20: 0d 0a 2d 37 37 0d 0a 2d 37 38 0d 0a 0d 0a 6f 6e  ..-77..-78....on
ed30: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
ed40: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
ed50: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
ed60: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
ed70: 6f 72 74 20 6c 61 62 65 6c 2d 33 36 38 0d 0a 53  ort label-368..S
ed80: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
ed90: 20 2b 20 63 6f 6c 31 20 2b 20 28 20 28 20 63 6f   + col1 + ( ( co
eda0: 6c 32 20 29 20 29 20 44 49 56 20 2d 20 28 20 2d  l2 ) ) DIV - ( -
edb0: 20 36 33 20 29 20 41 53 20 63 6f 6c 32 20 46 52   63 ) AS col2 FR
edc0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
edd0: 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 30 0d  .----..-86..-90.
ede0: 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-97....skipif m
edf0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
ee00: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
ee10: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 36 38  owsort label-368
ee20: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
ee30: 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 28 20 28  T - + col1 + ( (
ee40: 20 63 6f 6c 32 20 29 20 29 20 2f 20 2d 20 28 20   col2 ) ) / - ( 
ee50: 2d 20 36 33 20 29 20 41 53 20 63 6f 6c 32 20 46  - 63 ) AS col2 F
ee60: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
ee70: 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 30  ..----..-86..-90
ee80: 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-97....query I
ee90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
eea0: 20 41 4c 4c 20 2b 20 2b 20 28 20 63 6f 6c 32 20   ALL + + ( col2 
eeb0: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
eec0: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
eed0: 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 71 75  26..27..38....qu
eee0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
eef0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
ef00: 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
ef10: 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
ef20: 72 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 3e 20  r0 WHERE NULL > 
ef30: 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a  ( NULL )..----..
ef40: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
ef50: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
ef60: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
ef70: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
ef80: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
ef90: 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
efa0: 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f  CT + col0 DIV co
efb0: 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63  l1 + - col0 AS c
efc0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
efd0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor0..----..-3.
efe0: 0a 2d 35 38 0d 0a 2d 37 34 0d 0a 0d 0a 73 6b 69  .-58..-74....ski
eff0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
f000: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
f010: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
f020: 6c 2d 33 37 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-371..SELECT DI
f030: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2f 20  STINCT + col0 / 
f040: 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53  col1 + - col0 AS
f050: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
f060: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
f070: 33 0d 0a 2d 35 38 0d 0a 2d 37 34 0d 0a 0d 0a 6f  3..-58..-74....o
f080: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
f090: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
f0a0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
f0b0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
f0c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f0d0: 74 20 6c 61 62 65 6c 2d 33 37 32 0d 0a 53 45 4c  t label-372..SEL
f0e0: 45 43 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  ECT - CAST( NULL
f0f0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63   AS SIGNED ) + c
f100: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 * - col0 AS 
f110: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
f120: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
f130: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
f140: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
f150: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
f160: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f170: 20 6c 61 62 65 6c 2d 33 37 32 0d 0a 53 45 4c 45   label-372..SELE
f180: 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT - CAST ( NULL
f190: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
f1a0: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53  col1 * - col0 AS
f1b0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
f1c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
f1d0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
f1e0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
f1f0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
f200: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
f210: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
f220: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
f230: 37 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  73..SELECT col2 
f240: 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c  + col1 DIV + col
f250: 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
f260: 2d 0d 0a 32 37 0d 0a 32 38 0d 0a 33 39 0d 0a 0d  -..27..28..39...
f270: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
f280: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
f290: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
f2a0: 6c 61 62 65 6c 2d 33 37 33 0d 0a 53 45 4c 45 43  label-373..SELEC
f2b0: 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20  T col2 + col1 / 
f2c0: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
f2d0: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 38 0d 0a  ..----..27..28..
f2e0: 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  39....query IIII
f2f0: 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  IIIIIIIIIII rows
f300: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
f310: 2a 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  * FROM tab2 AS c
f320: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
f330: 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
f340: 31 2c 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  1, tab1, tab1 AS
f350: 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor2..----..364
f360: 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  5 values hashing
f370: 20 74 6f 20 34 34 35 34 35 61 36 32 39 37 61 61   to 44545a6297aa
f380: 32 39 62 62 37 33 30 66 66 62 39 30 37 63 31 33  29bb730ffb907c13
f390: 62 63 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  bc58....query I 
f3a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f3b0: 44 49 53 54 49 4e 43 54 20 2d 20 34 33 20 41 53  DISTINCT - 43 AS
f3c0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
f3d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
f3e0: 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  43....query I ro
f3f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
f400: 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  L - - cor0.col0 
f410: 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  + + col1 AS col1
f420: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
f430: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34  r0..----..29..74
f440: 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..93....query I 
f450: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f460: 2b 20 35 33 20 2a 20 63 6f 6c 32 20 2a 20 63 6f  + 53 * col2 * co
f470: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
f480: 2d 2d 0d 0a 33 30 32 31 30 0d 0a 36 36 31 34 34  --..30210..66144
f490: 0d 0a 37 34 34 31 32 0d 0a 0d 0a 6f 6e 6c 79 69  ..74412....onlyi
f4a0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
f4b0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
f4c0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
f4d0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
f4e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
f4f0: 62 65 6c 2d 33 37 38 0d 0a 53 45 4c 45 43 54 20  bel-378..SELECT 
f500: 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  - col0 + + col0 
f510: 2a 20 2d 20 43 41 53 54 28 20 2d 20 38 32 20 2a  * - CAST( - 82 *
f520: 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45   + col2 AS SIGNE
f530: 44 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  D ) FROM tab1..-
f540: 2d 2d 2d 0d 0a 31 33 32 38 31 0d 0a 32 39 39 30  ---..13281..2990
f550: 37 32 0d 0a 36 32 39 36 38 30 0d 0a 0d 0a 73 6b  72..629680....sk
f560: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
f570: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
f580: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
f590: 65 6c 2d 33 37 38 0d 0a 53 45 4c 45 43 54 20 2d  el-378..SELECT -
f5a0: 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a   col0 + + col0 *
f5b0: 20 2d 20 43 41 53 54 20 28 20 2d 20 38 32 20 2a   - CAST ( - 82 *
f5c0: 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   + col2 AS INTEG
f5d0: 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  ER ) FROM tab1..
f5e0: 2d 2d 2d 2d 0d 0a 31 33 32 38 31 0d 0a 32 39 39  ----..13281..299
f5f0: 30 37 32 0d 0a 36 32 39 36 38 30 0d 0a 0d 0a 71  072..629680....q
f600: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
f610: 53 45 4c 45 43 54 20 2d 20 74 61 62 32 2e 63 6f  SELECT - tab2.co
f620: 6c 32 20 2a 20 2d 20 33 35 20 46 52 4f 4d 20 74  l2 * - 35 FROM t
f630: 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
f640: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
f650: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 66 34  s hashing to af4
f660: 61 33 38 36 39 61 30 38 39 63 62 39 34 33 65 37  a3869a089cb943e7
f670: 33 38 63 35 33 30 65 65 31 61 32 62 39 0d 0a 0d  38c530ee1a2b9...
f680: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f690: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
f6a0: 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20  - tab1.col1 * - 
f6b0: 35 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  57 AS col0 FROM 
f6c0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38  tab1..----..1508
f6d0: 0d 0a 35 38 30 0d 0a 37 35 34 0d 0a 0d 0a 73 6b  ..580..754....sk
f6e0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
f6f0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
f700: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
f710: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
f720: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
f730: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74  owsort..SELECT t
f740: 61 62 32 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  ab2.col0 * col1 
f750: 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  + - col2 * + col
f760: 30 20 2a 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52  0 * col0 col2 FR
f770: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
f780: 31 31 30 36 0d 0a 2d 31 35 33 35 38 32 0d 0a 2d  1106..-153582..-
f790: 32 33 35 38 31 35 0d 0a 0d 0a 6f 6e 6c 79 69 66  235815....onlyif
f7a0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
f7b0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
f7c0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
f7d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
f7e0: 6c 61 62 65 6c 2d 33 38 32 0d 0a 53 45 4c 45 43  label-382..SELEC
f7f0: 54 20 44 49 53 54 49 4e 43 54 20 33 32 20 44 49  T DISTINCT 32 DI
f800: 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V + col0 FROM ta
f810: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 30 0d  b1..----..0..10.
f820: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
f830: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
f840: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f850: 74 20 6c 61 62 65 6c 2d 33 38 32 0d 0a 53 45 4c  t label-382..SEL
f860: 45 43 54 20 44 49 53 54 49 4e 43 54 20 33 32 20  ECT DISTINCT 32 
f870: 2f 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  / + col0 FROM ta
f880: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 30 0d  b1..----..0..10.
f890: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
f8a0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 30 20  rt..SELECT + 20 
f8b0: 2b 20 2d 20 28 20 63 6f 6c 30 20 29 20 46 52 4f  + - ( col0 ) FRO
f8c0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
f8d0: 2d 2d 2d 2d 0d 0a 2d 35 38 0d 0a 2d 35 39 0d 0a  ----..-58..-59..
f8e0: 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  13....query I ro
f8f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
f900: 4c 20 2b 20 2b 20 31 34 20 2a 20 2d 20 63 6f 6c  L + + 14 * - col
f910: 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  0 * + col2 FROM 
f920: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
f930: 2d 2d 0d 0a 2d 31 30 32 31 37 32 0d 0a 2d 31 31  --..-102172..-11
f940: 30 38 38 0d 0a 2d 34 39 30 0d 0a 0d 0a 71 75 65  088..-490....que
f950: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f960: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
f970: 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b 20 2d  + ( - col0 ) + -
f980: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
f990: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
f9a0: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 31  .----..-104..-11
f9b0: 37 0d 0a 2d 33 34 0d 0a 0d 0a 71 75 65 72 79 20  7..-34....query 
f9c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f9d0: 54 20 41 4c 4c 20 2b 20 2d 20 33 20 2b 20 2b 20  T ALL + - 3 + + 
f9e0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
f9f0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
fa00: 0d 0a 32 33 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79  ..23..7....query
fa10: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
fa20: 43 54 20 32 31 20 2b 20 2b 20 63 6f 6c 32 20 46  CT 21 + + col2 F
fa30: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
fa40: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a 37 35 0d  ..----..117..75.
fa50: 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .78....query I r
fa60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
fa70: 20 31 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20   10 * cor0.col2 
fa80: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
fa90: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 33  0..----..-10..-3
faa0: 33 30 0d 0a 2d 38 32 30 0d 0a 0d 0a 71 75 65 72  30..-820....quer
fab0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
fac0: 45 43 54 20 2b 20 38 31 20 2b 20 2d 20 63 6f 6c  ECT + 81 + - col
fad0: 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
fae0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 34 36 0d 0a  ..----..-8..46..
faf0: 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
fb00: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
fb10: 4c 20 31 32 20 2a 20 2d 20 37 36 20 41 53 20 63  L 12 * - 76 AS c
fb20: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
fb30: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
fb40: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
fb50: 69 6e 67 20 74 6f 20 38 30 38 30 64 39 62 38 63  ing to 8080d9b8c
fb60: 34 66 62 64 63 63 65 62 32 39 66 66 35 38 33 37  4fbdcceb29ff5837
fb70: 38 32 33 38 34 30 61 0d 0a 0d 0a 73 6b 69 70 69  823840a....skipi
fb80: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
fb90: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
fba0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
fbb0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
fbc0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
fbd0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
fbe0: 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  INCT + col0 * + 
fbf0: 28 20 63 6f 6c 32 20 29 20 63 6f 6c 31 20 46 52  ( col2 ) col1 FR
fc00: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
fc10: 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a  89..2028..3002..
fc20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fc30: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
fc40: 63 6f 6c 31 20 2b 20 38 39 20 46 52 4f 4d 20 74  col1 + 89 FROM t
fc50: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
fc60: 31 30 36 0d 0a 31 32 30 0d 0a 31 34 38 0d 0a 0d  106..120..148...
fc70: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
fc80: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
fc90: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
fca0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
fcb0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
fcc0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fcd0: 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 34  T ALL col0 * + 4
fce0: 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  4 col1 FROM tab1
fcf0: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38 31  ..----..132..281
fd00: 36 0d 0a 33 35 32 30 0d 0a 0d 0a 71 75 65 72 79  6..3520....query
fd10: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
fd20: 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  CT + col1 * - co
fd30: 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63  l1 + - col2 AS c
fd40: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
fd50: 2d 2d 2d 0d 0a 2d 37 34 32 39 0d 0a 2d 38 33 36  ---..-7429..-836
fd60: 33 0d 0a 2d 39 34 31 30 0d 0a 0d 0a 6f 6e 6c 79  3..-9410....only
fd70: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
fd80: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
fd90: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
fda0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fdb0: 74 20 6c 61 62 65 6c 2d 33 39 35 0d 0a 53 45 4c  t label-395..SEL
fdc0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
fdd0: 31 20 44 49 56 20 2b 20 28 20 63 6f 6c 31 20 2b  1 DIV + ( col1 +
fde0: 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   - col2 ) FROM t
fdf0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
fe00: 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  -..0....skipif m
fe10: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
fe20: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
fe30: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 35  owsort label-395
fe40: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
fe50: 54 20 63 6f 6c 31 20 2f 20 2b 20 28 20 63 6f 6c  T col1 / + ( col
fe60: 31 20 2b 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f  1 + - col2 ) FRO
fe70: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
fe80: 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ----..0....skipi
fe90: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
fea0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
feb0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
fec0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
fed0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
fee0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
fef0: 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a  .col2 + + col0 *
ff00: 20 28 20 63 6f 6c 30 20 29 20 63 6f 6c 31 20 46   ( col0 ) col1 F
ff10: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
ff20: 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 36 0d 0a 36 30  ..----..1226..60
ff30: 39 0d 0a 38 30 30 33 0d 0a 0d 0a 71 75 65 72 79  9..8003....query
ff40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ff50: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
ff60: 6c 30 20 2a 20 2b 20 34 32 20 46 52 4f 4d 20 74  l0 * + 42 FROM t
ff70: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
ff80: 2d 0d 0a 2d 32 39 34 0d 0a 2d 33 32 37 36 0d 0a  -..-294..-3276..
ff90: 2d 33 33 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  -3318....skipif 
ffa0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
ffb0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
ffc0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
ffd0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
ffe0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fff0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
10000 20 2a 20 28 20 2d 20 35 33 20 29 20 63 6f 6c 32   * ( - 53 ) col2
10010 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
10020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 34 39 0d 0a  r0..----..1749..
10030 34 33 34 36 0d 0a 35 33 0d 0a 0d 0a 71 75 65 72  4346..53....quer
10040 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10050 45 43 54 20 36 33 20 2a 20 36 31 20 46 52 4f 4d  ECT 63 * 61 FROM
10060 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
10070 2d 2d 2d 0d 0a 33 38 34 33 0d 0a 33 38 34 33 0d  ---..3843..3843.
10080 0a 33 38 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .3843....query I
10090 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
100a0 20 2b 20 34 36 20 2a 20 63 6f 6c 31 20 2b 20 2b   + 46 * col1 + +
100b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
100c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
100d0 39 38 39 0d 0a 34 32 36 38 0d 0a 34 34 36 33 0d  989..4268..4463.
100e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
100f0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
10100 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 34 31 20  or0.col0 * - 41 
10110 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
10120 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 0d 0a 33 31  0..----..287..31
10130 39 38 0d 0a 33 32 33 39 0d 0a 0d 0a 71 75 65 72  98..3239....quer
10140 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10150 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b  ECT ALL + col2 +
10160 20 31 37 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20   17 + col2 FROM 
10170 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
10180 2d 2d 0d 0a 31 32 35 0d 0a 31 33 31 0d 0a 32 30  --..125..131..20
10190 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
101a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
101b0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b   + col0 * col0 +
101c0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
101d0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
101e0 2d 2d 2d 2d 0d 0a 35 36 0d 0a 36 31 36 32 0d 0a  ----..56..6162..
101f0 36 33 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  6320....onlyif m
10200 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
10210 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
10220 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
10230 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
10240 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10250 2d 34 30 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  -404..SELECT + -
10260 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   cor0.col2 * + c
10270 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  or0.col2 + - col
10280 32 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  2 * - CAST( NULL
10290 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
102a0 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
102b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
102c0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
102d0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  LL....skipif pos
102e0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
102f0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
10300 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
10310 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
10320 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
10330 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
10340 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10350 62 65 6c 2d 34 30 34 0d 0a 53 45 4c 45 43 54 20  bel-404..SELECT 
10360 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + - cor0.col2 * 
10370 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20  + cor0.col2 + - 
10380 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 20 28 20  col2 * - CAST ( 
10390 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
103a0 29 20 2a 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52  ) * col2 col1 FR
103b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
103c0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
103d0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
103e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
103f0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
10400 28 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 29  ( + ( + col1 ) )
10410 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30   + + col0 * col0
10420 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
10430 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 36 30  r0..----..18..60
10440 32 35 0d 0a 36 32 32 34 0d 0a 0d 0a 71 75 65 72  25..6224....quer
10450 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10460 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
10470 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46   - col2 * col0 F
10480 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
10490 2d 2d 2d 0d 0a 2d 37 30 36 0d 0a 2d 37 32 30 37  ---..-706..-7207
104a0 0d 0a 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..62....onlyif m
104b0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
104c0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
104d0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
104e0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
104f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10500 2d 34 30 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  -407..SELECT DIS
10510 54 49 4e 43 54 20 43 41 53 54 28 20 4e 55 4c 4c  TINCT CAST( NULL
10520 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 2d   AS SIGNED ) - -
10530 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
10540 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
10550 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
10560 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
10570 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
10580 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 37 0d  wsort label-407.
10590 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
105a0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
105b0 49 4e 54 45 47 45 52 20 29 20 2d 20 2d 20 63 6f  INTEGER ) - - co
105c0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
105d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
105e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
105f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
10600 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 36 32 20 41  cor0.col1 * 62 A
10610 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
10620 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 33   cor0..----..533
10630 32 0d 0a 35 36 34 32 0d 0a 36 30 31 34 0d 0a 0d  2..5642..6014...
10640 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
10650 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
10660 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
10670 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
10680 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 39  owsort label-409
10690 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
106a0 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 34 36 20  T - col1 + - 46 
106b0 44 49 56 20 2d 20 35 33 20 63 6f 6c 31 20 46 52  DIV - 53 col1 FR
106c0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
106d0 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a  10..-13..-26....
106e0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
106f0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
10700 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
10710 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
10720 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
10730 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
10740 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
10750 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30  rowsort label-40
10760 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
10770 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 34 36  CT - col1 + - 46
10780 20 2f 20 2d 20 35 33 20 63 6f 6c 31 20 46 52 4f   / - 53 col1 FRO
10790 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
107a0 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 73  0..-13..-26....s
107b0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
107c0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
107d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
107e0 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 63  ELECT - CAST ( c
107f0 6f 6c 31 20 41 53 20 52 45 41 4c 20 29 20 2a 20  ol1 AS REAL ) * 
10800 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
10810 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
10820 2d 0d 0a 2d 32 38 39 0d 0a 2d 33 34 38 31 0d 0a  -..-289..-3481..
10830 2d 39 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -961....query I 
10840 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10850 2d 20 2b 20 28 20 2b 20 38 31 20 29 20 2a 20 63  - + ( + 81 ) * c
10860 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 + + col2 AS 
10870 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
10880 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
10890 34 30 0d 0a 2d 36 32 39 32 0d 0a 2d 36 33 36 31  40..-6292..-6361
108a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
108b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
108c0 49 4e 43 54 20 35 30 20 2b 20 2d 20 63 6f 6c 31  INCT 50 + - col1
108d0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
108e0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 31 39  b2..----..-9..19
108f0 0d 0a 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..33....skipif p
10900 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
10910 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
10920 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
10930 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
10940 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10950 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
10960 39 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  94 col1 FROM tab
10970 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
10980 0a 31 35 39 38 0d 0a 32 39 31 34 0d 0a 35 35 34  .1598..2914..554
10990 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
109a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
109b0 54 49 4e 43 54 20 2d 20 37 39 20 41 53 20 63 6f  TINCT - 79 AS co
109c0 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
109d0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
109e0 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-79....query I
109f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10a00 20 2d 20 28 20 28 20 2d 20 63 6f 6c 32 20 29 20   - ( ( - col2 ) 
10a10 29 20 2a 20 39 30 20 46 52 4f 4d 20 74 61 62 32  ) * 90 FROM tab2
10a20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10a30 32 33 34 30 0d 0a 32 34 33 30 0d 0a 33 34 32 30  2340..2430..3420
10a40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10a50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
10a60 36 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  69 AS col1 FROM 
10a70 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
10a80 2d 2d 0d 0a 36 39 0d 0a 36 39 0d 0a 36 39 0d 0a  --..69..69..69..
10a90 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
10aa0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
10ab0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
10ac0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
10ad0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31  rowsort label-41
10ae0 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  7..SELECT ALL - 
10af0 38 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20  8 DIV col1 FROM 
10b00 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
10b10 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
10b20 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
10b30 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
10b40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10b50 62 65 6c 2d 34 31 37 0d 0a 53 45 4c 45 43 54 20  bel-417..SELECT 
10b60 41 4c 4c 20 2d 20 38 20 2f 20 63 6f 6c 31 20 46  ALL - 8 / col1 F
10b70 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
10b80 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
10b90 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
10ba0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
10bb0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
10bc0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
10bd0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
10be0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10bf0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
10c00 31 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 32 20  1 * - col0 col2 
10c10 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
10c20 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31  ----..-1343..-21
10c30 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72  7..-4602....quer
10c40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10c50 45 43 54 20 2b 20 2b 20 36 37 20 41 53 20 63 6f  ECT + + 67 AS co
10c60 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
10c70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 37 0d 0a  cor0..----..67..
10c80 36 37 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20  67..67....query 
10c90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10ca0 54 20 41 4c 4c 20 2d 20 28 20 2d 20 38 36 20 29  T ALL - ( - 86 )
10cb0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
10cc0 0d 0a 38 36 0d 0a 38 36 0d 0a 38 36 0d 0a 0d 0a  ..86..86..86....
10cd0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
10ce0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
10cf0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
10d00 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
10d10 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
10d20 72 74 20 6c 61 62 65 6c 2d 34 32 31 0d 0a 53 45  rt label-421..SE
10d30 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 28  LECT ALL + CAST(
10d40 20 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45   + col1 AS SIGNE
10d50 44 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  D ) * - col2 FRO
10d60 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
10d70 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d  534..-646..-837.
10d80 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
10d90 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
10da0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10db0 74 20 6c 61 62 65 6c 2d 34 32 31 0d 0a 53 45 4c  t label-421..SEL
10dc0 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28  ECT ALL + CAST (
10dd0 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   + col1 AS INTEG
10de0 45 52 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52  ER ) * - col2 FR
10df0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
10e00 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37  1534..-646..-837
10e10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10e20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
10e30 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20  l2 * - col2 + - 
10e40 28 20 63 6f 6c 30 20 29 20 2d 20 28 20 2b 20 28  ( col0 ) - ( + (
10e50 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 29   - cor0.col0 ) )
10e60 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
10e70 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
10e80 0d 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32  ..2916..3249..92
10e90 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  16....onlyif mys
10ea0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
10eb0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
10ec0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
10ed0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
10ee0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
10ef0 32 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  23..SELECT + col
10f00 30 20 2b 20 2d 20 43 41 53 54 28 20 39 20 2b 20  0 + - CAST( 9 + 
10f10 2b 20 63 6f 6c 32 20 2a 20 2b 20 36 37 20 41 53  + col2 * + 67 AS
10f20 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
10f30 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
10f40 2d 0d 0a 2d 31 36 37 33 0d 0a 2d 31 38 31 31 0d  -..-1673..-1811.
10f50 0a 2d 32 34 37 36 0d 0a 0d 0a 73 6b 69 70 69 66  .-2476....skipif
10f60 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
10f70 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
10f80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
10f90 32 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  23..SELECT + col
10fa0 30 20 2b 20 2d 20 43 41 53 54 20 28 20 39 20 2b  0 + - CAST ( 9 +
10fb0 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 36 37 20 41   + col2 * + 67 A
10fc0 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
10fd0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
10fe0 2d 2d 2d 0d 0a 2d 31 36 37 33 0d 0a 2d 31 38 31  ---..-1673..-181
10ff0 31 0d 0a 2d 32 34 37 36 0d 0a 0d 0a 6f 6e 6c 79  1..-2476....only
11000 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
11010 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
11020 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
11030 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11040 74 20 6c 61 62 65 6c 2d 34 32 34 0d 0a 53 45 4c  t label-424..SEL
11050 45 43 54 20 41 4c 4c 20 2b 20 38 39 20 2b 20 63  ECT ALL + 89 + c
11060 6f 6c 31 20 44 49 56 20 2d 20 32 32 20 41 53 20  ol1 DIV - 22 AS 
11070 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
11080 2d 2d 2d 2d 0d 0a 38 38 0d 0a 38 39 0d 0a 38 39  ----..88..89..89
11090 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
110a0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
110b0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
110c0 72 74 20 6c 61 62 65 6c 2d 34 32 34 0d 0a 53 45  rt label-424..SE
110d0 4c 45 43 54 20 41 4c 4c 20 2b 20 38 39 20 2b 20  LECT ALL + 89 + 
110e0 63 6f 6c 31 20 2f 20 2d 20 32 32 20 41 53 20 63  col1 / - 22 AS c
110f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
11100 2d 2d 2d 0d 0a 38 38 0d 0a 38 39 0d 0a 38 39 0d  ---..88..89..89.
11110 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
11120 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
11130 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
11140 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
11150 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
11160 32 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  25..SELECT col0 
11170 44 49 56 20 36 32 20 46 52 4f 4d 20 74 61 62 30  DIV 62 FROM tab0
11180 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11190 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69  0..0..1....skipi
111a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
111b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
111c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
111d0 34 32 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  425..SELECT col0
111e0 20 2f 20 36 32 20 46 52 4f 4d 20 74 61 62 30 20   / 62 FROM tab0 
111f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
11200 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20  ..0..1....query 
11210 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11220 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63  T + - col0 * + c
11230 6f 6c 31 20 2a 20 2b 20 31 31 20 46 52 4f 4d 20  ol1 * + 11 FROM 
11240 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
11250 2d 2d 0d 0a 2d 31 31 34 34 30 0d 0a 2d 37 30 34  --..-11440..-704
11260 30 0d 0a 2d 38 35 38 0d 0a 0d 0a 6f 6e 6c 79 69  0..-858....onlyi
11270 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
11280 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
11290 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
112a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
112b0 20 6c 61 62 65 6c 2d 34 32 37 0d 0a 53 45 4c 45   label-427..SELE
112c0 43 54 20 2b 20 2b 20 63 6f 6c 31 20 44 49 56 20  CT + + col1 DIV 
112d0 28 20 28 20 63 6f 6c 31 20 29 20 2b 20 32 20 29  ( ( col1 ) + 2 )
112e0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
112f0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
11300 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
11310 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
11320 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
11330 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11340 6c 2d 34 32 37 0d 0a 53 45 4c 45 43 54 20 2b 20  l-427..SELECT + 
11350 2b 20 63 6f 6c 31 20 2f 20 28 20 28 20 63 6f 6c  + col1 / ( ( col
11360 31 20 29 20 2b 20 32 20 29 20 41 53 20 63 6f 6c  1 ) + 2 ) AS col
11370 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
11380 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
11390 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
113a0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
113b0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
113c0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
113d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
113e0 6c 2d 34 32 38 0d 0a 53 45 4c 45 43 54 20 63 6f  l-428..SELECT co
113f0 6c 30 20 44 49 56 20 2b 20 74 61 62 31 2e 63 6f  l0 DIV + tab1.co
11400 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
11410 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab1..----..0..0
11420 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
11430 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
11440 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
11450 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 32 38 0d  wsort label-428.
11460 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20 2b  .SELECT col0 / +
11470 20 74 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f   tab1.col2 AS co
11480 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
11490 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71  --..0..0..1....q
114a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
114b0 53 45 4c 45 43 54 20 2d 20 74 61 62 30 2e 63 6f  SELECT - tab0.co
114c0 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  l1 * + col1 AS c
114d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
114e0 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38  ---..-7396..-828
114f0 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 6f 6e 6c 79  1..-9409....only
11500 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
11510 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
11520 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
11530 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11540 74 20 6c 61 62 65 6c 2d 34 33 30 0d 0a 53 45 4c  t label-430..SEL
11550 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d  ECT DISTINCT ( -
11560 20 74 61 62 31 2e 63 6f 6c 31 20 29 20 2b 20 2d   tab1.col1 ) + -
11570 20 74 61 62 31 2e 63 6f 6c 31 20 44 49 56 20 38   tab1.col1 DIV 8
11580 36 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  6 FROM tab1..---
11590 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36  -..-10..-13..-26
115a0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
115b0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
115c0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
115d0 72 74 20 6c 61 62 65 6c 2d 34 33 30 0d 0a 53 45  rt label-430..SE
115e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
115f0 2d 20 74 61 62 31 2e 63 6f 6c 31 20 29 20 2b 20  - tab1.col1 ) + 
11600 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2f 20 38 36  - tab1.col1 / 86
11610 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
11620 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d  ..-10..-13..-26.
11630 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11640 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
11650 31 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  1 * - tab1.col0 
11660 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
11670 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a  1..----..-1040..
11680 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65  -640..-78....que
11690 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
116a0 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  LECT + col0 * - 
116b0 39 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  98 AS col0 FROM 
116c0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 35  tab0..----..-235
116d0 32 0d 0a 2d 33 34 33 30 0d 0a 2d 38 37 32 32 0d  2..-3430..-8722.
116e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
116f0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
11700 31 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 31 33 20  1 * + col1 - 13 
11710 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
11720 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 38 33 0d 0a 38  0..----..7383..8
11730 32 36 38 0d 0a 39 33 39 36 0d 0a 0d 0a 71 75 65  268..9396....que
11740 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11750 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20  LECT - - col1 + 
11760 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 36 35  - cor0.col2 * 65
11770 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
11780 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
11790 0d 0a 2d 31 36 33 31 0d 0a 2d 31 37 32 34 0d 0a  ..-1631..-1724..
117a0 2d 32 34 35 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  -2453....skipif 
117b0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
117c0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
117d0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
117e0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
117f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11800 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
11810 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  CT - + col0 * + 
11820 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32 20 46  cor0.col0 col2 F
11830 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
11840 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d  ..----..-4096..-
11850 36 34 30 30 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72  6400..-9....quer
11860 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11870 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  ECT col0 * col2 
11880 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
11890 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d   cor0..----..36.
118a0 0a 37 33 38 30 0d 0a 38 32 35 0d 0a 0d 0a 71 75  .7380..825....qu
118b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
118c0 45 4c 45 43 54 20 2d 20 2d 20 28 20 2b 20 63 6f  ELECT - - ( + co
118d0 6c 32 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  l2 ) * col0 FROM
118e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
118f0 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a  ---..189..2028..
11900 33 30 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3002....onlyif m
11910 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
11920 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
11930 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
11940 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
11950 62 65 6c 2d 34 33 38 0d 0a 53 45 4c 45 43 54 20  bel-438..SELECT 
11960 44 49 53 54 49 4e 43 54 20 28 20 63 6f 6c 30 20  DISTINCT ( col0 
11970 29 20 44 49 56 20 2d 20 43 41 53 54 28 20 2d 20  ) DIV - CAST( - 
11980 31 33 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47  13 + col2 AS SIG
11990 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52  NED ) AS col0 FR
119a0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
119b0 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69  --..-1..0....ski
119c0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
119d0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
119e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
119f0 6c 2d 34 33 38 0d 0a 53 45 4c 45 43 54 20 44 49  l-438..SELECT DI
11a00 53 54 49 4e 43 54 20 28 20 63 6f 6c 30 20 29 20  STINCT ( col0 ) 
11a10 2f 20 2d 20 43 41 53 54 20 28 20 2d 20 31 33 20  / - CAST ( - 13 
11a20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45  + col2 AS INTEGE
11a30 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  R ) AS col0 FROM
11a40 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
11a50 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ..-1..0....skipi
11a60 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
11a70 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
11a80 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
11a90 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
11aa0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
11ab0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 38  ort..SELECT - 38
11ac0 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 63   * - cor0.col2 c
11ad0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
11ae0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32   cor0..----..102
11af0 36 0d 0a 31 34 34 34 0d 0a 39 38 38 0d 0a 0d 0a  6..1444..988....
11b00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11b10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
11b20 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63   - col1 + cor0.c
11b30 6f 6c 31 20 2a 20 37 33 20 2a 20 36 37 20 46 52  ol1 * 73 * 67 FR
11b40 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
11b50 2d 2d 0d 0a 31 35 31 35 39 30 0d 0a 32 38 38 35  --..151590..2885
11b60 31 30 0d 0a 38 33 31 33 30 0d 0a 0d 0a 73 6b 69  10..83130....ski
11b70 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
11b80 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
11b90 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
11ba0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
11bb0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
11bc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
11bd0 4c 20 2b 20 36 30 20 2a 20 2d 20 63 6f 72 31 2e  L + 60 * - cor1.
11be0 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
11bf0 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
11c00 30 2c 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  0, tab0, tab1 AS
11c10 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20   cor1..----..81 
11c20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
11c30 6f 20 34 36 65 65 37 33 63 31 63 36 63 61 38 37  o 46ee73c1c6ca87
11c40 36 32 62 36 61 32 36 36 39 66 34 34 30 36 38 39  62b6a2669f440689
11c50 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  00....skipif pos
11c60 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
11c70 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
11c80 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
11c90 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
11ca0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11cb0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 36 31 20  SELECT ALL + 61 
11cc0 2a 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  * - col1 * - col
11cd0 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0 col0 FROM tab1
11ce0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 30   cor0..----..390
11cf0 34 30 0d 0a 34 37 35 38 0d 0a 36 33 34 34 30 0d  40..4758..63440.
11d00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11d10 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
11d20 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  NCT + cor0.col1 
11d30 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
11d40 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
11d50 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31  ---..110..132..1
11d60 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
11d70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
11d80 2b 20 35 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 51 AS col2 FRO
11d90 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
11da0 2d 2d 2d 2d 0d 0a 35 31 0d 0a 35 31 0d 0a 35 31  ----..51..51..51
11db0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
11dc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
11dd0 2b 20 38 36 20 2b 20 63 6f 6c 32 20 41 53 20 63  + 86 + col2 AS c
11de0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
11df0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
11e00 0d 0a 31 36 38 0d 0a 38 37 0d 0a 0d 0a 73 6b 69  ..168..87....ski
11e10 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
11e20 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
11e30 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
11e40 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
11e50 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
11e60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
11e70 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32  b1.col1 * - col2
11e80 20 2a 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f   * col1 col0 FRO
11e90 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
11ea0 36 32 32 34 0d 0a 2d 33 36 35 30 34 0d 0a 2d 35  6224..-36504..-5
11eb0 37 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  700....onlyif my
11ec0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
11ed0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
11ee0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
11ef0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
11f00 65 6c 2d 34 34 37 0d 0a 53 45 4c 45 43 54 20 63  el-447..SELECT c
11f10 6f 6c 31 20 44 49 56 20 2d 20 74 61 62 32 2e 63  ol1 DIV - tab2.c
11f20 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
11f30 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d   tab2..----..-4.
11f40 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
11f50 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
11f60 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
11f70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34  rowsort label-44
11f80 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f  7..SELECT col1 /
11f90 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20   - tab2.col0 AS 
11fa0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
11fb0 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 30 0d 0a 30 0d 0a  ----..-4..0..0..
11fc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11fd0 74 0d 0a 53 45 4c 45 43 54 20 32 33 20 2b 20 2b  t..SELECT 23 + +
11fe0 20 63 6f 6c 30 20 2a 20 2b 20 28 20 2b 20 63 6f   col0 * + ( + co
11ff0 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  l2 ) FROM tab1..
12000 2d 2d 2d 2d 0d 0a 31 38 35 0d 0a 33 36 37 31 0d  ----..185..3671.
12010 0a 37 37 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .7703....query I
12020 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12030 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62 32   DISTINCT + tab2
12040 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30 20 2a  .col0 - - col0 *
12050 20 32 34 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   24 FROM tab2..-
12060 2d 2d 2d 0d 0a 31 37 35 0d 0a 31 39 35 30 0d 0a  ---..175..1950..
12070 31 39 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1975....query I 
12080 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12090 44 49 53 54 49 4e 43 54 20 2b 20 34 32 20 2d 20  DISTINCT + 42 - 
120a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
120b0 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 31 31 0d 0a 32  ----..-17..11..2
120c0 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
120d0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
120e0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
120f0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
12100 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12110 2d 34 35 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -451..SELECT col
12120 32 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  2 + col2 DIV - c
12130 6f 6c 31 20 2d 20 33 33 20 2a 20 2d 20 63 6f 6c  ol1 - 33 * - col
12140 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
12150 2d 0d 0a 31 31 35 36 0d 0a 33 30 31 39 0d 0a 38  -..1156..3019..8
12160 32 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  25....skipif mys
12170 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
12180 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
12190 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35 31 0d 0a  sort label-451..
121a0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f  SELECT col2 + co
121b0 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 2d 20 33 33  l2 / - col1 - 33
121c0 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
121d0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 36 0d  ab0..----..1156.
121e0 0a 33 30 31 39 0d 0a 38 32 35 0d 0a 0d 0a 71 75  .3019..825....qu
121f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12200 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
12210 32 20 2b 20 32 39 20 46 52 4f 4d 20 74 61 62 30  2 + 29 FROM tab0
12220 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12230 31 31 31 0d 0a 33 30 0d 0a 36 32 0d 0a 0d 0a 73  111..30..62....s
12240 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
12250 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
12260 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
12270 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
12280 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
12290 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
122a0 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  - col0 + - col1 
122b0 2a 20 2d 20 37 37 20 2b 20 2d 20 63 6f 6c 32 20  * - 77 + - col2 
122c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
122d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
122e0 39 32 0d 0a 32 33 35 33 0d 0a 34 34 33 39 0d 0a  92..2353..4439..
122f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12300 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
12310 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 37 33  CT + col2 * - 73
12320 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   - - col2 FROM t
12330 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
12340 2d 0d 0a 2d 32 33 37 36 0d 0a 2d 35 39 30 34 0d  -..-2376..-5904.
12350 0a 2d 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-72....query I 
12360 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12370 44 49 53 54 49 4e 43 54 20 37 30 20 41 53 20 63  DISTINCT 70 AS c
12380 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
12390 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab1 AS cor0, tab
123a0 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
123b0 0a 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .70....skipif po
123c0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
123d0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
123e0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
123f0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
12400 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
12410 0a 53 45 4c 45 43 54 20 2b 20 37 30 20 2b 20 2d  .SELECT + 70 + -
12420 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20   col2 col0 FROM 
12430 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  tab1..----..-26.
12440 0a 31 33 0d 0a 31 36 0d 0a 0d 0a 71 75 65 72 79  .13..16....query
12450 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12460 43 54 20 41 4c 4c 20 33 37 20 2a 20 63 6f 6c 30  CT ALL 37 * col0
12470 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
12480 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 35 39 0d 0a 32  b2..----..259..2
12490 38 38 36 0d 0a 32 39 32 33 0d 0a 0d 0a 71 75 65  886..2923....que
124a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
124b0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
124c0 2a 20 31 36 20 46 52 4f 4d 20 74 61 62 31 20 41  * 16 FROM tab1 A
124d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
124e0 35 33 36 0d 0a 2d 38 36 34 0d 0a 2d 39 31 32 0d  536..-864..-912.
124f0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
12500 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
12510 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
12520 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
12530 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
12540 35 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  59..SELECT ALL c
12550 6f 6c 30 20 44 49 56 20 35 20 63 6f 6c 31 20 46  ol0 DIV 5 col1 F
12560 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
12570 30 0d 0a 31 32 0d 0a 31 36 0d 0a 0d 0a 73 6b 69  0..12..16....ski
12580 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
12590 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
125a0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
125b0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
125c0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
125d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
125e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
125f0 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35 39 0d 0a  sort label-459..
12600 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
12610 2f 20 35 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  / 5 col1 FROM ta
12620 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 32 0d  b1..----..0..12.
12630 0a 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .16....onlyif my
12640 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
12650 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
12660 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
12670 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
12680 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
12690 34 36 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  460..SELECT ALL 
126a0 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
126b0 53 49 47 4e 45 44 20 29 20 2a 20 36 31 20 2b 20  SIGNED ) * 61 + 
126c0 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  - col2 FROM tab2
126d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
126e0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
126f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
12700 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
12710 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
12720 72 74 20 6c 61 62 65 6c 2d 34 36 30 0d 0a 53 45  rt label-460..SE
12730 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20  LECT ALL - CAST 
12740 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
12750 52 20 29 20 2a 20 36 31 20 2b 20 2d 20 63 6f 6c  R ) * 61 + - col
12760 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
12770 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
12780 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
12790 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
127a0 53 45 4c 45 43 54 20 32 34 20 2a 20 2d 20 63 6f  SELECT 24 * - co
127b0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
127c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
127d0 2d 2d 0d 0a 2d 31 39 36 38 0d 0a 2d 32 34 0d 0a  --..-1968..-24..
127e0 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -792....query I 
127f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12800 41 4c 4c 20 2b 20 34 31 20 2a 20 2b 20 63 6f 6c  ALL + 41 * + col
12810 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  2 + - cor0.col1 
12820 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
12830 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 37 0d 0a 31  0..----..1007..1
12840 30 37 36 0d 0a 31 35 34 31 0d 0a 0d 0a 71 75 65  076..1541....que
12850 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12860 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
12870 2a 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  * + col1 * col0 
12880 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
12890 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
128a0 0a 2d 32 32 38 33 31 0d 0a 2d 32 37 31 35 31 38  .-22831..-271518
128b0 0d 0a 2d 36 37 32 37 0d 0a 0d 0a 71 75 65 72 79  ..-6727....query
128c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
128d0 43 54 20 2b 20 63 6f 6c 31 20 2b 20 32 30 20 2a  CT + col1 + 20 *
128e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
128f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
12900 35 39 37 0d 0a 31 36 31 39 0d 0a 31 37 31 0d 0a  597..1619..171..
12910 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
12920 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
12930 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
12940 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
12950 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36  rowsort label-46
12960 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  5..SELECT ALL + 
12970 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20  + col2 DIV col0 
12980 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
12990 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
129a0 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .0..0..1....skip
129b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
129c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
129d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
129e0 2d 34 36 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -465..SELECT ALL
129f0 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 30   + + col2 / col0
12a00 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
12a10 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
12a20 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65  ..0..0..1....que
12a30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12a40 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20  LECT ALL col1 + 
12a50 63 6f 6c 32 20 2a 20 74 61 62 32 2e 63 6f 6c 32  col2 * tab2.col2
12a60 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
12a70 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36 31 0d 0a  b2..----..1461..
12a80 37 33 35 0d 0a 37 36 30 0d 0a 0d 0a 71 75 65 72  735..760....quer
12a90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12aa0 45 43 54 20 63 6f 6c 30 20 2a 20 32 39 20 2b 20  ECT col0 * 29 + 
12ab0 2d 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20 63  - tab1.col0 AS c
12ac0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
12ad0 2d 2d 2d 0d 0a 31 37 39 32 0d 0a 32 32 34 30 0d  ---..1792..2240.
12ae0 0a 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .84....query I r
12af0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
12b00 49 53 54 49 4e 43 54 20 2b 20 39 36 20 2a 20 2b  ISTINCT + 96 * +
12b10 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 31 33 20   cor0.col0 * 13 
12b20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
12b30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
12b40 37 33 36 0d 0a 39 37 33 34 34 0d 0a 39 38 35 39  736..97344..9859
12b50 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
12b60 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
12b70 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
12b80 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
12b90 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
12ba0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12bb0 45 4c 45 43 54 20 34 34 20 2a 20 63 6f 72 30 2e  ELECT 44 * cor0.
12bc0 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
12bd0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
12be0 33 30 38 0d 0a 33 34 33 32 0d 0a 33 34 37 36 0d  308..3432..3476.
12bf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12c00 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 33  rt..SELECT + ( 3
12c10 38 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  8 ) FROM tab0 AS
12c20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 0d   cor0..----..38.
12c30 0a 33 38 0d 0a 33 38 0d 0a 0d 0a 6f 6e 6c 79 69  .38..38....onlyi
12c40 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
12c50 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
12c60 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
12c70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12c80 20 6c 61 62 65 6c 2d 34 37 31 0d 0a 53 45 4c 45   label-471..SELE
12c90 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 28 20 63  CT ALL + CAST( c
12ca0 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol1 AS SIGNED ) 
12cb0 44 49 56 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  DIV col0 + - col
12cc0 31 20 2a 20 28 20 2d 20 63 6f 6c 31 20 29 20 41  1 * ( - col1 ) A
12cd0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
12ce0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12cf0 37 33 39 39 0d 0a 38 32 38 32 0d 0a 39 34 31 31  7399..8282..9411
12d00 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
12d10 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
12d20 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
12d30 72 74 20 6c 61 62 65 6c 2d 34 37 31 0d 0a 53 45  rt label-471..SE
12d40 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20  LECT ALL + CAST 
12d50 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  ( col1 AS INTEGE
12d60 52 20 29 20 2f 20 63 6f 6c 30 20 2b 20 2d 20 63  R ) / col0 + - c
12d70 6f 6c 31 20 2a 20 28 20 2d 20 63 6f 6c 31 20 29  ol1 * ( - col1 )
12d80 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
12d90 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
12da0 0d 0a 37 33 39 39 0d 0a 38 32 38 32 0d 0a 39 34  ..7399..8282..94
12db0 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  11....query I ro
12dc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
12dd0 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20  - cor0.col1 + ( 
12de0 2b 20 63 6f 6c 30 20 29 20 2b 20 2b 20 31 36 20  + col0 ) + + 16 
12df0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12e00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 37 30 0d  0..----..-7..70.
12e10 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .83....query I r
12e20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
12e30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30   + col0 * - cor0
12e40 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20  .col0 FROM tab2 
12e50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
12e60 34 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32 34 31  49..-6084..-6241
12e70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12e80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
12e90 38 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f  8 ) + + col1 FRO
12ea0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
12eb0 2d 2d 2d 2d 0d 0a 32 33 0d 0a 35 31 0d 0a 39 0d  ----..23..51..9.
12ec0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
12ed0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
12ee0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
12ef0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
12f00 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
12f10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12f20 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
12f30 6f 6c 31 20 2b 20 35 30 20 63 6f 6c 32 20 46 52  ol1 + 50 col2 FR
12f40 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
12f50 33 36 0d 0a 2d 34 31 0d 0a 2d 34 37 0d 0a 0d 0a  36..-41..-47....
12f60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
12f70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
12f80 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2d 20 28   tab0.col1 + - (
12f90 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 41   col1 ) * col2 A
12fa0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
12fb0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 35 32 0d 0a 2d  ..----..-2752..-
12fc0 37 33 37 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  7371..0....skipi
12fd0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
12fe0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
12ff0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
13000 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
13010 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
13020 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
13030 49 4e 43 54 20 2d 20 34 30 20 63 6f 6c 31 20 46  INCT - 40 col1 F
13040 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
13050 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
13060 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
13070 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
13080 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
13090 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
130a0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
130b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37  rowsort label-47
130c0 38 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20  8..SELECT CAST( 
130d0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
130e0 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   - + col2 * - co
130f0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
13100 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
13110 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
13120 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
13130 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
13140 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 38  owsort label-478
13150 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20  ..SELECT CAST ( 
13160 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
13170 29 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  ) - + col2 * - c
13180 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
13190 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
131a0 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .NULL....onlyif 
131b0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
131c0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
131d0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
131e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
131f0 61 62 65 6c 2d 34 37 39 0d 0a 53 45 4c 45 43 54  abel-479..SELECT
13200 20 34 35 20 44 49 56 20 2d 20 39 20 2b 20 2b 20   45 DIV - 9 + + 
13210 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
13220 2d 2d 2d 2d 0d 0a 32 31 0d 0a 35 0d 0a 38 0d 0a  ----..21..5..8..
13230 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
13240 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
13250 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13260 20 6c 61 62 65 6c 2d 34 37 39 0d 0a 53 45 4c 45   label-479..SELE
13270 43 54 20 34 35 20 2f 20 2d 20 39 20 2b 20 2b 20  CT 45 / - 9 + + 
13280 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
13290 2d 2d 2d 2d 0d 0a 32 31 0d 0a 35 0d 0a 38 0d 0a  ----..21..5..8..
132a0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
132b0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
132c0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
132d0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
132e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 38  rowsort label-48
132f0 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41  0..SELECT ALL CA
13300 53 54 28 20 2d 20 63 6f 6c 31 20 41 53 20 53 49  ST( - col1 AS SI
13310 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 44 49  GNED ) + col0 DI
13320 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  V col0 AS col0 F
13330 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
13340 2d 31 36 0d 0a 2d 33 30 0d 0a 2d 35 38 0d 0a 0d  -16..-30..-58...
13350 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
13360 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
13370 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
13380 6c 61 62 65 6c 2d 34 38 30 0d 0a 53 45 4c 45 43  label-480..SELEC
13390 54 20 41 4c 4c 20 43 41 53 54 20 28 20 2d 20 63  T ALL CAST ( - c
133a0 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
133b0 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 41   + col0 / col0 A
133c0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
133d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 33 30  ..----..-16..-30
133e0 0d 0a 2d 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-58....query I
133f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13400 20 38 38 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20   88 + col1 FROM 
13410 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 0d  tab1..----..101.
13420 0a 31 31 34 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72  .114..98....quer
13430 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13440 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
13450 6f 6c 30 20 2a 20 2d 20 39 37 20 2d 20 63 6f 6c  ol0 * - 97 - col
13460 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  2 * + cor0.col2 
13470 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
13480 2d 2d 2d 2d 0d 0a 31 32 33 39 0d 0a 31 39 30 39  ----..1239..1909
13490 0d 0a 33 33 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..3394....onlyif
134a0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
134b0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
134c0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
134d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
134e0 6c 61 62 65 6c 2d 34 38 33 0d 0a 53 45 4c 45 43  label-483..SELEC
134f0 54 20 41 4c 4c 20 31 35 20 2a 20 63 6f 72 30 2e  T ALL 15 * cor0.
13500 63 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f  col2 DIV cor0.co
13510 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
13520 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
13530 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
13540 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 31  es hashing to d1
13550 64 32 38 30 64 33 38 62 66 39 63 32 64 35 64 35  d280d38bf9c2d5d5
13560 65 63 39 30 64 64 34 33 61 65 61 66 66 64 0d 0a  ec90dd43aeaffd..
13570 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
13580 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
13590 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
135a0 20 6c 61 62 65 6c 2d 34 38 33 0d 0a 53 45 4c 45   label-483..SELE
135b0 43 54 20 41 4c 4c 20 31 35 20 2a 20 63 6f 72 30  CT ALL 15 * cor0
135c0 2e 63 6f 6c 32 20 2f 20 63 6f 72 30 2e 63 6f 6c  .col2 / cor0.col
135d0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
135e0 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
135f0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
13600 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 31 64  s hashing to d1d
13610 32 38 30 64 33 38 62 66 39 63 32 64 35 64 35 65  280d38bf9c2d5d5e
13620 63 39 30 64 64 34 33 61 65 61 66 66 64 0d 0a 0d  c90dd43aeaffd...
13630 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13640 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
13650 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 + + cor0.col
13660 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
13670 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
13680 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a  -..-33..-4..21..
13690 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
136a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
136b0 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  CT + - cor0.col2
136c0 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30   + - col2 * col0
136d0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
136e0 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 34 0d 0a 2d 32  .----..-2054..-2
136f0 31 36 0d 0a 2d 33 30 34 30 0d 0a 0d 0a 71 75 65  16..-3040....que
13700 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13710 4c 45 43 54 20 41 4c 4c 20 2b 20 35 31 20 2b 20  LECT ALL + 51 + 
13720 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col1 * + cor0.co
13730 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
13740 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 39 34  cor0..----..1394
13750 0d 0a 32 36 38 0d 0a 34 36 35 33 0d 0a 0d 0a 71  ..268..4653....q
13760 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13770 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 37 20  SELECT ALL - 87 
13780 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20  * cor0.col2 + - 
13790 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53  col2 * + col1 AS
137a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
137b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
137c0 35 35 32 39 0d 0a 2d 36 31 30 32 0d 0a 2d 39 36  5529..-6102..-96
137d0 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
137e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
137f0 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f  STINCT - cor0.co
13800 6c 32 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l2 - col0 FROM t
13810 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
13820 2d 31 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d  -121..-176..-57.
13830 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13840 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
13850 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53  + col0 * col1 AS
13860 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
13870 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
13880 34 32 32 0d 0a 32 32 34 0d 0a 34 36 38 30 0d 0a  422..224..4680..
13890 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
138a0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 32 20  t..SELECT + - 2 
138b0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
138c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
138d0 31 31 0d 0a 32 34 0d 0a 38 0d 0a 0d 0a 71 75 65  11..24..8....que
138e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
138f0 4c 45 43 54 20 2d 20 37 32 20 2b 20 2d 20 63 6f  LECT - 72 + - co
13900 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
13910 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30  cor0..----..-110
13920 0d 0a 2d 39 38 0d 0a 2d 39 39 0d 0a 0d 0a 71 75  ..-98..-99....qu
13930 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13940 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
13950 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   * - col2 + col2
13960 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
13970 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
13980 0d 0a 32 39 37 30 0d 0a 33 33 30 36 0d 0a 39 33  ..2970..3306..93
13990 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  12....query I ro
139a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
139b0 53 54 49 4e 43 54 20 35 37 20 2a 20 2b 20 63 6f  STINCT 57 * + co
139c0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
139d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 37  cor0..----..1767
139e0 0d 0a 33 33 36 33 0d 0a 39 36 39 0d 0a 0d 0a 71  ..3363..969....q
139f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13a00 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 31  SELECT ALL - + 1
13a10 33 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  3 + col0 + col1 
13a20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
13a30 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
13a40 0a 31 32 34 0d 0a 32 35 0d 0a 38 33 0d 0a 0d 0a  .124..25..83....
13a50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13a60 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c  .SELECT tab1.col
13a70 30 20 2a 20 32 20 2b 20 2d 20 34 31 20 46 52 4f  0 * 2 + - 41 FRO
13a80 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab1..----..-3
13a90 35 0d 0a 31 31 39 0d 0a 38 37 0d 0a 0d 0a 71 75  5..119..87....qu
13aa0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13ab0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30  ELECT ALL - cor0
13ac0 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2d 20 63  .col0 + col2 - c
13ad0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
13ae0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
13af0 0d 0a 2d 36 34 0d 0a 2d 37 31 0d 0a 34 38 0d 0a  ..-64..-71..48..
13b00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13b10 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
13b20 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32   + col0 * + col2
13b30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
13b40 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
13b50 0d 0a 33 34 0d 0a 37 32 31 36 0d 0a 37 35 39 0d  ..34..7216..759.
13b60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13b70 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
13b80 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 35 35 20  NCT col1 + - 55 
13b90 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
13ba0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a 33 36 0d  0..----..31..36.
13bb0 0a 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .42....query I r
13bc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
13bd0 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 35 33 20 41  LL + col0 * 53 A
13be0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
13bf0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13c00 31 32 37 32 0d 0a 31 38 35 35 0d 0a 34 37 31 37  1272..1855..4717
13c10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13c20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
13c30 6c 30 20 2a 20 38 34 20 2b 20 38 20 2d 20 63 6f  l0 * 84 + 8 - co
13c40 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l0 * - cor0.col0
13c50 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
13c60 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
13c70 0d 0a 31 35 34 30 35 0d 0a 32 36 30 30 0d 0a 34  ..15405..2600..4
13c80 31 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  173....query I r
13c90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
13ca0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
13cb0 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 46 52   + ( + col2 ) FR
13cc0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
13cd0 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36  .----..-162..-36
13ce0 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65  48..-7680....que
13cf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13d00 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
13d10 6c 31 20 2a 20 2b 20 28 20 63 6f 72 30 2e 63 6f  l1 * + ( cor0.co
13d20 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l1 * col1 + + co
13d30 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l0 ) FROM tab0 A
13d40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33  S cor0..----..63
13d50 38 31 32 30 0d 0a 37 36 31 36 37 30 0d 0a 39 31  8120..761670..91
13d60 36 30 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6068....query I 
13d70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13d80 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  + - col1 + - col
13d90 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  0 + col0 AS col2
13da0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
13db0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d  r0..----..-86..-
13dc0 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79  91..-97....query
13dd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13de0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
13df0 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a  r0.col0 * col0 *
13e00 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
13e10 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
13e20 0a 2d 32 36 32 31 34 34 0d 0a 2d 32 37 0d 0a 2d  .-262144..-27..-
13e30 35 31 32 30 30 30 0d 0a 0d 0a 73 6b 69 70 69 66  512000....skipif
13e40 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
13e50 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
13e60 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
13e70 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
13e80 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
13e90 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
13ea0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 39 31  + cor0.col0 + 91
13eb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
13ec0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
13ed0 32 39 0d 0a 31 38 37 0d 0a 32 32 38 0d 0a 0d 0a  29..187..228....
13ee0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13ef0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32  .SELECT + + col2
13f00 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 63 6f   + ( col0 ) * co
13f10 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
13f20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d  cor0..----..216.
13f30 0a 33 37 30 35 0d 0a 37 37 37 36 0d 0a 0d 0a 71  .3705..7776....q
13f40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13f50 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
13f60 6f 6c 32 20 2a 20 37 31 20 41 53 20 63 6f 6c 31  ol2 * 71 AS col1
13f70 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
13f80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34 33 0d  r0..----..-2343.
13f90 0a 2d 35 38 32 32 0d 0a 2d 37 31 0d 0a 0d 0a 71  .-5822..-71....q
13fa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13fb0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 38 37  SELECT col2 * 87
13fc0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
13fd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 36 39 38 0d 0a  r0..----..4698..
13fe0 34 39 35 39 0d 0a 38 33 35 32 0d 0a 0d 0a 71 75  4959..8352....qu
13ff0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14000 45 4c 45 43 54 20 2d 20 28 20 2b 20 28 20 63 6f  ELECT - ( + ( co
14010 6c 30 20 29 20 29 20 46 52 4f 4d 20 74 61 62 31  l0 ) ) FROM tab1
14020 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
14030 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a  -3..-64..-80....
14040 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14050 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
14060 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30  ( col0 ) AS col0
14070 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
14080 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a  .----..-3..-64..
14090 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -80....query I r
140a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
140b0 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46  LL - cor0.col0 F
140c0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
140d0 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  S cor0, tab1 AS 
140e0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
140f0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
14100 20 37 32 39 63 31 65 64 64 61 39 33 33 32 33 39   729c1edda933239
14110 38 32 39 39 66 33 39 63 64 31 37 34 65 64 38 34  8299f39cd174ed84
14120 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
14130 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 34 20  sort..SELECT 94 
14140 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
14150 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
14160 0d 0a 2d 33 31 30 32 0d 0a 2d 37 37 30 38 0d 0a  ..-3102..-7708..
14170 2d 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -94....query I r
14180 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
14190 4c 4c 20 37 34 20 2a 20 63 6f 6c 30 20 2a 20 63  LL 74 * col0 * c
141a0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
141b0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
141c0 2d 2d 2d 0d 0a 33 30 33 31 30 34 0d 0a 34 37 33  ---..303104..473
141d0 36 30 30 0d 0a 36 36 36 0d 0a 0d 0a 71 75 65 72  600..666....quer
141e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
141f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
14200 6f 6c 32 20 2b 20 36 30 20 2a 20 2d 20 63 6f 6c  ol2 + 60 * - col
14210 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
14220 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 39 34  or0..----..-3294
14230 0d 0a 2d 33 34 37 37 0d 0a 2d 35 38 35 36 0d 0a  ..-3477..-5856..
14240 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
14250 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
14260 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
14270 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
14280 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
14290 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 35 0d 0a  sort label-515..
142a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
142b0 2d 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 4e  - col1 + CAST( N
142c0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
142d0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
142e0 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  2..----..NULL...
142f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
14300 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
14310 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
14320 6c 61 62 65 6c 2d 35 31 35 0d 0a 53 45 4c 45 43  label-515..SELEC
14330 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
14340 31 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  1 + CAST ( NULL 
14350 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
14360 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
14370 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
14380 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14390 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d  ELECT + col0 + -
143a0 20 28 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 29   ( col1 + col0 )
143b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
143c0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d  b0..----..-86..-
143d0 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 6f 6e 6c 79 69  91..-97....onlyi
143e0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
143f0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
14400 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
14410 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14420 20 6c 61 62 65 6c 2d 35 31 37 0d 0a 53 45 4c 45   label-517..SELE
14430 43 54 20 44 49 53 54 49 4e 43 54 20 37 35 20 2b  CT DISTINCT 75 +
14440 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 72 30   ( col2 ) * cor0
14450 2e 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 30  .col0 DIV - col0
14460 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
14470 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 31  r0..----..-21..1
14480 38 0d 0a 32 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  8..21....skipif 
14490 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
144a0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
144b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31  rowsort label-51
144c0 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
144d0 43 54 20 37 35 20 2b 20 28 20 63 6f 6c 32 20 29  CT 75 + ( col2 )
144e0 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 2d   * cor0.col0 / -
144f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
14500 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
14510 32 31 0d 0a 31 38 0d 0a 32 31 0d 0a 0d 0a 71 75  21..18..21....qu
14520 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14530 45 4c 45 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c  ELECT + tab1.col
14540 32 20 2d 20 2b 20 36 33 20 2a 20 28 20 63 6f 6c  2 - + 63 * ( col
14550 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
14560 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   tab1..----..-15
14570 38 34 0d 0a 2d 35 37 33 0d 0a 2d 37 32 33 0d 0a  84..-573..-723..
14580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14590 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
145a0 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
145b0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a  ab1..----..162..
145c0 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75  3648..7680....qu
145d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
145e0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63  ELECT + col2 + c
145f0 6f 6c 32 20 2a 20 2b 20 31 30 20 2a 20 2b 20 63  ol2 * + 10 * + c
14600 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20  ol1 + + col1 AS 
14610 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
14620 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
14630 35 38 39 0d 0a 31 34 31 32 30 0d 0a 35 37 36 37  589..14120..5767
14640 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
14650 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
14660 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
14670 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
14680 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
14690 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
146a0 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  LECT - cor0.col0
146b0 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63   * col2 + cor0.c
146c0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d  ol0 + + col2 * -
146d0 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 63   ( cor0.col1 ) c
146e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
146f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
14700 31 39 0d 0a 2d 33 34 38 34 0d 0a 2d 33 35 36 39  19..-3484..-3569
14710 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
14720 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
14730 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
14740 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
14750 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
14760 35 32 32 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  522..SELECT + + 
14770 63 6f 6c 32 20 2a 20 2b 20 33 31 20 2b 20 63 6f  col2 * + 31 + co
14780 6c 31 20 44 49 56 20 2d 20 63 6f 6c 32 20 46 52  l1 DIV - col2 FR
14790 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
147a0 0a 2d 2d 2d 2d 0d 0a 2d 36 36 0d 0a 31 30 32 31  .----..-66..1021
147b0 0d 0a 32 35 34 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..2541....skipif
147c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
147d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
147e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
147f0 32 32 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  22..SELECT + + c
14800 6f 6c 32 20 2a 20 2b 20 33 31 20 2b 20 63 6f 6c  ol2 * + 31 + col
14810 31 20 2f 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  1 / - col2 FROM 
14820 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
14830 2d 2d 0d 0a 2d 36 36 0d 0a 31 30 32 31 0d 0a 32  --..-66..1021..2
14840 35 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  541....skipif po
14850 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
14860 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
14870 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
14880 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
14890 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
148a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 36 20 63  .SELECT ALL 26 c
148b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
148c0 2d 2d 2d 0d 0a 32 36 0d 0a 32 36 0d 0a 32 36 0d  ---..26..26..26.
148d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
148e0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 34 20  rt..SELECT + 64 
148f0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
14900 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 39 30 0d  ..----..102..90.
14910 0a 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .91....query I r
14920 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
14930 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b  ol2 * + col2 * +
14940 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
14950 0a 2d 2d 2d 2d 0d 0a 36 31 31 38 38 34 0d 0a 39  .----..611884..9
14960 33 36 35 34 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  3654..97....quer
14970 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14980 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 36 39 20  ECT col0 * - 69 
14990 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  + + col1 AS col0
149a0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
149b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 37 30 0d  r0..----..-1570.
149c0 0a 2d 32 33 31 38 0d 0a 2d 36 30 35 30 0d 0a 0d  .-2318..-6050...
149d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
149e0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
149f0 63 6f 6c 32 20 2a 20 2b 20 28 20 2d 20 37 36 20  col2 * + ( - 76 
14a00 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
14a10 2d 0d 0a 2d 32 34 32 32 0d 0a 2d 36 31 34 31 0d  -..-2422..-6141.
14a20 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .21....query I r
14a30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
14a40 20 31 37 20 2a 20 37 31 20 46 52 4f 4d 20 74 61   17 * 71 FROM ta
14a50 62 31 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  b1, tab1 cor0..-
14a60 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
14a70 73 68 69 6e 67 20 74 6f 20 64 61 33 34 61 64 65  shing to da34ade
14a80 65 39 31 63 66 30 37 65 36 32 62 31 63 34 62 33  e91cf07e62b1c4b3
14a90 63 33 37 34 33 66 61 64 37 0d 0a 0d 0a 71 75 65  c3743fad7....que
14aa0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14ab0 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 28 20  LECT - col1 * ( 
14ac0 28 20 63 6f 6c 30 20 29 20 29 20 46 52 4f 4d 20  ( col0 ) ) FROM 
14ad0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
14ae0 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d  --..-1343..-217.
14af0 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20  .-4602....query 
14b00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14b10 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
14b20 2b 20 2d 20 63 6f 6c 30 20 2a 20 28 20 2b 20 63  + - col0 * ( + c
14b30 6f 6c 32 20 29 20 2a 20 63 6f 6c 30 20 2b 20 63  ol2 ) * col0 + c
14b40 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
14b50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
14b60 36 39 0d 0a 2d 31 35 38 31 33 32 0d 0a 2d 32 33  69..-158132..-23
14b70 37 30 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7082....onlyif m
14b80 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
14b90 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
14ba0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
14bb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
14bc0 62 65 6c 2d 35 33 31 0d 0a 53 45 4c 45 43 54 20  bel-531..SELECT 
14bd0 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
14be0 28 20 2d 20 34 32 20 29 20 44 49 56 20 2d 20 63  ( - 42 ) DIV - c
14bf0 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
14c00 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 35 0d  b1..----..2..35.
14c10 0a 34 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .47....skipif po
14c20 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
14c30 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
14c40 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
14c50 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
14c60 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
14c70 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
14c80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
14c90 61 62 65 6c 2d 35 33 31 0d 0a 53 45 4c 45 43 54  abel-531..SELECT
14ca0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
14cb0 20 28 20 2d 20 34 32 20 29 20 2f 20 2d 20 63 6f   ( - 42 ) / - co
14cc0 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
14cd0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 35 0d 0a  1..----..2..35..
14ce0 34 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  47....onlyif mys
14cf0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
14d00 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
14d10 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
14d20 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
14d30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
14d40 33 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  32..SELECT ALL +
14d50 20 43 41 53 54 28 20 39 39 20 41 53 20 53 49 47   CAST( 99 AS SIG
14d60 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52  NED ) AS col2 FR
14d70 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
14d80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
14d90 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
14da0 20 34 62 37 37 34 36 37 64 64 35 66 33 34 36 31   4b77467dd5f3461
14db0 30 39 64 32 39 66 36 33 36 34 61 37 62 62 38 64  09d29f6364a7bb8d
14dc0 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  b....skipif mysq
14dd0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
14de0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
14df0 6f 72 74 20 6c 61 62 65 6c 2d 35 33 32 0d 0a 53  ort label-532..S
14e00 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54  ELECT ALL + CAST
14e10 20 28 20 39 39 20 41 53 20 49 4e 54 45 47 45 52   ( 99 AS INTEGER
14e20 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
14e30 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
14e40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
14e50 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 62  es hashing to 4b
14e60 37 37 34 36 37 64 64 35 66 33 34 36 31 30 39 64  77467dd5f346109d
14e70 32 39 66 36 33 36 34 61 37 62 62 38 64 62 0d 0a  29f6364a7bb8db..
14e80 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
14e90 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
14ea0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
14eb0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
14ec0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33  rowsort label-53
14ed0 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
14ee0 43 54 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32  CT col0 DIV col2
14ef0 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   + - col0 * - co
14f00 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
14f10 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34  tab0..----..2064
14f20 0d 0a 33 34 33 30 0d 0a 38 31 30 30 0d 0a 0d 0a  ..3430..8100....
14f30 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
14f40 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
14f50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
14f60 61 62 65 6c 2d 35 33 33 0d 0a 53 45 4c 45 43 54  abel-533..SELECT
14f70 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2f   DISTINCT col0 /
14f80 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a   col2 + - col0 *
14f90 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   - col1 AS col1 
14fa0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
14fb0 0a 32 30 36 34 0d 0a 33 34 33 30 0d 0a 38 31 30  .2064..3430..810
14fc0 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
14fd0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
14fe0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
14ff0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
15000 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
15010 2d 35 33 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  -534..SELECT + +
15020 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30   col2 DIV + col0
15030 20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   - CAST( col1 AS
15040 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 31 20 46   SIGNED ) col1 F
15050 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
15060 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 39 31  ..----..-85..-91
15070 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-97....skipif 
15080 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
15090 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
150a0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
150b0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
150c0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
150d0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
150e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
150f0 20 6c 61 62 65 6c 2d 35 33 34 0d 0a 53 45 4c 45   label-534..SELE
15100 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2b 20  CT + + col2 / + 
15110 63 6f 6c 30 20 2d 20 43 41 53 54 20 28 20 63 6f  col0 - CAST ( co
15120 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
15130 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
15140 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
15150 35 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 73  5..-91..-97....s
15160 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
15170 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
15180 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
15190 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
151a0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
151b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
151c0 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 63 6f 6c  - ( - col2 ) col
151d0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
151e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32  or0..----..26..2
151f0 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49  7..38....query I
15200 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15210 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 28 20   DISTINCT - - ( 
15220 2d 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20  - col2 ) * col2 
15230 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
15240 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
15250 0a 2d 31 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37  .-1444..-676..-7
15260 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  29....query I ro
15270 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
15280 37 32 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74  72 - col2 FROM t
15290 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
152a0 2d 0d 0a 2d 31 31 30 0d 0a 2d 39 38 0d 0a 2d 39  -..-110..-98..-9
152b0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
152c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
152d0 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c  TINCT col2 * col
152e0 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  1 + - col2 * col
152f0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
15300 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
15310 2d 0d 0a 2d 32 33 35 36 0d 0a 2d 34 39 34 0d 0a  -..-2356..-494..
15320 36 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  648....query I r
15330 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
15340 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  LL + + col0 + co
15350 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l0 * - col0 AS c
15360 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
15370 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32   cor0..----..-42
15380 0d 0a 2d 36 30 30 36 0d 0a 2d 36 31 36 32 0d 0a  ..-6006..-6162..
15390 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
153a0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
153b0 20 63 6f 6c 32 20 2a 20 33 35 20 2b 20 2b 20 63   col2 * 35 + + c
153c0 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20  ol2 * - col2 AS 
153d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
153e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
153f0 37 30 31 0d 0a 33 34 34 36 34 0d 0a 34 36 32 32  701..34464..4622
15400 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
15410 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15420 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20  TINCT cor0.col0 
15430 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  * col1 + col0 * 
15440 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
15450 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15460 31 36 30 32 30 0d 0a 32 36 34 30 0d 0a 34 36 32  16020..2640..462
15470 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
15480 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
15490 20 2b 20 63 6f 72 31 2e 63 6f 6c 31 20 41 53 20   + cor1.col1 AS 
154a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
154b0 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
154c0 4e 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d  N tab0 cor1..---
154d0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
154e0 69 6e 67 20 74 6f 20 35 38 35 61 34 31 61 35 32  ing to 585a41a52
154f0 63 30 63 36 63 30 64 36 39 37 62 35 64 33 39 32  c0c6c0d697b5d392
15500 36 35 62 37 34 64 63 0d 0a 0d 0a 71 75 65 72 79  65b74dc....query
15510 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15520 43 54 20 2d 20 38 32 20 41 53 20 63 6f 6c 30 20  CT - 82 AS col0 
15530 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
15540 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
15550 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  0 cor1..----..9 
15560 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
15570 6f 20 66 38 30 30 62 30 61 61 64 32 38 62 38 32  o f800b0aad28b82
15580 62 32 64 65 62 36 37 66 37 30 34 35 63 39 61 34  b2deb67f7045c9a4
15590 35 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  5c....skipif pos
155a0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
155b0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
155c0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
155d0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
155e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
155f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
15600 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2d 20 74 61  tab1.col0 * - ta
15610 62 31 2e 63 6f 6c 31 20 2a 20 39 32 20 63 6f 6c  b1.col1 * 92 col
15620 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
15630 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
15640 0a 2d 35 38 38 38 30 0d 0a 2d 37 31 37 36 0d 0a  .-58880..-7176..
15650 2d 39 35 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20  -95680....query 
15660 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15670 54 20 2b 20 39 30 20 2a 20 2b 20 63 6f 6c 31 20  T + 90 * + col1 
15680 2b 20 2d 20 31 36 20 46 52 4f 4d 20 74 61 62 31  + - 16 FROM tab1
15690 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
156a0 31 31 35 34 0d 0a 32 33 32 34 0d 0a 38 38 34 0d  1154..2324..884.
156b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
156c0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
156d0 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 72  or0.col1 + - cor
156e0 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
156f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
15700 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32  ..----..-19..-62
15710 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..24....query I 
15720 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15730 2d 20 2b 20 33 34 20 2a 20 2d 20 63 6f 72 30 2e  - + 34 * - cor0.
15740 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 46 52  col1 + - col1 FR
15750 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
15760 0a 2d 2d 2d 2d 0d 0a 33 33 30 0d 0a 34 32 39 0d  .----..330..429.
15770 0a 38 35 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .858....onlyif m
15780 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
15790 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
157a0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
157b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
157c0 62 65 6c 2d 35 34 38 0d 0a 53 45 4c 45 43 54 20  bel-548..SELECT 
157d0 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 44 49  - col1 + col0 DI
157e0 56 20 2d 20 38 37 20 2d 20 2b 20 63 6f 6c 30 20  V - 87 - + col0 
157f0 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  DIV - col0 AS co
15800 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
15810 2d 2d 0d 0a 2d 38 35 0d 0a 2d 39 31 0d 0a 2d 39  --..-85..-91..-9
15820 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
15830 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
15840 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
15850 6f 72 74 20 6c 61 62 65 6c 2d 35 34 38 0d 0a 53  ort label-548..S
15860 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63  ELECT - col1 + c
15870 6f 6c 30 20 2f 20 2d 20 38 37 20 2d 20 2b 20 63  ol0 / - 87 - + c
15880 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20  ol0 / - col0 AS 
15890 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
158a0 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 39 31 0d 0a  ----..-85..-91..
158b0 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -96....query I r
158c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
158d0 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c  ol0 * col0 + col
158e0 31 20 2a 20 2d 20 38 31 20 2a 20 63 6f 6c 31 20  1 * - 81 * col1 
158f0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
15900 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 36 38 0d  0..----..-17168.
15910 0a 2d 32 37 35 38 37 37 0d 0a 2d 37 37 37 39 32  .-275877..-77792
15920 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15930 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
15940 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2d 20 2b 20  cor0.col0 ) - + 
15950 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
15960 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
15970 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a 71 75  ..-62..-62....qu
15980 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15990 45 4c 45 43 54 20 63 6f 6c 31 20 2d 20 31 34 20  ELECT col1 - 14 
159a0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
159b0 0a 2d 31 0d 0a 2d 34 0d 0a 31 32 0d 0a 0d 0a 71  .-1..-4..12....q
159c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
159d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
159e0 2d 20 32 35 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  - 25 * + cor0.co
159f0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
15a00 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
15a10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 35 30 0d 0a  r0..----..-650..
15a20 2d 36 37 35 0d 0a 2d 39 35 30 0d 0a 0d 0a 71 75  -675..-950....qu
15a30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15a40 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20  ELECT ALL + - ( 
15a50 32 33 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  23 ) FROM tab0 A
15a60 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
15a70 4e 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d  N tab0 cor1..---
15a80 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
15a90 69 6e 67 20 74 6f 20 63 65 36 30 62 66 34 62 30  ing to ce60bf4b0
15aa0 36 34 37 64 30 66 63 62 31 38 61 30 35 36 32 65  647d0fcb18a0562e
15ab0 33 35 31 63 35 32 64 0d 0a 0d 0a 71 75 65 72 79  351c52d....query
15ac0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15ad0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
15ae0 6c 32 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 31  l2 - ( cor0.col1
15af0 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
15b00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d  cor0..----..-55.
15b10 0a 2d 35 38 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65  .-58..-85....que
15b20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15b30 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
15b40 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20  + ( - col1 ) AS 
15b50 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
15b60 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
15b70 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 6f 6e 6c  3..54..67....onl
15b80 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
15b90 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
15ba0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
15bb0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
15bc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
15bd0 6c 61 62 65 6c 2d 35 35 36 0d 0a 53 45 4c 45 43  label-556..SELEC
15be0 54 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2d 20 63  T col0 + + ( - c
15bf0 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20 2d 20 43  or0.col0 ) * - C
15c00 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
15c10 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52  NED ) AS col0 FR
15c20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
15c30 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
15c40 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
15c50 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
15c60 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
15c70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
15c80 35 35 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  556..SELECT col0
15c90 20 2b 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f   + + ( - cor0.co
15ca0 6c 30 20 29 20 2a 20 2d 20 43 41 53 54 20 28 20  l0 ) * - CAST ( 
15cb0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
15cc0 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
15cd0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
15ce0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
15cf0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
15d00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
15d10 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 2b 20   - ( col2 ) * + 
15d20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
15d30 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
15d40 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d  ----..162..3648.
15d50 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .7680....query I
15d60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15d70 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20   - ( - col2 ) * 
15d80 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
15d90 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
15da0 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32  ----..2838..7462
15db0 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
15dc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15dd0 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72  ALL - col1 + cor
15de0 30 2e 63 6f 6c 30 20 2a 20 39 33 20 46 52 4f 4d  0.col0 * 93 FROM
15df0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
15e00 2d 2d 2d 0d 0a 32 31 34 36 0d 0a 33 31 35 38 0d  ---..2146..3158.
15e10 0a 38 31 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .8186....query I
15e20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15e30 20 44 49 53 54 49 4e 43 54 20 36 30 20 41 53 20   DISTINCT 60 AS 
15e40 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20  col2 FROM tab2, 
15e50 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
15e60 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .60....query I r
15e70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
15e80 4c 4c 20 39 38 20 2a 20 37 33 20 41 53 20 63 6f  LL 98 * 73 AS co
15e90 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
15ea0 2d 2d 0d 0a 37 31 35 34 0d 0a 37 31 35 34 0d 0a  --..7154..7154..
15eb0 37 31 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7154....onlyif m
15ec0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
15ed0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
15ee0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
15ef0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
15f00 62 65 6c 2d 35 36 32 0d 0a 53 45 4c 45 43 54 20  bel-562..SELECT 
15f10 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20 38 37 20  + + col2 DIV 87 
15f20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
15f30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15f40 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73 6b 69  7..78..79....ski
15f50 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
15f60 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
15f70 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
15f80 6c 2d 35 36 32 0d 0a 53 45 4c 45 43 54 20 2b 20  l-562..SELECT + 
15f90 2b 20 63 6f 6c 32 20 2f 20 38 37 20 2b 20 63 6f  + col2 / 87 + co
15fa0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
15fb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37  cor0..----..7..7
15fc0 38 0d 0a 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  8..79....onlyif 
15fd0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
15fe0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
15ff0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
16000 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16010 61 62 65 6c 2d 35 36 33 0d 0a 53 45 4c 45 43 54  abel-563..SELECT
16020 20 41 4c 4c 20 2b 20 74 61 62 30 2e 63 6f 6c 31   ALL + tab0.col1
16030 20 44 49 56 20 2d 20 28 20 63 6f 6c 31 20 2a 20   DIV - ( col1 * 
16040 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2b 20  + tab0.col2 + + 
16050 74 61 62 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d  tab0.col1 ) FROM
16060 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab0..----..0..
16070 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
16080 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
16090 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
160a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 36 33  owsort label-563
160b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74  ..SELECT ALL + t
160c0 61 62 30 2e 63 6f 6c 31 20 2f 20 2d 20 28 20 63  ab0.col1 / - ( c
160d0 6f 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c  ol1 * + tab0.col
160e0 32 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20  2 + + tab0.col1 
160f0 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
16100 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
16110 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16120 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d  ELECT + col1 + -
16130 20 35 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   55 AS col2 FROM
16140 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d   tab0..----..31.
16150 0a 33 36 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72 79  .36..42....query
16160 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16170 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e  CT ALL + - cor0.
16180 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col1 + + col2 AS
16190 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
161a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
161b0 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71 75  33..-4..21....qu
161c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
161d0 45 4c 45 43 54 20 2d 20 34 38 20 2a 20 2b 20 63  ELECT - 48 * + c
161e0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
161f0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
16200 2d 2d 2d 0d 0a 2d 32 35 39 32 0d 0a 2d 32 37 33  ---..-2592..-273
16210 36 0d 0a 2d 34 36 30 38 0d 0a 0d 0a 71 75 65 72  6..-4608....quer
16220 79 20 49 49 49 49 49 49 49 49 49 49 49 49 20 72  y IIIIIIIIIIII r
16230 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
16240 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c 20  LL * FROM tab0, 
16250 74 61 62 30 20 63 6f 72 30 2c 20 74 61 62 30 20  tab0 cor0, tab0 
16260 63 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63 6f  cor1, tab1 AS co
16270 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61  r2..----..972 va
16280 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
16290 38 38 32 31 33 61 30 64 65 34 63 30 61 34 34 61  88213a0de4c0a44a
162a0 61 65 66 65 38 62 62 66 66 62 63 61 66 34 34 61  aefe8bbffbcaf44a
162b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
162c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
162d0 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 31 37  cor0.col2 * - 17
162e0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
162f0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
16300 0d 0a 2d 31 36 33 32 0d 0a 2d 39 31 38 0d 0a 2d  ..-1632..-918..-
16310 39 36 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  969....onlyif my
16320 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
16330 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
16340 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
16350 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
16360 65 6c 2d 35 36 39 0d 0a 53 45 4c 45 43 54 20 41  el-569..SELECT A
16370 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  LL + col2 + col1
16380 20 44 49 56 20 2b 20 63 6f 6c 31 20 41 53 20 63   DIV + col1 AS c
16390 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
163a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a   cor0..----..2..
163b0 33 34 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66  34..83....skipif
163c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
163d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
163e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
163f0 36 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  69..SELECT ALL +
16400 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20 2b   col2 + col1 / +
16410 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
16420 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
16430 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d 0a 38 33  .----..2..34..83
16440 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
16450 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
16460 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
16470 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
16480 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
16490 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
164a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
164b0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2d 20  col1 + + col0 - 
164c0 35 39 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20 46  59 * col1 col2 F
164d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
164e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 36 34 0d 0a 2d  ..----..-4964..-
164f0 35 31 38 39 0d 0a 2d 35 35 39 31 0d 0a 0d 0a 71  5189..-5591....q
16500 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16510 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 31 37 20  SELECT ALL + 17 
16520 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + - col2 FROM ta
16530 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
16540 31 30 0d 0a 2d 32 31 0d 0a 2d 39 0d 0a 0d 0a 71  10..-21..-9....q
16550 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16560 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20  SELECT - ( col2 
16570 29 20 2a 20 2b 20 28 20 33 36 20 2a 20 63 6f 6c  ) * + ( 36 * col
16580 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  2 ) FROM tab0 AS
16590 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   cor0..----..-24
165a0 32 30 36 34 0d 0a 2d 33 36 0d 0a 2d 33 39 32 30  2064..-36..-3920
165b0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
165c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
165d0 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2b  TINCT + col0 - +
165e0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
165f0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
16600 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a 37  .----..-9..34..7
16610 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16620 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
16630 2d 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  - - col1 + - col
16640 32 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29  2 * - ( - col1 )
16650 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
16660 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 35 32 0d  r0..----..-2752.
16670 0a 2d 37 33 37 31 0d 0a 30 0d 0a 0d 0a 71 75 65  .-7371..0....que
16680 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16690 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 37 32 20  LECT ALL - - 72 
166a0 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  * cor0.col1 + co
166b0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
166c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
166d0 2d 2d 0d 0a 36 32 37 38 0d 0a 36 36 34 33 0d 0a  --..6278..6643..
166e0 37 30 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7081....query I 
166f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16700 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  ALL + col2 * - c
16710 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ol0 + cor0.col1 
16720 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
16730 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 36 0d 0a 2d  0..----..-706..-
16740 37 32 30 37 0d 0a 36 32 0d 0a 0d 0a 6f 6e 6c 79  7207..62....only
16750 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
16760 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
16770 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
16780 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16790 74 20 6c 61 62 65 6c 2d 35 37 37 0d 0a 53 45 4c  t label-577..SEL
167a0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
167b0 20 2b 20 63 6f 6c 31 20 44 49 56 20 34 39 20 41   + col1 DIV 49 A
167c0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
167d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
167e0 32 35 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 73 6b  25..36..90....sk
167f0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
16800 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
16810 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
16820 65 6c 2d 35 37 37 0d 0a 53 45 4c 45 43 54 20 41  el-577..SELECT A
16830 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  LL + col0 + + co
16840 6c 31 20 2f 20 34 39 20 41 53 20 63 6f 6c 32 20  l1 / 49 AS col2 
16850 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
16860 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 36 0d  0..----..25..36.
16870 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .90....query I r
16880 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
16890 49 53 54 49 4e 43 54 20 28 20 2d 20 33 39 20 29  ISTINCT ( - 39 )
168a0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
168b0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 0d 0a 0d  b2..----..-39...
168c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
168d0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
168e0 2d 20 2d 20 35 32 20 46 52 4f 4d 20 74 61 62 30  - - 52 FROM tab0
168f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16900 31 34 31 0d 0a 37 36 0d 0a 38 37 0d 0a 0d 0a 71  141..76..87....q
16910 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16920 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
16930 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col1 * - col1 * 
16940 2b 20 31 34 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 14 AS col2 FRO
16950 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
16960 2d 2d 2d 2d 0d 0a 2d 31 33 34 35 34 0d 0a 2d 34  ----..-13454..-4
16970 30 34 36 0d 0a 2d 34 38 37 33 34 0d 0a 0d 0a 71  046..-48734....q
16980 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16990 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20  SELECT + + col1 
169a0 2a 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 2b  * ( + col0 ) + +
169b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
169c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
169d0 34 32 32 0d 0a 32 32 34 0d 0a 34 36 38 30 0d 0a  422..224..4680..
169e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
169f0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
16a00 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   + - cor0.col1 *
16a10 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
16a20 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
16a30 0a 2d 31 33 32 36 0d 0a 2d 31 38 36 0d 0a 2d 34  .-1326..-186..-4
16a40 35 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  543....query I r
16a50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
16a60 6f 6c 30 20 2b 20 2d 20 38 34 20 2a 20 63 6f 6c  ol0 + - 84 * col
16a70 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
16a80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 34 38  or0..----..-2748
16a90 0d 0a 2d 34 39 0d 0a 2d 36 37 39 39 0d 0a 0d 0a  ..-49..-6799....
16aa0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16ab0 0a 53 45 4c 45 43 54 20 2b 20 32 39 20 2a 20 63  .SELECT + 29 * c
16ac0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
16ad0 2d 2d 2d 0d 0a 31 37 31 31 0d 0a 34 39 33 0d 0a  ---..1711..493..
16ae0 38 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  899....onlyif my
16af0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
16b00 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
16b10 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
16b20 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
16b30 65 6c 2d 35 38 35 0d 0a 53 45 4c 45 43 54 20 41  el-585..SELECT A
16b40 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56 20  LL - + col2 DIV 
16b50 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20  ( cor0.col1 ) + 
16b60 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  - col2 FROM tab2
16b70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16b80 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 34 30 0d 0a 0d  -26..-27..-40...
16b90 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
16ba0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
16bb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
16bc0 6c 61 62 65 6c 2d 35 38 35 0d 0a 53 45 4c 45 43  label-585..SELEC
16bd0 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2f  T ALL - + col2 /
16be0 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2b   ( cor0.col1 ) +
16bf0 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
16c00 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
16c10 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 34 30 0d 0a  .-26..-27..-40..
16c20 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
16c30 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
16c40 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
16c50 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
16c60 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
16c70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16c80 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
16c90 20 2a 20 39 35 20 63 6f 6c 31 20 46 52 4f 4d 20   * 95 col1 FROM 
16ca0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
16cb0 2d 2d 0d 0a 36 36 35 0d 0a 37 34 31 30 0d 0a 37  --..665..7410..7
16cc0 35 30 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  505....query I r
16cd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
16ce0 49 53 54 49 4e 43 54 20 2b 20 31 31 20 41 53 20  ISTINCT + 11 AS 
16cf0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
16d00 2d 2d 2d 2d 0d 0a 31 31 0d 0a 0d 0a 71 75 65 72  ----..11....quer
16d10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16d20 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a  ECT ALL + col1 *
16d30 20 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   ( col0 ) AS col
16d40 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
16d50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d  or0..----..1343.
16d60 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 6f 6e  .217..4602....on
16d70 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
16d80 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
16d90 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
16da0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
16db0 6f 72 74 20 6c 61 62 65 6c 2d 35 38 39 0d 0a 53  ort label-589..S
16dc0 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44 49 56  ELECT + col0 DIV
16dd0 20 2d 20 28 20 36 38 20 29 20 46 52 4f 4d 20 74   - ( 68 ) FROM t
16de0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
16df0 2d 31 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69  -1..-1..0....ski
16e00 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
16e10 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
16e20 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
16e30 6c 2d 35 38 39 0d 0a 53 45 4c 45 43 54 20 2b 20  l-589..SELECT + 
16e40 63 6f 6c 30 20 2f 20 2d 20 28 20 36 38 20 29 20  col0 / - ( 68 ) 
16e50 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
16e60 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 30 0d  ----..-1..-1..0.
16e70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16e80 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
16e90 6f 6c 31 20 2b 20 2d 20 28 20 2b 20 35 35 20 29  ol1 + - ( + 55 )
16ea0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
16eb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a 33 36  r0..----..31..36
16ec0 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..42....query I 
16ed0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16ee0 2d 20 63 6f 6c 30 20 2b 20 28 20 2d 20 63 6f 6c  - col0 + ( - col
16ef0 32 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 ) + col1 FROM 
16f00 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 30 0d  tab0..----..-80.
16f10 0a 32 39 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72 79  .29..61....query
16f20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16f30 43 54 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20 2d  CT tab2.col0 + -
16f40 20 31 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   10 FROM tab2..-
16f50 2d 2d 2d 0d 0a 2d 33 0d 0a 36 38 0d 0a 36 39 0d  ---..-3..68..69.
16f60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16f70 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
16f80 6f 6c 30 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 - + cor0.col
16f90 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 * - col0 AS co
16fa0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
16fb0 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 36 0d 0a 37 35  0..----..576..75
16fc0 0d 0a 39 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..960....onlyif 
16fd0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
16fe0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
16ff0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
17000 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
17010 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
17020 6c 2d 35 39 34 0d 0a 53 45 4c 45 43 54 20 41 4c  l-594..SELECT AL
17030 4c 20 2b 20 43 41 53 54 28 20 32 20 41 53 20 53  L + CAST( 2 AS S
17040 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 31 20 2a  IGNED ) + col1 *
17050 20 2d 20 31 39 20 46 52 4f 4d 20 74 61 62 31 20   - 19 FROM tab1 
17060 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
17070 31 38 38 0d 0a 2d 32 34 35 0d 0a 2d 34 39 32 0d  188..-245..-492.
17080 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
17090 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
170a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
170b0 74 20 6c 61 62 65 6c 2d 35 39 34 0d 0a 53 45 4c  t label-594..SEL
170c0 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28  ECT ALL + CAST (
170d0 20 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20   2 AS INTEGER ) 
170e0 2b 20 63 6f 6c 31 20 2a 20 2d 20 31 39 20 46 52  + col1 * - 19 FR
170f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
17100 0a 2d 2d 2d 2d 0d 0a 2d 31 38 38 0d 0a 2d 32 34  .----..-188..-24
17110 35 0d 0a 2d 34 39 32 0d 0a 0d 0a 71 75 65 72 79  5..-492....query
17120 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
17130 43 54 20 44 49 53 54 49 4e 43 54 20 30 20 2d 20  CT DISTINCT 0 - 
17140 28 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  ( - col0 + - col
17150 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  0 ) AS col1 FROM
17160 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
17170 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a 36  ---..128..160..6
17180 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17190 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
171a0 2d 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  - + col0 + col0 
171b0 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
171c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
171d0 34 30 33 32 0d 0a 36 0d 0a 36 33 32 30 0d 0a 0d  4032..6..6320...
171e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
171f0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
17200 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e  * col1 * + cor0.
17210 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
17220 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
17230 30 39 38 32 0d 0a 2d 32 35 39 34 37 0d 0a 2d 39  0982..-25947..-9
17240 30 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0506....query I 
17250 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17260 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29  ALL - ( + col1 )
17270 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
17280 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
17290 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
172a0 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 6f 6e 6c  3..54..67....onl
172b0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
172c0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
172d0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
172e0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
172f0 72 74 20 6c 61 62 65 6c 2d 35 39 39 0d 0a 53 45  rt label-599..SE
17300 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
17310 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f  + cor0.col1 * co
17320 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31  l2 DIV cor0.col1
17330 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
17340 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
17350 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a  ..55..58..85....
17360 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
17370 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
17380 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17390 61 62 65 6c 2d 35 39 39 0d 0a 53 45 4c 45 43 54  abel-599..SELECT
173a0 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 63 6f   ALL + col1 + co
173b0 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2f  r0.col1 * col2 /
173c0 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
173d0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
173e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a  cor0..----..55..
173f0 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20  58..85....query 
17400 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17410 54 20 63 6f 6c 30 20 2a 20 38 33 20 41 53 20 63  T col0 * 83 AS c
17420 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
17430 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 39   cor0..----..249
17440 0d 0a 35 33 31 32 0d 0a 36 36 34 30 0d 0a 0d 0a  ..5312..6640....
17450 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17460 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61  .SELECT ALL - ta
17470 62 32 2e 63 6f 6c 30 20 2b 20 2d 20 37 36 20 46  b2.col0 + - 76 F
17480 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
17490 2d 31 35 34 0d 0a 2d 31 35 35 0d 0a 2d 38 33 0d  -154..-155..-83.
174a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
174b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33  rt..SELECT ALL 3
174c0 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  1 + cor0.col1 AS
174d0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c   col1 FROM tab2,
174e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
174f0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
17500 73 68 69 6e 67 20 74 6f 20 66 33 64 66 62 32 30  shing to f3dfb20
17510 31 66 65 33 63 37 32 32 39 30 30 38 33 65 30 30  1fe3c72290083e00
17520 61 34 39 63 39 34 35 66 66 0d 0a 0d 0a 73 6b 69  a49c945ff....ski
17530 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
17540 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
17550 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
17560 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
17570 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
17580 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
17590 4c 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20  L - tab1.col2 + 
175a0 2d 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d  - col0 col0 FROM
175b0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   tab1..----..-12
175c0 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d 0a  1..-176..-57....
175d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
175e0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
175f0 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  l2 * + col1 + + 
17600 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
17610 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab1..----..13
17620 34 34 0d 0a 31 34 35 38 0d 0a 36 32 37 0d 0a 0d  44..1458..627...
17630 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17640 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
17650 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 74 61 62  ol0 * col1 * tab
17660 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  2.col0 AS col0 F
17670 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
17680 2d 31 30 36 30 39 37 0d 0a 2d 31 35 31 39 0d 0a  -106097..-1519..
17690 2d 33 35 38 39 35 36 0d 0a 0d 0a 71 75 65 72 79  -358956....query
176a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
176b0 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
176c0 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  l2 + - col0 * - 
176d0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
176e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
176f0 2d 2d 2d 2d 0d 0a 32 30 33 31 0d 0a 33 33 39 34  ----..2031..3394
17700 0d 0a 38 30 31 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..8017....onlyif
17710 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
17720 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
17730 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
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 30 37 0d 0a 53 45 4c 45 43  label-607..SELEC
17760 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
17770 6f 6c 32 20 44 49 56 20 38 39 20 2b 20 2d 20 63  ol2 DIV 89 + - c
17780 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
17790 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   cor0..----..-26
177a0 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b  ..-27..-38....sk
177b0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
177c0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
177d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
177e0 65 6c 2d 36 30 37 0d 0a 53 45 4c 45 43 54 20 44  el-607..SELECT D
177f0 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32  ISTINCT + + col2
17800 20 2f 20 38 39 20 2b 20 2d 20 63 6f 6c 32 20 46   / 89 + - col2 F
17810 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
17820 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37  ..----..-26..-27
17830 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-38....skipif 
17840 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
17850 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
17860 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
17870 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
17880 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17890 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 39  t..SELECT ALL 69
178a0 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20   + ( - col2 ) + 
178b0 2d 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d  - col0 col0 FROM
178c0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
178d0 0d 0a 2d 31 30 37 0d 0a 2d 35 32 0d 0a 31 32 0d  ..-107..-52..12.
178e0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
178f0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
17900 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
17910 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
17920 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
17930 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30 39 0d  wsort label-609.
17940 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41  .SELECT ALL - CA
17950 53 54 28 20 2d 20 63 6f 6c 32 20 41 53 20 53 49  ST( - col2 AS SI
17960 47 4e 45 44 20 29 20 2b 20 63 6f 6c 32 20 2a 20  GNED ) + col2 * 
17970 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
17980 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
17990 2d 2d 2d 2d 0d 0a 31 35 36 30 0d 0a 36 38 34 0d  ----..1560..684.
179a0 0a 38 36 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .864....skipif m
179b0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
179c0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
179d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30 39  owsort label-609
179e0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43  ..SELECT ALL - C
179f0 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 41 53 20  AST ( - col2 AS 
17a00 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 32  INTEGER ) + col2
17a10 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   * col1 AS col0 
17a20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
17a30 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30 0d 0a 36  0..----..1560..6
17a40 38 34 0d 0a 38 36 34 0d 0a 0d 0a 71 75 65 72 79  84..864....query
17a50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
17a60 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 32 34  CT DISTINCT - 24
17a70 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46   * col2 + col0 F
17a80 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
17a90 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 36 0d 0a 2d 36  ..----..-546..-6
17aa0 34 31 0d 0a 2d 38 33 33 0d 0a 0d 0a 71 75 65 72  41..-833....quer
17ab0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17ac0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38  ECT DISTINCT - 8
17ad0 35 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  5 * cor0.col0 FR
17ae0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
17af0 0a 2d 2d 2d 2d 0d 0a 2d 32 35 35 0d 0a 2d 35 34  .----..-255..-54
17b00 34 30 0d 0a 2d 36 38 30 30 0d 0a 0d 0a 71 75 65  40..-6800....que
17b10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17b20 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72  LECT ALL - - cor
17b30 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20  0.col0 + col2 * 
17b40 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
17b50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31   cor0..----..291
17b60 39 0d 0a 33 33 31 33 0d 0a 39 32 39 36 0d 0a 0d  9..3313..9296...
17b70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17b80 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 33 36 20  ..SELECT - - 36 
17b90 2b 20 2b 20 36 34 20 46 52 4f 4d 20 74 61 62 30  + + 64 FROM tab0
17ba0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17bb0 31 30 30 0d 0a 31 30 30 0d 0a 31 30 30 0d 0a 0d  100..100..100...
17bc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17bd0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
17be0 2a 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 37 20 2b  * - col2 * - 7 +
17bf0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
17c00 0a 2d 2d 2d 2d 0d 0a 2d 32 34 34 0d 0a 2d 35 31  .----..-244..-51
17c10 30 30 34 0d 0a 2d 35 35 31 31 0d 0a 0d 0a 71 75  004..-5511....qu
17c20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17c30 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
17c40 20 32 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53   20 FROM tab2 AS
17c50 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
17c60 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
17c70 2d 2d 2d 0d 0a 2d 32 30 0d 0a 0d 0a 73 6b 69 70  ---..-20....skip
17c80 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
17c90 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
17ca0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
17cb0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
17cc0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
17cd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 36  sort..SELECT - 6
17ce0 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  4 col1 FROM tab0
17cf0 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
17d00 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31  OIN tab2 AS cor1
17d10 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
17d20 20 68 61 73 68 69 6e 67 20 74 6f 20 36 30 31 65   hashing to 601e
17d30 63 34 33 39 61 37 32 66 62 34 37 38 36 61 39 63  c439a72fb4786a9c
17d40 62 37 61 36 35 34 37 61 63 65 35 65 0d 0a 0d 0a  b7a6547ace5e....
17d50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17d60 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
17d70 20 2b 20 2d 20 39 33 20 2a 20 2d 20 63 6f 6c 31   + - 93 * - col1
17d80 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
17d90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 39 0d 0a  r0..----..1209..
17da0 32 34 31 38 0d 0a 39 33 30 0d 0a 0d 0a 71 75 65  2418..930....que
17db0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17dc0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
17dd0 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63  col0 * col2 AS c
17de0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
17df0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35   cor0..----..-35
17e00 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d  ..-7298..-792...
17e10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17e20 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
17e30 54 20 28 20 63 6f 6c 32 20 2a 20 2b 20 39 37 20  T ( col2 * + 97 
17e40 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
17e50 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 35 32 32 0d  ab2..----..2522.
17e60 0a 32 36 31 39 0d 0a 33 36 38 36 0d 0a 0d 0a 71  .2619..3686....q
17e70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17e80 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
17e90 6c 30 20 2d 20 36 37 20 41 53 20 63 6f 6c 31 20  l0 - 67 AS col1 
17ea0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
17eb0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34  0..----..-3..-64
17ec0 0d 0a 31 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..13....skipif p
17ed0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
17ee0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
17ef0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
17f00 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
17f10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17f20 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
17f30 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 * cor0.col2 
17f40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
17f50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
17f60 0a 31 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a 71  .1089..6724....q
17f70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17f80 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
17f90 2b 20 2b 20 37 39 20 46 52 4f 4d 20 74 61 62 32  + + 79 FROM tab2
17fa0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17fb0 31 35 37 0d 0a 31 35 38 0d 0a 38 36 0d 0a 0d 0a  157..158..86....
17fc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17fd0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
17fe0 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30   + col2 + - col0
17ff0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
18000 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
18010 0d 0a 31 30 35 0d 0a 31 31 32 0d 0a 35 30 0d 0a  ..105..112..50..
18020 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18030 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
18040 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  CT - cor0.col2 *
18050 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 33   - cor0.col2 + 3
18060 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  6 AS col1 FROM t
18070 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
18080 32 39 35 32 0d 0a 33 32 38 35 0d 0a 39 32 35 32  2952..3285..9252
18090 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
180a0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
180b0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
180c0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
180d0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
180e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 35  owsort label-625
180f0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
18100 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  * CAST( NULL AS 
18110 44 45 43 49 4d 41 4c 20 29 20 2d 20 63 6f 6c 32  DECIMAL ) - col2
18120 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
18130 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
18140 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
18150 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
18160 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
18170 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18180 65 6c 2d 36 32 35 0d 0a 53 45 4c 45 43 54 20 2b  el-625..SELECT +
18190 20 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 4e   col2 * CAST ( N
181a0 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2d 20  ULL AS REAL ) - 
181b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
181c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
181d0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
181e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
181f0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  t..SELECT col0 +
18200 20 28 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d   ( + col1 ) FROM
18210 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30   tab0..----..110
18220 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75  ..132..180....qu
18230 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18240 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b  ELECT - col0 * +
18250 20 28 20 28 20 2d 20 63 6f 6c 32 20 29 20 29 20   ( ( - col2 ) ) 
18260 2a 20 36 33 20 2b 20 2d 20 74 61 62 31 2e 63 6f  * 63 + - tab1.co
18270 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
18280 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 38  tab1..----..1018
18290 30 0d 0a 32 32 39 38 31 34 0d 0a 34 38 33 38 32  0..229814..48382
182a0 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
182b0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
182c0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
182d0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
182e0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
182f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18300 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 28  ELECT + col2 + (
18310 20 2d 20 39 37 20 29 20 2b 20 74 61 62 30 2e 63   - 97 ) + tab0.c
18320 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol1 col0 FROM ta
18330 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 32 0d  b0..----..1..22.
18340 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .76....query I r
18350 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
18360 49 53 54 49 4e 43 54 20 2d 20 39 20 2a 20 37 38  ISTINCT - 9 * 78
18370 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
18380 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18390 2d 37 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -702....query I 
183a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
183b0 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ALL + cor0.col2 
183c0 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20  * cor0.col1 + ( 
183d0 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  + col1 * + col0 
183e0 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
183f0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
18400 2d 0d 0a 31 32 31 30 0d 0a 31 34 38 32 0d 0a 32  -..1210..1482..2
18410 32 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  288....onlyif my
18420 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
18430 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
18440 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
18450 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18460 65 6c 2d 36 33 31 0d 0a 53 45 4c 45 43 54 20 41  el-631..SELECT A
18470 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LL + - col0 * co
18480 6c 32 20 44 49 56 20 32 20 2d 20 2b 20 63 6f 6c  l2 DIV 2 - + col
18490 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  2 col0 FROM tab1
184a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
184b0 2d 31 33 35 0d 0a 2d 31 38 38 31 0d 0a 2d 33 39  -135..-1881..-39
184c0 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  36....skipif pos
184d0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
184e0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
184f0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
18500 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
18510 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
18520 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..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 33 31 0d 0a 53 45 4c 45 43 54 20  bel-631..SELECT 
18550 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63  ALL + - col0 * c
18560 6f 6c 32 20 2f 20 32 20 2d 20 2b 20 63 6f 6c 32  ol2 / 2 - + col2
18570 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
18580 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
18590 31 33 35 0d 0a 2d 31 38 38 31 0d 0a 2d 33 39 33  135..-1881..-393
185a0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
185b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
185c0 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b  TINCT + col2 * +
185d0 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b   col2 * - col1 +
185e0 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
185f0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
18600 0a 2d 32 32 36 33 30 0d 0a 2d 32 34 35 36 35 0d  .-22630..-24565.
18610 0a 2d 33 39 39 34 33 0d 0a 0d 0a 73 6b 69 70 69  .-39943....skipi
18620 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
18630 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
18640 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
18650 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
18660 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
18670 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
18680 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2d 20 38 32  INCT - col0 - 82
18690 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
186a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
186b0 31 30 36 0d 0a 2d 31 31 37 0d 0a 2d 31 37 31 0d  106..-117..-171.
186c0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
186d0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
186e0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
186f0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
18700 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
18710 33 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  34..SELECT - cor
18720 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20  0.col2 DIV col0 
18730 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  + - col0 * col2 
18740 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
18750 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
18760 0a 2d 31 38 30 0d 0a 2d 33 36 34 38 0d 0a 2d 37  .-180..-3648..-7
18770 36 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  681....skipif my
18780 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
18790 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
187a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 34 0d  wsort label-634.
187b0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
187c0 6f 6c 32 20 2f 20 63 6f 6c 30 20 2b 20 2d 20 63  ol2 / col0 + - c
187d0 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
187e0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
187f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 30  cor0..----..-180
18800 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 31 0d 0a  ..-3648..-7681..
18810 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18820 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
18830 43 54 20 2b 20 63 6f 6c 31 20 2b 20 37 20 2a 20  CT + col1 + 7 * 
18840 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
18850 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a  or0..----..104..
18860 32 30 38 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  208..80....query
18870 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18880 43 54 20 63 6f 6c 30 20 2d 20 34 39 20 41 53 20  CT col0 - 49 AS 
18890 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
188a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
188b0 34 0d 0a 2d 32 35 0d 0a 34 30 0d 0a 0d 0a 71 75  4..-25..40....qu
188c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
188d0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d  ELECT ALL col0 -
188e0 20 36 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   62 AS col2 FROM
188f0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
18900 2d 2d 2d 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 32  ---..-27..-38..2
18910 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
18920 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
18930 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72  1 + col1 * + cor
18940 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  0.col1 AS col1 F
18950 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
18960 0d 0a 2d 2d 2d 2d 0d 0a 33 30 36 0d 0a 33 35 34  ..----..306..354
18970 30 0d 0a 39 39 32 0d 0a 0d 0a 71 75 65 72 79 20  0..992....query 
18980 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18990 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  T + - col2 * col
189a0 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 + col2 FROM ta
189b0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
189c0 0d 0a 2d 32 38 30 35 0d 0a 2d 37 33 38 30 0d 0a  ..-2805..-7380..
189d0 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -96....query I r
189e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
189f0 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 74 61 62   tab0.col1 * tab
18a00 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
18a10 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33  ..----..2064..33
18a20 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72  95..8099....quer
18a30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18a40 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT + - cor0.col
18a50 30 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72  0 * col0 + - cor
18a60 30 2e 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53  0.col1 - col0 AS
18a70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
18a80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
18a90 33 38 0d 0a 2d 34 31 37 30 0d 0a 2d 36 34 39 33  38..-4170..-6493
18aa0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18ab0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
18ac0 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  l1 + col0 + + co
18ad0 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 * col1 FROM t
18ae0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
18af0 33 35 30 30 0d 0a 33 35 31 0d 0a 39 33 37 0d 0a  3500..351..937..
18b00 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
18b10 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
18b20 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
18b30 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
18b40 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34  rowsort label-64
18b50 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  3..SELECT + - co
18b60 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 41 53  l2 DIV + col1 AS
18b70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
18b80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
18b90 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 73 6b 69  2..-5..-7....ski
18ba0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
18bb0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
18bc0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
18bd0 6c 2d 36 34 33 0d 0a 53 45 4c 45 43 54 20 2b 20  l-643..SELECT + 
18be0 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31 20  - col2 / + col1 
18bf0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
18c00 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
18c10 0a 2d 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 71  .-2..-5..-7....q
18c20 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
18c30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46  ..SELECT ALL * F
18c40 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 20 57 48  ROM tab1 cor0 WH
18c50 45 52 45 20 28 20 4e 55 4c 4c 20 29 20 3e 3d 20  ERE ( NULL ) >= 
18c60 63 6f 6c 32 20 2b 20 63 6f 6c 32 0d 0a 2d 2d 2d  col2 + col2..---
18c70 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
18c80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
18c90 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  ol2 + col2 * + c
18ca0 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol2 * - col0 AS 
18cb0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
18cc0 2d 2d 2d 2d 0d 0a 2d 32 36 31 36 39 0d 0a 2d 33  ----..-26169..-3
18cd0 36 0d 0a 2d 35 39 38 35 31 38 0d 0a 0d 0a 73 6b  6..-598518....sk
18ce0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
18cf0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
18d00 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
18d10 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
18d20 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
18d30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
18d40 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32 20   cor0.col0 col2 
18d50 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
18d60 30 20 57 48 45 52 45 20 28 20 63 6f 6c 30 20 29  0 WHERE ( col0 )
18d70 20 3c 3e 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d   <> ( NULL )..--
18d80 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
18d90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
18da0 4c 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  L col1 * - col0 
18db0 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  - col0 * - col1 
18dc0 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
18dd0 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28 20 2d 20  NULL NOT IN ( - 
18de0 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col0 )..----....
18df0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18e00 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32  .SELECT + + col2
18e10 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   * - col2 * - co
18e20 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
18e30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 30  cor0..----..1140
18e40 37 36 0d 0a 35 31 30 33 0d 0a 35 32 37 32 38 0d  76..5103..52728.
18e50 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
18e60 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
18e70 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
18e80 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
18e90 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
18ea0 34 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  49..SELECT - col
18eb0 32 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20  2 DIV cor0.col1 
18ec0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
18ed0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
18ee0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
18ef0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
18f00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
18f10 6c 61 62 65 6c 2d 36 34 39 0d 0a 53 45 4c 45 43  label-649..SELEC
18f20 54 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 72 30 2e  T - col2 / cor0.
18f30 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
18f40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
18f50 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
18f60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
18f70 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f  STINCT - cor0.co
18f80 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  l1 + cor0.col1 *
18f90 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
18fa0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
18fb0 0a 30 0d 0a 32 37 35 32 0d 0a 37 33 37 31 0d 0a  .0..2752..7371..
18fc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18fd0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
18fe0 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  - col1 + cor0.co
18ff0 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  l0 * col1 * col0
19000 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
19010 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 31 31 34  r0..----..106114
19020 0d 0a 31 35 35 30 0d 0a 33 35 39 30 31 35 0d 0a  ..1550..359015..
19030 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19040 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
19050 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   * + col1 + col1
19060 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
19070 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 37 0d 0a  2..----..-1397..
19080 2d 35 35 30 0d 0a 2d 37 39 39 0d 0a 0d 0a 6f 6e  -550..-799....on
19090 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
190a0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
190b0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
190c0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
190d0 6f 72 74 20 6c 61 62 65 6c 2d 36 35 33 0d 0a 53  ort label-653..S
190e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
190f0 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63   col0 * col0 + c
19100 6f 6c 30 20 44 49 56 20 2b 20 74 61 62 31 2e 63  ol0 DIV + tab1.c
19110 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ol2 + - col2 AS 
19120 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
19130 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a 34 30 34 30 0d  ----..-45..4040.
19140 0a 36 33 30 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  .6304....skipif 
19150 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
19160 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
19170 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35  rowsort label-65
19180 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
19190 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30  CT + col0 * col0
191a0 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 74 61 62 31   + col0 / + tab1
191b0 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41  .col2 + - col2 A
191c0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
191d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a 34 30 34  ..----..-45..404
191e0 30 0d 0a 36 33 30 34 0d 0a 0d 0a 6f 6e 6c 79 69  0..6304....onlyi
191f0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
19200 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
19210 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
19220 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19230 20 6c 61 62 65 6c 2d 36 35 34 0d 0a 53 45 4c 45   label-654..SELE
19240 43 54 20 41 4c 4c 20 2b 20 74 61 62 32 2e 63 6f  CT ALL + tab2.co
19250 6c 32 20 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f  l2 + col1 DIV co
19260 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
19270 2d 2d 0d 0a 32 37 0d 0a 32 38 0d 0a 33 39 0d 0a  --..27..28..39..
19280 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
19290 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
192a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
192b0 20 6c 61 62 65 6c 2d 36 35 34 0d 0a 53 45 4c 45   label-654..SELE
192c0 43 54 20 41 4c 4c 20 2b 20 74 61 62 32 2e 63 6f  CT ALL + tab2.co
192d0 6c 32 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 31  l2 + col1 / col1
192e0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
192f0 0d 0a 32 37 0d 0a 32 38 0d 0a 33 39 0d 0a 0d 0a  ..27..28..39....
19300 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
19310 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
19320 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
19330 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
19340 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
19350 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19360 20 63 6f 6c 31 20 2b 20 74 61 62 32 2e 63 6f 6c   col1 + tab2.col
19370 32 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20  2 + - col0 col1 
19380 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
19390 0a 2d 32 34 0d 0a 35 31 0d 0a 37 0d 0a 0d 0a 71  .-24..51..7....q
193a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
193b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
193c0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  + + cor0.col2 + 
193d0 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
193e0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
193f0 31 36 34 0d 0a 32 0d 0a 36 36 0d 0a 0d 0a 71 75  164..2..66....qu
19400 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19410 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32 2e 63  ELECT ALL tab2.c
19420 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20  ol0 - - col2 AS 
19430 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
19440 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a  ----..104..117..
19450 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  34....onlyif mys
19460 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
19470 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
19480 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
19490 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
194a0 6c 2d 36 35 38 0d 0a 53 45 4c 45 43 54 20 2d 20  l-658..SELECT - 
194b0 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2d 20  cor0.col2 DIV - 
194c0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
194d0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
194e0 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a  ----..0..1..18..
194f0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
19500 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
19510 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19520 20 6c 61 62 65 6c 2d 36 35 38 0d 0a 53 45 4c 45   label-658..SELE
19530 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2f  CT - cor0.col2 /
19540 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
19550 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
19560 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31  0..----..0..1..1
19570 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  8....skipif post
19580 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
19590 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
195a0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
195b0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
195c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
195d0 45 4c 45 43 54 20 63 6f 6c 31 20 63 6f 6c 32 20  ELECT col1 col2 
195e0 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
195f0 4e 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 42 45 54  NOT NULL NOT BET
19600 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e 55  WEEN NULL AND NU
19610 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79  LL..----....only
19620 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
19630 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
19640 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
19650 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19660 74 20 6c 61 62 65 6c 2d 36 36 30 0d 0a 53 45 4c  t label-660..SEL
19670 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
19680 32 20 44 49 56 20 63 6f 6c 31 20 2d 20 2d 20 63  2 DIV col1 - - c
19690 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
196a0 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d  ---..86..91..97.
196b0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
196c0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
196d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
196e0 74 20 6c 61 62 65 6c 2d 36 36 30 0d 0a 53 45 4c  t label-660..SEL
196f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
19700 32 20 2f 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c  2 / col1 - - col
19710 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
19720 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d  -..86..91..97...
19730 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19740 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
19750 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 74 61  - tab0.col1 * ta
19760 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b0.col1 FROM tab
19770 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34 38 32 0d 0a  0..----..-7482..
19780 2d 38 33 37 32 0d 0a 2d 39 35 30 36 0d 0a 0d 0a  -8372..-9506....
19790 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
197a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
197b0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2d   col1 * - col0 -
197c0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41   col1 * - col0 A
197d0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
197e0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..----..0....ski
197f0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
19800 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
19810 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
19820 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
19830 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
19840 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
19850 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col1 col0 FROM t
19860 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20 4e 55  ab0 WHERE NOT NU
19870 4c 4c 20 3e 3d 20 2b 20 63 6f 6c 31 0d 0a 2d 2d  LL >= + col1..--
19880 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  --....onlyif mys
19890 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
198a0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
198b0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
198c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
198d0 6c 2d 36 36 34 0d 0a 53 45 4c 45 43 54 20 2b 20  l-664..SELECT + 
198e0 63 6f 6c 31 20 44 49 56 20 2b 20 74 61 62 31 2e  col1 DIV + tab1.
198f0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
19900 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab1..----..0.
19910 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
19920 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
19930 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
19940 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36  rowsort label-66
19950 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  4..SELECT + col1
19960 20 2f 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 41   / + tab1.col2 A
19970 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
19980 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
19990 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
199a0 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e  rt..SELECT tab0.
199b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
199c0 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 0d  tab1, tab2 cor0.
199d0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
199e0 20 68 61 73 68 69 6e 67 20 74 6f 20 39 66 63 31   hashing to 9fc1
199f0 64 63 64 37 36 66 65 61 66 34 33 65 35 63 35 64  dcd76feaf43e5c5d
19a00 63 30 36 30 61 30 32 30 31 34 63 64 0d 0a 0d 0a  c060a02014cd....
19a10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19a20 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d  .SELECT col2 * -
19a30 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c   cor0.col1 + col
19a40 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
19a50 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
19a60 2d 32 38 31 34 0d 0a 2d 36 32 0d 0a 2d 37 33 37  -2814..-62..-737
19a70 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  3....skipif post
19a80 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
19a90 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
19aa0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
19ab0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
19ac0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19ad0 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2d  ELECT - - col1 -
19ae0 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 28 20 63   cor0.col1 * ( c
19af0 6f 6c 30 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 ) col2 FROM 
19b00 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
19b10 2d 2d 0d 0a 2d 31 33 32 36 0d 0a 2d 31 38 36 0d  --..-1326..-186.
19b20 0a 2d 34 35 34 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-4543....onlyif
19b30 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
19b40 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
19b50 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
19b60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
19b70 6c 61 62 65 6c 2d 36 36 38 0d 0a 53 45 4c 45 43  label-668..SELEC
19b80 54 20 41 4c 4c 20 63 6f 6c 30 20 44 49 56 20 63  T ALL col0 DIV c
19b90 6f 6c 31 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 - col1 FROM 
19ba0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  tab1..----..-26.
19bb0 0a 2d 34 0d 0a 2d 37 0d 0a 0d 0a 73 6b 69 70 69  .-4..-7....skipi
19bc0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
19bd0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
19be0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
19bf0 36 36 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  668..SELECT ALL 
19c00 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 2d 20 63 6f  col0 / col1 - co
19c10 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
19c20 2d 2d 0d 0a 2d 32 36 0d 0a 2d 34 0d 0a 2d 37 0d  --..-26..-4..-7.
19c30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19c40 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
19c50 20 39 35 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20   95 - tab1.col1 
19c60 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * - col1 FROM ta
19c70 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 35 0d 0a 32  b1..----..195..2
19c80 36 34 0d 0a 37 37 31 0d 0a 0d 0a 6f 6e 6c 79 69  64..771....onlyi
19c90 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
19ca0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
19cb0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
19cc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19cd0 20 6c 61 62 65 6c 2d 36 37 30 0d 0a 53 45 4c 45   label-670..SELE
19ce0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
19cf0 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   * + col2 + - co
19d00 6c 32 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63  l2 DIV col1 AS c
19d10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
19d20 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37  ---..35..7298..7
19d30 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  92....skipif mys
19d40 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
19d50 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
19d60 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 30 0d 0a  sort label-670..
19d70 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
19d80 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  col0 * + col2 + 
19d90 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 41 53  - col2 / col1 AS
19da0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
19db0 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d  .----..35..7298.
19dc0 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49  .792....query II
19dd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19de0 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48  T * FROM tab1 WH
19df0 45 52 45 20 4e 4f 54 20 2b 20 63 6f 6c 31 20 3e  ERE NOT + col1 >
19e00 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d   ( NULL )..----.
19e10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19e20 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
19e30 31 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  1 + col0 * col1 
19e40 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  * col2 AS col1 F
19e50 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
19e60 33 36 34 39 30 0d 0a 34 32 33 38 0d 0a 39 39 38  36490..4238..998
19e70 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  53....onlyif mys
19e80 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
19e90 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
19ea0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
19eb0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
19ec0 6c 2d 36 37 33 0d 0a 53 45 4c 45 43 54 20 41 4c  l-673..SELECT AL
19ed0 4c 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20  L col2 DIV col0 
19ee0 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 46 52  + - tab2.col2 FR
19ef0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
19f00 32 34 0d 0a 2d 32 36 0d 0a 2d 33 38 0d 0a 0d 0a  24..-26..-38....
19f10 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
19f20 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
19f30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
19f40 61 62 65 6c 2d 36 37 33 0d 0a 53 45 4c 45 43 54  abel-673..SELECT
19f50 20 41 4c 4c 20 63 6f 6c 32 20 2f 20 63 6f 6c 30   ALL col2 / col0
19f60 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 46   + - tab2.col2 F
19f70 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
19f80 2d 32 34 0d 0a 2d 32 36 0d 0a 2d 33 38 0d 0a 0d  -24..-26..-38...
19f90 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
19fa0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
19fb0 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20  NCT * FROM tab2 
19fc0 57 48 45 52 45 20 63 6f 6c 32 20 2a 20 2d 20 63  WHERE col2 * - c
19fd0 6f 6c 30 20 3e 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d  ol0 >= NULL..---
19fe0 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
19ff0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1a000 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2b   col1 * col0 + +
1a010 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
1a020 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
1a030 30 39 37 0d 0a 33 33 39 36 0d 0a 38 31 38 31 0d  097..3396..8181.
1a040 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
1a050 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1a060 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  TINCT * FROM tab
1a070 31 20 57 48 45 52 45 20 4e 55 4c 4c 20 4e 4f 54  1 WHERE NULL NOT
1a080 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e   BETWEEN NULL AN
1a090 44 20 28 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  D ( col2 * + col
1a0a0 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  2 )..----....que
1a0b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a0c0 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20  LECT - col2 + + 
1a0d0 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS c
1a0e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
1a0f0 2d 2d 2d 0d 0a 33 34 0d 0a 37 32 31 36 0d 0a 37  ---..34..7216..7
1a100 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  59....query III 
1a110 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a120 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20  DISTINCT * FROM 
1a130 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 2d  tab2 WHERE NOT -
1a140 20 63 6f 6c 32 20 3d 20 2d 20 63 6f 6c 31 20 2b   col2 = - col1 +
1a150 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31 0d 0a   col2 / + col1..
1a160 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
1a170 61 73 68 69 6e 67 20 74 6f 20 61 64 30 35 62 35  ashing to ad05b5
1a180 39 34 32 34 30 30 64 35 65 37 61 32 31 62 33 32  942400d5e7a21b32
1a190 33 62 33 64 61 36 35 61 34 35 0d 0a 0d 0a 71 75  3b3da65a45....qu
1a1a0 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
1a1b0 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
1a1c0 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 28 20  ab2 WHERE NOT ( 
1a1d0 4e 55 4c 4c 20 29 20 42 45 54 57 45 45 4e 20 4e  NULL ) BETWEEN N
1a1e0 55 4c 4c 20 41 4e 44 20 28 20 63 6f 6c 31 20 29  ULL AND ( col1 )
1a1f0 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
1a200 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a210 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 63  T ALL col0 * + c
1a220 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ol0 + - col2 AS 
1a230 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
1a240 2d 2d 2d 2d 0d 0a 31 32 32 34 0d 0a 35 34 33 0d  ----..1224..543.
1a250 0a 37 38 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .7839....query I
1a260 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
1a270 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57  CT * FROM tab2 W
1a280 48 45 52 45 20 4e 4f 54 20 28 20 4e 55 4c 4c 20  HERE NOT ( NULL 
1a290 29 20 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f 6c  ) NOT IN ( + col
1a2a0 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  1 + - col0 * col
1a2b0 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  0 * + col1 + col
1a2c0 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  1 )..----....que
1a2d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a2e0 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 30 20 2d  LECT tab0.col0 -
1a2f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1a300 57 48 45 52 45 20 4e 4f 54 20 28 20 2d 20 63 6f  WHERE NOT ( - co
1a310 6c 32 20 29 20 49 4e 20 28 20 2b 20 63 6f 6c 30  l2 ) IN ( + col0
1a320 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32   * col0 + - col2
1a330 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 29   * col2 + col1 )
1a340 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
1a350 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1a360 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1a370 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1a380 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1a390 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
1a3a0 38 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  83..SELECT ALL -
1a3b0 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2a   col2 * - col2 *
1a3c0 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2d   - tab0.col2 + -
1a3d0 20 74 61 62 30 2e 63 6f 6c 31 20 44 49 56 20 63   tab0.col1 DIV c
1a3e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
1a3f0 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 33 35 39 34 30 0d  ---..-3..-35940.
1a400 0a 2d 35 35 31 33 36 39 0d 0a 0d 0a 73 6b 69 70  .-551369....skip
1a410 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1a420 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1a430 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1a440 2d 36 38 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -683..SELECT ALL
1a450 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32   - col2 * - col2
1a460 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2b   * - tab0.col2 +
1a470 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2f 20 63   - tab0.col1 / c
1a480 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
1a490 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 33 35 39 34 30 0d  ---..-3..-35940.
1a4a0 0a 2d 35 35 31 33 36 39 0d 0a 0d 0a 71 75 65 72  .-551369....quer
1a4b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a4c0 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 74 61 62  ECT - col0 + tab
1a4d0 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  0.col2 + - col0 
1a4e0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1a4f0 0a 2d 31 35 0d 0a 2d 36 39 0d 0a 2d 39 36 0d 0a  .-15..-69..-96..
1a500 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
1a510 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1a520 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52  * FROM tab2 WHER
1a530 45 20 28 20 63 6f 6c 30 20 29 20 49 4e 20 28 20  E ( col0 ) IN ( 
1a540 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20  - col1 * col1 * 
1a550 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col2 )..----....
1a560 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a570 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1a580 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 46   - col0 - col1 F
1a590 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 2d  ROM tab0 WHERE -
1a5a0 20 63 6f 6c 30 20 3c 3d 20 2d 20 63 6f 6c 30 20   col0 <= - col0 
1a5b0 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 2d 20  + tab0.col2 * - 
1a5c0 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 0d 0a 2d  col1 * - col0..-
1a5d0 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 33 32 0d  ---..-110..-132.
1a5e0 0a 2d 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-180....query I
1a5f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a600 20 63 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c   col1 + tab1.col
1a610 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  1 * - col0 * col
1a620 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
1a630 2d 0d 0a 2d 33 36 34 37 30 0d 0a 2d 34 31 38 36  -..-36470..-4186
1a640 0d 0a 2d 39 39 38 32 37 0d 0a 0d 0a 71 75 65 72  ..-99827....quer
1a650 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a660 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c  ECT + col2 - col
1a670 31 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  1 * + col1 * - c
1a680 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
1a690 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 34   tab0..----..244
1a6a0 31 30 31 0d 0a 36 37 39 31 32 34 0d 0a 39 34 31  101..679124..941
1a6b0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1a6c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1a6d0 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2b   - tab2.col0 * +
1a6e0 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a   col0 + + col0 *
1a6f0 20 2b 20 37 35 20 41 53 20 63 6f 6c 32 20 46 52   + 75 AS col2 FR
1a700 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
1a710 32 33 34 0d 0a 2d 33 31 36 0d 0a 34 37 36 0d 0a  234..-316..476..
1a720 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a730 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 38 30  t..SELECT - + 80
1a740 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1a750 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
1a760 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
1a770 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
1a780 6e 67 20 74 6f 20 34 64 64 65 33 62 64 35 36 35  ng to 4dde3bd565
1a790 32 64 33 30 33 39 36 62 39 63 61 64 64 30 65 32  2d30396b9cadd0e2
1a7a0 63 66 62 36 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  cfb680....onlyif
1a7b0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1a7c0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1a7d0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1a7e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1a7f0 6c 61 62 65 6c 2d 36 39 31 0d 0a 53 45 4c 45 43  label-691..SELEC
1a800 54 20 63 6f 6c 32 20 44 49 56 20 2b 20 74 61 62  T col2 DIV + tab
1a810 31 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2d 20  1.col2 + col1 - 
1a820 2d 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  - ( col1 ) FROM 
1a830 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a  tab1..----..21..
1a840 32 37 0d 0a 35 33 0d 0a 0d 0a 73 6b 69 70 69 66  27..53....skipif
1a850 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1a860 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1a870 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
1a880 39 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  91..SELECT col2 
1a890 2f 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20  / + tab1.col2 + 
1a8a0 63 6f 6c 31 20 2d 20 2d 20 28 20 63 6f 6c 31 20  col1 - - ( col1 
1a8b0 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
1a8c0 2d 0d 0a 32 31 0d 0a 32 37 0d 0a 35 33 0d 0a 0d  -..21..27..53...
1a8d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a8e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1a8f0 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  T - + cor0.col2 
1a900 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  * - cor0.col2 AS
1a910 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1a920 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
1a930 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  IN tab2 AS cor1.
1a940 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37 36  .----..1444..676
1a950 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..729....query I
1a960 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a970 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b   DISTINCT col0 +
1a980 20 2d 20 33 39 20 46 52 4f 4d 20 74 61 62 32 20   - 39 FROM tab2 
1a990 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1a9a0 33 32 0d 0a 33 39 0d 0a 34 30 0d 0a 0d 0a 71 75  32..39..40....qu
1a9b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a9c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1a9d0 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 28 20 63 6f   + col0 + - ( co
1a9e0 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  l0 ) FROM tab2 A
1a9f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1aa00 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1aa10 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1aa20 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1aa30 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1aa40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
1aa50 39 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  95..SELECT + - c
1aa60 6f 6c 31 20 2a 20 2b 20 37 34 20 2b 20 28 20 2b  ol1 * + 74 + ( +
1aa70 20 63 6f 6c 32 20 29 20 44 49 56 20 2b 20 63 6f   col2 ) DIV + co
1aa80 6c 31 20 2b 20 37 38 20 2a 20 63 6f 6c 32 20 46  l1 + 78 * col2 F
1aa90 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1aaa0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 38 0d 0a 2d 33  ..----..-338..-3
1aab0 37 39 30 0d 0a 2d 37 31 30 30 0d 0a 0d 0a 73 6b  790..-7100....sk
1aac0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1aad0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1aae0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1aaf0 65 6c 2d 36 39 35 0d 0a 53 45 4c 45 43 54 20 2b  el-695..SELECT +
1ab00 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 37 34 20 2b   - col1 * + 74 +
1ab10 20 28 20 2b 20 63 6f 6c 32 20 29 20 2f 20 2b 20   ( + col2 ) / + 
1ab20 63 6f 6c 31 20 2b 20 37 38 20 2a 20 63 6f 6c 32  col1 + 78 * col2
1ab30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1ab40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 38 0d 0a  r0..----..-338..
1ab50 2d 33 37 39 30 0d 0a 2d 37 31 30 30 0d 0a 0d 0a  -3790..-7100....
1ab60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ab70 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32  .SELECT - + col2
1ab80 20 2a 20 2d 20 32 20 2b 20 34 30 20 46 52 4f 4d   * - 2 + 40 FROM
1ab90 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1aba0 2d 2d 2d 0d 0a 31 30 36 0d 0a 32 30 34 0d 0a 34  ---..106..204..4
1abb0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1abc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1abd0 31 20 2a 20 28 20 2d 20 33 38 20 29 20 41 53 20  1 * ( - 38 ) AS 
1abe0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
1abf0 2d 2d 2d 2d 0d 0a 2d 33 32 36 38 0d 0a 2d 33 34  ----..-3268..-34
1ac00 35 38 0d 0a 2d 33 36 38 36 0d 0a 0d 0a 71 75 65  58..-3686....que
1ac10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ac20 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
1ac30 31 20 2a 20 35 31 20 46 52 4f 4d 20 74 61 62 30  1 * 51 FROM tab0
1ac40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ac50 34 33 38 36 0d 0a 34 36 34 31 0d 0a 34 39 34 37  4386..4641..4947
1ac60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ac70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
1ac80 6c 32 20 2a 20 2b 20 36 38 20 2b 20 2d 20 63 6f  l2 * + 68 + - co
1ac90 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
1aca0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1acb0 0a 33 36 31 38 0d 0a 33 38 31 39 0d 0a 36 34 33  .3618..3819..643
1acc0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1acd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
1ace0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d  ol1 + - col0 + -
1acf0 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29   ( + cor0.col1 )
1ad00 20 2a 20 2b 20 37 37 20 46 52 4f 4d 20 74 61 62   * + 77 FROM tab
1ad10 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
1ad20 33 37 31 0d 0a 2d 32 33 36 33 0d 0a 2d 34 35 36  371..-2363..-456
1ad30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1ad40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 36 20  sort..SELECT 66 
1ad50 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20  FROM tab1, tab2 
1ad60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
1ad70 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1ad80 32 39 37 39 34 39 31 35 62 35 38 35 65 65 61 38  29794915b585eea8
1ad90 34 38 61 64 36 37 30 30 37 35 34 35 32 63 38 38  48ad670075452c88
1ada0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1adb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1adc0 63 6f 6c 31 20 2d 20 28 20 2b 20 74 61 62 30 2e  col1 - ( + tab0.
1add0 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46  col1 ) AS col1 F
1ade0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1adf0 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
1ae00 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1ae10 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1ae20 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1ae30 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1ae40 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1ae50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 35 20 2a  ort..SELECT 65 *
1ae60 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32   - col2 * - col2
1ae70 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
1ae80 0a 2d 2d 2d 2d 0d 0a 34 33 39 34 30 0d 0a 34 37  .----..43940..47
1ae90 33 38 35 0d 0a 39 33 38 36 30 0d 0a 0d 0a 71 75  385..93860....qu
1aea0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1aeb0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1aec0 6f 6c 32 20 2d 20 2b 20 33 37 20 46 52 4f 4d 20  ol2 - + 37 FROM 
1aed0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d  tab0..----..-36.
1aee0 0a 2d 34 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72 79  .-4..45....query
1aef0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1af00 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
1af10 6c 30 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20  l0 - ( - col2 ) 
1af20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1af30 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37  0..----..-34..-7
1af40 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..9....query I r
1af50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1af60 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 2b 20   ( - col1 ) * + 
1af70 63 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 30 20  col2 + ( - col0 
1af80 29 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ) + + col2 FROM 
1af90 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33  tab1..----..-123
1afa0 32 0d 0a 2d 31 33 35 33 0d 0a 2d 35 37 37 0d 0a  2..-1353..-577..
1afb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1afc0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
1afd0 74 61 62 31 2e 63 6f 6c 32 20 2a 20 34 31 20 2d  tab1.col2 * 41 -
1afe0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
1aff0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 36 38 0d 0a  1..----..-2268..
1b000 2d 32 33 39 34 0d 0a 2d 34 30 33 32 0d 0a 0d 0a  -2394..-4032....
1b010 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
1b020 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
1b030 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
1b040 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
1b050 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
1b060 72 74 20 6c 61 62 65 6c 2d 37 30 38 0d 0a 53 45  rt label-708..SE
1b070 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2f 20 28 20  LECT + col1 / ( 
1b080 2b 20 63 6f 6c 30 20 29 20 2b 20 2b 20 43 41 53  + col0 ) + + CAS
1b090 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
1b0a0 44 20 29 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  D ) + + col2 AS 
1b0b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
1b0c0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
1b0d0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
1b0e0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1b0f0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1b100 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1b110 30 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  08..SELECT + col
1b120 31 20 2f 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b  1 / ( + col0 ) +
1b130 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
1b140 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20  S INTEGER ) + + 
1b150 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
1b160 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab2..----..NU
1b170 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
1b180 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1b190 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1b1a0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1b1b0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1b1c0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1b1d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b1e0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
1b1f0 6c 30 20 2d 20 2d 20 31 32 20 63 6f 6c 32 20 46  l0 - - 12 col2 F
1b200 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1b210 2d 31 32 0d 0a 2d 32 33 0d 0a 2d 37 37 0d 0a 0d  -12..-23..-77...
1b220 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b230 0d 0a 53 45 4c 45 43 54 20 35 36 20 2a 20 2b 20  ..SELECT 56 * + 
1b240 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63  col1 + col2 AS c
1b250 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
1b260 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31   cor0..----..151
1b270 30 0d 0a 36 31 37 0d 0a 38 32 34 0d 0a 0d 0a 73  0..617..824....s
1b280 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1b290 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1b2a0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1b2b0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1b2c0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1b2d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1b2e0 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  ALL - col1 + col
1b2f0 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  1 col2 FROM tab1
1b300 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1b310 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
1b320 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b330 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d  CT cor0.col0 + -
1b340 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 46   col1 * - col2 F
1b350 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1b360 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 38 0d 0a 31 34  ..----..1328..14
1b370 30 37 0d 0a 36 33 34 0d 0a 0d 0a 71 75 65 72 79  07..634....query
1b380 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b390 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
1b3a0 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   - - col2 AS col
1b3b0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1b3c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a  or0..----..171..
1b3d0 33 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20  36..57....query 
1b3e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b3f0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72  T DISTINCT + cor
1b400 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  0.col1 * - col2 
1b410 2a 20 2d 20 63 6f 6c 30 20 2d 20 37 36 20 41 53  * - col0 - 76 AS
1b420 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1b430 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1b440 31 39 35 37 36 0d 0a 35 30 39 35 38 0d 0a 35 37  19576..50958..57
1b450 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
1b460 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1b470 74 61 62 31 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30  tab1.col1 * col0
1b480 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
1b490 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1b4a0 0a 33 36 34 38 30 0d 0a 34 32 31 32 0d 0a 39 39  .36480..4212..99
1b4b0 38 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  840....skipif po
1b4c0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1b4d0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1b4e0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1b4f0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1b500 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b510 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1b520 20 2d 20 28 20 63 6f 6c 31 20 29 20 2d 20 63 6f   - ( col1 ) - co
1b530 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
1b540 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37  1..----..-29..-7
1b550 34 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20  4..-93....query 
1b560 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b570 54 20 2d 20 35 33 20 2a 20 63 6f 6c 30 20 46 52  T - 53 * col0 FR
1b580 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
1b590 31 32 37 32 0d 0a 2d 31 38 35 35 0d 0a 2d 34 37  1272..-1855..-47
1b5a0 31 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  17....onlyif mys
1b5b0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1b5c0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1b5d0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1b5e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1b5f0 6c 2d 37 31 38 0d 0a 53 45 4c 45 43 54 20 2b 20  l-718..SELECT + 
1b600 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 44 49  col0 - + col2 DI
1b610 56 20 28 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  V ( col1 + + col
1b620 31 20 2a 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f  1 * + col2 ) FRO
1b630 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1b640 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d  ----..3..64..80.
1b650 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1b660 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1b670 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b680 74 20 6c 61 62 65 6c 2d 37 31 38 0d 0a 53 45 4c  t label-718..SEL
1b690 45 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63  ECT + col0 - + c
1b6a0 6f 6c 32 20 2f 20 28 20 63 6f 6c 31 20 2b 20 2b  ol2 / ( col1 + +
1b6b0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 29   col1 * + col2 )
1b6c0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1b6d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d  r0..----..3..64.
1b6e0 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
1b6f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1b700 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d  ISTINCT col1 * -
1b710 20 63 6f 6c 30 20 2a 20 34 35 20 2b 20 2d 20 37   col0 * 45 + - 7
1b720 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  7 FROM tab2 AS c
1b730 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 31  or0..----..-2071
1b740 36 37 0d 0a 2d 36 30 35 31 32 0d 0a 2d 39 38 34  67..-60512..-984
1b750 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1b760 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1b770 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63  TINCT + col1 * c
1b780 6f 72 30 2e 63 6f 6c 31 20 2d 20 63 6f 6c 30 20  or0.col1 - col0 
1b790 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1b7a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1b7b0 0a 32 31 30 0d 0a 33 34 30 33 0d 0a 39 35 34 0d  .210..3403..954.
1b7c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b7d0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1b7e0 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 63  NCT - + col0 + c
1b7f0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol2 * + col2 FRO
1b800 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1b810 2d 2d 2d 2d 0d 0a 32 39 31 33 0d 0a 33 31 38 35  ----..2913..3185
1b820 0d 0a 39 31 33 36 0d 0a 0d 0a 71 75 65 72 79 20  ..9136....query 
1b830 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b840 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  T + col1 * + col
1b850 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  2 + cor0.col1 * 
1b860 2d 20 38 33 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 83 AS col0 FRO
1b870 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1b880 2d 2d 2d 2d 0d 0a 2d 32 36 30 0d 0a 2d 37 35 34  ----..-260..-754
1b890 0d 0a 31 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..169....query I
1b8a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b8b0 20 41 4c 4c 20 2d 20 2d 20 37 20 2a 20 2b 20 63   ALL - - 7 * + c
1b8c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
1b8d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 31   cor0..----..231
1b8e0 0d 0a 35 37 34 0d 0a 37 0d 0a 0d 0a 73 6b 69 70  ..574..7....skip
1b8f0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1b900 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1b910 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1b920 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1b930 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1b940 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1b950 20 31 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   10 col2 FROM ta
1b960 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1b970 0d 0a 31 30 0d 0a 31 30 0d 0a 31 30 0d 0a 0d 0a  ..10..10..10....
1b980 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b990 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
1b9a0 20 2b 20 63 6f 6c 30 20 2b 20 32 37 20 2a 20 2d   + col0 + 27 * -
1b9b0 20 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d   ( - col1 ) FROM
1b9c0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 39 31   tab1..----..391
1b9d0 0d 0a 35 32 37 0d 0a 37 35 39 0d 0a 0d 0a 71 75  ..527..759....qu
1b9e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b9f0 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
1ba00 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
1ba10 32 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  2 cor0, tab2 AS 
1ba20 63 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63 6f  cor1, tab1 AS co
1ba30 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  r2..----..81 val
1ba40 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61  ues hashing to a
1ba50 64 61 65 61 33 38 65 61 65 30 33 32 63 31 36 33  daea38eae032c163
1ba60 39 37 31 35 66 32 31 38 33 31 64 64 33 37 36 0d  9715f21831dd376.
1ba70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ba80 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1ba90 4e 43 54 20 2b 20 39 30 20 2a 20 2d 20 63 6f 6c  NCT + 90 * - col
1baa0 30 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  0 + col2 + - col
1bab0 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  1 * - cor0.col2 
1bac0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1bad0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1bae0 0a 2d 35 31 33 33 0d 0a 2d 35 38 35 36 0d 0a 31  .-5133..-5856..1
1baf0 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  188....query I r
1bb00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1bb10 20 31 39 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20   19 + cor0.col1 
1bb20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1bb30 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1bb40 0a 36 37 0d 0a 37 32 0d 0a 37 38 0d 0a 0d 0a 71  .67..72..78....q
1bb50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1bb60 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e  SELECT - + cor0.
1bb70 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 46 52  col0 + + col0 FR
1bb80 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1bb90 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
1bba0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bbb0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
1bbc0 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col1 + cor0.col
1bbd0 30 20 2a 20 2d 20 33 38 20 2d 20 63 6f 6c 31 20  0 * - 38 - col1 
1bbe0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1bbf0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1bc00 0a 2d 32 36 36 0d 0a 2d 32 39 36 34 0d 0a 2d 33  .-266..-2964..-3
1bc10 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
1bc20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
1bc30 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 29 20 2a   col1 + col2 ) *
1bc40 20 2d 20 33 30 20 46 52 4f 4d 20 74 61 62 31 0d   - 30 FROM tab1.
1bc50 0a 2d 2d 2d 2d 0d 0a 2d 32 30 31 30 0d 0a 2d 32  .----..-2010..-2
1bc60 34 30 30 0d 0a 2d 33 32 37 30 0d 0a 0d 0a 71 75  400..-3270....qu
1bc70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1bc80 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63  ELECT col2 + + c
1bc90 6f 6c 31 20 2b 20 38 36 20 46 52 4f 4d 20 74 61  ol1 + 86 FROM ta
1bca0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 0d 0a 31  b1..----..153..1
1bcb0 36 36 0d 0a 31 39 35 0d 0a 0d 0a 6f 6e 6c 79 69  66..195....onlyi
1bcc0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1bcd0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1bce0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1bcf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1bd00 20 6c 61 62 65 6c 2d 37 33 33 0d 0a 53 45 4c 45   label-733..SELE
1bd10 43 54 20 44 49 53 54 49 4e 43 54 20 31 32 20 2a  CT DISTINCT 12 *
1bd20 20 63 6f 6c 30 20 44 49 56 20 2b 20 32 38 20 2b   col0 DIV + 28 +
1bd30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
1bd40 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a 35 30 0d 0a 39  .----..34..50..9
1bd50 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
1bd60 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1bd70 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1bd80 6f 72 74 20 6c 61 62 65 6c 2d 37 33 33 0d 0a 53  ort label-733..S
1bd90 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 31  ELECT DISTINCT 1
1bda0 32 20 2a 20 63 6f 6c 30 20 2f 20 2b 20 32 38 20  2 * col0 / + 28 
1bdb0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
1bdc0 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a 35 30 0d 0a  ..----..34..50..
1bdd0 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
1bde0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1bdf0 36 34 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  64 + + col2 * co
1be00 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
1be10 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 37 34 0d 0a 33  0..----..2774..3
1be20 33 0d 0a 37 33 39 38 0d 0a 0d 0a 6f 6e 6c 79 69  3..7398....onlyi
1be30 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1be40 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1be50 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1be60 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1be70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1be80 62 65 6c 2d 37 33 35 0d 0a 53 45 4c 45 43 54 20  bel-735..SELECT 
1be90 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2d 20 63  DISTINCT + ( - c
1bea0 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 32 20 2a  ol1 ) + + col2 *
1beb0 20 2b 20 43 41 53 54 28 20 2d 20 35 35 20 41 53   + CAST( - 55 AS
1bec0 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
1bed0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1bee0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 39 36  or0..----..-2996
1bef0 0d 0a 2d 33 31 34 35 0d 0a 2d 35 32 39 33 0d 0a  ..-3145..-5293..
1bf00 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1bf10 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1bf20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1bf30 20 6c 61 62 65 6c 2d 37 33 35 0d 0a 53 45 4c 45   label-735..SELE
1bf40 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20  CT DISTINCT + ( 
1bf50 2d 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c  - col1 ) + + col
1bf60 32 20 2a 20 2b 20 43 41 53 54 20 28 20 2d 20 35  2 * + CAST ( - 5
1bf70 35 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  5 AS INTEGER ) A
1bf80 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1bf90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1bfa0 2d 32 39 39 36 0d 0a 2d 33 31 34 35 0d 0a 2d 35  -2996..-3145..-5
1bfb0 32 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  293....query I r
1bfc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1bfd0 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63  LL col0 * cor0.c
1bfe0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
1bff0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1c000 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d  ..35..7298..792.
1c010 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c020 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d  rt..SELECT + ( -
1c030 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53 20   cor0.col2 ) AS 
1c040 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
1c050 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a  or0..----..-26..
1c060 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 6f 6e 6c 79  -27..-38....only
1c070 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1c080 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1c090 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1c0a0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1c0b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1c0c0 61 62 65 6c 2d 37 33 38 0d 0a 53 45 4c 45 43 54  abel-738..SELECT
1c0d0 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28 20   DISTINCT CAST( 
1c0e0 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29  col1 AS SIGNED )
1c0f0 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
1c100 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1c110 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33  0..----..2064..3
1c120 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 73 6b 69  395..8099....ski
1c130 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1c140 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1c150 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1c160 6c 2d 37 33 38 0d 0a 53 45 4c 45 43 54 20 44 49  l-738..SELECT DI
1c170 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 63 6f  STINCT CAST ( co
1c180 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
1c190 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
1c1a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1c1b0 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33  ..----..2064..33
1c1c0 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72  95..8099....quer
1c1d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c1e0 45 43 54 20 41 4c 4c 20 2b 20 2b 20 28 20 2d 20  ECT ALL + + ( - 
1c1f0 38 33 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  83 ) AS col0 FRO
1c200 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1c210 2d 2d 2d 2d 0d 0a 2d 38 33 0d 0a 2d 38 33 0d 0a  ----..-83..-83..
1c220 2d 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -83....onlyif my
1c230 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
1c240 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
1c250 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
1c260 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
1c270 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1c280 37 34 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  740..SELECT ALL 
1c290 2d 20 2d 20 43 41 53 54 28 20 2b 20 37 32 20 41  - - CAST( + 72 A
1c2a0 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c  S SIGNED ) + col
1c2b0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
1c2c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 0d 0a  or0..----..126..
1c2d0 31 32 39 0d 0a 31 36 38 0d 0a 0d 0a 73 6b 69 70  129..168....skip
1c2e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1c2f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1c300 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1c310 2d 37 34 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -740..SELECT ALL
1c320 20 2d 20 2d 20 43 41 53 54 20 28 20 2b 20 37 32   - - CAST ( + 72
1c330 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
1c340 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1c350 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
1c360 36 0d 0a 31 32 39 0d 0a 31 36 38 0d 0a 0d 0a 71  6..129..168....q
1c370 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c380 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1c390 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  - ( + cor0.col0 
1c3a0 29 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 32 39 20  ) * col1 + - 29 
1c3b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1c3c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1c3d0 0a 2d 31 30 36 39 0d 0a 2d 31 30 37 0d 0a 2d 36  .-1069..-107..-6
1c3e0 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  69....query I ro
1c3f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1c400 63 6f 6c 31 20 2b 20 2b 20 32 32 20 46 52 4f 4d  col1 + + 22 FROM
1c410 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38   tab0..----..108
1c420 0d 0a 31 31 33 0d 0a 31 31 39 0d 0a 0d 0a 71 75  ..113..119....qu
1c430 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c440 45 4c 45 43 54 20 33 20 2a 20 2d 20 32 32 20 41  ELECT 3 * - 22 A
1c450 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
1c460 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c470 2d 36 36 0d 0a 2d 36 36 0d 0a 2d 36 36 0d 0a 0d  -66..-66..-66...
1c480 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1c490 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1c4a0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1c4b0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1c4c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 34  owsort label-744
1c4d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1c4e0 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 39 35 20  T - col2 DIV 95 
1c4f0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1c500 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
1c510 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1c520 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1c530 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 34 0d 0a  sort label-744..
1c540 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1c550 2d 20 63 6f 6c 32 20 2f 20 39 35 20 46 52 4f 4d  - col2 / 95 FROM
1c560 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
1c570 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c580 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 34  t..SELECT ALL 64
1c590 20 2d 20 38 35 20 46 52 4f 4d 20 74 61 62 30 2c   - 85 FROM tab0,
1c5a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1c5b0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
1c5c0 73 68 69 6e 67 20 74 6f 20 36 33 31 66 62 64 31  shing to 631fbd1
1c5d0 66 64 39 32 39 34 30 35 61 62 61 35 34 61 32 32  fd929405aba54a22
1c5e0 63 32 61 30 36 63 37 35 37 0d 0a 0d 0a 71 75 65  c2a06c757....que
1c5f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c600 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1c610 38 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  80 AS col1 FROM 
1c620 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72 30 0d  tab2, tab1 cor0.
1c630 0a 2d 2d 2d 2d 0d 0a 2d 38 30 0d 0a 0d 0a 6f 6e  .----..-80....on
1c640 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1c650 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1c660 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1c670 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1c680 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c690 20 6c 61 62 65 6c 2d 37 34 37 0d 0a 53 45 4c 45   label-747..SELE
1c6a0 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28 20 63  CT ALL - CAST( c
1c6b0 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol2 AS SIGNED ) 
1c6c0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
1c6d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1c6e0 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39  ..----..53..9..9
1c6f0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
1c700 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1c710 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1c720 6f 72 74 20 6c 61 62 65 6c 2d 37 34 37 0d 0a 53  ort label-747..S
1c730 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
1c740 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   ( col2 AS INTEG
1c750 45 52 20 29 20 2b 20 63 6f 6c 31 20 41 53 20 63  ER ) + col1 AS c
1c760 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1c770 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d   cor0..----..53.
1c780 0a 39 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  .9..96....onlyif
1c790 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1c7a0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1c7b0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1c7c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1c7d0 6c 61 62 65 6c 2d 37 34 38 0d 0a 53 45 4c 45 43  label-748..SELEC
1c7e0 54 20 2b 20 38 37 20 44 49 56 20 38 30 20 46 52  T + 87 DIV 80 FR
1c7f0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1c800 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a  .----..1..1..1..
1c810 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1c820 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1c830 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c840 20 6c 61 62 65 6c 2d 37 34 38 0d 0a 53 45 4c 45   label-748..SELE
1c850 43 54 20 2b 20 38 37 20 2f 20 38 30 20 46 52 4f  CT + 87 / 80 FRO
1c860 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1c870 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d  ----..1..1..1...
1c880 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c890 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28  ..SELECT ALL + (
1c8a0 20 2d 20 30 20 29 20 41 53 20 63 6f 6c 31 20 46   - 0 ) AS col1 F
1c8b0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1c8c0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
1c8d0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1c8e0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1c8f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c900 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1c910 43 54 20 2b 20 2b 20 43 41 53 54 20 28 20 63 6f  CT + + CAST ( co
1c920 6c 30 20 41 53 20 52 45 41 4c 20 29 20 2a 20 63  l0 AS REAL ) * c
1c930 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1c940 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34   cor0..----..134
1c950 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a  3..217..4602....
1c960 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c970 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1c980 20 37 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63   71 + + col1 * c
1c990 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1c9a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 36   cor0..----..746
1c9b0 37 0d 0a 38 33 35 32 0d 0a 39 34 38 30 0d 0a 0d  7..8352..9480...
1c9c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1c9d0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1c9e0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1c9f0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1ca00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35 32  owsort label-752
1ca10 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
1ca20 44 49 56 20 2b 20 37 39 20 41 53 20 63 6f 6c 30  DIV + 79 AS col0
1ca30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
1ca40 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d  .----..-1..0..0.
1ca50 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1ca60 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1ca70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ca80 74 20 6c 61 62 65 6c 2d 37 35 32 0d 0a 53 45 4c  t label-752..SEL
1ca90 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 37  ECT - col2 / + 7
1caa0 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  9 AS col0 FROM t
1cab0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1cac0 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  -1..0..0....quer
1cad0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1cae0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b  ECT ALL - col0 +
1caf0 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32   + col0 * + col2
1cb00 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
1cb10 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1cb20 0a 30 0d 0a 32 36 31 31 32 0d 0a 35 39 38 33 34  .0..26112..59834
1cb30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1cb40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 39  sort..SELECT ( 9
1cb50 36 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  6 ) AS col1 FROM
1cb60 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 39 36 0d   tab1..----..96.
1cb70 0a 39 36 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  .96..96....query
1cb80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cb90 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20  CT ALL + col0 + 
1cba0 2b 20 28 20 2d 20 38 39 20 29 20 41 53 20 63 6f  + ( - 89 ) AS co
1cbb0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
1cbc0 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 31 0d 0a 2d 38  --..-10..-11..-8
1cbd0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1cbe0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 20 41  sort..SELECT 8 A
1cbf0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
1cc00 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
1cc10 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
1cc20 61 73 68 69 6e 67 20 74 6f 20 66 66 63 35 62 34  ashing to ffc5b4
1cc30 63 39 38 62 35 37 61 65 35 34 36 35 32 31 31 37  c98b57ae54652117
1cc40 35 39 39 35 63 34 39 63 35 37 0d 0a 0d 0a 71 75  5995c49c57....qu
1cc50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1cc60 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
1cc70 30 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  0 - col1 * col0 
1cc80 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1cc90 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1cca0 0a 2d 31 34 32 32 0d 0a 2d 32 32 34 0d 0a 2d 34  .-1422..-224..-4
1ccb0 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  680....query I r
1ccc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1ccd0 20 34 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63   41 + + col0 * c
1cce0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
1ccf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d   cor0..----..-6.
1cd00 0a 37 32 35 37 0d 0a 37 35 31 0d 0a 0d 0a 71 75  .7257..751....qu
1cd10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1cd20 45 4c 45 43 54 20 2d 20 2b 20 33 31 20 2a 20 2b  ELECT - + 31 * +
1cd30 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c   col2 * cor0.col
1cd40 31 20 2b 20 31 36 20 41 53 20 63 6f 6c 31 20 46  1 + 16 AS col1 F
1cd50 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1cd60 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 31 33 30 36 0d  ..----..-231306.
1cd70 0a 2d 32 39 39 31 0d 0a 2d 38 37 39 36 32 0d 0a  .-2991..-87962..
1cd80 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1cd90 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1cda0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1cdb0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1cdc0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1cdd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cde0 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  CT - col1 * col1
1cdf0 20 2d 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46   - + col1 col2 F
1ce00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1ce10 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 36 0d 0a 2d 33  ..----..-306..-3
1ce20 35 34 30 0d 0a 2d 39 39 32 0d 0a 0d 0a 71 75 65  540..-992....que
1ce30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ce40 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1ce50 28 20 2d 20 63 6f 6c 31 20 29 20 2d 20 2b 20 63  ( - col1 ) - + c
1ce60 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
1ce70 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 0d 0a 71 75  ---..2..62....qu
1ce80 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
1ce90 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
1cea0 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c  ECT * FROM tab1,
1ceb0 20 74 61 62 30 20 63 6f 72 30 20 43 52 4f 53 53   tab0 cor0 CROSS
1cec0 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61 62 32   JOIN tab0, tab2
1ced0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
1cee0 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65  ----..3645 value
1cef0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 38 34  s hashing to f84
1cf00 32 36 63 64 34 64 30 31 62 61 39 36 61 37 32 64  26cd4d01ba96a72d
1cf10 37 33 34 38 35 37 34 66 62 62 63 38 65 0d 0a 0d  7348574fbbc8e...
1cf20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cf30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
1cf40 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  * + col1 + + col
1cf50 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1cf60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 31 0d  or0..----..-251.
1cf70 0a 2d 33 34 35 35 0d 0a 2d 39 33 34 0d 0a 0d 0a  .-3455..-934....
1cf80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1cf90 0a 53 45 4c 45 43 54 20 2b 20 31 34 20 2b 20 2b  .SELECT + 14 + +
1cfa0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63   cor0.col0 * - c
1cfb0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
1cfc0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1cfd0 2d 2d 2d 0d 0a 2d 31 32 31 31 0d 0a 2d 35 36 32  ---..-1211..-562
1cfe0 0d 0a 2d 37 39 30 37 0d 0a 0d 0a 73 6b 69 70 69  ..-7907....skipi
1cff0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1d000 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1d010 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1d020 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1d030 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1d040 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
1d050 20 2d 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46   - - col0 col1 F
1d060 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
1d070 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35  ---..121..176..5
1d080 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
1d090 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1d0a0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1d0b0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1d0c0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1d0d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d0e0 45 4c 45 43 54 20 38 34 20 2a 20 32 34 20 2b 20  ELECT 84 * 24 + 
1d0f0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 32  + cor0.col2 col2
1d100 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1d110 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 32 0d 0a  r0..----..2042..
1d120 32 30 34 33 0d 0a 32 30 35 34 0d 0a 0d 0a 6f 6e  2043..2054....on
1d130 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1d140 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1d150 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1d160 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1d170 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d180 20 6c 61 62 65 6c 2d 37 36 37 0d 0a 53 45 4c 45   label-767..SELE
1d190 43 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20  CT - CAST( NULL 
1d1a0 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20  AS SIGNED ) * + 
1d1b0 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 63 6f 6c 30  col1 + col2 col0
1d1c0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1d1d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1d1e0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
1d1f0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1d200 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1d210 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1d220 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1d230 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
1d240 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1d250 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1d260 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 36 37 0d  wsort label-767.
1d270 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28  .SELECT - CAST (
1d280 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
1d290 20 29 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f   ) * + col1 + co
1d2a0 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
1d2b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1d2c0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
1d2d0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
1d2e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
1d2f0 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 32  ol0 * - col1 + 2
1d300 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 * + col1 FROM 
1d310 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1d320 0a 31 37 31 37 0d 0a 35 39 30 30 0d 0a 38 39 39  .1717..5900..899
1d330 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d340 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1d350 2d 20 38 34 20 2a 20 63 6f 6c 30 20 2b 20 2b 20  - 84 * col0 + + 
1d360 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f  cor0.col0 * - co
1d370 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
1d380 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34  cor0..----..-144
1d390 30 30 0d 0a 2d 34 31 34 0d 0a 2d 39 30 32 34 0d  00..-414..-9024.
1d3a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d3b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1d3c0 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  NCT cor0.col0 + 
1d3d0 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 31 20 2b 20  col1 * ( col1 + 
1d3e0 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46  col2 ) AS col1 F
1d3f0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
1d400 2d 2d 2d 0d 0a 31 34 39 37 0d 0a 32 30 38 33 0d  ---..1497..2083.
1d410 0a 37 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .734....onlyif m
1d420 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1d430 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1d440 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1d450 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1d460 62 65 6c 2d 37 37 31 0d 0a 53 45 4c 45 43 54 20  bel-771..SELECT 
1d470 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20 63  DISTINCT - ( - c
1d480 6f 6c 30 20 29 20 2a 20 28 20 63 6f 6c 32 20 29  ol0 ) * ( col2 )
1d490 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f   - col2 DIV + co
1d4a0 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  r0.col2 AS col0 
1d4b0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1d4c0 2d 2d 2d 2d 0d 0a 33 34 0d 0a 37 32 39 37 0d 0a  ----..34..7297..
1d4d0 37 39 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  791....skipif my
1d4e0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1d4f0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1d500 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 31 0d  wsort label-771.
1d510 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1d520 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20   - ( - col0 ) * 
1d530 28 20 63 6f 6c 32 20 29 20 2d 20 63 6f 6c 32 20  ( col2 ) - col2 
1d540 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  / + cor0.col2 AS
1d550 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1d560 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a  cor0..----..34..
1d570 37 32 39 37 0d 0a 37 39 31 0d 0a 0d 0a 6f 6e 6c  7297..791....onl
1d580 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
1d590 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
1d5a0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
1d5b0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
1d5c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1d5d0 6c 61 62 65 6c 2d 37 37 32 0d 0a 53 45 4c 45 43  label-772..SELEC
1d5e0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
1d5f0 31 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53  1 * col2 * + CAS
1d600 54 28 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47  T( + col0 AS SIG
1d610 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2b  NED ) + - col0 +
1d620 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
1d630 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1d640 31 39 36 33 33 0d 0a 35 30 39 37 32 0d 0a 35 38  19633..50972..58
1d650 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  83....skipif mys
1d660 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1d670 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1d680 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 32 0d 0a  sort label-772..
1d690 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1d6a0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20  + col1 * col2 * 
1d6b0 2b 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 30 20  + CAST ( + col0 
1d6c0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d  AS INTEGER ) + -
1d6d0 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f   col0 + col1 FRO
1d6e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1d6f0 2d 2d 2d 2d 0d 0a 31 31 39 36 33 33 0d 0a 35 30  ----..119633..50
1d700 39 37 32 0d 0a 35 38 38 33 0d 0a 0d 0a 71 75 65  972..5883....que
1d710 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d720 4c 45 43 54 20 2d 20 28 20 63 6f 6c 30 20 29 20  LECT - ( col0 ) 
1d730 2b 20 2d 20 39 35 20 41 53 20 63 6f 6c 30 20 46  + - 95 AS col0 F
1d740 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1d750 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d 31  ..----..-159..-1
1d760 37 35 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79  75..-98....query
1d770 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d780 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
1d790 2b 20 63 6f 6c 31 20 29 20 2b 20 63 6f 72 30 2e  + col1 ) + cor0.
1d7a0 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS c
1d7b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1d7c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36   cor0..----..136
1d7d0 0d 0a 33 36 33 38 0d 0a 37 36 36 37 0d 0a 0d 0a  ..3638..7667....
1d7e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d7f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 31 36  .SELECT ALL + 16
1d800 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
1d810 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
1d820 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
1d830 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1d840 74 6f 20 65 65 35 62 64 65 39 66 36 38 65 65 38  to ee5bde9f68ee8
1d850 32 38 65 38 63 64 38 36 62 30 64 35 39 30 30 39  28e8cd86b0d59009
1d860 30 62 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  0bc....query I r
1d870 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1d880 4c 4c 20 2d 20 38 33 20 46 52 4f 4d 20 74 61 62  LL - 83 FROM tab
1d890 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  1, tab0 AS cor0,
1d8a0 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
1d8b0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
1d8c0 61 73 68 69 6e 67 20 74 6f 20 37 37 61 34 38 61  ashing to 77a48a
1d8d0 64 37 32 32 64 62 31 32 32 66 35 31 64 35 65 66  d722db122f51d5ef
1d8e0 33 36 36 30 34 61 64 38 34 33 0d 0a 0d 0a 71 75  36604ad843....qu
1d8f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d900 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 28 20 32  ELECT col0 * ( 2
1d910 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
1d920 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1d930 2d 2d 2d 0d 0a 31 38 36 39 0d 0a 35 30 34 0d 0a  ---..1869..504..
1d940 37 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  735....query I r
1d950 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1d960 20 2d 20 63 6f 6c 31 20 2a 20 35 31 20 2a 20 2b   - col1 * 51 * +
1d970 20 34 36 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b   46 + - col0 + +
1d980 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
1d990 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
1d9a0 2d 2d 0d 0a 31 33 38 33 36 32 0d 0a 33 39 38 34  --..138362..3984
1d9b0 31 0d 0a 37 32 37 34 36 0d 0a 0d 0a 6f 6e 6c 79  1..72746....only
1d9c0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1d9d0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1d9e0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1d9f0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1da00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1da10 61 62 65 6c 2d 37 37 39 0d 0a 53 45 4c 45 43 54  abel-779..SELECT
1da20 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20 43 41   ALL col2 * - CA
1da30 53 54 28 20 2b 20 63 6f 6c 30 20 41 53 20 53 49  ST( + col0 AS SI
1da40 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 72 30 2e  GNED ) * - cor0.
1da50 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
1da60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d  or0..----..1225.
1da70 0a 31 39 30 30 38 0d 0a 36 34 39 35 32 32 0d 0a  .19008..649522..
1da80 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1da90 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1daa0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1dab0 20 6c 61 62 65 6c 2d 37 37 39 0d 0a 53 45 4c 45   label-779..SELE
1dac0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20  CT ALL col2 * - 
1dad0 43 41 53 54 20 28 20 2b 20 63 6f 6c 30 20 41 53  CAST ( + col0 AS
1dae0 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63   INTEGER ) * - c
1daf0 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
1db00 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
1db10 32 32 35 0d 0a 31 39 30 30 38 0d 0a 36 34 39 35  225..19008..6495
1db20 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  22....query I ro
1db30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1db40 74 61 62 31 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32  tab1.col1 * col2
1db50 20 2a 20 31 33 20 46 52 4f 4d 20 74 61 62 31 0d   * 13 FROM tab1.
1db60 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 32 34 0d 0a 2d  .----..-16224..-
1db70 31 38 32 35 32 0d 0a 2d 37 34 31 30 0d 0a 0d 0a  18252..-7410....
1db80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1db90 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
1dba0 20 2a 20 2b 20 30 20 46 52 4f 4d 20 74 61 62 30   * + 0 FROM tab0
1dbb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1dbc0 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
1dbd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1dbe0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
1dbf0 20 2a 20 28 20 2d 20 63 6f 6c 31 20 29 20 46 52   * ( - col1 ) FR
1dc00 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1dc10 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31  .----..-1248..-1
1dc20 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 6f 6e 6c  404..-570....onl
1dc30 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1dc40 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1dc50 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1dc60 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1dc70 72 74 20 6c 61 62 65 6c 2d 37 38 33 0d 0a 53 45  rt label-783..SE
1dc80 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 72  LECT ALL + + cor
1dc90 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 44 49  0.col2 * col2 DI
1dca0 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  V col0 AS col0 F
1dcb0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1dcc0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 0d 0a 35 30 0d  ..----..115..50.
1dcd0 0a 39 37 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .972....skipif m
1dce0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1dcf0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1dd00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 33  owsort label-783
1dd10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
1dd20 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c   cor0.col2 * col
1dd30 32 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  2 / col0 AS col0
1dd40 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1dd50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 0d 0a 35  r0..----..115..5
1dd60 30 0d 0a 39 37 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  0..972....onlyif
1dd70 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1dd80 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1dd90 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1dda0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1ddb0 6c 61 62 65 6c 2d 37 38 34 0d 0a 53 45 4c 45 43  label-784..SELEC
1ddc0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
1ddd0 32 20 44 49 56 20 2d 20 38 36 20 41 53 20 63 6f  2 DIV - 86 AS co
1dde0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
1ddf0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b  0..----..0....sk
1de00 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1de10 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1de20 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1de30 65 6c 2d 37 38 34 0d 0a 53 45 4c 45 43 54 20 44  el-784..SELECT D
1de40 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2f  ISTINCT - col2 /
1de50 20 2d 20 38 36 20 41 53 20 63 6f 6c 32 20 46 52   - 86 AS col2 FR
1de60 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1de70 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  --..0....query I
1de80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1de90 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   ALL cor0.col2 +
1dea0 20 2b 20 32 34 20 2a 20 63 6f 72 30 2e 63 6f 6c   + 24 * cor0.col
1deb0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
1dec0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1ded0 2d 0d 0a 32 32 31 38 0d 0a 36 30 39 0d 0a 38 34  -..2218..609..84
1dee0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1def0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
1df00 6f 6c 31 20 2a 20 2d 20 38 37 20 46 52 4f 4d 20  ol1 * - 87 FROM 
1df10 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1df20 0a 2d 31 34 37 39 0d 0a 2d 32 36 39 37 0d 0a 2d  .-1479..-2697..-
1df30 35 31 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5133....query I 
1df40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1df50 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  - col2 + + col1 
1df60 2a 20 2d 20 28 20 2d 20 63 6f 6c 31 20 2b 20 2b  * - ( - col1 + +
1df70 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
1df80 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1df90 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d  .-1..-33..-82...
1dfa0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1dfb0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1dfc0 54 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  T cor0.col1 AS c
1dfd0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
1dfe0 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
1dff0 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20  1 AS cor1, tab0 
1e000 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor2..----..8
1e010 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65  6..91..97....que
1e020 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e030 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72  LECT ALL - + cor
1e040 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
1e050 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab0 cor0..---
1e060 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
1e070 69 6e 67 20 74 6f 20 30 39 64 38 61 39 31 32 64  ing to 09d8a912d
1e080 65 31 62 38 61 62 37 36 32 65 35 66 66 62 65 30  e1b8ab762e5ffbe0
1e090 32 38 63 65 39 39 65 0d 0a 0d 0a 71 75 65 72 79  28ce99e....query
1e0a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e0b0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
1e0c0 63 6f 6c 31 20 2a 20 28 20 2b 20 63 6f 6c 31 20  col1 * ( + col1 
1e0d0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
1e0e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d  or0..----..-100.
1e0f0 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 71  .-169..-676....q
1e100 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e110 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1e120 39 35 20 2a 20 38 38 20 2a 20 63 6f 6c 31 20 46  95 * 88 * col1 F
1e130 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1e140 0d 0a 2d 2d 2d 2d 0d 0a 37 31 38 39 36 30 0d 0a  ..----..718960..
1e150 37 36 30 37 36 30 0d 0a 38 31 30 39 32 30 0d 0a  760760..810920..
1e160 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e170 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1e180 43 54 20 63 6f 6c 30 20 2a 20 2d 20 38 38 20 46  CT col0 * - 88 F
1e190 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1e1a0 2d 32 31 31 32 0d 0a 2d 33 30 38 30 0d 0a 2d 37  -2112..-3080..-7
1e1b0 38 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  832....query I r
1e1c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1e1d0 20 36 33 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f   63 * + col0 FRO
1e1e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1e1f0 2d 2d 2d 2d 0d 0a 2d 31 35 31 32 0d 0a 2d 32 32  ----..-1512..-22
1e200 30 35 0d 0a 2d 35 36 30 37 0d 0a 0d 0a 71 75 65  05..-5607....que
1e210 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e220 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 72  LECT ALL + + cor
1e230 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  0.col1 * - col2 
1e240 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1e250 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1e260 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38  .-1534..-646..-8
1e270 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
1e280 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1e290 4c 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  L - col0 * + col
1e2a0 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
1e2b0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1e2c0 0d 0a 2d 31 37 37 35 30 34 0d 0a 2d 33 32 39 33  ..-177504..-3293
1e2d0 31 35 0d 0a 2d 37 33 37 30 30 39 0d 0a 0d 0a 71  15..-737009....q
1e2e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e2f0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
1e300 63 6f 6c 32 20 2b 20 2d 20 28 20 28 20 2d 20 63  col2 + - ( ( - c
1e310 6f 6c 30 20 29 20 29 20 41 53 20 63 6f 6c 30 20  ol0 ) ) AS col0 
1e320 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1e330 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 30 39 0d 0a  0..----..-7209..
1e340 2d 37 36 38 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  -768..0....query
1e350 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e360 43 54 20 2b 20 36 20 41 53 20 63 6f 6c 32 20 46  CT + 6 AS col2 F
1e370 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41  ROM tab1, tab2 A
1e380 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
1e390 4e 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  N tab0, tab1 AS 
1e3a0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor1..----..81 v
1e3b0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1e3c0 20 34 34 66 32 33 33 64 31 62 33 38 30 34 65 30   44f233d1b3804e0
1e3d0 30 64 39 34 33 36 63 30 61 34 31 64 31 65 32 63  0d9436c0a41d1e2c
1e3e0 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
1e3f0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
1e400 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
1e410 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
1e420 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
1e430 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39  rowsort label-79
1e440 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41  8..SELECT ALL CA
1e450 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
1e460 45 44 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63  ED ) * col2 AS c
1e470 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
1e480 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
1e490 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
1e4a0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1e4b0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1e4c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39  rowsort label-79
1e4d0 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41  8..SELECT ALL CA
1e4e0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
1e4f0 45 47 45 52 20 29 20 2a 20 63 6f 6c 32 20 41 53  EGER ) * col2 AS
1e500 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
1e510 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
1e520 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
1e530 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e540 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a  CT - tab2.col1 *
1e550 20 63 6f 6c 30 20 2b 20 2d 20 34 36 20 2d 20 2b   col0 + - 46 - +
1e560 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
1e570 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
1e580 31 34 32 37 0d 0a 2d 32 39 30 0d 0a 2d 34 36 37  1427..-290..-467
1e590 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1e5a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1e5b0 20 2d 20 2d 20 28 20 2b 20 31 35 20 29 20 2a 20   - - ( + 15 ) * 
1e5c0 2b 20 63 6f 6c 32 20 2a 20 31 32 20 41 53 20 63  + col2 * 12 AS c
1e5d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
1e5e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 36 38   cor0..----..468
1e5f0 30 0d 0a 34 38 36 30 0d 0a 36 38 34 30 0d 0a 0d  0..4860..6840...
1e600 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1e610 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1e620 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1e630 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1e640 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1e650 6f 72 74 20 6c 61 62 65 6c 2d 38 30 31 0d 0a 53  ort label-801..S
1e660 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
1e670 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   * - cor0.col0 +
1e680 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 28 20   col0 + - CAST( 
1e690 2b 20 38 31 20 41 53 20 53 49 47 4e 45 44 20 29  + 81 AS SIGNED )
1e6a0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1e6b0 0a 2d 2d 2d 2d 0d 0a 2d 32 31 32 31 0d 0a 2d 33  .----..-2121..-3
1e6c0 34 34 31 0d 0a 2d 38 30 39 31 0d 0a 0d 0a 73 6b  441..-8091....sk
1e6d0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1e6e0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1e6f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1e700 65 6c 2d 38 30 31 0d 0a 53 45 4c 45 43 54 20 41  el-801..SELECT A
1e710 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  LL + col1 * - co
1e720 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b  r0.col0 + col0 +
1e730 20 2d 20 43 41 53 54 20 28 20 2b 20 38 31 20 41   - CAST ( + 81 A
1e740 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
1e750 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1e760 0d 0a 2d 32 31 32 31 0d 0a 2d 33 34 34 31 0d 0a  ..-2121..-3441..
1e770 2d 38 30 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -8091....onlyif 
1e780 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1e790 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1e7a0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1e7b0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1e7c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1e7d0 6c 2d 38 30 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-802..SELECT AL
1e7e0 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  L - cor0.col1 * 
1e7f0 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  col2 + cor0.col2
1e800 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
1e810 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
1e820 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1e830 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
1e840 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
1e850 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1e860 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1e870 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 32 0d  wsort label-802.
1e880 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
1e890 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b  r0.col1 * col2 +
1e8a0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 43 41 53   cor0.col2 + CAS
1e8b0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
1e8c0 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 20  GER ) FROM tab2 
1e8d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
1e8e0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
1e8f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e900 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1e910 4e 43 54 20 2b 20 39 32 20 2b 20 36 31 20 2a 20  NCT + 92 + 61 * 
1e920 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1e930 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
1e940 35 36 0d 0a 32 32 32 37 0d 0a 35 35 32 31 0d 0a  56..2227..5521..
1e950 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e960 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
1e970 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l2 * - cor0.col2
1e980 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   - col1 * - col0
1e990 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1e9a0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
1e9b0 33 37 35 0d 0a 33 33 39 34 0d 0a 39 37 35 0d 0a  375..3394..975..
1e9c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e9d0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
1e9e0 2e 63 6f 6c 31 20 2a 20 2d 20 31 39 20 46 52 4f  .col1 * - 19 FRO
1e9f0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1ea00 2d 2d 2d 2d 0d 0a 2d 31 31 32 31 0d 0a 2d 33 32  ----..-1121..-32
1ea10 33 0d 0a 2d 35 38 39 0d 0a 0d 0a 6f 6e 6c 79 69  3..-589....onlyi
1ea20 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1ea30 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1ea40 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1ea50 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1ea60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1ea70 62 65 6c 2d 38 30 36 0d 0a 53 45 4c 45 43 54 20  bel-806..SELECT 
1ea80 44 49 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e  DISTINCT - tab0.
1ea90 63 6f 6c 31 20 2d 20 43 41 53 54 28 20 4e 55 4c  col1 - CAST( NUL
1eaa0 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  L AS SIGNED ) * 
1eab0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
1eac0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
1ead0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1eae0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1eaf0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1eb00 65 6c 2d 38 30 36 0d 0a 53 45 4c 45 43 54 20 44  el-806..SELECT D
1eb10 49 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e 63  ISTINCT - tab0.c
1eb20 6f 6c 31 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  ol1 - CAST ( NUL
1eb30 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
1eb40 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
1eb50 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
1eb60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1eb70 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
1eb80 6f 72 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or2.col2 FROM ta
1eb90 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b0 AS cor0 CROSS
1eba0 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61 62 30   JOIN tab1, tab0
1ebb0 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30 2c 20   AS cor1, tab0, 
1ebc0 74 61 62 30 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  tab0 cor2..----.
1ebd0 0a 32 34 33 20 76 61 6c 75 65 73 20 68 61 73 68  .243 values hash
1ebe0 69 6e 67 20 74 6f 20 32 39 31 63 64 66 32 30 66  ing to 291cdf20f
1ebf0 35 35 64 63 37 62 62 63 62 35 35 66 35 36 31 64  55dc7bbcb55f561d
1ec00 63 30 62 37 34 64 38 0d 0a 0d 0a 71 75 65 72 79  c0b74d8....query
1ec10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ec20 43 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 30  CT ALL tab0.col0
1ec30 20 2d 20 28 20 2d 20 39 39 20 29 20 2a 20 2d 20   - ( - 99 ) * - 
1ec40 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
1ec50 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab0..----..-3
1ec60 32 34 33 0d 0a 2d 36 34 0d 0a 2d 38 30 32 39 0d  243..-64..-8029.
1ec70 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1ec80 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1ec90 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1eca0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1ecb0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1ecc0 30 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74  09..SELECT ALL t
1ecd0 61 62 31 2e 63 6f 6c 30 20 44 49 56 20 63 6f 6c  ab1.col0 DIV col
1ece0 31 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 28 20 2d  1 + col2 + + ( -
1ecf0 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 29 20 41   col0 * col1 ) A
1ed00 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
1ed10 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 35 37  ..----..-24..-57
1ed20 37 0d 0a 2d 39 33 38 0d 0a 0d 0a 73 6b 69 70 69  7..-938....skipi
1ed30 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1ed40 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1ed50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1ed60 38 30 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  809..SELECT ALL 
1ed70 74 61 62 31 2e 63 6f 6c 30 20 2f 20 63 6f 6c 31  tab1.col0 / col1
1ed80 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 28 20 2d 20   + col2 + + ( - 
1ed90 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 29 20 41 53  col0 * col1 ) AS
1eda0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
1edb0 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 35 37 37  .----..-24..-577
1edc0 0d 0a 2d 39 33 38 0d 0a 0d 0a 71 75 65 72 79 20  ..-938....query 
1edd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ede0 54 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 41 53  T - tab2.col2 AS
1edf0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c   col1 FROM tab2,
1ee00 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
1ee10 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
1ee20 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
1ee30 68 69 6e 67 20 74 6f 20 66 39 64 34 62 62 38 36  hing to f9d4bb86
1ee40 37 37 64 62 37 62 39 38 63 37 65 64 38 39 64 30  77db7b98c7ed89d0
1ee50 36 65 36 65 38 63 64 36 0d 0a 0d 0a 71 75 65 72  6e6e8cd6....quer
1ee60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1ee70 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
1ee80 30 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 46  0 + ( - col0 ) F
1ee90 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1eea0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1eeb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1eec0 20 63 6f 6c 32 20 2b 20 33 32 20 2a 20 2b 20 63   col2 + 32 * + c
1eed0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
1eee0 2d 2d 2d 0d 0a 31 30 38 39 0d 0a 32 37 30 36 0d  ---..1089..2706.
1eef0 0a 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .33....query I r
1ef00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1ef10 6f 6c 30 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c  ol0 + - tab2.col
1ef20 31 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  1 + + col1 AS co
1ef30 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
1ef40 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d  --..7..78..79...
1ef50 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1ef60 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1ef70 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1ef80 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1ef90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 34  owsort label-814
1efa0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28  ..SELECT ALL + (
1efb0 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 31   col1 ) + - col1
1efc0 20 44 49 56 20 34 37 20 41 53 20 63 6f 6c 31 20   DIV 47 AS col1 
1efd0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1efe0 0a 38 35 0d 0a 39 30 0d 0a 39 35 0d 0a 0d 0a 73  .85..90..95....s
1eff0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1f000 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1f010 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1f020 62 65 6c 2d 38 31 34 0d 0a 53 45 4c 45 43 54 20  bel-814..SELECT 
1f030 41 4c 4c 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b  ALL + ( col1 ) +
1f040 20 2d 20 63 6f 6c 31 20 2f 20 34 37 20 41 53 20   - col1 / 47 AS 
1f050 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
1f060 2d 2d 2d 2d 0d 0a 38 35 0d 0a 39 30 0d 0a 39 35  ----..85..90..95
1f070 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f080 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1f090 49 4e 43 54 20 35 38 20 2b 20 74 61 62 31 2e 63  INCT 58 + tab1.c
1f0a0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
1f0b0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32   tab1..----..112
1f0c0 0d 0a 31 31 35 0d 0a 31 35 34 0d 0a 0d 0a 71 75  ..115..154....qu
1f0d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f0e0 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c  ELECT col2 * col
1f0f0 31 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 35 34 20  1 + col0 * - 54 
1f100 2a 20 2b 20 33 35 20 2d 20 63 6f 6c 31 20 46 52  * + 35 - col1 FR
1f110 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1f120 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 32 34 0d 0a 2d  .----..-12424..-
1f130 31 34 35 39 34 35 0d 0a 2d 31 34 38 36 38 31 0d  145945..-148681.
1f140 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f150 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1f160 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63   ( + col0 ) AS c
1f170 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
1f180 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d  r0..----..-24..-
1f190 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79  35..-89....query
1f1a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f1b0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
1f1c0 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63  r0.col2 * cor0.c
1f1d0 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ol0 + cor0.col2 
1f1e0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1f1f0 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  1, tab1 AS cor0.
1f200 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 33 35  .----..-108..-35
1f210 39 31 0d 0a 2d 37 35 38 34 0d 0a 0d 0a 6f 6e 6c  91..-7584....onl
1f220 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
1f230 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
1f240 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
1f250 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
1f260 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1f270 6c 61 62 65 6c 2d 38 31 39 0d 0a 53 45 4c 45 43  label-819..SELEC
1f280 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b  T DISTINCT - ( +
1f290 20 39 38 20 29 20 2b 20 2b 20 63 6f 6c 30 20 2a   98 ) + + col0 *
1f2a0 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
1f2b0 20 44 45 43 49 4d 41 4c 20 29 20 46 52 4f 4d 20   DECIMAL ) FROM 
1f2c0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1f2d0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
1f2e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1f2f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1f300 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1f310 2d 38 31 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  -819..SELECT DIS
1f320 54 49 4e 43 54 20 2d 20 28 20 2b 20 39 38 20 29  TINCT - ( + 98 )
1f330 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41   + + col0 * - CA
1f340 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
1f350 4c 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  L ) FROM tab2 AS
1f360 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1f370 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
1f380 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1f390 54 49 4e 43 54 20 2d 20 38 35 20 2b 20 63 6f 6c  TINCT - 85 + col
1f3a0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
1f3b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1f3c0 2d 0d 0a 2d 35 39 0d 0a 2d 37 32 0d 0a 2d 37 35  -..-59..-72..-75
1f3d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f3e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
1f3f0 6c 32 20 2d 20 33 33 20 41 53 20 63 6f 6c 32 20  l2 - 33 AS col2 
1f400 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1f410 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 39 0d 0a 2d 36  0..----..-59..-6
1f420 30 0d 0a 2d 37 31 0d 0a 0d 0a 71 75 65 72 79 20  0..-71....query 
1f430 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f440 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 35 35 20  T - col2 * - 55 
1f450 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1f460 0a 32 39 37 30 0d 0a 33 31 33 35 0d 0a 35 32 38  .2970..3135..528
1f470 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
1f480 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
1f490 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
1f4a0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
1f4b0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
1f4c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32  rowsort label-82
1f4d0 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
1f4e0 43 54 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20  CT + ( col0 ) * 
1f4f0 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  - col1 * - col2 
1f500 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  + + col0 * col1 
1f510 2a 20 2d 20 43 41 53 54 28 20 2b 20 63 6f 6c 32  * - CAST( + col2
1f520 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
1f530 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab1..----..0.
1f540 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1f550 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1f560 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f570 74 20 6c 61 62 65 6c 2d 38 32 33 0d 0a 53 45 4c  t label-823..SEL
1f580 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28  ECT DISTINCT + (
1f590 20 63 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 31   col0 ) * - col1
1f5a0 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   * - col2 + + co
1f5b0 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 43 41  l0 * col1 * - CA
1f5c0 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 49  ST ( + col2 AS I
1f5d0 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
1f5e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71  b1..----..0....q
1f5f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f600 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1f610 2d 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20 63  - tab1.col0 AS c
1f620 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
1f630 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
1f640 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
1f650 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d  .-3..-64..-80...
1f660 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f670 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
1f680 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52  - col2 + col0 FR
1f690 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
1f6a0 31 35 39 0d 0a 2d 33 35 38 34 0d 0a 2d 37 36 30  159..-3584..-760
1f6b0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1f6c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 38 20  sort..SELECT 18 
1f6d0 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  - col2 AS col2 F
1f6e0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1f6f0 2d 33 36 0d 0a 2d 33 39 0d 0a 2d 37 38 0d 0a 0d  -36..-39..-78...
1f700 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1f710 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1f720 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1f730 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1f740 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1f750 6f 72 74 20 6c 61 62 65 6c 2d 38 32 37 0d 0a 53  ort label-827..S
1f760 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c  ELECT col0 + col
1f770 32 20 2a 20 2b 20 43 41 53 54 28 20 63 6f 6c 32  2 * + CAST( col2
1f780 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
1f790 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
1f7a0 2d 2d 2d 2d 0d 0a 32 39 31 39 0d 0a 33 33 31 33  ----..2919..3313
1f7b0 0d 0a 39 32 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  ..9296....skipif
1f7c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1f7d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1f7e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1f7f0 32 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  27..SELECT col0 
1f800 2b 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 20  + col2 * + CAST 
1f810 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45  ( col2 AS INTEGE
1f820 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  R ) AS col1 FROM
1f830 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31   tab1..----..291
1f840 39 0d 0a 33 33 31 33 0d 0a 39 32 39 36 0d 0a 0d  9..3313..9296...
1f850 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1f860 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1f870 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1f880 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1f890 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1f8a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f8b0 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T - cor0.col2 * 
1f8c0 2d 20 32 31 20 2a 20 2b 20 33 20 63 6f 6c 30 20  - 21 * + 3 col0 
1f8d0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1f8e0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 30 32 0d 0a 33  0..----..3402..3
1f8f0 35 39 31 0d 0a 36 30 34 38 0d 0a 0d 0a 71 75 65  591..6048....que
1f900 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1f910 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  LECT col1 * col0
1f920 20 2a 20 38 32 20 2b 20 2b 20 74 61 62 32 2e 63   * 82 + + tab2.c
1f930 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
1f940 2d 2d 2d 0d 0a 31 31 30 31 36 34 0d 0a 31 37 38  ---..110164..178
1f950 32 31 0d 0a 33 37 37 33 39 30 0d 0a 0d 0a 6f 6e  21..377390....on
1f960 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1f970 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1f980 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1f990 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1f9a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f9b0 20 6c 61 62 65 6c 2d 38 33 30 0d 0a 53 45 4c 45   label-830..SELE
1f9c0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20  CT ALL - col1 + 
1f9d0 2d 20 43 41 53 54 28 20 2d 20 28 20 63 6f 6c 30  - CAST( - ( col0
1f9e0 20 29 20 41 53 20 53 49 47 4e 45 44 20 29 20 41   ) AS SIGNED ) A
1f9f0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1fa00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1fa10 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a  -2..-62..-62....
1fa20 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1fa30 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1fa40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1fa50 61 62 65 6c 2d 38 33 30 0d 0a 53 45 4c 45 43 54  abel-830..SELECT
1fa60 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2d 20   ALL - col1 + - 
1fa70 43 41 53 54 20 28 20 2d 20 28 20 63 6f 6c 30 20  CAST ( - ( col0 
1fa80 29 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  ) AS INTEGER ) A
1fa90 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1faa0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1fab0 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a  -2..-62..-62....
1fac0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1fad0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1fae0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1faf0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1fb00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 31 0d  wsort label-831.
1fb10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1fb20 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f   - col2 DIV + co
1fb30 6c 32 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  l2 + col0 + col1
1fb40 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * + cor0.col1 F
1fb50 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1fb60 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 0d 0a 32 34 38  ..----..163..248
1fb70 0d 0a 36 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..678....skipif 
1fb80 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1fb90 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1fba0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33  rowsort label-83
1fbb0 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
1fbc0 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f  CT - col2 / + co
1fbd0 6c 32 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  l2 + col0 + col1
1fbe0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * + cor0.col1 F
1fbf0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1fc00 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 0d 0a 32 34 38  ..----..163..248
1fc10 0d 0a 36 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..678....query I
1fc20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fc30 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20   ALL + col2 * + 
1fc40 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  col2 + col1 * co
1fc50 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1fc60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 30  cor0..----..1690
1fc70 0d 0a 31 37 33 33 0d 0a 34 31 35 37 0d 0a 0d 0a  ..1733..4157....
1fc80 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1fc90 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1fca0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1fcb0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1fcc0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 33 0d  wsort label-833.
1fcd0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1fce0 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2d 20 63   col1 * col2 - c
1fcf0 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30 20 46  ol2 DIV + col0 F
1fd00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1fd10 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34  ..----..1534..64
1fd20 36 0d 0a 38 33 34 0d 0a 0d 0a 73 6b 69 70 69 66  6..834....skipif
1fd30 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1fd40 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1fd50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1fd60 33 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  33..SELECT DISTI
1fd70 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  NCT col1 * col2 
1fd80 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 30 20  - col2 / + col0 
1fd90 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1fda0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36  0..----..1534..6
1fdb0 34 36 0d 0a 38 33 34 0d 0a 0d 0a 71 75 65 72 79  46..834....query
1fdc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1fdd0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
1fde0 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
1fdf0 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
1fe00 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32  ..----..110..132
1fe10 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..180....query I
1fe20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fe30 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 72 30   ALL col0 * cor0
1fe40 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2b  .col1 + - col2 +
1fe50 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
1fe60 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1fe70 0a 31 32 32 36 0d 0a 31 38 33 0d 0a 34 34 39 38  .1226..183..4498
1fe80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1fe90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
1fea0 6c 30 20 2b 20 2b 20 35 37 20 41 53 20 63 6f 6c  l0 + + 57 AS col
1feb0 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
1fec0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 0d 0a 31 33 36  ..----..135..136
1fed0 0d 0a 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..64....query I 
1fee0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1fef0 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 28  ALL + col1 * - (
1ff00 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31   + col2 + - col1
1ff10 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
1ff20 2d 2d 0d 0a 34 35 35 38 0d 0a 38 31 39 0d 0a 39  --..4558..819..9
1ff30 33 31 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  312....skipif po
1ff40 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1ff50 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1ff60 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1ff70 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1ff80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ff90 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
1ffa0 20 2b 20 37 35 20 2b 20 63 6f 6c 32 20 63 6f 6c   + 75 + col2 col
1ffb0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
1ffc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 36 37  or0..----..-1767
1ffd0 0d 0a 2d 32 36 32 34 0d 0a 2d 36 35 39 33 0d 0a  ..-2624..-6593..
1ffe0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1fff0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
20000 6c 31 20 2a 20 2d 20 28 20 2d 20 32 20 29 20 46  l1 * - ( - 2 ) F
20010 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
20020 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32  ..----..172..182
20030 0d 0a 31 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..194....query I
20040 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20050 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 28 20   ALL - col0 + ( 
20060 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2a 20  - cor0.col1 ) * 
20070 28 20 37 39 20 29 20 41 53 20 63 6f 6c 30 20 46  ( 79 ) AS col0 F
20080 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
20090 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 38 31 38 0d 0a 2d  ..----..-6818..-
200a0 37 32 37 38 0d 0a 2d 37 36 39 38 0d 0a 0d 0a 73  7278..-7698....s
200b0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
200c0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
200d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
200e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43  ELECT DISTINCT C
200f0 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20 52 45  AST ( col0 AS RE
20100 41 4c 20 29 20 2b 20 2d 20 63 6f 6c 30 20 41 53  AL ) + - col0 AS
20110 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
20120 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  cor0..----..0...
20130 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20140 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
20150 2b 20 35 31 20 46 52 4f 4d 20 74 61 62 31 20 41  + 51 FROM tab1 A
20160 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
20170 33 0d 0a 2d 32 39 0d 0a 34 38 0d 0a 0d 0a 71 75  3..-29..48....qu
20180 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20190 45 4c 45 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f  ELECT ALL ( + co
201a0 6c 32 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  l2 ) * + cor0.co
201b0 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 + col1 FROM t
201c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
201d0 2d 0d 0a 31 33 32 0d 0a 37 33 38 39 0d 0a 38 37  -..132..7389..87
201e0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
201f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
20200 6f 6c 30 20 2d 20 2b 20 32 39 20 41 53 20 63 6f  ol0 - + 29 AS co
20210 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
20220 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  cor0..----..-26.
20230 0a 33 35 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79  .35..51....query
20240 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20250 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
20260 6c 31 20 2a 20 63 6f 6c 31 20 2d 20 2b 20 63 6f  l1 * col1 - + co
20270 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
20280 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
20290 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 38 32 0d 0a  --..-110..-182..
202a0 2d 37 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -702....onlyif m
202b0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
202c0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
202d0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
202e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
202f0 62 65 6c 2d 38 34 36 0d 0a 53 45 4c 45 43 54 20  bel-846..SELECT 
20300 41 4c 4c 20 2b 20 36 30 20 44 49 56 20 2b 20 31  ALL + 60 DIV + 1
20310 39 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  9 FROM tab1 AS c
20320 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 33 0d  or0..----..3..3.
20330 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .3....skipif mys
20340 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
20350 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
20360 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34 36 0d 0a  sort label-846..
20370 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 36 30 20  SELECT ALL + 60 
20380 2f 20 2b 20 31 39 20 46 52 4f 4d 20 74 61 62 31  / + 19 FROM tab1
20390 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
203a0 33 0d 0a 33 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79  3..3..3....query
203b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
203c0 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e  CT ALL + - cor0.
203d0 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col2 + col1 * + 
203e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
203f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33  S cor0..----..43
20400 0d 0a 36 32 32 0d 0a 37 33 0d 0a 0d 0a 71 75 65  ..622..73....que
20410 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20420 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 33 31  LECT + col2 + 31
20430 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
20440 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 36 30  ab0..----..-2460
20450 0d 0a 2d 33 30 0d 0a 2d 39 39 30 0d 0a 0d 0a 73  ..-30..-990....s
20460 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
20470 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
20480 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
20490 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
204a0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
204b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
204c0 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 2b  - ( - col2 ) * +
204d0 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20   cor0.col2 col1 
204e0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
204f0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33  0..----..2916..3
20500 32 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a 71 75 65  249..9216....que
20510 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20520 4c 45 43 54 20 2d 20 2b 20 38 31 20 2a 20 34 31  LECT - + 81 * 41
20530 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
20540 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
20550 0d 0a 2d 33 33 32 31 0d 0a 2d 33 33 32 31 0d 0a  ..-3321..-3321..
20560 2d 33 33 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -3321....query I
20570 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20580 20 39 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   99 AS col2 FROM
20590 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
205a0 0d 0a 39 39 0d 0a 39 39 0d 0a 39 39 0d 0a 0d 0a  ..99..99..99....
205b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
205c0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
205d0 35 33 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  53 * + col1 FROM
205e0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
205f0 0d 0a 2d 31 36 34 33 0d 0a 2d 33 31 32 37 0d 0a  ..-1643..-3127..
20600 2d 39 30 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -901....onlyif m
20610 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
20620 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
20630 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
20640 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
20650 62 65 6c 2d 38 35 33 0d 0a 53 45 4c 45 43 54 20  bel-853..SELECT 
20660 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c  + col0 DIV - col
20670 30 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63  0 + - col0 + + c
20680 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol1 * cor0.col1 
20690 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
206a0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
206b0 0a 37 33 37 31 0d 0a 38 31 39 31 0d 0a 39 33 37  .7371..8191..937
206c0 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
206d0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
206e0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
206f0 6f 72 74 20 6c 61 62 65 6c 2d 38 35 33 0d 0a 53  ort label-853..S
20700 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2d  ELECT + col0 / -
20710 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b   col0 + - col0 +
20720 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63   + col1 * cor0.c
20730 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
20740 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
20750 2d 2d 2d 0d 0a 37 33 37 31 0d 0a 38 31 39 31 0d  ---..7371..8191.
20760 0a 39 33 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .9373....query I
20770 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20780 20 2d 20 31 36 20 2b 20 63 6f 6c 32 20 46 52 4f   - 16 + col2 FRO
20790 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
207a0 2d 2d 2d 2d 0d 0a 33 38 0d 0a 34 31 0d 0a 38 30  ----..38..41..80
207b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
207c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
207d0 49 4e 43 54 20 2d 20 2b 20 28 20 63 6f 6c 32 20  INCT - + ( col2 
207e0 29 20 2b 20 63 6f 6c 31 20 2a 20 34 39 20 41 53  ) + col1 * 49 AS
207f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
20800 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
20810 31 38 31 0d 0a 34 33 37 37 0d 0a 34 37 35 32 0d  181..4377..4752.
20820 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20830 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
20840 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b   ( cor0.col2 ) +
20850 20 2b 20 63 6f 72 31 2e 63 6f 6c 31 20 2a 20 2d   + cor1.col1 * -
20860 20 32 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   22 AS col2 FROM
20870 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
20880 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53  OSS JOIN tab1 AS
20890 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
208a0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
208b0 20 64 30 34 30 33 32 30 33 62 61 31 37 32 38 31   d0403203ba17281
208c0 37 37 33 64 33 61 30 63 63 33 62 66 65 33 65 61  773d3a0cc3bfe3ea
208d0 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  d....query I row
208e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
208f0 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 28  ol1 + col0 + - (
20900 20 39 31 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c   91 ) * cor0.col
20910 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
20920 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 0d  or0..----..-153.
20930 0a 2d 33 30 36 35 0d 0a 2d 37 34 36 34 0d 0a 0d  .-3065..-7464...
20940 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
20950 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
20960 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
20970 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
20980 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
20990 6f 72 74 20 6c 61 62 65 6c 2d 38 35 38 0d 0a 53  ort label-858..S
209a0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
209b0 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  l1 * - col2 * + 
209c0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
209d0 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32  GNED ) FROM tab2
209e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
209f0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
20a00 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
20a10 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
20a20 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
20a30 72 74 20 6c 61 62 65 6c 2d 38 35 38 0d 0a 53 45  rt label-858..SE
20a40 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
20a50 31 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 43  1 * - col2 * + C
20a60 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
20a70 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
20a80 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20a90 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
20aa0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
20ab0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
20ac0 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63  TINCT - col2 * c
20ad0 6f 6c 30 20 2d 20 2d 20 37 36 20 2a 20 63 6f 6c  ol0 - - 76 * col
20ae0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
20af0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
20b00 2d 0d 0a 2d 31 37 31 30 0d 0a 32 31 36 37 0d 0a  -..-1710..2167..
20b10 32 34 35 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  2456....onlyif m
20b20 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
20b30 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
20b40 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
20b50 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
20b60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
20b70 2d 38 36 30 0d 0a 53 45 4c 45 43 54 20 2b 20 32  -860..SELECT + 2
20b80 35 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 43 41 53  5 + col2 / - CAS
20b90 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
20ba0 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  D ) FROM tab0 AS
20bb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
20bc0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
20bd0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
20be0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
20bf0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
20c00 6c 61 62 65 6c 2d 38 36 30 0d 0a 53 45 4c 45 43  label-860..SELEC
20c10 54 20 2b 20 32 35 20 2b 20 63 6f 6c 32 20 2f 20  T + 25 + col2 / 
20c20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
20c30 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
20c40 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
20c50 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
20c60 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  NULL....onlyif m
20c70 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
20c80 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
20c90 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
20ca0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
20cb0 62 65 6c 2d 38 36 31 0d 0a 53 45 4c 45 43 54 20  bel-861..SELECT 
20cc0 41 4c 4c 20 37 32 20 44 49 56 20 2d 20 63 6f 6c  ALL 72 DIV - col
20cd0 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
20ce0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 37 32 0d  ..----..-2..-72.
20cf0 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
20d00 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
20d10 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
20d20 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 31 0d 0a  sort label-861..
20d30 53 45 4c 45 43 54 20 41 4c 4c 20 37 32 20 2f 20  SELECT ALL 72 / 
20d40 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
20d50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
20d60 0a 2d 37 32 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  .-72..0....query
20d70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20d80 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2b  CT - tab0.col2 +
20d90 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46   col0 * - col2 F
20da0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
20db0 2d 33 36 0d 0a 2d 37 33 38 30 0d 0a 2d 38 32 35  -36..-7380..-825
20dc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20dd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 36  ort..SELECT + 76
20de0 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
20df0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20e00 0a 31 39 37 36 0d 0a 32 30 35 32 0d 0a 32 38 38  .1976..2052..288
20e10 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
20e20 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
20e30 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
20e40 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
20e50 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
20e60 2d 38 36 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  -864..SELECT DIS
20e70 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a  TINCT - + col2 *
20e80 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 72 30   col2 DIV + cor0
20e90 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
20ea0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
20eb0 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d  .----..-54..-57.
20ec0 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-96....skipif m
20ed0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
20ee0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
20ef0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 34  owsort label-864
20f00 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
20f10 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  T - + col2 * col
20f20 32 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  2 / + cor0.col2 
20f30 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
20f40 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20f50 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a  .-54..-57..-96..
20f60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20f70 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
20f80 2b 20 39 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 91 AS col2 FRO
20f90 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
20fa0 2d 2d 2d 2d 0d 0a 2d 39 31 0d 0a 2d 39 31 0d 0a  ----..-91..-91..
20fb0 2d 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -91....onlyif my
20fc0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
20fd0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
20fe0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
20ff0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
21000 65 6c 2d 38 36 36 0d 0a 53 45 4c 45 43 54 20 2d  el-866..SELECT -
21010 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 2b   col1 DIV col0 +
21020 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d   + cor0.col2 + -
21030 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20   col0 * col0 AS 
21040 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
21050 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
21060 30 33 39 0d 0a 2d 36 33 30 34 0d 0a 33 37 0d 0a  039..-6304..37..
21070 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
21080 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
21090 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
210a0 20 6c 61 62 65 6c 2d 38 36 36 0d 0a 53 45 4c 45   label-866..SELE
210b0 43 54 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 30  CT - col1 / col0
210c0 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   + + cor0.col2 +
210d0 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41   - col0 * col0 A
210e0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
210f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21100 2d 34 30 33 39 0d 0a 2d 36 33 30 34 0d 0a 33 37  -4039..-6304..37
21110 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21120 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
21130 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
21140 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  OM tab2 AS cor0 
21150 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20  CROSS JOIN tab2 
21160 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
21170 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
21180 74 6f 20 39 35 62 39 36 63 61 31 64 62 65 32 65  to 95b96ca1dbe2e
21190 33 39 61 30 66 61 37 38 66 35 30 64 33 37 34 66  39a0fa78f50d374f
211a0 35 31 61 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  51a....onlyif my
211b0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
211c0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
211d0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
211e0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
211f0 65 6c 2d 38 36 38 0d 0a 53 45 4c 45 43 54 20 44  el-868..SELECT D
21200 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 44 49 56  ISTINCT col2 DIV
21210 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 41 53 20   + tab1.col2 AS 
21220 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
21230 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69  ----..1....skipi
21240 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
21250 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
21260 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
21270 38 36 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  868..SELECT DIST
21280 49 4e 43 54 20 63 6f 6c 32 20 2f 20 2b 20 74 61  INCT col2 / + ta
21290 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  b1.col2 AS col0 
212a0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
212b0 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
212c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 36  wsort..SELECT 96
212d0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
212e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
212f0 0a 31 30 33 0d 0a 31 37 34 0d 0a 31 37 35 0d 0a  .103..174..175..
21300 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21310 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
21320 43 54 20 2d 20 2d 20 39 34 20 2a 20 38 37 20 2d  CT - - 94 * 87 -
21330 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
21340 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43  M tab0 AS cor0 C
21350 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41  ROSS JOIN tab0 A
21360 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 30  S cor1..----..80
21370 38 31 0d 0a 38 30 38 37 0d 0a 38 30 39 32 0d 0a  81..8087..8092..
21380 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
21390 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
213a0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
213b0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
213c0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
213d0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 37 31 0d 0a  sort label-871..
213e0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53  SELECT ALL - CAS
213f0 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d  T( NULL AS DECIM
21400 41 4c 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  AL ) AS col2 FRO
21410 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  M tab2, tab2 AS 
21420 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f  cor0, tab1 AS co
21430 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
21440 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31  ues hashing to 1
21450 36 62 65 38 38 36 38 61 31 65 36 66 34 65 38 38  6be8868a1e6f4e88
21460 35 30 35 30 39 66 39 33 32 37 61 66 65 39 30 0d  50509f9327afe90.
21470 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
21480 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
21490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
214a0 74 20 6c 61 62 65 6c 2d 38 37 31 0d 0a 53 45 4c  t label-871..SEL
214b0 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28  ECT ALL - CAST (
214c0 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20   NULL AS REAL ) 
214d0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
214e0 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  2, tab2 AS cor0,
214f0 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
21500 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
21510 61 73 68 69 6e 67 20 74 6f 20 31 36 62 65 38 38  ashing to 16be88
21520 36 38 61 31 65 36 66 34 65 38 38 35 30 35 30 39  68a1e6f4e8850509
21530 66 39 33 32 37 61 66 65 39 30 0d 0a 0d 0a 73 6b  f9327afe90....sk
21540 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
21550 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
21560 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
21570 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
21580 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
21590 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
215a0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a  ISTINCT - col1 *
215b0 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 63 6f 6c   + tab0.col0 col
215c0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
215d0 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d  -..-2064..-3395.
215e0 0a 2d 38 30 39 39 0d 0a 0d 0a 73 6b 69 70 69 66  .-8099....skipif
215f0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
21600 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
21610 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
21620 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
21630 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
21640 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
21650 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2d   - cor0.col2 - -
21660 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 63 6f 6c   col0 * col0 col
21670 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
21680 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a  or0..----..-45..
21690 34 30 33 39 0d 0a 36 33 30 34 0d 0a 0d 0a 71 75  4039..6304....qu
216a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
216b0 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 36 32 20  ELECT col2 + 62 
216c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
216d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
216e0 0a 31 34 34 0d 0a 36 33 0d 0a 39 35 0d 0a 0d 0a  .144..63..95....
216f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21700 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
21710 6c 30 20 2b 20 33 36 20 41 53 20 63 6f 6c 31 20  l0 + 36 AS col1 
21720 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
21730 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 31  0..----..100..11
21740 36 0d 0a 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49  6..39....query I
21750 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21760 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   + - cor0.col0 +
21770 20 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   ( col0 ) AS col
21780 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
21790 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
217a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
217b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
217c0 4e 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  NCT col0 + + col
217d0 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 * + col2 AS co
217e0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
217f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 32  cor0..----..1612
21800 0d 0a 37 32 35 0d 0a 38 34 34 0d 0a 0d 0a 71 75  ..725..844....qu
21810 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21820 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
21830 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63   col0 + col1 * c
21840 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  or0.col2 AS col2
21850 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
21860 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 38 0d 0a  r0..----..1328..
21870 31 34 30 37 0d 0a 36 33 34 0d 0a 0d 0a 6f 6e 6c  1407..634....onl
21880 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
21890 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
218a0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
218b0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
218c0 72 74 20 6c 61 62 65 6c 2d 38 37 39 0d 0a 53 45  rt label-879..SE
218d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
218e0 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20 33 33 20  + col0 DIV - 33 
218f0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
21900 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d  ----..-1..-2..0.
21910 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
21920 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
21930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21940 74 20 6c 61 62 65 6c 2d 38 37 39 0d 0a 53 45 4c  t label-879..SEL
21950 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
21960 20 63 6f 6c 30 20 2f 20 2d 20 33 33 20 46 52 4f   col0 / - 33 FRO
21970 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
21980 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a  -..-1..-2..0....
21990 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
219a0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
219b0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
219c0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
219d0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
219e0 72 74 20 6c 61 62 65 6c 2d 38 38 30 0d 0a 53 45  rt label-880..SE
219f0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
21a00 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
21a10 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 31 20  SIGNED ) + col1 
21a20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
21a30 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
21a40 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
21a50 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
21a60 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
21a70 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
21a80 6f 72 74 20 6c 61 62 65 6c 2d 38 38 30 0d 0a 53  ort label-880..S
21a90 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
21aa0 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
21ab0 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f  S INTEGER ) + co
21ac0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
21ad0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
21ae0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
21af0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  NULL....skipif p
21b00 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
21b10 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
21b20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
21b30 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
21b40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21b50 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 37 30 20  ..SELECT - + 70 
21b60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
21b70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
21b80 30 0d 0a 2d 37 30 0d 0a 2d 37 30 0d 0a 0d 0a 6f  0..-70..-70....o
21b90 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
21ba0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
21bb0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
21bc0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
21bd0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38 32 0d 0a  sort label-882..
21be0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63  SELECT ALL - + c
21bf0 6f 6c 30 20 2a 20 2d 20 33 39 20 2d 20 63 6f 6c  ol0 * - 39 - col
21c00 31 20 44 49 56 20 28 20 2d 20 63 6f 6c 30 20 29  1 DIV ( - col0 )
21c10 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
21c20 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
21c30 0d 0a 31 32 35 0d 0a 32 34 39 36 0d 0a 33 31 32  ..125..2496..312
21c40 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
21c50 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
21c60 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
21c70 6f 72 74 20 6c 61 62 65 6c 2d 38 38 32 0d 0a 53  ort label-882..S
21c80 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
21c90 6c 30 20 2a 20 2d 20 33 39 20 2d 20 63 6f 6c 31  l0 * - 39 - col1
21ca0 20 2f 20 28 20 2d 20 63 6f 6c 30 20 29 20 41 53   / ( - col0 ) AS
21cb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
21cc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
21cd0 32 35 0d 0a 32 34 39 36 0d 0a 33 31 32 30 0d 0a  25..2496..3120..
21ce0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21cf0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
21d00 20 2b 20 31 38 20 46 52 4f 4d 20 74 61 62 31 20   + 18 FROM tab1 
21d10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 0d  cor0..----..114.
21d20 0a 37 32 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79  .72..75....query
21d30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
21d40 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
21d50 6c 30 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 - col2 FROM t
21d60 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
21d70 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 31 37 0d 0a 2d  -..-104..-117..-
21d80 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
21d90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
21da0 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d 20  STINCT col1 * - 
21db0 38 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  87 AS col2 FROM 
21dc0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
21dd0 2d 2d 0d 0a 2d 31 34 37 39 0d 0a 2d 32 36 39 37  --..-1479..-2697
21de0 0d 0a 2d 35 31 33 33 0d 0a 0d 0a 73 6b 69 70 69  ..-5133....skipi
21df0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
21e00 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
21e10 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
21e20 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
21e30 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
21e40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
21e50 6c 31 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 32 20  l1 + - ( + col2 
21e60 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  ) col1 FROM tab1
21e70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21e80 2d 32 38 0d 0a 2d 34 37 0d 0a 2d 38 33 0d 0a 0d  -28..-47..-83...
21e90 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
21ea0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
21eb0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
21ec0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
21ed0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
21ee0 6f 72 74 20 6c 61 62 65 6c 2d 38 38 37 0d 0a 53  ort label-887..S
21ef0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
21f00 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
21f10 20 29 20 2a 20 2b 20 39 31 20 2b 20 2d 20 63 6f   ) * + 91 + - co
21f20 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
21f30 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab0..----..NULL
21f40 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
21f50 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
21f60 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
21f70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
21f80 61 62 65 6c 2d 38 38 37 0d 0a 53 45 4c 45 43 54  abel-887..SELECT
21f90 20 41 4c 4c 20 2d 20 43 41 53 54 20 28 20 4e 55   ALL - CAST ( NU
21fa0 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
21fb0 2a 20 2b 20 39 31 20 2b 20 2d 20 63 6f 6c 32 20  * + 91 + - col2 
21fc0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
21fd0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
21fe0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
21ff0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22000 4c 45 43 54 20 36 37 20 2b 20 63 6f 6c 30 20 46  LECT 67 + col0 F
22010 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
22020 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 0d 0a 31 34 36  ..----..145..146
22030 0d 0a 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..74....query I 
22040 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22050 2b 20 2d 20 63 6f 72 31 2e 63 6f 6c 30 20 41 53  + - cor1.col0 AS
22060 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
22070 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
22080 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  IN tab0 AS cor1.
22090 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
220a0 68 61 73 68 69 6e 67 20 74 6f 20 30 39 64 38 61  hashing to 09d8a
220b0 39 31 32 64 65 31 62 38 61 62 37 36 32 65 35 66  912de1b8ab762e5f
220c0 66 62 65 30 32 38 63 65 39 39 65 0d 0a 0d 0a 71  fbe028ce99e....q
220d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
220e0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20  SELECT col2 * - 
220f0 38 38 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  88 + + col2 AS c
22100 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
22110 2d 2d 2d 0d 0a 2d 34 36 39 38 0d 0a 2d 34 39 35  ---..-4698..-495
22120 39 0d 0a 2d 38 33 35 32 0d 0a 0d 0a 6f 6e 6c 79  9..-8352....only
22130 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
22140 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
22150 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
22160 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
22170 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
22180 61 62 65 6c 2d 38 39 31 0d 0a 53 45 4c 45 43 54  abel-891..SELECT
22190 20 43 41 53 54 28 20 32 36 20 41 53 20 53 49 47   CAST( 26 AS SIG
221a0 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20 41 53 20  NED ) * col0 AS 
221b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
221c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33  S cor0..----..23
221d0 31 34 0d 0a 36 32 34 0d 0a 39 31 30 0d 0a 0d 0a  14..624..910....
221e0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
221f0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
22200 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
22210 61 62 65 6c 2d 38 39 31 0d 0a 53 45 4c 45 43 54  abel-891..SELECT
22220 20 43 41 53 54 20 28 20 32 36 20 41 53 20 49 4e   CAST ( 26 AS IN
22230 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30 20 41  TEGER ) * col0 A
22240 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
22250 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22260 32 33 31 34 0d 0a 36 32 34 0d 0a 39 31 30 0d 0a  2314..624..910..
22270 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22280 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 33 20 2a  t..SELECT - 73 *
22290 20 39 30 20 2b 20 63 6f 6c 30 20 2a 20 38 35 20   90 + col0 * 85 
222a0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
222b0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
222c0 0a 2d 31 31 33 30 0d 0a 2d 36 33 31 35 0d 0a 32  .-1130..-6315..2
222d0 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
222e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 30  wsort..SELECT 30
222f0 20 2b 20 36 36 20 46 52 4f 4d 20 74 61 62 30 20   + 66 FROM tab0 
22300 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
22310 36 0d 0a 39 36 0d 0a 39 36 0d 0a 0d 0a 71 75 65  6..96..96....que
22320 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22330 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
22340 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72  1 + + col2 * cor
22350 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
22360 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22370 31 38 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d  188..3658..7693.
22380 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22390 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
223a0 6f 6c 31 20 2a 20 38 36 20 41 53 20 63 6f 6c 30  ol1 * 86 AS col0
223b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
223c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 38 0d 0a  r0..----..1118..
223d0 32 32 33 36 0d 0a 38 36 30 0d 0a 0d 0a 71 75 65  2236..860....que
223e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
223f0 4c 45 43 54 20 2d 20 34 38 20 2a 20 2b 20 63 6f  LECT - 48 * + co
22400 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
22410 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
22420 2d 2d 0d 0a 2d 31 34 34 0d 0a 2d 33 30 37 32 0d  --..-144..-3072.
22430 0a 2d 33 38 34 30 0d 0a 0d 0a 71 75 65 72 79 20  .-3840....query 
22440 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22450 54 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b  T - ( + col0 ) +
22460 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
22470 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
22480 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71  .-7..16..51....q
22490 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
224a0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
224b0 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 * + col1 FROM 
224c0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
224d0 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d  .-1248..-1404..-
224e0 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  570....query I r
224f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
22500 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63   - cor0.col2 * c
22510 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
22520 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
22530 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33 32 34 39 0d  ---..2916..3249.
22540 0a 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .9216....query I
22550 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22560 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
22570 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 + col0 AS col
22580 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
22590 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 33  or0..----..-9..3
225a0 34 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  4..7....skipif p
225b0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
225c0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
225d0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
225e0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
225f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22600 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
22610 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  T col0 + - col0 
22620 2b 20 37 37 20 63 6f 6c 32 20 46 52 4f 4d 20 74  + 77 col2 FROM t
22630 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
22640 2d 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49  -..77....query I
22650 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22660 20 2b 20 39 30 20 2a 20 63 6f 6c 32 20 46 52 4f   + 90 * col2 FRO
22670 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 38  M tab1..----..48
22680 36 30 0d 0a 35 31 33 30 0d 0a 38 36 34 30 0d 0a  60..5130..8640..
22690 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
226a0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20  t..SELECT - ( + 
226b0 74 61 62 31 2e 63 6f 6c 31 20 29 20 2a 20 74 61  tab1.col1 ) * ta
226c0 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  b1.col2 AS col1 
226d0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
226e0 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d  .-1248..-1404..-
226f0 35 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  570....skipif po
22700 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
22710 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
22720 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
22730 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
22740 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22750 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2d  .SELECT - col0 -
22760 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
22770 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
22780 2d 2d 0d 0a 2d 31 37 31 0d 0a 2d 33 36 0d 0a 2d  --..-171..-36..-
22790 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
227a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
227b0 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72 30  cor0.col1 + cor0
227c0 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col1 + cor0.col
227d0 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
227e0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a  ..----..10..13..
227f0 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  26....query I ro
22800 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
22810 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 28 20  - cor0.col2 * ( 
22820 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 63 6f  cor0.col2 ) + co
22830 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l2 * + col1 FROM
22840 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
22850 2d 2d 2d 0d 0a 31 37 34 39 0d 0a 37 33 38 0d 0a  ---..1749..738..
22860 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
22870 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
22880 63 6f 6c 30 20 2a 20 32 34 20 46 52 4f 4d 20 74  col0 * 24 FROM t
22890 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 36  ab1..----..-1536
228a0 0d 0a 2d 31 39 32 30 0d 0a 2d 37 32 0d 0a 0d 0a  ..-1920..-72....
228b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
228c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
228d0 20 2d 20 2d 20 28 20 39 35 20 29 20 46 52 4f 4d   - - ( 95 ) FROM
228e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
228f0 2d 2d 2d 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79  ---..95....query
22900 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22910 43 54 20 2b 20 2b 20 28 20 63 6f 72 30 2e 63 6f  CT + + ( cor0.co
22920 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l0 ) AS col1 FRO
22930 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
22940 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39  ----..24..35..89
22950 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22960 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 31  ort..SELECT tab1
22970 2e 63 6f 6c 31 20 2a 20 31 30 20 46 52 4f 4d 20  .col1 * 10 FROM 
22980 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d  tab1..----..100.
22990 0a 31 33 30 0d 0a 32 36 30 0d 0a 0d 0a 71 75 65  .130..260....que
229a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
229b0 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
229c0 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 72  + col0 * - ( cor
229d0 30 2e 63 6f 6c 32 20 29 20 2a 20 28 20 63 6f 6c  0.col2 ) * ( col
229e0 32 20 2b 20 2b 20 63 6f 6c 31 20 29 20 41 53 20  2 + + col1 ) AS 
229f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
22a00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39 30  or0..----..-1290
22a10 36 0d 0a 2d 32 34 34 33 35 39 0d 0a 2d 38 33 37  6..-244359..-837
22a20 30 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  024....onlyif my
22a30 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
22a40 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
22a50 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
22a60 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
22a70 65 6c 2d 39 31 32 0d 0a 53 45 4c 45 43 54 20 41  el-912..SELECT A
22a80 4c 4c 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20  LL + col1 DIV - 
22a90 31 34 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  14 + col0 AS col
22aa0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
22ab0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 34  or0..----..2..64
22ac0 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..80....skipif m
22ad0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
22ae0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
22af0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 32  owsort label-912
22b00 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
22b10 6f 6c 31 20 2f 20 2d 20 31 34 20 2b 20 63 6f 6c  ol1 / - 14 + col
22b20 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
22b30 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
22b40 2d 0d 0a 32 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a  -..2..64..80....
22b50 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
22b60 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
22b70 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
22b80 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
22b90 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 33 0d  wsort label-913.
22ba0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
22bb0 6c 30 20 44 49 56 20 2d 20 37 20 46 52 4f 4d 20  l0 DIV - 7 FROM 
22bc0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
22bd0 2d 2d 0d 0a 2d 31 0d 0a 2d 31 31 0d 0a 2d 31 31  --..-1..-11..-11
22be0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
22bf0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
22c00 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
22c10 72 74 20 6c 61 62 65 6c 2d 39 31 33 0d 0a 53 45  rt label-913..SE
22c20 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
22c30 2f 20 2d 20 37 20 46 52 4f 4d 20 74 61 62 32 20  / - 7 FROM tab2 
22c40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
22c50 31 0d 0a 2d 31 31 0d 0a 2d 31 31 0d 0a 0d 0a 71  1..-11..-11....q
22c60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22c70 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
22c80 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72  - - col2 * - cor
22c90 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  0.col1 FROM tab2
22ca0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22cb0 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33  -1534..-646..-83
22cc0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
22cd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
22ce0 6f 6c 31 20 2a 20 36 33 20 46 52 4f 4d 20 74 61  ol1 * 63 FROM ta
22cf0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
22d00 31 36 33 38 0d 0a 2d 36 33 30 0d 0a 2d 38 31 39  1638..-630..-819
22d10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22d20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
22d30 49 4e 43 54 20 63 6f 6c 32 20 2a 20 35 32 20 2b  INCT col2 * 52 +
22d40 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
22d50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
22d60 34 39 0d 0a 31 38 30 32 0d 0a 34 33 35 35 0d 0a  49..1802..4355..
22d70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22d80 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
22d90 43 54 20 31 38 20 41 53 20 63 6f 6c 31 20 46 52  CT 18 AS col1 FR
22da0 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  OM tab2, tab0 AS
22db0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d   cor0..----..18.
22dc0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22dd0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
22de0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 35 39 20   cor0.col2 + 59 
22df0 2a 20 2b 20 39 34 20 41 53 20 63 6f 6c 31 20 46  * + 94 AS col1 F
22e00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
22e10 0d 0a 2d 2d 2d 2d 0d 0a 35 35 30 38 0d 0a 35 35  ..----..5508..55
22e20 31 39 0d 0a 35 35 32 30 0d 0a 0d 0a 6f 6e 6c 79  19..5520....only
22e30 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
22e40 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
22e50 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
22e60 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
22e70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
22e80 61 62 65 6c 2d 39 31 39 0d 0a 53 45 4c 45 43 54  abel-919..SELECT
22e90 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2f 20 2d 20   ALL - col0 / - 
22ea0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
22eb0 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32  GNED ) FROM tab2
22ec0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22ed0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
22ee0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
22ef0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
22f00 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
22f10 72 74 20 6c 61 62 65 6c 2d 39 31 39 0d 0a 53 45  rt label-919..SE
22f20 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
22f30 2f 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  / - CAST ( NULL 
22f40 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
22f50 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
22f60 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
22f70 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
22f80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22f90 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 63  T ALL + col0 + c
22fa0 6f 6c 32 20 2a 20 2b 20 38 39 20 46 52 4f 4d 20  ol2 * + 89 FROM 
22fb0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
22fc0 2d 2d 0d 0a 34 38 30 39 0d 0a 35 31 33 37 0d 0a  --..4809..5137..
22fd0 38 36 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8624....query I 
22fe0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22ff0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
23000 63 6f 6c 32 20 2b 20 33 20 41 53 20 63 6f 6c 32  col2 + 3 AS col2
23010 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
23020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 34 0d  r0..----..36..4.
23030 0a 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .85....onlyif my
23040 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
23050 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
23060 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
23070 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
23080 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
23090 39 32 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  922..SELECT DIST
230a0 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  INCT + cor0.col0
230b0 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   * + CAST( NULL 
230c0 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
230d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
230e0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
230f0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
23100 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
23110 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
23120 6c 2d 39 32 32 0d 0a 53 45 4c 45 43 54 20 44 49  l-922..SELECT DI
23130 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f  STINCT + cor0.co
23140 6c 30 20 2a 20 2b 20 43 41 53 54 20 28 20 4e 55  l0 * + CAST ( NU
23150 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
23160 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
23170 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
23180 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
23190 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
231a0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
231b0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
231c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 32 33  owsort label-923
231d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72  ..SELECT ALL cor
231e0 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  0.col1 + - col2 
231f0 44 49 56 20 35 39 20 41 53 20 63 6f 6c 32 20 46  DIV 59 AS col2 F
23200 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
23210 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 32 0d 0a  ..----..10..12..
23220 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  26....skipif mys
23230 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
23240 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
23250 73 6f 72 74 20 6c 61 62 65 6c 2d 39 32 33 0d 0a  sort label-923..
23260 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e  SELECT ALL cor0.
23270 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2f 20  col1 + - col2 / 
23280 35 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  59 AS col2 FROM 
23290 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
232a0 2d 2d 0d 0a 31 30 0d 0a 31 32 0d 0a 32 36 0d 0a  --..10..12..26..
232b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
232c0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
232d0 63 6f 6c 30 20 2b 20 28 20 2d 20 37 34 20 29 20  col0 + ( - 74 ) 
232e0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
232f0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
23300 0a 2d 31 33 38 0d 0a 2d 31 35 34 0d 0a 2d 37 37  .-138..-154..-77
23310 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23320 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
23330 63 6f 6c 31 20 2b 20 39 20 41 53 20 63 6f 6c 32  col1 + 9 AS col2
23340 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
23350 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 34 30  r0..----..26..40
23360 0d 0a 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..68....query I 
23370 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23380 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
23390 32 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  2 - col1 * col0 
233a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
233b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 38 31 0d 0a  0..----..-1381..
233c0 2d 32 34 34 0d 0a 2d 34 36 32 38 0d 0a 0d 0a 71  -244..-4628....q
233d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
233e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
233f0 2d 20 63 6f 6c 30 20 2b 20 2b 20 36 35 20 41 53  - col0 + + 65 AS
23400 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
23410 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
23420 32 34 0d 0a 33 30 0d 0a 34 31 0d 0a 0d 0a 71 75  24..30..41....qu
23430 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23440 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
23450 2e 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 2a  .col2 - + col1 *
23460 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
23470 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
23480 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 34 0d 0a 31  0..----..1344..1
23490 34 35 38 0d 0a 36 32 37 0d 0a 0d 0a 71 75 65 72  458..627....quer
234a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
234b0 45 43 54 20 2d 20 38 34 20 2d 20 2b 20 63 6f 6c  ECT - 84 - + col
234c0 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  2 * + col0 FROM 
234d0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
234e0 2d 2d 0d 0a 2d 32 31 31 32 0d 0a 2d 32 37 33 0d  --..-2112..-273.
234f0 0a 2d 33 30 38 36 0d 0a 0d 0a 73 6b 69 70 69 66  .-3086....skipif
23500 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
23510 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
23520 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
23530 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
23540 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
23550 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
23560 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   - col1 * + col1
23570 20 2d 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46   - + col0 col2 F
23580 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
23590 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 0d 0a 33 34 30  ..----..210..340
235a0 33 0d 0a 39 35 34 0d 0a 0d 0a 71 75 65 72 79 20  3..954....query 
235b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
235c0 54 20 28 20 63 6f 6c 32 20 29 20 2d 20 2b 20 63  T ( col2 ) - + c
235d0 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
235e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
235f0 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32 31  ---..-33..-4..21
23600 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23610 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
23620 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a   * col0 - col2 *
23630 20 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   4 FROM tab0 AS 
23640 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a  cor0..----..31..
23650 36 36 30 0d 0a 36 39 37 30 0d 0a 0d 0a 6f 6e 6c  660..6970....onl
23660 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
23670 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
23680 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
23690 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
236a0 72 74 20 6c 61 62 65 6c 2d 39 33 33 0d 0a 53 45  rt label-933..SE
236b0 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20 74 61  LECT col1 DIV ta
236c0 62 31 2e 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a  b1.col0 - col1 *
236d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
236e0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31  .----..-1248..-1
236f0 33 39 36 0d 0a 2d 35 37 30 0d 0a 0d 0a 73 6b 69  396..-570....ski
23700 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
23710 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
23720 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
23730 6c 2d 39 33 33 0d 0a 53 45 4c 45 43 54 20 63 6f  l-933..SELECT co
23740 6c 31 20 2f 20 74 61 62 31 2e 63 6f 6c 30 20 2d  l1 / tab1.col0 -
23750 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f   col1 * col2 FRO
23760 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
23770 32 34 38 0d 0a 2d 31 33 39 36 0d 0a 2d 35 37 30  248..-1396..-570
23780 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23790 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
237a0 2b 20 39 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  + 9 FROM tab2 co
237b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 0d 0a 39 0d 0a  r0..----..9..9..
237c0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
237d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
237e0 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 28  ol0 + col1 * + (
237f0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b   + col2 * col0 +
23800 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20   + ( + col2 ) * 
23810 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31  col2 ) FROM tab1
23820 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23830 32 31 39 37 32 38 0d 0a 36 39 30 33 34 0d 0a 38  219728..69034..8
23840 30 30 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0031....query I 
23850 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23860 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 28 20 2d  DISTINCT - + ( -
23870 20 63 6f 6c 31 20 29 20 2a 20 37 33 20 41 53 20   col1 ) * 73 AS 
23880 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
23890 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 31 0d  or0..----..1241.
238a0 0a 32 32 36 33 0d 0a 34 33 30 37 0d 0a 0d 0a 71  .2263..4307....q
238b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
238c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
238d0 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 46 52  col2 + - col2 FR
238e0 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f  OM tab1 WHERE NO
238f0 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  T - col2 + col1 
23900 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  * col0 * - col0 
23910 3c 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d  <= NULL..----...
23920 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23930 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
23940 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  1 * - col1 * col
23950 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
23960 2d 0d 0a 2d 31 30 30 30 0d 0a 2d 31 37 35 37 36  -..-1000..-17576
23970 0d 0a 2d 32 31 39 37 0d 0a 0d 0a 71 75 65 72 79  ..-2197....query
23980 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23990 43 54 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 32  CT col1 + - tab2
239a0 2e 63 6f 6c 30 20 2d 20 2b 20 74 61 62 32 2e 63  .col0 - + tab2.c
239b0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
239c0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   tab2..----..-10
239d0 30 0d 0a 2d 33 0d 0a 2d 34 35 0d 0a 0d 0a 71 75  0..-3..-45....qu
239e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
239f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
23a00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 57 48  ol0 FROM tab0 WH
23a10 45 52 45 20 28 20 63 6f 6c 30 20 2f 20 2d 20 63  ERE ( col0 / - c
23a20 6f 6c 32 20 29 20 3e 3d 20 2b 20 63 6f 6c 32 0d  ol2 ) >= + col2.
23a30 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
23a40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23a50 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c   tab2.col1 * col
23a60 31 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 46 52  1 + tab2.col2 FR
23a70 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab2..----..3
23a80 32 37 0d 0a 33 35 30 37 0d 0a 39 38 38 0d 0a 0d  27..3507..988...
23a90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23aa0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
23ab0 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  col0 - col0 FROM
23ac0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 30 33   tab1..----..403
23ad0 32 0d 0a 36 0d 0a 36 33 32 30 0d 0a 0d 0a 71 75  2..6..6320....qu
23ae0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23af0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
23b00 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2d 20 63   tab0.col1 * - c
23b10 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
23b20 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33   tab0..----..283
23b30 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71  8..7462..97....q
23b40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23b50 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62  SELECT ALL + tab
23b60 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  0.col0 AS col1 F
23b70 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 63  ROM tab0, tab2 c
23b80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
23b90 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
23ba0 62 34 39 37 39 39 39 34 32 61 39 65 33 35 33 61  b49799942a9e353a
23bb0 33 64 32 37 39 63 66 36 34 65 66 33 66 36 33 0d  3d279cf64ef3f63.
23bc0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23bd0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63  rt..SELECT + ( c
23be0 6f 6c 30 20 2b 20 63 6f 6c 30 20 29 20 41 53 20  ol0 + col0 ) AS 
23bf0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
23c00 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a  ----..128..160..
23c10 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
23c20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
23c30 30 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29  0 + - ( - col0 )
23c40 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
23c50 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a 34 38 0d 0a  .----..178..48..
23c60 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
23c70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
23c80 53 54 49 4e 43 54 20 2b 20 2d 20 28 20 36 20 29  STINCT + - ( 6 )
23c90 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
23ca0 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
23cb0 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
23cc0 0d 0a 2d 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-6....query I 
23cd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23ce0 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
23cf0 63 6f 6c 30 20 2a 20 2d 20 35 32 20 41 53 20 63  col0 * - 52 AS c
23d00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
23d10 2d 2d 2d 0d 0a 2d 32 39 39 35 32 0d 0a 2d 34 31  ---..-29952..-41
23d20 31 38 39 32 0d 0a 2d 36 33 37 30 30 0d 0a 0d 0a  1892..-63700....
23d30 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
23d40 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
23d50 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
23d60 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
23d70 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
23d80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23d90 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 37 35 20 63   ALL col0 * 75 c
23da0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
23db0 2d 2d 2d 0d 0a 31 38 30 30 0d 0a 32 36 32 35 0d  ---..1800..2625.
23dc0 0a 36 36 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .6675....query I
23dd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23de0 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 36 31 20 46   ALL col1 * 61 F
23df0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
23e00 35 32 34 36 0d 0a 35 35 35 31 0d 0a 35 39 31 37  5246..5551..5917
23e10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23e20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
23e30 49 4e 43 54 20 37 36 20 2a 20 33 30 20 46 52 4f  INCT 76 * 30 FRO
23e40 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
23e50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38 30  cor0..----..2280
23e60 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
23e70 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
23e80 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
23e90 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
23ea0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
23eb0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35 32  owsort label-952
23ec0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
23ed0 2d 20 43 41 53 54 28 20 34 38 20 41 53 20 53 49  - CAST( 48 AS SI
23ee0 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
23ef0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
23f00 0d 0a 2d 32 34 0d 0a 34 31 0d 0a 0d 0a 73 6b 69  ..-24..41....ski
23f10 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
23f20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
23f30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
23f40 6c 2d 39 35 32 0d 0a 53 45 4c 45 43 54 20 63 6f  l-952..SELECT co
23f50 6c 30 20 2b 20 2d 20 43 41 53 54 20 28 20 34 38  l0 + - CAST ( 48
23f60 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
23f70 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
23f80 2d 2d 0d 0a 2d 31 33 0d 0a 2d 32 34 0d 0a 34 31  --..-13..-24..41
23f90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23fa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
23fb0 49 4e 43 54 20 2b 20 38 33 20 46 52 4f 4d 20 74  INCT + 83 FROM t
23fc0 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab2, tab2 AS cor
23fd0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
23fe0 0a 2d 2d 2d 2d 0d 0a 38 33 0d 0a 0d 0a 6f 6e 6c  .----..83....onl
23ff0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
24000 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
24010 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
24020 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
24030 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
24040 6c 61 62 65 6c 2d 39 35 34 0d 0a 53 45 4c 45 43  label-954..SELEC
24050 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28  T DISTINCT CAST(
24060 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
24070 20 29 20 2a 20 2d 20 33 33 20 2b 20 74 61 62 31   ) * - 33 + tab1
24080 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d  .col1 FROM tab1.
24090 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
240a0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
240b0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
240c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
240d0 62 65 6c 2d 39 35 34 0d 0a 53 45 4c 45 43 54 20  bel-954..SELECT 
240e0 44 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20  DISTINCT CAST ( 
240f0 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2a  NULL AS REAL ) *
24100 20 2d 20 33 33 20 2b 20 74 61 62 31 2e 63 6f 6c   - 33 + tab1.col
24110 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
24120 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  -..NULL....onlyi
24130 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
24140 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
24150 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
24160 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24170 20 6c 61 62 65 6c 2d 39 35 35 0d 0a 53 45 4c 45   label-955..SELE
24180 43 54 20 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c  CT ALL - ( + col
24190 32 20 29 20 44 49 56 20 63 6f 6c 30 20 2b 20 2b  2 ) DIV col0 + +
241a0 20 36 32 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63   62 * + col0 * c
241b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
241c0 2d 2d 2d 0d 0a 32 35 33 39 35 32 0d 0a 33 39 36  ---..253952..396
241d0 37 39 39 0d 0a 35 34 30 0d 0a 0d 0a 73 6b 69 70  799..540....skip
241e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
241f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
24200 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
24210 2d 39 35 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -955..SELECT ALL
24220 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 2f 20   - ( + col2 ) / 
24230 63 6f 6c 30 20 2b 20 2b 20 36 32 20 2a 20 2b 20  col0 + + 62 * + 
24240 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col0 * col0 FROM
24250 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 35 33   tab1..----..253
24260 39 35 32 0d 0a 33 39 36 37 39 39 0d 0a 35 34 30  952..396799..540
24270 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24280 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 20  ort..SELECT + 8 
24290 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * - col1 FROM ta
242a0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 0d 0a  b2..----..-136..
242b0 2d 32 34 38 0d 0a 2d 34 37 32 0d 0a 0d 0a 71 75  -248..-472....qu
242c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
242d0 45 4c 45 43 54 20 34 33 20 2a 20 2d 20 63 6f 6c  ELECT 43 * - col
242e0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
242f0 2d 0d 0a 2d 31 31 31 38 0d 0a 2d 34 33 30 0d 0a  -..-1118..-430..
24300 2d 35 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -559....query I 
24310 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24320 2b 20 39 30 20 2b 20 38 35 20 2a 20 2d 20 63 6f  + 90 + 85 * - co
24330 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
24340 2d 2d 0d 0a 2d 37 32 32 30 0d 0a 2d 37 36 34 35  --..-7220..-7645
24350 0d 0a 2d 38 31 35 35 0d 0a 0d 0a 71 75 65 72 79  ..-8155....query
24360 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24370 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20  CT ALL - col0 + 
24380 35 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  50 FROM tab0..--
24390 2d 2d 0d 0a 2d 33 39 0d 0a 31 35 0d 0a 32 36 0d  --..-39..15..26.
243a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
243b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
243c0 20 31 31 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63   11 + col2 * - c
243d0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
243e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
243f0 2d 2d 2d 0d 0a 2d 31 30 37 38 0d 0a 2d 36 37 31  ---..-1078..-671
24400 33 0d 0a 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49  3..10....query I
24410 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24420 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 33 20   ALL - col2 * 3 
24430 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
24440 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
24450 2d 2d 2d 0d 0a 2d 31 35 36 0d 0a 2d 31 39 33 0d  ---..-156..-193.
24460 0a 2d 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-88....query I 
24470 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24480 44 49 53 54 49 4e 43 54 20 28 20 28 20 2b 20 63  DISTINCT ( ( + c
24490 6f 6c 30 20 29 20 29 20 2a 20 2d 20 39 33 20 2b  ol0 ) ) * - 93 +
244a0 20 35 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f   51 + + col0 FRO
244b0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
244c0 2d 0d 0a 2d 35 39 33 0d 0a 2d 37 31 32 35 0d 0a  -..-593..-7125..
244d0 2d 37 32 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  -7217....query I
244e0 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  IIIIIIIIIII rows
244f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
24500 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f  OM tab2, tab1 co
24510 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
24520 2c 20 74 61 62 30 20 63 6f 72 32 0d 0a 2d 2d 2d  , tab0 cor2..---
24530 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61  -..972 values ha
24540 73 68 69 6e 67 20 74 6f 20 38 62 34 66 63 64 61  shing to 8b4fcda
24550 37 66 31 63 61 37 36 62 61 64 37 63 37 64 37 32  7f1ca76bad7c7d72
24560 38 66 35 34 61 35 31 65 30 0d 0a 0d 0a 71 75 65  8f54a51e0....que
24570 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49  ry IIIIIIIIIIIII
24580 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
24590 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61  CT ALL * FROM ta
245a0 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b2, tab1 AS cor0
245b0 2c 20 74 61 62 31 20 63 6f 72 31 2c 20 74 61 62  , tab1 cor1, tab
245c0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d  0, tab0 AS cor2.
245d0 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75  .----..3645 valu
245e0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 30  es hashing to 40
245f0 33 37 64 36 35 35 37 31 63 31 62 62 66 36 65 30  37d65571c1bbf6e0
24600 65 37 64 37 35 39 66 38 35 38 31 32 30 65 0d 0a  e7d759f858120e..
24610 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24620 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
24630 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30  CT col0 + + col0
24640 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
24650 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
24660 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a  or0..----..-13..
24670 31 32 30 0d 0a 31 33 30 0d 0a 0d 0a 71 75 65 72  120..130....quer
24680 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24690 45 43 54 20 41 4c 4c 20 2d 20 2b 20 38 20 2a 20  ECT ALL - + 8 * 
246a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
246b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
246c0 30 34 0d 0a 2d 32 30 38 0d 0a 2d 38 30 0d 0a 0d  04..-208..-80...
246d0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
246e0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
246f0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
24700 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
24710 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36 37  owsort label-967
24720 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
24730 32 20 2b 20 63 6f 6c 31 20 44 49 56 20 31 35 20  2 + col1 DIV 15 
24740 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
24750 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38  0 cor0..----..38
24760 0d 0a 37 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69  ..7..88....skipi
24770 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
24780 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
24790 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
247a0 39 36 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  967..SELECT - - 
247b0 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20 31 35  col2 + col1 / 15
247c0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
247d0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  b0 cor0..----..3
247e0 38 0d 0a 37 0d 0a 38 38 0d 0a 0d 0a 71 75 65 72  8..7..88....quer
247f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24800 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
24810 20 2d 20 63 6f 6c 30 20 2a 20 35 30 20 41 53 20   - col0 * 50 AS 
24820 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
24830 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
24840 34 33 0d 0a 2d 33 38 32 32 0d 0a 2d 33 38 37 31  43..-3822..-3871
24850 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24860 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
24870 2d 20 2d 20 37 39 20 2b 20 63 6f 6c 31 20 2a 20  - - 79 + col1 * 
24880 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
24890 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
248a0 2d 2d 2d 2d 0d 0a 31 33 32 37 0d 0a 31 34 38 33  ----..1327..1483
248b0 0d 0a 36 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..649....query I
248c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
248d0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b   + cor0.col1 * +
248e0 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 46   col0 + - col1 F
248f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
24900 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 37 0d 0a 35 32  ..----..1027..52
24910 0d 0a 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..630....query I
24920 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24930 20 36 38 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f   68 + col1 AS co
24940 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
24950 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 0d  cor0..----..127.
24960 0a 38 35 0d 0a 39 39 0d 0a 0d 0a 71 75 65 72 79  .85..99....query
24970 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24980 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
24990 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2b 20  col0 * col2 + + 
249a0 39 39 20 2a 20 33 31 20 46 52 4f 4d 20 74 61 62  99 * 31 FROM tab
249b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
249c0 0a 2d 34 32 32 39 0d 0a 32 32 37 37 0d 0a 33 30  .-4229..2277..30
249d0 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
249e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
249f0 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f  STINCT - cor0.co
24a00 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 28 20 63 6f  l1 * col2 + ( co
24a10 6c 31 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  l1 ) * col1 FROM
24a20 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
24a30 2d 2d 2d 0d 0a 2d 33 35 37 0d 0a 31 32 34 0d 0a  ---..-357..124..
24a40 31 39 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1947....query I 
24a50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24a60 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  + col0 + + col2 
24a70 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 36 20 46  * - col1 + + 6 F
24a80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
24a90 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 38 0d 0a 2d  ..----..-2808..-
24aa0 35 36 0d 0a 2d 37 33 36 37 0d 0a 0d 0a 71 75 65  56..-7367....que
24ab0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24ac0 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  LECT + + col1 + 
24ad0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20 63  col0 * col1 AS c
24ae0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
24af0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
24b00 0d 0a 31 30 35 33 0d 0a 36 35 30 0d 0a 0d 0a 71  ..1053..650....q
24b10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24b20 53 45 4c 45 43 54 20 2b 20 33 37 20 2a 20 63 6f  SELECT + 37 * co
24b30 72 30 2e 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 32  r0.col2 + ( col2
24b40 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d   + cor0.col0 * -
24b50 20 32 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52   20 ) AS col1 FR
24b60 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
24b70 0a 2d 2d 2d 2d 0d 0a 2d 36 36 32 0d 0a 31 33 33  .----..-662..133
24b80 36 0d 0a 37 37 34 0d 0a 0d 0a 71 75 65 72 79 20  6..774....query 
24b90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24ba0 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 30 20  T ALL tab2.col0 
24bb0 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  * + col0 + col2 
24bc0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
24bd0 0a 36 31 31 30 0d 0a 36 32 37 39 0d 0a 37 36 0d  .6110..6279..76.
24be0 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 20  ...query IIIIII 
24bf0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24c00 2a 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  * FROM tab0, tab
24c10 31 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20  1 AS cor0 WHERE 
24c20 4e 55 4c 4c 20 42 45 54 57 45 45 4e 20 4e 55 4c  NULL BETWEEN NUL
24c30 4c 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  L AND NULL..----
24c40 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f  ....query III ro
24c50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20  wsort..SELECT * 
24c60 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 20 57  FROM tab0 cor0 W
24c70 48 45 52 45 20 4e 4f 54 20 63 6f 6c 32 20 2a 20  HERE NOT col2 * 
24c80 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 49 4e  - col2 * col2 IN
24c90 20 28 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   ( col0 * - col2
24ca0 20 29 20 4f 52 20 4e 55 4c 4c 20 4e 4f 54 20 42   ) OR NULL NOT B
24cb0 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20  ETWEEN NULL AND 
24cc0 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a  ( NULL )..----..
24cd0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
24ce0 20 74 6f 20 33 38 61 31 36 37 33 65 32 65 30 39   to 38a1673e2e09
24cf0 64 36 39 34 63 38 63 65 63 34 35 63 37 39 37 30  d694c8cec45c7970
24d00 33 34 61 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  34a7....query I 
24d10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24d20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20  + col2 * col2 + 
24d30 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
24d40 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
24d50 31 31 32 32 0d 0a 32 0d 0a 36 38 30 36 0d 0a 0d  1122..2..6806...
24d60 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
24d70 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
24d80 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
24d90 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
24da0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
24db0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24dc0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
24dd0 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  or0.col0 + - col
24de0 32 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20  2 * - col2 col0 
24df0 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
24e00 2d 2d 2d 2d 0d 0a 31 33 36 35 0d 0a 35 39 38 0d  ----..1365..598.
24e10 0a 37 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .722....query I 
24e20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24e30 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col1 * - col1 + 
24e40 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
24e50 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
24e60 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a 2d 33 34 30 33  ---..-210..-3403
24e70 0d 0a 2d 39 35 34 0d 0a 0d 0a 71 75 65 72 79 20  ..-954....query 
24e80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24e90 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20  T - cor0.col2 - 
24ea0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53  col0 * + col0 AS
24eb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
24ec0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
24ed0 31 32 32 36 0d 0a 2d 36 30 39 0d 0a 2d 38 30 30  1226..-609..-800
24ee0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
24ef0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
24f00 20 2b 20 31 32 20 2b 20 2d 20 63 6f 6c 31 20 2a   + 12 + - col1 *
24f10 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30   + col1 + + col0
24f20 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
24f30 0d 0a 2d 32 34 0d 0a 2d 36 36 31 0d 0a 2d 37 37  ..-24..-661..-77
24f40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24f50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 38 20 2a  ort..SELECT 18 *
24f60 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a   - col0 + col0 *
24f70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
24f80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
24f90 36 33 32 0d 0a 32 37 36 35 0d 0a 36 34 39 37 0d  632..2765..6497.
24fa0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
24fb0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
24fc0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
24fd0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
24fe0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
24ff0 38 36 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 28  86..SELECT ( + (
25000 20 2d 20 63 6f 6c 31 20 29 20 29 20 2a 20 2b 20   - col1 ) ) * + 
25010 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 46 52  col0 DIV col0 FR
25020 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
25030 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a  86..-91..-97....
25040 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
25050 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
25060 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
25070 61 62 65 6c 2d 39 38 36 0d 0a 53 45 4c 45 43 54  abel-986..SELECT
25080 20 28 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20   ( + ( - col1 ) 
25090 29 20 2a 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c  ) * + col0 / col
250a0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
250b0 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37  -..-86..-91..-97
250c0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
250d0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
250e0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
250f0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
25100 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25110 39 38 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  987..SELECT ALL 
25120 2d 20 63 6f 6c 30 20 2a 20 2b 20 35 38 20 2b 20  - col0 * + 58 + 
25130 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31 20  col2 DIV + col1 
25140 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  + + col1 AS col1
25150 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
25160 0d 0a 2d 31 34 36 0d 0a 2d 33 36 39 37 0d 0a 2d  ..-146..-3697..-
25170 34 36 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  4620....skipif m
25180 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
25190 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
251a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38 37  owsort label-987
251b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
251c0 6f 6c 30 20 2a 20 2b 20 35 38 20 2b 20 63 6f 6c  ol0 * + 58 + col
251d0 32 20 2f 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  2 / + col1 + + c
251e0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
251f0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   tab1..----..-14
25200 36 0d 0a 2d 33 36 39 37 0d 0a 2d 34 36 32 30 0d  6..-3697..-4620.
25210 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25220 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
25230 4e 43 54 20 63 6f 6c 30 20 2a 20 39 36 20 46 52  NCT col0 * 96 FR
25240 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36  OM tab2..----..6
25250 37 32 0d 0a 37 34 38 38 0d 0a 37 35 38 34 0d 0a  72..7488..7584..
25260 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
25270 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
25280 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
25290 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
252a0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
252b0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38 39 0d 0a  sort label-989..
252c0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53  SELECT ALL - CAS
252d0 54 28 20 2b 20 36 36 20 41 53 20 53 49 47 4e 45  T( + 66 AS SIGNE
252e0 44 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  D ) + col2 FROM 
252f0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d  tab1..----..-12.
25300 0a 2d 39 0d 0a 33 30 0d 0a 0d 0a 73 6b 69 70 69  .-9..30....skipi
25310 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25320 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
25330 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25340 39 38 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  989..SELECT ALL 
25350 2d 20 43 41 53 54 20 28 20 2b 20 36 36 20 41 53  - CAST ( + 66 AS
25360 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c   INTEGER ) + col
25370 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
25380 2d 0d 0a 2d 31 32 0d 0a 2d 39 0d 0a 33 30 0d 0a  -..-12..-9..30..
25390 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
253a0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
253b0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
253c0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
253d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39  rowsort label-99
253e0 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 28 20  0..SELECT - - ( 
253f0 2b 20 63 6f 6c 30 20 29 20 44 49 56 20 63 6f 6c  + col0 ) DIV col
25400 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
25410 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
25420 30 0d 0a 36 0d 0a 36 0d 0a 0d 0a 73 6b 69 70 69  0..6..6....skipi
25430 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25440 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
25450 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25460 39 39 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  990..SELECT - - 
25470 28 20 2b 20 63 6f 6c 30 20 29 20 2f 20 63 6f 6c  ( + col0 ) / col
25480 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
25490 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
254a0 30 0d 0a 36 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79  0..6..6....query
254b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
254c0 43 54 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 63 6f  CT - col2 - - co
254d0 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
254e0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
254f0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .0..0..0....skip
25500 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
25510 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
25520 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
25530 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
25540 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
25550 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
25560 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  0 + col0 * col2 
25570 2a 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  * col1 col2 FROM
25580 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
25590 2d 2d 2d 0d 0a 33 34 33 30 0d 0a 36 36 34 32 30  ---..3430..66420
255a0 37 0d 0a 36 38 31 33 36 0d 0a 0d 0a 71 75 65 72  7..68136....quer
255b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
255c0 45 43 54 20 2b 20 28 20 2b 20 74 61 62 31 2e 63  ECT + ( + tab1.c
255d0 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41  ol2 ) * + col1 A
255e0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
255f0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34  ..----..1248..14
25600 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79  04..570....query
25610 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25620 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  CT - col1 + + co
25630 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41  l0 * cor0.col0 A
25640 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
25650 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
25660 0d 0a 34 30 38 36 0d 0a 36 33 38 37 0d 0a 0d 0a  ..4086..6387....
25670 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25680 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
25690 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   - col1 * - col0
256a0 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
256b0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
256c0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 30 39 37 0d  0..----..106097.
256d0 0a 31 35 31 39 0d 0a 33 35 38 39 35 36 0d 0a 0d  .1519..358956...
256e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
256f0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
25700 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
25710 20 57 48 45 52 45 20 4e 4f 54 20 28 20 4e 55 4c   WHERE NOT ( NUL
25720 4c 20 29 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c  L ) BETWEEN NULL
25730 20 41 4e 44 20 2b 20 63 6f 6c 30 0d 0a 2d 2d 2d   AND + col0..---
25740 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
25750 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
25760 31 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  1 * - tab1.col0 
25770 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  + col0 * + col0 
25780 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
25790 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 39 0d 0a 33 34  1..----..-69..34
257a0 35 36 0d 0a 35 33 36 30 0d 0a 0d 0a 71 75 65 72  56..5360....quer
257b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
257c0 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63  ECT + col2 + + c
257d0 6f 6c 31 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 / col0 AS co
257e0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45  l2 FROM tab1 WHE
257f0 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3d 20 4e 55  RE NOT NULL = NU
25800 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79  LL..----....only
25810 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
25820 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
25830 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
25840 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25850 74 20 6c 61 62 65 6c 2d 39 39 39 0d 0a 53 45 4c  t label-999..SEL
25860 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b  ECT ALL - col0 +
25870 20 74 61 62 30 2e 63 6f 6c 30 20 44 49 56 20 2d   tab0.col0 DIV -
25880 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
25890 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d  tab0..----..-24.
258a0 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b 69  .-35..-89....ski
258b0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
258c0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
258d0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
258e0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
258f0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
25900 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
25910 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
25920 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 39 0d 0a  sort label-999..
25930 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
25940 30 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2f 20  0 + tab0.col0 / 
25950 2d 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  - col1 col2 FROM
25960 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   tab0..----..-24
25970 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 6f 6e  ..-35..-89....on
25980 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
25990 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
259a0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
259b0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
259c0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 30 0d 0a  ort label-1000..
259d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
259e0 74 61 62 31 2e 63 6f 6c 30 20 44 49 56 20 2b 20  tab1.col0 DIV + 
259f0 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  tab1.col2 FROM t
25a00 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  ab1..----..0..1.
25a10 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
25a20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
25a30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25a40 74 20 6c 61 62 65 6c 2d 31 30 30 30 0d 0a 53 45  t label-1000..SE
25a50 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61  LECT DISTINCT ta
25a60 62 31 2e 63 6f 6c 30 20 2f 20 2b 20 74 61 62 31  b1.col0 / + tab1
25a70 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d  .col2 FROM tab1.
25a80 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71  .----..0..1....q
25a90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25aa0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20  SELECT col2 * + 
25ab0 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53  col2 * + col1 AS
25ac0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
25ad0 0a 2d 2d 2d 2d 0d 0a 31 31 39 38 30 38 0d 0a 33  .----..119808..3
25ae0 32 34 39 30 0d 0a 37 35 38 31 36 0d 0a 0d 0a 6f  2490..75816....o
25af0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
25b00 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
25b10 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
25b20 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
25b30 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 32 0d  sort label-1002.
25b40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32  .SELECT ALL tab2
25b50 2e 63 6f 6c 30 20 44 49 56 20 74 61 62 32 2e 63  .col0 DIV tab2.c
25b60 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
25b70 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab2..----..1..
25b80 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1..1....skipif m
25b90 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
25ba0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
25bb0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30  owsort label-100
25bc0 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61  2..SELECT ALL ta
25bd0 62 32 2e 63 6f 6c 30 20 2f 20 74 61 62 32 2e 63  b2.col0 / tab2.c
25be0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
25bf0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab2..----..1..
25c00 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..1....query I 
25c10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25c20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  + col2 * + col0 
25c30 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20  FROM tab1 WHERE 
25c40 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2d 20  - col0 * col2 - 
25c50 2d 20 63 6f 6c 32 20 49 4e 20 28 20 63 6f 6c 30  - col2 IN ( col0
25c60 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79   )..----....only
25c70 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
25c80 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
25c90 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
25ca0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25cb0 74 20 6c 61 62 65 6c 2d 31 30 30 34 0d 0a 53 45  t label-1004..SE
25cc0 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  LECT col2 * - co
25cd0 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 63 6f  l0 + - col0 - co
25ce0 6c 30 20 44 49 56 20 2b 20 63 6f 6c 31 20 41 53  l0 DIV + col1 AS
25cf0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
25d00 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a 2d 37 33 38  .----..-70..-738
25d10 37 0d 0a 2d 38 31 36 0d 0a 0d 0a 73 6b 69 70 69  7..-816....skipi
25d20 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25d30 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
25d40 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25d50 31 30 30 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1004..SELECT col
25d60 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  2 * - col0 + - c
25d70 6f 6c 30 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 63  ol0 - col0 / + c
25d80 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
25d90 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30   tab0..----..-70
25da0 0d 0a 2d 37 33 38 37 0d 0a 2d 38 31 36 0d 0a 0d  ..-7387..-816...
25db0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25dc0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
25dd0 2a 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2d 20  * tab0.col1 * - 
25de0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
25df0 2d 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d 36 36  ----..-3395..-66
25e00 34 31 31 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d 0a  4118..-68112....
25e10 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
25e20 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
25e30 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
25e40 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
25e50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 36  wsort label-1006
25e60 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74  ..SELECT ALL + t
25e70 61 62 31 2e 63 6f 6c 30 20 44 49 56 20 2b 20 74  ab1.col0 DIV + t
25e80 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  ab1.col1 AS col0
25e90 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
25ea0 0d 0a 30 0d 0a 36 0d 0a 36 0d 0a 0d 0a 73 6b 69  ..0..6..6....ski
25eb0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
25ec0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
25ed0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
25ee0 6c 2d 31 30 30 36 0d 0a 53 45 4c 45 43 54 20 41  l-1006..SELECT A
25ef0 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2f  LL + tab1.col0 /
25f00 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20   + tab1.col1 AS 
25f10 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
25f20 2d 2d 2d 2d 0d 0a 30 0d 0a 36 0d 0a 36 0d 0a 0d  ----..0..6..6...
25f30 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
25f40 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
25f50 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
25f60 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
25f70 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30  owsort label-100
25f80 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
25f90 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  CT - col1 * - co
25fa0 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 46 52  l1 DIV - col1 FR
25fb0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
25fc0 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a  10..-13..-26....
25fd0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
25fe0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
25ff0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26000 61 62 65 6c 2d 31 30 30 37 0d 0a 53 45 4c 45 43  abel-1007..SELEC
26010 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
26020 31 20 2a 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63  1 * - col1 / - c
26030 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
26040 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d  ---..-10..-13..-
26050 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  26....query I ro
26060 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
26070 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20  STINCT - col2 + 
26080 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2b 20  - tab1.col1 + + 
26090 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
260a0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab1..----..-2
260b0 39 0d 0a 2d 33 0d 0a 2d 37 37 0d 0a 0d 0a 71 75  9..-3..-77....qu
260c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
260d0 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63  ELECT col2 * - c
260e0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol2 * + col0 AS 
260f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
26100 2d 2d 2d 2d 0d 0a 2d 32 36 31 33 36 0d 0a 2d 33  ----..-26136..-3
26110 35 0d 0a 2d 35 39 38 34 33 36 0d 0a 0d 0a 71 75  5..-598436....qu
26120 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26130 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63  ELECT col1 * - c
26140 6f 6c 32 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 - col0 FROM 
26150 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32  tab0..----..-132
26160 0d 0a 2d 32 38 36 32 0d 0a 2d 37 35 35 31 0d 0a  ..-2862..-7551..
26170 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26180 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 32 2e 63  t..SELECT tab2.c
26190 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
261a0 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20   tab2 WHERE NOT 
261b0 4e 55 4c 4c 20 49 4e 20 28 20 74 61 62 32 2e 63  NULL IN ( tab2.c
261c0 6f 6c 31 20 2f 20 63 6f 6c 30 20 29 0d 0a 2d 2d  ol1 / col0 )..--
261d0 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
261e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
261f0 4c 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62 31 2e  L col0 * + tab1.
26200 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
26210 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 30  M tab1..----..40
26220 39 36 0d 0a 36 34 30 30 0d 0a 39 0d 0a 0d 0a 71  96..6400..9....q
26230 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26240 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26250 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col1 * + col1 + 
26260 2b 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20  + col1 - - col2 
26270 2a 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63  * tab2.col0 AS c
26280 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
26290 2d 2d 2d 0d 0a 31 31 38 31 0d 0a 33 33 30 38 0d  ---..1181..3308.
262a0 0a 35 35 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .5568....query I
262b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
262c0 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2d   col0 * col0 + -
262d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
262e0 57 48 45 52 45 20 4e 55 4c 4c 20 4e 4f 54 20 42  WHERE NULL NOT B
262f0 45 54 57 45 45 4e 20 28 20 4e 55 4c 4c 20 29 20  ETWEEN ( NULL ) 
26300 41 4e 44 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a  AND col0..----..
26310 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26320 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
26330 63 6f 6c 31 20 2d 20 74 61 62 32 2e 63 6f 6c 31  col1 - tab2.col1
26340 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 46   * - tab2.col1 F
26350 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
26360 33 30 36 0d 0a 33 35 34 30 0d 0a 39 39 32 0d 0a  306..3540..992..
26370 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26380 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 32  t..SELECT + tab2
26390 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20  .col1 FROM tab2 
263a0 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20  WHERE NULL IN ( 
263b0 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30  tab2.col1 * col0
263c0 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72   )..----....quer
263d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
263e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
263f0 30 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20  0 * tab0.col2 * 
26400 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab0.col1 FROM t
26410 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d  ab0..----..3395.
26420 0a 36 36 34 31 31 38 0d 0a 36 38 31 31 32 0d 0a  .664118..68112..
26430 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26440 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
26450 43 54 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2d  CT tab2.col2 * -
26460 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20   col2 * col2 AS 
26470 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
26480 2d 2d 2d 2d 0d 0a 2d 31 37 35 37 36 0d 0a 2d 31  ----..-17576..-1
26490 39 36 38 33 0d 0a 2d 35 34 38 37 32 0d 0a 0d 0a  9683..-54872....
264a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
264b0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63  .SELECT col0 * c
264c0 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 + col2 AS co
264d0 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
264e0 2d 2d 0d 0a 34 31 35 33 0d 0a 36 33 0d 0a 36 34  --..4153..63..64
264f0 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  96....query III 
26500 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26510 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  ALL * FROM tab0 
26520 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 30 20 4e  WHERE NOT col0 N
26530 4f 54 20 49 4e 20 28 20 2d 20 63 6f 6c 31 20 29  OT IN ( - col1 )
26540 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
26550 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26560 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
26570 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  + col0 * + col2 
26580 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  * - col0 AS col0
26590 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
265a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 34 0d  r0..----..-1224.
265b0 0a 2d 31 38 39 37 35 0d 0a 2d 36 34 39 34 34 30  .-18975..-649440
265c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
265d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
265e0 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 63   * cor0.col2 - c
265f0 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  or0.col2 AS col1
26600 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
26610 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38 0d 0a  r0..----..1508..
26620 36 30 38 0d 0a 38 31 30 0d 0a 0d 0a 71 75 65 72  608..810....quer
26630 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26640 45 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20  ECT - tab0.col2 
26650 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
26660 4e 4f 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  NOT + col0 + col
26670 31 20 3c 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a  1 < NULL..----..
26680 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26690 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
266a0 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30  CT + col0 + cor0
266b0 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c  .col1 * cor0.col
266c0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
266d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
266e0 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a 34 36  -..1422..224..46
266f0 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
26700 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
26710 4c 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  L - col1 + + col
26720 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 * col1 FROM ta
26730 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
26740 0d 0a 31 39 37 38 0d 0a 33 32 39 38 0d 0a 38 30  ..1978..3298..80
26750 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  08....onlyif mys
26760 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
26770 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
26780 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
26790 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
267a0 6c 2d 31 30 32 36 0d 0a 53 45 4c 45 43 54 20 44  l-1026..SELECT D
267b0 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
267c0 6f 6c 30 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol0 DIV cor0.col
267d0 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
267e0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
267f0 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .-1....skipif my
26800 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
26810 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
26820 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 36  wsort label-1026
26830 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
26840 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20  T - cor0.col0 / 
26850 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
26860 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
26870 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 6f  0..----..-1....o
26880 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
26890 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
268a0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
268b0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
268c0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 37 0d  sort label-1027.
268d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
268e0 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 44  r0.col0 * col1 D
268f0 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  IV col1 FROM tab
26900 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
26910 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d  .-7..-78..-79...
26920 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
26930 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
26940 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
26950 6c 61 62 65 6c 2d 31 30 32 37 0d 0a 53 45 4c 45  label-1027..SELE
26960 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
26970 6c 30 20 2a 20 63 6f 6c 31 20 2f 20 63 6f 6c 31  l0 * col1 / col1
26980 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
26990 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37  r0..----..-7..-7
269a0 38 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69 70 69 66  8..-79....skipif
269b0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
269c0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
269d0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
269e0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
269f0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
26a00 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
26a10 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e  0.col1 + + cor0.
26a20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
26a30 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
26a40 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a  -..-33..-4..21..
26a50 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
26a60 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
26a70 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
26a80 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
26a90 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
26aa0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 39 0d  sort label-1029.
26ab0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54  .SELECT ALL CAST
26ac0 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
26ad0 20 29 20 2a 20 28 20 2d 20 63 6f 6c 31 20 29 20   ) * ( - col1 ) 
26ae0 2a 20 63 6f 6c 32 20 2b 20 32 39 20 2a 20 2d 20  * col2 + 29 * - 
26af0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
26b00 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
26b10 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
26b20 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
26b30 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
26b40 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
26b50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
26b60 30 32 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  029..SELECT ALL 
26b70 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
26b80 4e 54 45 47 45 52 20 29 20 2a 20 28 20 2d 20 63  NTEGER ) * ( - c
26b90 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 2b 20 32  ol1 ) * col2 + 2
26ba0 39 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  9 * - col0 AS co
26bb0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
26bc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
26bd0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
26be0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26bf0 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32  .SELECT - + col2
26c00 20 2b 20 2b 20 37 33 20 41 53 20 63 6f 6c 31 20   + + 73 AS col1 
26c10 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
26c20 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 31 36 0d 0a 31  ----..-23..16..1
26c30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
26c40 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
26c50 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
26c60 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
26c70 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
26c80 2d 31 30 33 31 0d 0a 53 45 4c 45 43 54 20 41 4c  -1031..SELECT AL
26c90 4c 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  L + col1 + + col
26ca0 30 20 44 49 56 20 2d 20 63 6f 6c 32 20 46 52 4f  0 DIV - col2 FRO
26cb0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
26cc0 2d 2d 2d 2d 0d 0a 31 33 0d 0a 32 36 0d 0a 39 0d  ----..13..26..9.
26cd0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
26ce0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
26cf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26d00 74 20 6c 61 62 65 6c 2d 31 30 33 31 0d 0a 53 45  t label-1031..SE
26d10 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
26d20 2b 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  + + col0 / - col
26d30 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
26d40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 32  or0..----..13..2
26d50 36 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6..9....query I 
26d60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26d70 35 34 20 2a 20 38 32 20 2b 20 2b 20 63 6f 6c 30  54 * 82 + + col0
26d80 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
26d90 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
26da0 0d 0a 34 34 33 35 0d 0a 34 35 30 36 0d 0a 34 35  ..4435..4506..45
26db0 30 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  07....skipif pos
26dc0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
26dd0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
26de0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
26df0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
26e00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26e10 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26e20 2d 20 32 36 20 63 6f 6c 32 20 46 52 4f 4d 20 74  - 26 col2 FROM t
26e30 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a  ab2..----..-26..
26e40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26e50 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
26e60 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  CT - col1 * col0
26e70 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 37 39 20 2a   * col0 - - 79 *
26e80 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
26e90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
26ea0 31 30 33 30 39 35 0d 0a 2d 33 35 36 39 30 32 0d  103095..-356902.
26eb0 0a 36 31 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .614....onlyif m
26ec0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
26ed0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
26ee0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
26ef0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
26f00 62 65 6c 2d 31 30 33 35 0d 0a 53 45 4c 45 43 54  bel-1035..SELECT
26f10 20 44 49 53 54 49 4e 43 54 20 2d 20 36 20 44 49   DISTINCT - 6 DI
26f20 56 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  V cor0.col1 FROM
26f30 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
26f40 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
26f50 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
26f60 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
26f70 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 35  wsort label-1035
26f80 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
26f90 54 20 2d 20 36 20 2f 20 63 6f 72 30 2e 63 6f 6c  T - 6 / cor0.col
26fa0 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
26fb0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
26fc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26fd0 4c 45 43 54 20 2d 20 2d 20 31 32 20 2a 20 63 6f  LECT - - 12 * co
26fe0 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32  r0.col1 + - col2
26ff0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
27000 0a 2d 2d 2d 2d 0d 0a 32 35 38 0d 0a 36 30 0d 0a  .----..258..60..
27010 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  63....query I ro
27020 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
27030 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  L cor0.col2 * + 
27040 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63  col0 + col0 AS c
27050 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
27060 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36   cor0..----..196
27070 0d 0a 32 31 30 36 0d 0a 33 30 38 31 0d 0a 0d 0a  ..2106..3081....
27080 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27090 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
270a0 20 2b 20 35 36 20 2a 20 2d 20 63 6f 6c 32 20 41   + 56 * - col2 A
270b0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
270c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
270d0 2d 33 30 32 34 0d 0a 2d 33 31 39 32 0d 0a 2d 35  -3024..-3192..-5
270e0 33 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  376....onlyif my
270f0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
27100 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
27110 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
27120 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
27130 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
27140 31 30 33 39 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  1039..SELECT + +
27150 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a   col1 + - col0 *
27160 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53   CAST( col2 AS S
27170 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20  IGNED ) AS col1 
27180 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
27190 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 36 0d 0a 2d  0..----..-706..-
271a0 37 32 30 37 0d 0a 36 32 0d 0a 0d 0a 73 6b 69 70  7207..62....skip
271b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
271c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
271d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
271e0 2d 31 30 33 39 0d 0a 53 45 4c 45 43 54 20 2b 20  -1039..SELECT + 
271f0 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  + col1 + - col0 
27200 2a 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53  * CAST ( col2 AS
27210 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
27220 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
27230 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 36  cor0..----..-706
27240 0d 0a 2d 37 32 30 37 0d 0a 36 32 0d 0a 0d 0a 6f  ..-7207..62....o
27250 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
27260 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
27270 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
27280 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
27290 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 30 0d  sort label-1040.
272a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
272b0 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30   + col2 DIV col0
272c0 20 2b 20 2d 20 35 20 46 52 4f 4d 20 74 61 62 30   + - 5 FROM tab0
272d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
272e0 2d 34 0d 0a 2d 35 0d 0a 0d 0a 73 6b 69 70 69 66  -4..-5....skipif
272f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
27300 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
27310 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
27320 30 34 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  040..SELECT DIST
27330 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2f 20 63 6f  INCT + col2 / co
27340 6c 30 20 2b 20 2d 20 35 20 46 52 4f 4d 20 74 61  l0 + - 5 FROM ta
27350 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
27360 0d 0a 2d 34 0d 0a 2d 35 0d 0a 0d 0a 71 75 65 72  ..-4..-5....quer
27370 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27380 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72  ECT DISTINCT cor
27390 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  0.col2 * + col1 
273a0 2b 20 2d 20 28 20 63 6f 6c 32 20 2a 20 63 6f 6c  + - ( col2 * col
273b0 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  0 ) AS col1 FROM
273c0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
273d0 2d 2d 2d 0d 0a 2d 32 33 35 36 0d 0a 2d 34 39 34  ---..-2356..-494
273e0 0d 0a 36 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..648....query I
273f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27400 20 2d 20 63 6f 6c 31 20 2b 20 28 20 37 39 20 2b   - col1 + ( 79 +
27410 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 30 20 46   col0 ) * col0 F
27420 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
27430 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 30 37 0d 0a 32  ..----..12707..2
27440 32 30 0d 0a 39 31 34 32 0d 0a 0d 0a 71 75 65 72  20..9142....quer
27450 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27460 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63  ECT ALL + cor0.c
27470 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63  ol0 * + col1 + c
27480 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
27490 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
274a0 2d 2d 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a  ---..1422..224..
274b0 34 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4680....query I 
274c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
274d0 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 35  ALL + + col0 + 5
274e0 39 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  9 * - col1 FROM 
274f0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
27500 0a 2d 35 30 35 30 0d 0a 2d 35 32 38 30 0d 0a 2d  .-5050..-5280..-
27510 35 36 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5688....query I 
27520 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27530 41 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  ALL col2 + col2 
27540 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
27550 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27560 31 30 35 0d 0a 31 31 32 0d 0a 35 30 0d 0a 0d 0a  105..112..50....
27570 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27580 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
27590 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   * + col1 + col1
275a0 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
275b0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
275c0 0a 31 31 34 30 0d 0a 32 34 39 36 0d 0a 32 38 30  .1140..2496..280
275d0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
275e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
275f0 6f 6c 32 20 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c  ol2 * col1 - col
27600 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  0 * col2 AS col0
27610 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
27620 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 36 0d  r0..----..-1026.
27630 0a 2d 33 35 36 32 0d 0a 2d 33 36 34 38 0d 0a 0d  .-3562..-3648...
27640 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
27650 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
27660 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
27670 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
27680 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34  owsort label-104
27690 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 33  8..SELECT ALL 83
276a0 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   DIV + col1 FROM
276b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
276c0 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 34 0d 0a 0d 0a  ---..1..2..4....
276d0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
276e0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
276f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
27700 61 62 65 6c 2d 31 30 34 38 0d 0a 53 45 4c 45 43  abel-1048..SELEC
27710 54 20 41 4c 4c 20 38 33 20 2f 20 2b 20 63 6f 6c  T ALL 83 / + col
27720 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
27730 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d  or0..----..1..2.
27740 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .4....query I ro
27750 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
27760 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
27770 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  + col0 + cor0.co
27780 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
27790 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30  cor0..----..1360
277a0 0d 0a 32 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 6f  ..248..4661....o
277b0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
277c0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
277d0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
277e0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
277f0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 30 0d  sort label-1050.
27800 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28 20 2b 20  .SELECT + - ( + 
27810 63 6f 6c 32 20 29 20 44 49 56 20 2d 20 63 6f 6c  col2 ) DIV - col
27820 32 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 + + col1 FROM 
27830 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
27840 0a 31 31 0d 0a 31 34 0d 0a 32 37 0d 0a 0d 0a 73  .11..14..27....s
27850 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
27860 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
27870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
27880 62 65 6c 2d 31 30 35 30 0d 0a 53 45 4c 45 43 54  bel-1050..SELECT
27890 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20   + - ( + col2 ) 
278a0 2f 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  / - col2 + + col
278b0 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
278c0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a  ..----..11..14..
278d0 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  27....query I ro
278e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
278f0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
27900 39 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  91 FROM tab2 cor
27910 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 34 37 0d 0a 32  0..----..1547..2
27920 38 32 31 0d 0a 35 33 36 39 0d 0a 0d 0a 71 75 65  821..5369....que
27930 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27940 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
27950 2a 20 39 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  * 90 AS col2 FRO
27960 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
27970 2d 2d 2d 2d 0d 0a 2d 31 31 37 30 0d 0a 2d 32 33  ----..-1170..-23
27980 34 30 0d 0a 2d 39 30 30 0d 0a 0d 0a 71 75 65 72  40..-900....quer
27990 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
279a0 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  ECT cor0.col0 + 
279b0 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  + col1 * cor0.co
279c0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
279d0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
279e0 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36 32 0d 0a 37  --..132..2862..7
279f0 35 35 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  551....onlyif my
27a00 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
27a10 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
27a20 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
27a30 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
27a40 65 6c 2d 31 30 35 34 0d 0a 53 45 4c 45 43 54 20  el-1054..SELECT 
27a50 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 38 33 20  DISTINCT - - 83 
27a60 44 49 56 20 2b 20 33 31 20 46 52 4f 4d 20 74 61  DIV + 31 FROM ta
27a70 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
27a80 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..2....skipif my
27a90 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
27aa0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
27ab0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 34  wsort label-1054
27ac0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
27ad0 54 20 2d 20 2d 20 38 33 20 2f 20 2b 20 33 31 20  T - - 83 / + 31 
27ae0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
27af0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 0d 0a 71 75  0..----..2....qu
27b00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27b10 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
27b20 20 2a 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20   * + ( + col2 ) 
27b30 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
27b40 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 32 0d 0a 2d 31  ..----..-182..-1
27b50 39 35 30 0d 0a 2d 32 39 32 33 0d 0a 0d 0a 71 75  950..-2923....qu
27b60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27b70 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b  ELECT ALL col1 +
27b80 20 28 20 32 20 29 20 41 53 20 63 6f 6c 30 20 46   ( 2 ) AS col0 F
27b90 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
27ba0 31 39 0d 0a 33 33 0d 0a 36 31 0d 0a 0d 0a 71 75  19..33..61....qu
27bb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27bc0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
27bd0 20 35 39 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 72   59 * col0 + cor
27be0 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
27bf0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27c00 2d 31 35 31 0d 0a 2d 33 37 36 36 0d 0a 2d 34 37  -151..-3766..-47
27c10 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  07....query I ro
27c20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
27c30 2d 20 34 33 20 2b 20 2b 20 33 38 20 41 53 20 63  - 43 + + 38 AS c
27c40 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
27c50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 31 0d   cor0..----..81.
27c60 0a 38 31 0d 0a 38 31 0d 0a 0d 0a 6f 6e 6c 79 69  .81..81....onlyi
27c70 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
27c80 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
27c90 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
27ca0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
27cb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
27cc0 62 65 6c 2d 31 30 35 39 0d 0a 53 45 4c 45 43 54  bel-1059..SELECT
27cd0 20 41 4c 4c 20 2d 20 2b 20 32 32 20 2a 20 2d 20   ALL - + 22 * - 
27ce0 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col2 + col0 * - 
27cf0 43 41 53 54 28 20 2d 20 63 6f 6c 30 20 41 53 20  CAST( - col0 AS 
27d00 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31  SIGNED ) AS col1
27d10 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
27d20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 34 33 0d 0a 36  r0..----..643..6
27d30 36 35 36 0d 0a 37 30 37 37 0d 0a 0d 0a 73 6b 69  656..7077....ski
27d40 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
27d50 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
27d60 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
27d70 6c 2d 31 30 35 39 0d 0a 53 45 4c 45 43 54 20 41  l-1059..SELECT A
27d80 4c 4c 20 2d 20 2b 20 32 32 20 2a 20 2d 20 63 6f  LL - + 22 * - co
27d90 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41  l2 + col0 * - CA
27da0 53 54 20 28 20 2d 20 63 6f 6c 30 20 41 53 20 49  ST ( - col0 AS I
27db0 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31  NTEGER ) AS col1
27dc0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
27dd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 34 33 0d 0a 36  r0..----..643..6
27de0 36 35 36 0d 0a 37 30 37 37 0d 0a 0d 0a 6f 6e 6c  656..7077....onl
27df0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
27e00 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
27e10 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
27e20 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
27e30 72 74 20 6c 61 62 65 6c 2d 31 30 36 30 0d 0a 53  rt label-1060..S
27e40 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
27e50 6f 6c 30 20 44 49 56 20 31 37 20 2b 20 2b 20 63  ol0 DIV 17 + + c
27e60 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
27e70 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d   tab2..----..27.
27e80 0a 33 30 0d 0a 34 32 0d 0a 0d 0a 73 6b 69 70 69  .30..42....skipi
27e90 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
27ea0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
27eb0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
27ec0 31 30 36 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  1060..SELECT DIS
27ed0 54 49 4e 43 54 20 63 6f 6c 30 20 2f 20 31 37 20  TINCT col0 / 17 
27ee0 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  + + col2 AS col2
27ef0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
27f00 0d 0a 32 37 0d 0a 33 30 0d 0a 34 32 0d 0a 0d 0a  ..27..30..42....
27f10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27f20 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
27f30 20 28 20 74 61 62 31 2e 63 6f 6c 32 20 29 20 46   ( tab1.col2 ) F
27f40 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
27f50 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 71 75  28..47..83....qu
27f60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27f70 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
27f80 6f 6c 31 20 2b 20 2d 20 32 33 20 46 52 4f 4d 20  ol1 + - 23 FROM 
27f90 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a  tab2..----..-6..
27fa0 33 36 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49  36..8....query I
27fb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27fc0 20 2b 20 36 20 2a 20 63 6f 6c 32 20 46 52 4f 4d   + 6 * col2 FROM
27fd0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
27fe0 0d 0a 33 32 34 0d 0a 33 34 32 0d 0a 35 37 36 0d  ..324..342..576.
27ff0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28000 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
28010 2b 20 38 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 81 AS col2 FRO
28020 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab2..----..10
28030 37 0d 0a 31 30 38 0d 0a 31 31 39 0d 0a 0d 0a 71  7..108..119....q
28040 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28050 53 45 4c 45 43 54 20 2b 20 34 37 20 2a 20 2d 20  SELECT + 47 * - 
28060 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  5 AS col0 FROM t
28070 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 35 0d  ab1..----..-235.
28080 0a 2d 32 33 35 0d 0a 2d 32 33 35 0d 0a 0d 0a 71  .-235..-235....q
28090 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
280a0 53 45 4c 45 43 54 20 2d 20 35 30 20 2b 20 63 6f  SELECT - 50 + co
280b0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
280c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d  cor0..----..-19.
280d0 0a 2d 33 33 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79  .-33..9....query
280e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
280f0 43 54 20 44 49 53 54 49 4e 43 54 20 31 34 20 2b  CT DISTINCT 14 +
28100 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b   col0 * + col1 +
28110 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
28120 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 31 31 0d 0a 33  0..----..2111..3
28130 34 31 30 0d 0a 38 31 39 35 0d 0a 0d 0a 71 75 65  410..8195....que
28140 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28150 4c 45 43 54 20 2d 20 35 39 20 2a 20 2d 20 63 6f  LECT - 59 * - co
28160 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
28170 2d 2d 0d 0a 31 35 33 34 0d 0a 31 35 39 33 0d 0a  --..1534..1593..
28180 32 32 34 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  2242....onlyif m
28190 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
281a0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
281b0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
281c0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
281d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
281e0 2d 31 30 36 39 0d 0a 53 45 4c 45 43 54 20 44 49  -1069..SELECT DI
281f0 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 63  STINCT - CAST( c
28200 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol0 AS SIGNED ) 
28210 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  + + col1 AS col1
28220 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
28230 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d  r0..----..-54..-
28240 36 37 0d 0a 32 33 0d 0a 0d 0a 73 6b 69 70 69 66  67..23....skipif
28250 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
28260 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
28270 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
28280 30 36 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  069..SELECT DIST
28290 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 63 6f  INCT - CAST ( co
282a0 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
282b0 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  + + col1 AS col1
282c0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
282d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d  r0..----..-54..-
282e0 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79 20  67..23....query 
282f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28300 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
28310 6f 6c 31 20 2a 20 2d 20 35 33 20 2a 20 2b 20 63  ol1 * - 53 * + c
28320 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
28330 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30   cor0..----..150
28340 34 31 34 0d 0a 33 39 35 34 38 36 0d 0a 35 31 34  414..395486..514
28350 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
28360 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
28370 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 29 20 46  ol1 + - col1 ) F
28380 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
28390 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
283a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
283b0 43 54 20 44 49 53 54 49 4e 43 54 20 35 37 20 2b  CT DISTINCT 57 +
283c0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   - cor0.col0 FRO
283d0 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61  M tab0, tab1, ta
283e0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
283f0 0d 0a 2d 33 32 0d 0a 32 32 0d 0a 33 33 0d 0a 0d  ..-32..22..33...
28400 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28410 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f  ..SELECT tab1.co
28420 6c 30 20 2a 20 2b 20 35 39 20 46 52 4f 4d 20 74  l0 * + 59 FROM t
28430 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37 37 0d 0a  ab1..----..177..
28440 33 37 37 36 0d 0a 34 37 32 30 0d 0a 0d 0a 71 75  3776..4720....qu
28450 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28460 45 4c 45 43 54 20 28 20 2d 20 34 35 20 29 20 2a  ELECT ( - 45 ) *
28470 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
28480 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
28490 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
284a0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
284b0 65 34 64 35 63 36 33 63 64 34 35 30 66 32 62 33  e4d5c63cd450f2b3
284c0 33 65 66 65 36 30 35 63 64 37 33 38 30 32 39 64  3efe605cd738029d
284d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
284e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
284f0 6c 32 20 2a 20 2b 20 37 34 20 2d 20 63 6f 72 30  l2 * + 74 - cor0
28500 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f  .col0 * col1 FRO
28510 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
28520 2d 2d 2d 2d 0d 0a 2d 32 36 37 38 0d 0a 31 34 36  ----..-2678..146
28530 39 0d 0a 31 37 38 31 0d 0a 0d 0a 71 75 65 72 79  9..1781....query
28540 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28550 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
28560 63 6f 6c 31 20 2b 20 35 31 20 2a 20 63 6f 6c 32  col1 + 51 * col2
28570 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
28580 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
28590 0d 0a 31 33 38 35 0d 0a 31 34 30 38 0d 0a 31 39  ..1385..1408..19
285a0 35 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  55....onlyif mys
285b0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
285c0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
285d0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
285e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
285f0 6c 2d 31 30 37 37 0d 0a 53 45 4c 45 43 54 20 2d  l-1077..SELECT -
28600 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f   + col1 DIV - co
28610 6c 31 20 2b 20 2d 20 32 37 20 46 52 4f 4d 20 74  l1 + - 27 FROM t
28620 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
28630 2d 32 36 0d 0a 2d 32 36 0d 0a 2d 32 36 0d 0a 0d  -26..-26..-26...
28640 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
28650 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
28660 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
28670 6c 61 62 65 6c 2d 31 30 37 37 0d 0a 53 45 4c 45  label-1077..SELE
28680 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2f 20 2d 20  CT - + col1 / - 
28690 63 6f 6c 31 20 2b 20 2d 20 32 37 20 46 52 4f 4d  col1 + - 27 FROM
286a0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
286b0 0d 0a 2d 32 36 0d 0a 2d 32 36 0d 0a 2d 32 36 0d  ..-26..-26..-26.
286c0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
286d0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
286e0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
286f0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
28700 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
28710 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28720 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  ECT - col0 * - c
28730 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 63 6f 6c  ol0 - - col2 col
28740 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
28750 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 36 0d  or0..----..1226.
28760 0a 36 30 39 0d 0a 38 30 30 33 0d 0a 0d 0a 71 75  .609..8003....qu
28770 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28780 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
28790 6f 6c 31 20 2a 20 2d 20 36 20 46 52 4f 4d 20 74  ol1 * - 6 FROM t
287a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
287b0 2d 0d 0a 2d 35 31 36 0d 0a 2d 35 34 36 0d 0a 2d  -..-516..-546..-
287c0 35 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  582....query I r
287d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
287e0 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 37 34 20  ol2 + col1 * 74 
287f0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
28800 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
28810 0a 36 33 39 37 0d 0a 36 38 31 36 0d 0a 37 31 37  .6397..6816..717
28820 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
28830 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
28840 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a  TINCT + - col1 *
28850 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   ( col1 ) FROM t
28860 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
28870 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d  -..-7396..-8281.
28880 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20  .-9409....query 
28890 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
288a0 54 20 41 4c 4c 20 35 34 20 2a 20 63 6f 6c 30 20  T ALL 54 * col0 
288b0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
288c0 0a 31 36 32 0d 0a 33 34 35 36 0d 0a 34 33 32 30  .162..3456..4320
288d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
288e0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
288f0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
28900 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
28910 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
28920 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28930 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 36 39  LECT DISTINCT 69
28940 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
28950 0a 2d 2d 2d 2d 0d 0a 36 39 0d 0a 0d 0a 73 6b 69  .----..69....ski
28960 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
28970 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
28980 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
28990 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
289a0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
289b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
289c0 63 6f 6c 32 20 2a 20 2b 20 74 61 62 32 2e 63 6f  col2 * + tab2.co
289d0 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
289e0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d 0a  2..----..-1444..
289f0 2d 36 37 36 0d 0a 2d 37 32 39 0d 0a 0d 0a 71 75  -676..-729....qu
28a00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28a10 45 4c 45 43 54 20 34 38 20 2a 20 2d 20 63 6f 6c  ELECT 48 * - col
28a20 31 20 2b 20 2d 20 32 34 20 46 52 4f 4d 20 74 61  1 + - 24 FROM ta
28a30 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
28a40 0d 0a 2d 31 32 37 32 0d 0a 2d 35 30 34 0d 0a 2d  ..-1272..-504..-
28a50 36 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  648....query I r
28a60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
28a70 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   + col1 + - col0
28a80 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
28a90 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
28aa0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a  or0..----..-17..
28ab0 34 30 38 36 0d 0a 36 33 38 37 0d 0a 0d 0a 71 75  4086..6387....qu
28ac0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28ad0 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 39 20 2b  ELECT col0 * 9 +
28ae0 20 2d 20 35 36 20 41 53 20 63 6f 6c 30 20 46 52   - 56 AS col0 FR
28af0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
28b00 0a 2d 2d 2d 2d 0d 0a 31 36 30 0d 0a 32 35 39 0d  .----..160..259.
28b10 0a 37 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .745....query I 
28b20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28b30 2b 20 63 6f 6c 30 20 2a 20 2d 20 31 39 20 46 52  + col0 * - 19 FR
28b40 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
28b50 2d 2d 0d 0a 2d 31 36 39 31 0d 0a 2d 34 35 36 0d  --..-1691..-456.
28b60 0a 2d 36 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .-665....query I
28b70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28b80 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63   - col0 * cor0.c
28b90 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  ol1 * - col0 FRO
28ba0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
28bb0 2d 2d 2d 2d 0d 0a 31 30 36 30 39 37 0d 0a 31 35  ----..106097..15
28bc0 31 39 0d 0a 33 35 38 39 35 36 0d 0a 0d 0a 73 6b  19..358956....sk
28bd0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
28be0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
28bf0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
28c00 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
28c10 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
28c20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
28c30 20 63 6f 6c 31 20 2b 20 2b 20 35 32 20 63 6f 6c   col1 + + 52 col
28c40 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
28c50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 0d 0a  or0..----..138..
28c60 31 34 33 0d 0a 31 34 39 0d 0a 0d 0a 71 75 65 72  143..149....quer
28c70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28c80 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT - cor0.col2 
28c90 2b 20 2d 20 28 20 39 39 20 29 20 41 53 20 63 6f  + - ( 99 ) AS co
28ca0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
28cb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35  cor0..----..-125
28cc0 0d 0a 2d 31 32 36 0d 0a 2d 31 33 37 0d 0a 0d 0a  ..-126..-137....
28cd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28ce0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
28cf0 20 2b 20 2b 20 35 38 20 41 53 20 63 6f 6c 32 20   + + 58 AS col2 
28d00 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
28d10 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 0d 0a 31 31  0..----..112..11
28d20 35 0d 0a 31 35 34 0d 0a 0d 0a 71 75 65 72 79 20  5..154....query 
28d30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28d40 54 20 2b 20 28 20 2d 20 35 32 20 29 20 2a 20 2d  T + ( - 52 ) * -
28d50 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
28d60 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
28d70 0a 2d 2d 2d 2d 0d 0a 34 34 37 32 0d 0a 34 37 33  .----..4472..473
28d80 32 0d 0a 35 30 34 34 0d 0a 0d 0a 6f 6e 6c 79 69  2..5044....onlyi
28d90 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
28da0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
28db0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
28dc0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
28dd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
28de0 62 65 6c 2d 31 30 39 34 0d 0a 53 45 4c 45 43 54  bel-1094..SELECT
28df0 20 2d 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20   - CAST( + col1 
28e00 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20  AS SIGNED ) * + 
28e10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
28e20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
28e30 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d  838..-7462..-97.
28e40 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
28e50 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
28e60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28e70 74 20 6c 61 62 65 6c 2d 31 30 39 34 0d 0a 53 45  t label-1094..SE
28e80 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 2b 20  LECT - CAST ( + 
28e90 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
28ea0 29 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ) * + col2 FROM 
28eb0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
28ec0 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 32  --..-2838..-7462
28ed0 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-97....query I
28ee0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28ef0 20 41 4c 4c 20 2b 20 28 20 28 20 2b 20 63 6f 6c   ALL + ( ( + col
28f00 32 20 29 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f  2 ) ) + col2 FRO
28f10 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
28f20 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31 31 34 0d 0a  ----..108..114..
28f30 31 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  192....query I r
28f40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
28f50 20 38 32 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63   82 * + col0 * c
28f60 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
28f70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30   cor0..----..110
28f80 31 32 36 0d 0a 31 37 37 39 34 0d 0a 33 37 37 33  126..17794..3773
28f90 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
28fa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
28fb0 53 54 49 4e 43 54 20 2d 20 39 35 20 2a 20 2b 20  STINCT - 95 * + 
28fc0 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
28fd0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
28fe0 2d 0d 0a 2d 31 36 31 35 0d 0a 2d 32 39 34 35 0d  -..-1615..-2945.
28ff0 0a 2d 35 36 30 35 0d 0a 0d 0a 73 6b 69 70 69 66  .-5605....skipif
29000 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
29010 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
29020 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
29030 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
29040 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
29050 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
29060 32 20 2a 20 2d 20 37 20 63 6f 6c 31 20 46 52 4f  2 * - 7 col1 FRO
29070 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
29080 2d 2d 2d 2d 0d 0a 32 33 31 0d 0a 35 37 34 0d 0a  ----..231..574..
29090 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
290a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
290b0 20 34 37 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c   47 * - cor0.col
290c0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
290d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
290e0 2d 0d 0a 2d 33 32 39 0d 0a 2d 33 36 36 36 0d 0a  -..-329..-3666..
290f0 2d 33 37 31 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -3713....onlyif 
29100 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
29110 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
29120 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
29130 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
29140 61 62 65 6c 2d 31 31 30 30 0d 0a 53 45 4c 45 43  abel-1100..SELEC
29150 54 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 30 20  T col0 + ( col0 
29160 29 20 44 49 56 20 2b 20 74 61 62 30 2e 63 6f 6c  ) DIV + tab0.col
29170 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
29180 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33  ab0..----..25..3
29190 36 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  6..90....skipif 
291a0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
291b0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
291c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
291d0 30 30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  00..SELECT col0 
291e0 2b 20 28 20 63 6f 6c 30 20 29 20 2f 20 2b 20 74  + ( col0 ) / + t
291f0 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  ab0.col0 AS col0
29200 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
29210 0d 0a 32 35 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a  ..25..36..90....
29220 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
29230 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
29240 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
29250 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
29260 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
29270 72 74 20 6c 61 62 65 6c 2d 31 31 30 31 0d 0a 53  rt label-1101..S
29280 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55  ELECT + CAST( NU
29290 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20  LL AS DECIMAL ) 
292a0 2a 20 33 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  * 32 AS col2 FRO
292b0 4d 20 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61  M tab2, tab1, ta
292c0 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b2 AS cor0, tab0
292d0 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
292e0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 62 33  s hashing to cb3
292f0 33 63 33 30 64 36 66 35 32 62 62 62 32 34 33 33  3c30d6f52bbb2433
29300 38 61 32 39 33 63 37 34 30 66 32 39 63 0d 0a 0d  8a293c740f29c...
29310 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
29320 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
29330 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
29340 6c 61 62 65 6c 2d 31 31 30 31 0d 0a 53 45 4c 45  label-1101..SELE
29350 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT + CAST ( NULL
29360 20 41 53 20 52 45 41 4c 20 29 20 2a 20 33 32 20   AS REAL ) * 32 
29370 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
29380 32 2c 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  2, tab1, tab2 AS
29390 20 63 6f 72 30 2c 20 74 61 62 30 0d 0a 2d 2d 2d   cor0, tab0..---
293a0 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73  -..81 values has
293b0 68 69 6e 67 20 74 6f 20 63 62 33 33 63 33 30 64  hing to cb33c30d
293c0 36 66 35 32 62 62 62 32 34 33 33 38 61 32 39 33  6f52bbb24338a293
293d0 63 37 34 30 66 32 39 63 0d 0a 0d 0a 71 75 65 72  c740f29c....quer
293e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
293f0 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  ECT col1 * - col
29400 32 20 2d 20 2b 20 39 32 20 2a 20 63 6f 72 30 2e  2 - + 92 * cor0.
29410 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
29420 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
29430 35 30 30 36 0d 0a 2d 31 38 39 0d 0a 2d 35 38 37  5006..-189..-587
29440 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
29450 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
29460 20 2b 20 34 36 20 41 53 20 63 6f 6c 30 20 46 52   + 46 AS col0 FR
29470 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
29480 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
29490 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72 31   tab2, tab1 cor1
294a0 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
294b0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 38 36  s hashing to 086
294c0 65 38 66 35 36 32 30 31 66 62 66 34 63 30 63 65  e8f56201fbf4c0ce
294d0 37 34 30 38 37 65 37 31 30 38 31 31 64 0d 0a 0d  74087e710811d...
294e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
294f0 0d 0a 53 45 4c 45 43 54 20 63 6f 72 32 2e 63 6f  ..SELECT cor2.co
29500 6c 31 20 2d 20 63 6f 72 31 2e 63 6f 6c 32 20 46  l1 - cor1.col2 F
29510 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
29520 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
29530 4e 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61  N tab1, tab2, ta
29540 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30  b1 AS cor1, tab0
29550 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
29560 37 32 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  729 values hashi
29570 6e 67 20 74 6f 20 30 30 38 30 30 66 38 34 36 33  ng to 00800f8463
29580 33 63 39 33 66 39 34 66 64 64 63 37 32 64 63 30  3c93f94fddc72dc0
29590 62 66 30 34 35 66 0d 0a 0d 0a 71 75 65 72 79 20  bf045f....query 
295a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
295b0 54 20 41 4c 4c 20 2b 20 31 33 20 2a 20 74 61 62  T ALL + 13 * tab
295c0 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  1.col1 AS col1 F
295d0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
295e0 31 33 30 0d 0a 31 36 39 0d 0a 33 33 38 0d 0a 0d  130..169..338...
295f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29600 0d 0a 53 45 4c 45 43 54 20 39 36 20 46 52 4f 4d  ..SELECT 96 FROM
29610 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63   tab2, tab2 AS c
29620 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
29630 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  ab0..----..27 va
29640 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
29650 66 31 64 39 37 38 63 32 64 35 62 66 63 36 66 32  f1d978c2d5bfc6f2
29660 36 65 30 39 30 37 61 63 37 37 37 62 65 38 33 65  6e0907ac777be83e
29670 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29680 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
29690 2b 20 2d 20 39 37 20 2a 20 2b 20 63 6f 6c 31 20  + - 97 * + col1 
296a0 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  + - col1 + + col
296b0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
296c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
296d0 2d 0d 0a 2d 38 33 34 32 0d 0a 2d 38 38 32 37 0d  -..-8342..-8827.
296e0 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20  .-9409....query 
296f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29700 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38 34 20  T DISTINCT - 84 
29710 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
29720 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
29730 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35 31 0d  ..----..-2..-51.
29740 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-83....query I 
29750 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29760 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20 63  DISTINCT + ( + c
29770 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20 63 6f 6c  or0.col0 ) + col
29780 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
29790 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a  or0..----..171..
297a0 33 36 0d 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  36..57....onlyif
297b0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
297c0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
297d0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
297e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
297f0 6c 61 62 65 6c 2d 31 31 31 30 0d 0a 53 45 4c 45  label-1110..SELE
29800 43 54 20 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20  CT - + ( col1 ) 
29810 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  DIV - col0 FROM 
29820 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
29830 2d 2d 0d 0a 30 0d 0a 30 0d 0a 38 0d 0a 0d 0a 73  --..0..0..8....s
29840 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
29850 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
29860 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
29870 62 65 6c 2d 31 31 31 30 0d 0a 53 45 4c 45 43 54  bel-1110..SELECT
29880 20 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20 2f 20   - + ( col1 ) / 
29890 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
298a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
298b0 30 0d 0a 30 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79  0..0..8....query
298c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
298d0 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20 63 6f 6c  CT ALL + ( - col
298e0 32 20 29 20 2b 20 36 38 20 46 52 4f 4d 20 74 61  2 ) + 68 FROM ta
298f0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
29900 32 38 0d 0a 31 31 0d 0a 31 34 0d 0a 0d 0a 71 75  28..11..14....qu
29910 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29920 45 4c 45 43 54 20 2b 20 38 38 20 41 53 20 63 6f  ELECT + 88 AS co
29930 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
29940 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
29950 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
29960 6e 67 20 74 6f 20 36 62 65 31 37 62 38 32 65 63  ng to 6be17b82ec
29970 62 33 65 38 62 32 36 38 66 63 62 34 62 61 36 31  b3e8b268fcb4ba61
29980 30 64 64 62 33 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  0ddb37....onlyif
29990 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
299a0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
299b0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
299c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
299d0 6c 61 62 65 6c 2d 31 31 31 33 0d 0a 53 45 4c 45  label-1113..SELE
299e0 43 54 20 41 4c 4c 20 2b 20 33 34 20 44 49 56 20  CT ALL + 34 DIV 
299f0 2b 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d  + tab1.col0 FROM
29a00 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab1..----..0..
29a10 30 0d 0a 31 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  0..11....skipif 
29a20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
29a30 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
29a40 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
29a50 31 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  13..SELECT ALL +
29a60 20 33 34 20 2f 20 2b 20 74 61 62 31 2e 63 6f 6c   34 / + tab1.col
29a70 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
29a80 2d 0d 0a 30 0d 0a 30 0d 0a 31 31 0d 0a 0d 0a 71  -..0..0..11....q
29a90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29aa0 53 45 4c 45 43 54 20 37 37 20 2b 20 63 6f 6c 32  SELECT 77 + col2
29ab0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
29ac0 0d 0a 31 31 30 0d 0a 31 35 39 0d 0a 37 38 0d 0a  ..110..159..78..
29ad0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29ae0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61  t..SELECT ALL ta
29af0 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  b1.col2 AS col1 
29b00 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20  FROM tab1, tab2 
29b10 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f  AS cor0, tab2 co
29b20 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
29b30 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
29b40 66 34 61 39 62 66 32 34 64 36 34 38 33 33 37 30  f4a9bf24d6483370
29b50 36 64 66 62 64 64 30 62 61 66 34 39 64 37 39 0d  6dfbdd0baf49d79.
29b60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29b70 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
29b80 4e 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  NCT col0 * + col
29b90 31 20 2d 20 37 35 20 46 52 4f 4d 20 74 61 62 30  1 - 75 FROM tab0
29ba0 0d 0a 2d 2d 2d 2d 0d 0a 31 39 38 39 0d 0a 33 33  ..----..1989..33
29bb0 32 30 0d 0a 38 30 32 34 0d 0a 0d 0a 71 75 65 72  20..8024....quer
29bc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29bd0 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 63  ECT - - col2 + c
29be0 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol0 * - col0 AS 
29bf0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
29c00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
29c10 32 0d 0a 2d 36 30 35 38 0d 0a 2d 36 32 30 33 0d  2..-6058..-6203.
29c20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29c30 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
29c40 4e 43 54 20 2d 20 33 34 20 2a 20 63 6f 6c 32 20  NCT - 34 * col2 
29c50 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  - + col0 FROM ta
29c60 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 33 39 0d  b1..----..-1839.
29c70 0a 2d 32 30 30 32 0d 0a 2d 33 33 34 34 0d 0a 0d  .-2002..-3344...
29c80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29c90 0d 0a 53 45 4c 45 43 54 20 31 36 20 2b 20 63 6f  ..SELECT 16 + co
29ca0 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63  l1 - - col2 AS c
29cb0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
29cc0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35   cor0..----..125
29cd0 0d 0a 38 33 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79  ..83..96....only
29ce0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
29cf0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
29d00 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
29d10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29d20 74 20 6c 61 62 65 6c 2d 31 31 32 30 0d 0a 53 45  t label-1120..SE
29d30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
29d40 63 6f 6c 31 20 44 49 56 20 28 20 2d 20 63 6f 6c  col1 DIV ( - col
29d50 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
29d60 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab1..----..0..
29d70 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
29d80 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
29d90 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
29da0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 30 0d 0a  ort label-1120..
29db0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
29dc0 2d 20 63 6f 6c 31 20 2f 20 28 20 2d 20 63 6f 6c  - col1 / ( - col
29dd0 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
29de0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab1..----..0..
29df0 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
29e00 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
29e10 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
29e20 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
29e30 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
29e40 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
29e50 32 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43  21..SELECT ALL C
29e60 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47  AST( col1 AS SIG
29e70 4e 45 44 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46  NED ) + + col1 F
29e80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
29e90 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32  ..----..172..182
29ea0 0d 0a 31 39 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..194....skipif 
29eb0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
29ec0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
29ed0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
29ee0 32 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43  21..SELECT ALL C
29ef0 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e  AST ( col1 AS IN
29f00 54 45 47 45 52 20 29 20 2b 20 2b 20 63 6f 6c 31  TEGER ) + + col1
29f10 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
29f20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31  r0..----..172..1
29f30 38 32 0d 0a 31 39 34 0d 0a 0d 0a 71 75 65 72 79  82..194....query
29f40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29f50 43 54 20 32 33 20 41 53 20 63 6f 6c 31 20 46 52  CT 23 AS col1 FR
29f60 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f  OM tab0, tab0 co
29f70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
29f80 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 39  es hashing to d9
29f90 34 66 61 64 63 63 31 63 38 63 63 34 66 63 35 31  4fadcc1c8cc4fc51
29fa0 62 37 38 62 38 33 65 30 34 37 39 35 66 32 0d 0a  b78b83e04795f2..
29fb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29fc0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
29fd0 6c 32 20 2a 20 2d 20 36 39 20 46 52 4f 4d 20 74  l2 * - 69 FROM t
29fe0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
29ff0 2d 33 37 32 36 0d 0a 2d 33 39 33 33 0d 0a 2d 36  -3726..-3933..-6
2a000 36 32 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  624....skipif my
2a010 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2a020 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2a030 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2a040 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20  STINCT + CAST ( 
2a050 63 6f 6c 31 20 41 53 20 52 45 41 4c 20 29 20 41  col1 AS REAL ) A
2a060 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2a070 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a  ..----..17..31..
2a080 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  59....query I ro
2a090 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2a0a0 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  l1 * + col2 * + 
2a0b0 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
2a0c0 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
2a0d0 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 32 34 0d 0a 33  ..----..16224..3
2a0e0 36 35 30 34 0d 0a 35 37 30 30 0d 0a 0d 0a 71 75  6504..5700....qu
2a0f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a100 45 4c 45 43 54 20 2d 20 36 36 20 2a 20 63 6f 6c  ELECT - 66 * col
2a110 31 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 - col2 FROM ta
2a120 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 30 39 0d  b0..----..-5709.
2a130 0a 2d 36 30 38 38 0d 0a 2d 36 34 30 33 0d 0a 0d  .-6088..-6403...
2a140 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a150 0d 0a 53 45 4c 45 43 54 20 2b 20 34 20 2d 20 2d  ..SELECT + 4 - -
2a160 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
2a170 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 36  OM tab1..----..6
2a180 38 0d 0a 37 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72  8..7..84....quer
2a190 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a1a0 45 43 54 20 41 4c 4c 20 2d 20 2d 20 35 20 2a 20  ECT ALL - - 5 * 
2a1b0 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col2 * col1 FROM
2a1c0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2a1d0 2d 2d 2d 0d 0a 31 34 31 39 30 0d 0a 33 37 33 31  ---..14190..3731
2a1e0 30 0d 0a 34 38 35 0d 0a 0d 0a 71 75 65 72 79 20  0..485....query 
2a1f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a200 54 20 44 49 53 54 49 4e 43 54 20 28 20 31 34 20  T DISTINCT ( 14 
2a210 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
2a220 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 0d  or0..----..14...
2a230 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2a240 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2a250 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2a260 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2a270 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2a280 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33 30 0d 0a  ort label-1130..
2a290 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e  SELECT + CAST( N
2a2a0 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
2a2b0 20 2b 20 36 20 46 52 4f 4d 20 74 61 62 30 20 63   + 6 FROM tab0 c
2a2c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2a2d0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
2a2e0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2a2f0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2a300 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2a310 62 65 6c 2d 31 31 33 30 0d 0a 53 45 4c 45 43 54  bel-1130..SELECT
2a320 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
2a330 53 20 52 45 41 4c 20 29 20 2b 20 36 20 46 52 4f  S REAL ) + 6 FRO
2a340 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
2a350 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2a360 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ULL....onlyif my
2a370 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2a380 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2a390 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2a3a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2a3b0 65 6c 2d 31 31 33 31 0d 0a 53 45 4c 45 43 54 20  el-1131..SELECT 
2a3c0 2d 20 2d 20 28 20 63 6f 6c 32 20 29 20 44 49 56  - - ( col2 ) DIV
2a3d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2a3e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2a3f0 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..1....skipif
2a400 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2a410 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2a420 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2a430 31 33 31 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  131..SELECT - - 
2a440 28 20 63 6f 6c 32 20 29 20 2f 20 63 6f 6c 30 20  ( col2 ) / col0 
2a450 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2a460 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31  0..----..0..0..1
2a470 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2a480 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2a490 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 2a 20 2b 20  - cor1.col1 * + 
2a4a0 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 31 38 20 41  cor0.col1 + 18 A
2a4b0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2a4c0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20  , tab0 AS cor0, 
2a4d0 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
2a4e0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
2a4f0 73 68 69 6e 67 20 74 6f 20 38 33 64 34 62 64 66  shing to 83d4bdf
2a500 31 32 61 32 64 63 61 36 33 62 31 63 63 30 62 62  12a2dca63b1cc0bb
2a510 36 64 34 66 32 34 34 36 63 0d 0a 0d 0a 71 75 65  6d4f2446c....que
2a520 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a530 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 31 2e  LECT ALL - cor1.
2a540 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
2a550 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  M tab1, tab1 AS 
2a560 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
2a570 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
2a580 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
2a590 38 32 64 66 31 64 65 33 63 62 36 36 36 32 32 34  82df1de3cb666224
2a5a0 36 39 30 61 38 33 66 33 64 37 39 30 64 37 39 0d  690a83f3d790d79.
2a5b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a5c0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
2a5d0 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  2 * cor0.col0 + 
2a5e0 2d 20 33 33 20 46 52 4f 4d 20 74 61 62 30 20 41  - 33 FROM tab0 A
2a5f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d  S cor0..----..2.
2a600 0a 37 32 36 35 0d 0a 37 35 39 0d 0a 0d 0a 6f 6e  .7265..759....on
2a610 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2a620 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2a630 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2a640 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2a650 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33 35 0d 0a  ort label-1135..
2a660 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
2a670 39 36 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20  96 + col1 DIV - 
2a680 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2a690 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 31  S cor0..----..51
2a6a0 38 34 0d 0a 35 34 37 32 0d 0a 39 32 31 36 0d 0a  84..5472..9216..
2a6b0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2a6c0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2a6d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a6e0 20 6c 61 62 65 6c 2d 31 31 33 35 0d 0a 53 45 4c   label-1135..SEL
2a6f0 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 39 36 20  ECT + col2 * 96 
2a700 2b 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32 20  + col1 / - col2 
2a710 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2a720 30 0d 0a 2d 2d 2d 2d 0d 0a 35 31 38 34 0d 0a 35  0..----..5184..5
2a730 34 37 32 0d 0a 39 32 31 36 0d 0a 0d 0a 71 75 65  472..9216....que
2a740 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a750 4c 45 43 54 20 28 20 2b 20 63 6f 6c 32 20 29 20  LECT ( + col2 ) 
2a760 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  * - col1 AS col1
2a770 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2a780 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a  ..-2838..-7462..
2a790 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -97....query I r
2a7a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2a7b0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b  ISTINCT - col1 +
2a7c0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41   col1 * - col0 A
2a7d0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2a7e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
2a7f0 34 0d 0a 2d 31 30 35 33 0d 0a 2d 36 35 30 0d 0a  4..-1053..-650..
2a800 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a810 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
2a820 6c 31 20 2a 20 28 20 2d 20 39 33 20 29 20 46 52  l1 * ( - 93 ) FR
2a830 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2a840 2d 2d 0d 0a 31 35 38 31 0d 0a 32 38 38 33 0d 0a  --..1581..2883..
2a850 35 34 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5487....query I 
2a860 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a870 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  - - cor0.col2 * 
2a880 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f  cor0.col0 + + co
2a890 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2a8a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 0d  cor0..----..188.
2a8b0 0a 33 36 35 38 0d 0a 37 36 39 33 0d 0a 0d 0a 71  .3658..7693....q
2a8c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2a8d0 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e  SELECT + + cor0.
2a8e0 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  col0 + cor0.col0
2a8f0 20 2b 20 32 38 20 2a 20 63 6f 6c 30 20 41 53 20   + 28 * col0 AS 
2a900 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
2a910 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 0d 0a  or0..----..210..
2a920 32 33 34 30 0d 0a 32 33 37 30 0d 0a 0d 0a 73 6b  2340..2370....sk
2a930 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2a940 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2a950 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2a960 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2a970 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2a980 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2a990 4c 4c 20 38 36 20 2a 20 2b 20 63 6f 6c 32 20 2b  LL 86 * + col2 +
2a9a0 20 38 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   80 col1 FROM ta
2a9b0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 37 32 34 0d 0a  b1..----..4724..
2a9c0 34 39 38 32 0d 0a 38 33 33 36 0d 0a 0d 0a 71 75  4982..8336....qu
2a9d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a9e0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
2a9f0 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 74 61 62 32   + + col0 + tab2
2aa00 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
2aa10 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
2aa20 38 32 0d 0a 31 39 36 0d 0a 34 31 0d 0a 0d 0a 71  82..196..41....q
2aa30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2aa40 53 45 4c 45 43 54 20 41 4c 4c 20 36 38 20 2b 20  SELECT ALL 68 + 
2aa50 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
2aa60 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 34 0d 0a  ..----..-12..4..
2aa70 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  65....query I ro
2aa80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2aa90 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b 20  L col2 + col0 + 
2aaa0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
2aab0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
2aac0 30 0d 0a 31 35 35 0d 0a 36 31 0d 0a 0d 0a 71 75  0..155..61....qu
2aad0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2aae0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2aaf0 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
2ab00 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
2ab10 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b1, tab2 AS cor0
2ab20 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31  ..----..-17..-31
2ab30 0d 0a 2d 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-59....onlyif 
2ab40 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2ab50 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2ab60 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2ab70 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2ab80 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2ab90 6c 2d 31 31 34 36 0d 0a 53 45 4c 45 43 54 20 41  l-1146..SELECT A
2aba0 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  LL - - cor0.col1
2abb0 20 2b 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20   + - CAST( NULL 
2abc0 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f  AS SIGNED ) * co
2abd0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
2abe0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2abf0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2ac00 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2ac10 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2ac20 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2ac30 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34  owsort label-114
2ac40 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  6..SELECT ALL - 
2ac50 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20  - cor0.col1 + - 
2ac60 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
2ac70 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 31 20  NTEGER ) * col1 
2ac80 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2ac90 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2aca0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
2acb0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  L....skipif post
2acc0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2acd0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2ace0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2acf0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2ad00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ad10 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d  ELECT + col2 * -
2ad20 20 33 36 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   36 col1 FROM ta
2ad30 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
2ad40 31 33 36 38 0d 0a 2d 39 33 36 0d 0a 2d 39 37 32  1368..-936..-972
2ad50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ad60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2ad70 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  INCT + col0 * - 
2ad80 35 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  52 AS col2 FROM 
2ad90 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
2ada0 0a 2d 33 36 34 0d 0a 2d 34 30 35 36 0d 0a 2d 34  .-364..-4056..-4
2adb0 31 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  108....query I r
2adc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2add0 4c 4c 20 63 6f 6c 31 20 2a 20 32 31 20 46 52 4f  LL col1 * 21 FRO
2ade0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2adf0 2d 2d 2d 2d 0d 0a 31 32 33 39 0d 0a 33 35 37 0d  ----..1239..357.
2ae00 0a 36 35 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .651....onlyif m
2ae10 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2ae20 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2ae30 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2ae40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2ae50 62 65 6c 2d 31 31 35 30 0d 0a 53 45 4c 45 43 54  bel-1150..SELECT
2ae60 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 44   - col2 + col0 D
2ae70 49 56 20 2b 20 35 38 20 46 52 4f 4d 20 74 61 62  IV + 58 FROM tab
2ae80 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2ae90 0a 2d 35 34 0d 0a 2d 35 36 0d 0a 2d 39 35 0d 0a  .-54..-56..-95..
2aea0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2aeb0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2aec0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2aed0 20 6c 61 62 65 6c 2d 31 31 35 30 0d 0a 53 45 4c   label-1150..SEL
2aee0 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  ECT - col2 + col
2aef0 30 20 2f 20 2b 20 35 38 20 46 52 4f 4d 20 74 61  0 / + 58 FROM ta
2af00 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2af10 0d 0a 2d 35 34 0d 0a 2d 35 36 0d 0a 2d 39 35 0d  ..-54..-56..-95.
2af20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2af30 72 74 0d 0a 53 45 4c 45 43 54 20 36 36 20 46 52  rt..SELECT 66 FR
2af40 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 63 6f  OM tab1, tab0 co
2af50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
2af60 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 39  es hashing to 29
2af70 37 39 34 39 31 35 62 35 38 35 65 65 61 38 34 38  794915b585eea848
2af80 61 64 36 37 30 30 37 35 34 35 32 63 38 38 0d 0a  ad670075452c88..
2af90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2afa0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
2afb0 6c 31 20 2b 20 2b 20 34 38 20 46 52 4f 4d 20 74  l1 + + 48 FROM t
2afc0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2afd0 2d 0d 0a 31 30 37 0d 0a 36 35 0d 0a 37 39 0d 0a  -..107..65..79..
2afe0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2aff0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2b000 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2b010 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2b020 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2b030 35 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  53..SELECT ALL -
2b040 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f   - col2 DIV + co
2b050 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
2b060 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2b070 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 73 6b 69  .0..1..18....ski
2b080 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2b090 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2b0a0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2b0b0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2b0c0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
2b0d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2b0e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2b0f0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 33 0d  sort label-1153.
2b100 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
2b110 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 30 20 63 6f  col2 / + col0 co
2b120 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2b130 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
2b140 0d 0a 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..18....query I 
2b150 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b160 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  col0 + col1 * - 
2b170 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2b180 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2b190 34 35 36 0d 0a 2d 35 36 37 0d 0a 2d 38 33 30 0d  456..-567..-830.
2b1a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b1b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  rt..SELECT ALL (
2b1c0 20 2d 20 32 37 20 29 20 2d 20 63 6f 6c 30 20 2a   - 27 ) - col0 *
2b1d0 20 33 33 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   33 FROM tab1..-
2b1e0 2d 2d 2d 0d 0a 2d 31 32 36 0d 0a 2d 32 31 33 39  ---..-126..-2139
2b1f0 0d 0a 2d 32 36 36 37 0d 0a 0d 0a 71 75 65 72 79  ..-2667....query
2b200 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b210 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20 2d 20 33  CT ALL + - ( - 3
2b220 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
2b230 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
2b240 0d 0a 33 30 0d 0a 33 30 0d 0a 33 30 0d 0a 0d 0a  ..30..30..30....
2b250 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b260 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2b270 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30   + - col2 * col0
2b280 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 38 36 20 41   * col1 + - 86 A
2b290 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2b2a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b2b0 2d 33 36 35 36 36 0d 0a 2d 34 32 39 38 0d 0a 2d  -36566..-4298..-
2b2c0 39 39 39 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  99926....onlyif 
2b2d0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2b2e0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2b2f0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2b300 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2b310 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2b320 6c 2d 31 31 35 38 0d 0a 53 45 4c 45 43 54 20 43  l-1158..SELECT C
2b330 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
2b340 4e 45 44 20 29 20 2b 20 2d 20 28 20 2d 20 74 61  NED ) + - ( - ta
2b350 62 31 2e 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 32  b1.col0 ) * col2
2b360 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2b370 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
2b380 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
2b390 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2b3a0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2b3b0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 38 0d  sort label-1158.
2b3c0 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e  .SELECT CAST ( N
2b3d0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
2b3e0 20 2b 20 2d 20 28 20 2d 20 74 61 62 31 2e 63 6f   + - ( - tab1.co
2b3f0 6c 30 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  l0 ) * col2 FROM
2b400 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab1..----..NUL
2b410 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
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 41 4c 4c 20 2d 20 37  ..SELECT ALL - 7
2b440 31 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 28  1 * + col2 + + (
2b450 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 37 39   ( + col2 ) * 79
2b460 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
2b470 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2b480 2d 2d 0d 0a 32 36 34 0d 0a 36 35 36 0d 0a 38 0d  --..264..656..8.
2b490 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b4a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
2b4b0 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 28  ol2 * col2 + + (
2b4c0 20 33 38 20 29 20 46 52 4f 4d 20 74 61 62 30 20   38 ) FROM tab0 
2b4d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2b4e0 31 32 37 0d 0a 33 39 0d 0a 36 37 36 32 0d 0a 0d  127..39..6762...
2b4f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b500 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
2b510 30 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 35  0 * + col1 - + 5
2b520 36 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  6 FROM tab2 AS c
2b530 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 39  or0..----..-1399
2b540 0d 0a 2d 32 37 33 0d 0a 2d 34 36 35 38 0d 0a 0d  ..-273..-4658...
2b550 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b560 0d 0a 53 45 4c 45 43 54 20 2b 20 31 32 20 2a 20  ..SELECT + 12 * 
2b570 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  col2 * col0 + co
2b580 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
2b590 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 31 0d  tab0..----..421.
2b5a0 0a 38 37 36 35 38 0d 0a 39 35 33 37 0d 0a 0d 0a  .87658..9537....
2b5b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b5c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2b5d0 20 63 6f 6c 31 20 2b 20 74 61 62 32 2e 63 6f 6c   col1 + tab2.col
2b5e0 32 20 2a 20 2b 20 38 33 20 46 52 4f 4d 20 74 61  2 * + 83 FROM ta
2b5f0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 31 37 0d 0a  b2..----..2217..
2b600 32 32 37 32 0d 0a 33 31 37 31 0d 0a 0d 0a 6f 6e  2272..3171....on
2b610 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2b620 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2b630 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2b640 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2b650 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 34 0d 0a  ort label-1164..
2b660 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2b670 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c  + - col2 DIV col
2b680 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63  1 + - col0 * + c
2b690 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
2b6a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
2b6b0 34 0d 0a 2d 33 36 35 33 0d 0a 2d 37 36 38 37 0d  4..-3653..-7687.
2b6c0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2b6d0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2b6e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b6f0 74 20 6c 61 62 65 6c 2d 31 31 36 34 0d 0a 53 45  t label-1164..SE
2b700 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2b710 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 2b 20  - col2 / col1 + 
2b720 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  - col0 * + col2 
2b730 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2b740 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d  0..----..-164..-
2b750 33 36 35 33 0d 0a 2d 37 36 38 37 0d 0a 0d 0a 73  3653..-7687....s
2b760 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2b770 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2b780 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2b790 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2b7a0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2b7b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b7c0 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  - cor0.col1 + + 
2b7d0 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
2b7e0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
2b7f0 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71  -33..-4..21....q
2b800 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b810 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
2b820 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  * - col2 + col1 
2b830 2a 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20  * + col2 - col2 
2b840 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2b850 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  0 cor0..----..14
2b860 31 30 34 0d 0a 33 38 39 34 0d 0a 39 37 0d 0a 0d  104..3894..97...
2b870 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2b880 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2b890 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2b8a0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2b8b0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2b8c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b8d0 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2a  T ALL + + col1 *
2b8e0 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   + col1 col1 FRO
2b8f0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2b900 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32 38 31  ----..7396..8281
2b910 0d 0a 39 34 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..9409....onlyif
2b920 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2b930 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2b940 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2b950 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2b960 6c 61 62 65 6c 2d 31 31 36 38 0d 0a 53 45 4c 45  label-1168..SELE
2b970 43 54 20 2b 20 37 34 20 44 49 56 20 2b 20 63 6f  CT + 74 DIV + co
2b980 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
2b990 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2b9a0 0a 30 0d 0a 32 0d 0a 37 34 0d 0a 0d 0a 73 6b 69  .0..2..74....ski
2b9b0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2b9c0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2b9d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2b9e0 6c 2d 31 31 36 38 0d 0a 53 45 4c 45 43 54 20 2b  l-1168..SELECT +
2b9f0 20 37 34 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c   74 / + cor0.col
2ba00 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2ba10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d  or0..----..0..2.
2ba20 0a 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .74....query I r
2ba30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2ba40 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63  ISTINCT + cor0.c
2ba50 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol2 + cor0.col0 
2ba60 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2ba70 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36  0..----..171..36
2ba80 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..57....skipif p
2ba90 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2baa0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2bab0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2bac0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2bad0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2bae0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 31 2e  ..SELECT + cor1.
2baf0 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col2 col2 FROM t
2bb00 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab2 AS cor0 CROS
2bb10 53 20 4a 4f 49 4e 20 74 61 62 31 20 63 6f 72 31  S JOIN tab1 cor1
2bb20 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
2bb30 20 68 61 73 68 69 6e 67 20 74 6f 20 38 30 63 61   hashing to 80ca
2bb40 30 61 31 63 63 33 33 37 61 37 37 31 34 61 38 39  0a1cc337a7714a89
2bb50 39 30 61 37 36 34 63 66 64 62 31 37 0d 0a 0d 0a  90a764cfdb17....
2bb60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2bb70 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 74 61  .SELECT ALL ( ta
2bb80 62 30 2e 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 31  b0.col2 + ( col1
2bb90 20 29 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f   ) ) AS col1 FRO
2bba0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab0..----..11
2bbb0 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71 75  9..173..98....qu
2bbc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2bbd0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2bbe0 20 2b 20 34 31 20 2b 20 2d 20 63 6f 6c 31 20 2a   + 41 + - col1 *
2bbf0 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46   col2 * - col0 F
2bc00 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2bc10 0d 0a 2d 2d 2d 2d 0d 0a 33 34 33 36 0d 0a 36 36  ..----..3436..66
2bc20 34 31 35 39 0d 0a 36 38 31 35 33 0d 0a 0d 0a 71  4159..68153....q
2bc30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2bc40 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
2bc50 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 28  1 * + col0 + - (
2bc60 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20   col1 ) AS col1 
2bc70 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
2bc80 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 30 35  ----..-104..-105
2bc90 33 0d 0a 2d 36 35 30 0d 0a 0d 0a 71 75 65 72 79  3..-650....query
2bca0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2bcb0 43 54 20 2b 20 63 6f 6c 32 20 2b 20 28 20 2d 20  CT + col2 + ( - 
2bcc0 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31  col2 ) FROM tab1
2bcd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2bce0 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
2bcf0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2bd00 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  CT + col1 * col2
2bd10 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   - + col1 FROM t
2bd20 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2bd30 2d 0d 0a 31 32 33 35 0d 0a 31 33 37 38 0d 0a 35  -..1235..1378..5
2bd40 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  60....onlyif mys
2bd50 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2bd60 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2bd70 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2bd80 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2bd90 6c 2d 31 31 37 36 0d 0a 53 45 4c 45 43 54 20 2d  l-1176..SELECT -
2bda0 20 2d 20 63 6f 6c 30 20 44 49 56 20 43 41 53 54   - col0 DIV CAST
2bdb0 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  ( col1 AS SIGNED
2bdc0 20 29 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b 20   ) - - col0 * + 
2bdd0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
2bde0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2bdf0 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 39 0d  ----..189..2029.
2be00 0a 33 30 30 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  .3006....skipif 
2be10 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2be20 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2be30 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2be40 37 36 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  76..SELECT - - c
2be50 6f 6c 30 20 2f 20 43 41 53 54 20 28 20 63 6f 6c  ol0 / CAST ( col
2be60 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d  1 AS INTEGER ) -
2be70 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32   - col0 * + col2
2be80 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2be90 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2bea0 0d 0a 31 38 39 0d 0a 32 30 32 39 0d 0a 33 30 30  ..189..2029..300
2beb0 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
2bec0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2bed0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2bee0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2bef0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2bf00 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2bf10 37 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  77..SELECT ALL +
2bf20 20 2b 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   + CAST( col1 AS
2bf30 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 63 6f   SIGNED ) + + co
2bf40 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 31 20 29 20  l0 * - ( col1 ) 
2bf50 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2bf60 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2bf70 0a 2d 31 33 32 36 0d 0a 2d 31 38 36 0d 0a 2d 34  .-1326..-186..-4
2bf80 35 34 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  543....skipif my
2bf90 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2bfa0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2bfb0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37 37  wsort label-1177
2bfc0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
2bfd0 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20   CAST ( col1 AS 
2bfe0 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 63 6f  INTEGER ) + + co
2bff0 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 31 20 29 20  l0 * - ( col1 ) 
2c000 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2c010 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2c020 0a 2d 31 33 32 36 0d 0a 2d 31 38 36 0d 0a 2d 34  .-1326..-186..-4
2c030 35 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  543....query I r
2c040 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2c050 49 53 54 49 4e 43 54 20 2d 20 2d 20 36 37 20 41  ISTINCT - - 67 A
2c060 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2c070 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c080 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  67....query I ro
2c090 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2c0a0 2d 20 63 6f 6c 30 20 2a 20 36 36 20 41 53 20 63  - col0 * 66 AS c
2c0b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
2c0c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38   cor0..----..158
2c0d0 34 0d 0a 32 33 31 30 0d 0a 35 38 37 34 0d 0a 0d  4..2310..5874...
2c0e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2c0f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2c100 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2c110 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2c120 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2c130 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c140 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20  T ALL cor0.col1 
2c150 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
2c160 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61  tab1 AS cor0, ta
2c170 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
2c180 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
2c190 69 6e 67 20 74 6f 20 64 36 37 31 61 30 36 34 65  ing to d671a064e
2c1a0 32 64 61 37 30 39 63 61 34 63 64 66 65 61 33 31  2da709ca4cdfea31
2c1b0 37 62 38 65 38 39 32 0d 0a 0d 0a 71 75 65 72 79  7b8e892....query
2c1c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c1d0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 38 32  CT DISTINCT + 82
2c1e0 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
2c1f0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2c200 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 34  or0..----..-1394
2c210 0d 0a 2d 32 35 34 32 0d 0a 2d 34 38 33 38 0d 0a  ..-2542..-4838..
2c220 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c230 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
2c240 6c 31 20 2b 20 39 31 20 2a 20 63 6f 6c 32 20 41  l1 + 91 * col2 A
2c250 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2c260 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c270 34 38 38 38 0d 0a 35 31 37 37 0d 0a 38 37 32 33  4888..5177..8723
2c280 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c290 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2c2a0 49 4e 43 54 20 2d 20 2d 20 33 37 20 41 53 20 63  INCT - - 37 AS c
2c2b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2c2c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 0d   cor0..----..37.
2c2d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c2e0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
2c2f0 2a 20 2b 20 63 6f 6c 31 20 2d 20 35 32 20 46 52  * + col1 - 52 FR
2c300 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
2c310 30 31 32 0d 0a 33 33 34 33 0d 0a 38 30 34 37 0d  012..3343..8047.
2c320 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c330 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2c340 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  NCT + col1 * - c
2c350 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol0 * + col1 FRO
2c360 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
2c370 33 35 32 30 0d 0a 2d 32 30 32 38 0d 0a 2d 36 34  3520..-2028..-64
2c380 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
2c390 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2c3a0 6c 32 20 2a 20 35 30 20 2a 20 2b 20 63 6f 6c 32  l2 * 50 * + col2
2c3b0 20 2b 20 2b 20 37 38 20 46 52 4f 4d 20 74 61 62   + + 78 FROM tab
2c3c0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 33 33  0..----..128..33
2c3d0 36 32 37 38 0d 0a 35 34 35 32 38 0d 0a 0d 0a 71  6278..54528....q
2c3e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c3f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2c400 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53  ( cor0.col2 ) AS
2c410 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c   col0 FROM tab2,
2c420 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2c430 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d  ---..54..57..96.
2c440 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c450 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38 33 20  rt..SELECT - 83 
2c460 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  * cor0.col1 AS c
2c470 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
2c480 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
2c490 37 39 0d 0a 2d 32 31 35 38 0d 0a 2d 38 33 30 0d  79..-2158..-830.
2c4a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c4b0 72 74 0d 0a 53 45 4c 45 43 54 20 33 36 20 2a 20  rt..SELECT 36 * 
2c4c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2c4d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
2c4e0 38 0d 0a 32 33 30 34 0d 0a 32 38 38 30 0d 0a 0d  8..2304..2880...
2c4f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c500 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 32 20  ..SELECT ALL 92 
2c510 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2c520 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  1, tab0 AS cor0.
2c530 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
2c540 68 61 73 68 69 6e 67 20 74 6f 20 35 31 36 66 61  hashing to 516fa
2c550 34 35 63 38 62 30 36 66 39 66 36 37 64 36 65 35  45c8b06f9f67d6e5
2c560 30 30 62 66 64 34 33 35 63 31 61 0d 0a 0d 0a 73  00bfd435c1a....s
2c570 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2c580 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2c590 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2c5a0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2c5b0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2c5c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c5d0 28 20 2b 20 38 34 20 29 20 2b 20 2b 20 63 6f 6c  ( + 84 ) + + col
2c5e0 31 20 2d 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63  1 - + ( + cor0.c
2c5f0 6f 6c 31 20 2b 20 63 6f 6c 30 20 29 20 2a 20 2d  ol1 + col0 ) * -
2c600 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20   col0 col1 FROM 
2c610 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2c620 2d 2d 0d 0a 31 30 38 32 39 0d 0a 33 38 31 0d 0a  --..10829..381..
2c630 37 36 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7685....query I 
2c640 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c650 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 31 33 20  DISTINCT - + 13 
2c660 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  * - col0 AS col2
2c670 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2c680 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 37 0d 0a  r0..----..1157..
2c690 33 31 32 0d 0a 34 35 35 0d 0a 0d 0a 73 6b 69 70  312..455....skip
2c6a0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2c6b0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2c6c0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2c6d0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2c6e0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2c6f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2c700 54 49 4e 43 54 20 2b 20 34 30 20 63 6f 6c 31 20  TINCT + 40 col1 
2c710 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
2c720 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
2c730 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2c740 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2c750 20 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 63 6f   ( - col1 ) + co
2c760 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
2c770 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34  0..----..-23..54
2c780 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..67....query I 
2c790 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c7a0 2b 20 34 30 20 46 52 4f 4d 20 74 61 62 32 2c 20  + 40 FROM tab2, 
2c7b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2c7c0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2c7d0 68 69 6e 67 20 74 6f 20 62 31 65 38 66 66 65 65  hing to b1e8ffee
2c7e0 66 33 33 34 62 34 61 32 62 30 31 62 32 66 39 31  f334b4a2b01b2f91
2c7f0 65 36 34 39 63 32 64 33 0d 0a 0d 0a 71 75 65 72  e649c2d3....quer
2c800 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c810 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2b  ECT - - col0 + +
2c820 20 34 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   45 AS col1 FROM
2c830 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2c840 2d 2d 2d 0d 0a 31 32 33 0d 0a 31 32 34 0d 0a 35  ---..123..124..5
2c850 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2c860 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2c870 20 2b 20 35 30 20 2a 20 63 6f 6c 31 20 2a 20 2d   + 50 * col1 * -
2c880 20 63 6f 6c 30 20 2b 20 2b 20 36 31 20 2d 20 63   col0 + + 61 - c
2c890 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
2c8a0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31   tab1..----..-31
2c8b0 39 34 39 0d 0a 2d 33 38 36 35 0d 0a 2d 35 31 39  949..-3865..-519
2c8c0 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  52....query I ro
2c8d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2c8e0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
2c8f0 74 61 62 31 2e 63 6f 6c 30 20 2d 20 63 6f 6c 32  tab1.col0 - col2
2c900 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2c910 0d 0a 2d 32 31 36 0d 0a 2d 33 37 30 35 0d 0a 2d  ..-216..-3705..-
2c920 37 37 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7776....query I 
2c930 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c940 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f  cor0.col0 + - co
2c950 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l1 - col0 AS col
2c960 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2c970 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a  or0..----..-10..
2c980 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72  -13..-26....quer
2c990 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c9a0 45 43 54 20 2d 20 33 31 20 41 53 20 63 6f 6c 31  ECT - 31 AS col1
2c9b0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
2c9c0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
2c9d0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
2c9e0 68 61 73 68 69 6e 67 20 74 6f 20 63 36 63 38 65  hashing to c6c8e
2c9f0 65 62 65 62 31 61 35 39 66 37 63 30 34 36 34 30  ebeb1a59f7c04640
2ca00 32 65 32 35 36 33 30 63 30 61 63 0d 0a 0d 0a 71  2e25630c0ac....q
2ca10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2ca20 53 45 4c 45 43 54 20 2d 20 39 32 20 41 53 20 63  SELECT - 92 AS c
2ca30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol2 FROM tab0, t
2ca40 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
2ca50 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
2ca60 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
2ca70 6e 67 20 74 6f 20 61 30 65 36 62 37 36 32 32 37  ng to a0e6b76227
2ca80 64 38 37 30 64 31 30 63 34 64 39 66 34 36 35 34  d870d10c4d9f4654
2ca90 35 61 37 63 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  5a7c83....onlyif
2caa0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2cab0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2cac0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2cad0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2cae0 6c 61 62 65 6c 2d 31 32 30 32 0d 0a 53 45 4c 45  label-1202..SELE
2caf0 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32  CT col1 + + col2
2cb00 20 2a 20 63 6f 6c 31 20 44 49 56 20 2b 20 36 30   * col1 DIV + 60
2cb10 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2cb20 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2cb30 0d 0a 31 39 0d 0a 33 33 0d 0a 34 39 0d 0a 0d 0a  ..19..33..49....
2cb40 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2cb50 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2cb60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2cb70 61 62 65 6c 2d 31 32 30 32 0d 0a 53 45 4c 45 43  abel-1202..SELEC
2cb80 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  T col1 + + col2 
2cb90 2a 20 63 6f 6c 31 20 2f 20 2b 20 36 30 20 41 53  * col1 / + 60 AS
2cba0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
2cbb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2cbc0 39 0d 0a 33 33 0d 0a 34 39 0d 0a 0d 0a 71 75 65  9..33..49....que
2cbd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2cbe0 4c 45 43 54 20 33 35 20 46 52 4f 4d 20 74 61 62  LECT 35 FROM tab
2cbf0 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  1, tab2 AS cor0,
2cc00 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
2cc10 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
2cc20 61 73 68 69 6e 67 20 74 6f 20 30 64 31 33 64 66  ashing to 0d13df
2cc30 64 34 63 34 61 39 64 35 31 61 63 65 33 35 38 32  d4c4a9d51ace3582
2cc40 63 33 31 63 61 64 63 64 62 63 0d 0a 0d 0a 71 75  c31cadcdbc....qu
2cc50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2cc60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2cc70 20 38 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f   80 * col1 AS co
2cc80 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
2cc90 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32  0..----..1360..2
2cca0 34 38 30 0d 0a 34 37 32 30 0d 0a 0d 0a 71 75 65  480..4720....que
2ccb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ccc0 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  LECT + - cor0.co
2ccd0 6c 30 20 2a 20 2d 20 31 35 20 2a 20 2d 20 63 6f  l0 * - 15 * - co
2cce0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2ccf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35  cor0..----..-115
2cd00 32 30 30 0d 0a 2d 32 34 33 30 0d 0a 2d 35 34 37  200..-2430..-547
2cd10 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
2cd20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2cd30 74 61 62 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32  tab0.col1 + col2
2cd40 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2d   * tab0.col1 * -
2cd50 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
2cd60 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
2cd70 32 34 33 39 38 32 0d 0a 2d 36 37 38 39 35 31 0d  243982..-678951.
2cd80 0a 2d 39 33 31 32 0d 0a 0d 0a 71 75 65 72 79 20  .-9312....query 
2cd90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2cda0 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2b  T ALL + + col1 +
2cdb0 20 39 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   99 AS col0 FROM
2cdc0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2cdd0 2d 2d 2d 0d 0a 31 30 39 0d 0a 31 31 32 0d 0a 31  ---..109..112..1
2cde0 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  25....query I ro
2cdf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2ce00 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
2ce10 63 6f 6c 30 20 2b 20 2d 20 28 20 2b 20 63 6f 6c  col0 + - ( + col
2ce20 31 20 29 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 ) + col2 AS co
2ce30 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2ce40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 31 31  cor0..----..2011
2ce50 0d 0a 33 32 39 39 0d 0a 38 30 39 30 0d 0a 0d 0a  ..3299..8090....
2ce60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ce70 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a  .SELECT + col0 *
2ce80 20 2b 20 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 32   + col1 + ( col2
2ce90 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72   ) FROM tab0 cor
2cea0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d 0a 33  0..----..2097..3
2ceb0 33 39 36 0d 0a 38 31 38 31 0d 0a 0d 0a 71 75 65  396..8181....que
2cec0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ced0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2cee0 63 6f 6c 32 20 2b 20 2d 20 28 20 2d 20 63 6f 6c  col2 + - ( - col
2cef0 30 20 29 20 2a 20 37 32 20 46 52 4f 4d 20 74 61  0 ) * 72 FROM ta
2cf00 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2cf10 0d 0a 31 36 32 0d 0a 34 35 35 31 0d 0a 35 36 36  ..162..4551..566
2cf20 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2cf30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2cf40 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b   + cor0.col2 + +
2cf50 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2d 20 2b   col1 * col1 - +
2cf60 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41   ( cor0.col2 ) A
2cf70 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2cf80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39   cor0..----..289
2cf90 0d 0a 33 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a 71  ..3481..961....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 2d 20 2d 20 63 6f 72 30 2e  SELECT - - cor0.
2cfc0 63 6f 6c 31 20 2a 20 36 34 20 2b 20 63 6f 6c 31  col1 * 64 + col1
2cfd0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2cfe0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2cff0 0d 0a 31 31 30 35 0d 0a 32 30 31 35 0d 0a 33 38  ..1105..2015..38
2d000 33 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  35....skipif pos
2d010 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2d020 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2d030 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2d040 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2d050 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2d060 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
2d070 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20  * + cor0.col1 - 
2d080 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20  - cor0.col0 * - 
2d090 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  1 col1 FROM tab0
2d0a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34   cor0..----..204
2d0b0 30 0d 0a 33 33 36 30 0d 0a 38 30 31 30 0d 0a 0d  0..3360..8010...
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 32 36 20 2a 20 2b 20 34 20 41 53 20 63 6f  T 26 * + 4 AS co
2d0f0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
2d100 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 0d 0a  0..----..104....
2d110 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d120 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
2d130 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30  l0 * col0 + col0
2d140 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   * - col2 + col0
2d150 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
2d160 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2d170 2d 0d 0a 2d 32 33 33 31 38 0d 0a 2d 33 34 33 32  -..-23318..-3432
2d180 0d 0a 2d 34 36 35 35 0d 0a 0d 0a 71 75 65 72 79  ..-4655....query
2d190 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d1a0 43 54 20 2d 20 38 35 20 2b 20 2b 20 63 6f 6c 32  CT - 85 + + col2
2d1b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2d1c0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2d1d0 0d 0a 2d 32 38 0d 0a 2d 33 31 0d 0a 31 31 0d 0a  ..-28..-31..11..
2d1e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d1f0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 36 34  t..SELECT + + 64
2d200 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
2d210 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2d220 0a 31 35 33 36 0d 0a 32 32 34 30 0d 0a 35 36 39  .1536..2240..569
2d230 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2d240 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2d250 54 49 4e 43 54 20 2b 20 31 33 20 2b 20 2d 20 36  TINCT + 13 + - 6
2d260 36 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  6 FROM tab1 AS c
2d270 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a  or0..----..-53..
2d280 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d290 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2d2a0 31 34 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  14 - + col1 FROM
2d2b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2d2c0 2d 2d 2d 0d 0a 2d 33 31 0d 0a 2d 34 35 0d 0a 2d  ---..-31..-45..-
2d2d0 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  73....query I ro
2d2e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
2d2f0 62 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a  b0.col0 - col0 *
2d300 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46   + col0 * col1 F
2d310 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2d320 2d 31 31 38 37 39 30 0d 0a 2d 34 39 35 31 32 0d  -118790..-49512.
2d330 0a 2d 37 32 30 37 32 32 0d 0a 0d 0a 71 75 65 72  .-720722....quer
2d340 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d350 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34  ECT DISTINCT - 4
2d360 35 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  5 * - col1 * + c
2d370 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2d380 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 30   cor0..----..290
2d390 37 30 0d 0a 33 37 36 36 35 0d 0a 36 39 30 33 30  70..37665..69030
2d3a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d3b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2d3c0 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  INCT + col1 * co
2d3d0 6c 31 20 2a 20 2b 20 35 30 20 2b 20 2d 20 63 6f  l1 * + 50 + - co
2d3e0 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l1 * + col2 FROM
2d3f0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2d400 2d 2d 2d 0d 0a 31 33 38 30 34 0d 0a 31 37 32 35  ---..13804..1725
2d410 31 36 0d 0a 34 37 32 31 33 0d 0a 0d 0a 6f 6e 6c  16..47213....onl
2d420 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2d430 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2d440 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2d450 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2d460 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2d470 6c 61 62 65 6c 2d 31 32 32 33 0d 0a 53 45 4c 45  label-1223..SELE
2d480 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  CT + CAST( NULL 
2d490 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 38 36  AS SIGNED ) * 86
2d4a0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2d4b0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
2d4c0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
2d4d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2d4e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2d4f0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 33 0d  sort label-1223.
2d500 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28  .SELECT + CAST (
2d510 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
2d520 20 29 20 2a 20 38 36 20 46 52 4f 4d 20 74 61 62   ) * 86 FROM tab
2d530 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  2..----..NULL..N
2d540 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
2d550 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2d560 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2d570 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2d580 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2d590 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2d5a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2d5b0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
2d5c0 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  + col1 + - col1 
2d5d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2d5e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2d5f0 32 36 31 0d 0a 2d 31 34 33 30 0d 0a 2d 35 38 30  261..-1430..-580
2d600 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2d610 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2d620 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2d630 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2d640 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2d650 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2d660 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  LECT - cor0.col0
2d670 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 31 20 46   * - col2 col1 F
2d680 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2d690 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32  ..----..189..202
2d6a0 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79  8..3002....query
2d6b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d6c0 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30  CT ALL cor0.col0
2d6d0 20 2a 20 2d 20 63 6f 6c 32 20 2d 20 37 33 20 2a   * - col2 - 73 *
2d6e0 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
2d6f0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2d700 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35  cor0..----..-135
2d710 32 30 0d 0a 2d 33 38 31 0d 0a 2d 38 33 32 30 0d  20..-381..-8320.
2d720 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d730 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2d740 20 32 33 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   23 FROM tab0, t
2d750 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
2d760 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
2d770 20 74 6f 20 63 65 36 30 62 66 34 62 30 36 34 37   to ce60bf4b0647
2d780 64 30 66 63 62 31 38 61 30 35 36 32 65 33 35 31  d0fcb18a0562e351
2d790 63 35 32 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20  c52d....query I 
2d7a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d7b0 44 49 53 54 49 4e 43 54 20 34 33 20 2a 20 74 61  DISTINCT 43 * ta
2d7c0 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b1.col1 FROM tab
2d7d0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 38 0d 0a 34  1..----..1118..4
2d7e0 33 30 0d 0a 35 35 39 0d 0a 0d 0a 71 75 65 72 79  30..559....query
2d7f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d800 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33 30  CT DISTINCT + 30
2d810 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2d820 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b1 AS cor0 CROSS
2d830 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f   JOIN tab2 AS co
2d840 72 31 0d 0a 2d 2d 2d 2d 0d 0a 33 30 0d 0a 0d 0a  r1..----..30....
2d850 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2d860 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2d870 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2d880 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2d890 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 30  wsort label-1230
2d8a0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
2d8b0 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 28 20 63  + col2 DIV + ( c
2d8c0 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol0 ) FROM tab2 
2d8d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a  cor0..----..-4..
2d8e0 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69 70  -78..-79....skip
2d8f0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2d900 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2d910 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d920 2d 31 32 33 30 0d 0a 53 45 4c 45 43 54 20 2d 20  -1230..SELECT - 
2d930 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2f 20 2b 20  col0 + col2 / + 
2d940 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  ( col0 ) FROM ta
2d950 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
2d960 34 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 71  4..-78..-79....q
2d970 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2d980 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2d990 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col1 + - col1 * 
2d9a0 38 39 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  89 FROM tab1..--
2d9b0 2d 2d 0d 0a 2d 31 31 34 34 0d 0a 2d 32 32 38 38  --..-1144..-2288
2d9c0 0d 0a 2d 38 38 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-880....query 
2d9d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d9e0 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 63  T ALL col1 * + c
2d9f0 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol0 - col0 * col
2da00 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2da10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 35 36  or0..----..-3456
2da20 0d 0a 2d 35 33 36 30 0d 0a 36 39 0d 0a 0d 0a 6f  ..-5360..69....o
2da30 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2da40 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2da50 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2da60 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2da70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2da80 74 20 6c 61 62 65 6c 2d 31 32 33 33 0d 0a 53 45  t label-1233..SE
2da90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2daa0 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
2dab0 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 34 33 20  SIGNED ) * + 43 
2dac0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
2dad0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2dae0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2daf0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2db00 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2db10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33  owsort label-123
2db20 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
2db30 43 54 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55  CT + - CAST ( NU
2db40 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
2db50 2a 20 2b 20 34 33 20 2b 20 63 6f 6c 32 20 46 52  * + 43 + col2 FR
2db60 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2db70 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f  .----..NULL....o
2db80 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2db90 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2dba0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2dbb0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2dbc0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 34 0d  sort label-1234.
2dbd0 0a 53 45 4c 45 43 54 20 33 30 20 44 49 56 20 2b  .SELECT 30 DIV +
2dbe0 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20   col1 + col2 AS 
2dbf0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
2dc00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
2dc10 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69  .33..82....skipi
2dc20 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2dc30 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2dc40 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2dc50 31 32 33 34 0d 0a 53 45 4c 45 43 54 20 33 30 20  1234..SELECT 30 
2dc60 2f 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  / + col1 + col2 
2dc70 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2dc80 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2dc90 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75  .1..33..82....qu
2dca0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2dcb0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 38 32 20 2a  ELECT ALL + 82 *
2dcc0 20 33 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53   34 FROM tab0 AS
2dcd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 38   cor0..----..278
2dce0 38 0d 0a 32 37 38 38 0d 0a 32 37 38 38 0d 0a 0d  8..2788..2788...
2dcf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2dd00 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2dd10 54 20 2b 20 28 20 38 32 20 29 20 41 53 20 63 6f  T + ( 82 ) AS co
2dd20 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2dd30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 32 0d 0a  cor0..----..82..
2dd40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2dd50 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2dd60 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 32  CT cor0.col2 * 2
2dd70 34 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  4 FROM tab1 AS c
2dd80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 36 0d  or0..----..1296.
2dd90 0a 31 33 36 38 0d 0a 32 33 30 34 0d 0a 0d 0a 6f  .1368..2304....o
2dda0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2ddb0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2ddc0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2ddd0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2dde0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 38 0d  sort label-1238.
2ddf0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2de00 6c 30 20 44 49 56 20 2b 20 34 36 20 46 52 4f 4d  l0 DIV + 46 FROM
2de10 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2de20 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d 0a  ---..0..1..1....
2de30 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2de40 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2de50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2de60 61 62 65 6c 2d 31 32 33 38 0d 0a 53 45 4c 45 43  abel-1238..SELEC
2de70 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2f 20 2b  T ALL + col0 / +
2de80 20 34 36 20 46 52 4f 4d 20 74 61 62 31 20 41 53   46 FROM tab1 AS
2de90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2dea0 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..1....query I 
2deb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2dec0 2b 20 36 39 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  + 69 * + col1 + 
2ded0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
2dee0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 39 36 37 0d  or0..----..5967.
2def0 0a 36 33 36 31 0d 0a 36 36 39 34 0d 0a 0d 0a 71  .6361..6694....q
2df00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2df10 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
2df20 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  9 AS col2 FROM t
2df30 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 38 36 0d 0a  ab1..----..486..
2df40 35 31 33 0d 0a 38 36 34 0d 0a 0d 0a 71 75 65 72  513..864....quer
2df50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2df60 45 43 54 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 63  ECT - col2 - - c
2df70 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 * - col0 AS 
2df80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
2df90 2d 2d 2d 2d 0d 0a 2d 31 33 38 31 0d 0a 2d 32 34  ----..-1381..-24
2dfa0 34 0d 0a 2d 34 36 32 38 0d 0a 0d 0a 6f 6e 6c 79  4..-4628....only
2dfb0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2dfc0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
2dfd0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
2dfe0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
2dff0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2e000 61 62 65 6c 2d 31 32 34 32 0d 0a 53 45 4c 45 43  abel-1242..SELEC
2e010 54 20 2d 20 43 41 53 54 28 20 37 38 20 41 53 20  T - CAST( 78 AS 
2e020 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32  SIGNED ) AS col2
2e030 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
2e040 0a 2d 2d 2d 2d 0d 0a 2d 37 38 0d 0a 2d 37 38 0d  .----..-78..-78.
2e050 0a 2d 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-78....skipif m
2e060 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2e070 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2e080 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34  owsort label-124
2e090 32 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  2..SELECT - CAST
2e0a0 20 28 20 37 38 20 41 53 20 49 4e 54 45 47 45 52   ( 78 AS INTEGER
2e0b0 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
2e0c0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2e0d0 0a 2d 37 38 0d 0a 2d 37 38 0d 0a 2d 37 38 0d 0a  .-78..-78..-78..
2e0e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e0f0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2e100 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63  col2 * col2 AS c
2e110 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
2e120 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d  r0..----..-1444.
2e130 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d 0a 0d 0a 71  .-676..-729....q
2e140 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e150 53 45 4c 45 43 54 20 33 20 2b 20 2b 20 63 6f 6c  SELECT 3 + + col
2e160 31 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  1 - cor0.col2 * 
2e170 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  - cor0.col1 FROM
2e180 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
2e190 0d 0a 31 32 36 34 0d 0a 31 34 33 33 0d 0a 35 38  ..1264..1433..58
2e1a0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
2e1b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2e1c0 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2b 20 33  TINCT col2 + + 3
2e1d0 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  5 AS col0 FROM t
2e1e0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 36  ab2..----..61..6
2e1f0 32 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49  2..73....query I
2e200 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e210 20 44 49 53 54 49 4e 43 54 20 2d 20 37 38 20 2b   DISTINCT - 78 +
2e220 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
2e230 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2e240 0a 2d 2d 2d 2d 0d 0a 2d 35 32 0d 0a 2d 36 35 0d  .----..-52..-65.
2e250 0a 2d 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-68....query I 
2e260 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e270 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 28  ALL - col2 * - (
2e280 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30   - col1 + - cor0
2e290 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c  .col0 * cor0.col
2e2a0 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  2 ) FROM tab1 AS
2e2b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
2e2c0 31 35 32 0d 0a 2d 32 30 38 35 30 36 0d 0a 2d 37  152..-208506..-7
2e2d0 33 38 35 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  38528....query I
2e2e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e2f0 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2b 20   ALL + - col2 + 
2e300 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  col1 * + col2 * 
2e310 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
2e320 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2e330 2d 2d 2d 2d 0d 0a 32 34 34 30 33 35 0d 0a 36 37  ----..244035..67
2e340 38 39 36 30 0d 0a 39 34 30 38 0d 0a 0d 0a 71 75  8960..9408....qu
2e350 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e360 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 38  ELECT DISTINCT 8
2e370 31 20 2b 20 35 32 20 46 52 4f 4d 20 74 61 62 31  1 + 52 FROM tab1
2e380 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
2e390 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
2e3a0 2d 2d 2d 0d 0a 31 33 33 0d 0a 0d 0a 71 75 65 72  ---..133....quer
2e3b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e3c0 45 43 54 20 36 38 20 46 52 4f 4d 20 74 61 62 30  ECT 68 FROM tab0
2e3d0 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab1 cor0..---
2e3e0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
2e3f0 69 6e 67 20 74 6f 20 35 39 39 62 65 65 31 35 61  ing to 599bee15a
2e400 63 34 63 63 33 39 62 38 35 39 38 35 34 65 30 37  c4cc39b859854e07
2e410 64 66 65 37 39 39 30 0d 0a 0d 0a 71 75 65 72 79  dfe7990....query
2e420 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e430 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
2e440 74 61 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  tab1.col0 AS col
2e450 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
2e460 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34 30 30 0d  -..-4096..-6400.
2e470 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .-9....query I r
2e480 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2e490 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 28 20  LL - col0 + - ( 
2e4a0 34 37 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63  47 ) * col2 AS c
2e4b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
2e4c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35   cor0..----..-25
2e4d0 34 31 0d 0a 2d 32 37 34 33 0d 0a 2d 34 35 39 32  41..-2743..-4592
2e4e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2e4f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2e500 2d 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 32 20  - col0 * ( col2 
2e510 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
2e520 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2e530 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d  -..-35..-7298..-
2e540 37 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  792....skipif my
2e550 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2e560 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2e570 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2e580 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 37 37  col1 * CAST ( 77
2e590 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20   AS REAL ) FROM 
2e5a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2e5b0 2d 2d 0d 0a 31 33 30 39 0d 0a 32 33 38 37 0d 0a  --..1309..2387..
2e5c0 34 35 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4543....query I 
2e5d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e5e0 41 4c 4c 20 63 6f 6c 32 20 2a 20 39 30 20 46 52  ALL col2 * 90 FR
2e5f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2e600 0a 2d 2d 2d 2d 0d 0a 34 38 36 30 0d 0a 35 31 33  .----..4860..513
2e610 30 0d 0a 38 36 34 30 0d 0a 0d 0a 71 75 65 72 79  0..8640....query
2e620 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e630 43 54 20 63 6f 6c 31 20 2b 20 28 20 34 30 20 29  CT col1 + ( 40 )
2e640 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2e650 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 0d 0a 31  b0..----..126..1
2e660 33 31 0d 0a 31 33 37 0d 0a 0d 0a 71 75 65 72 79  31..137....query
2e670 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e680 43 54 20 35 34 20 41 53 20 63 6f 6c 31 20 46 52  CT 54 AS col1 FR
2e690 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
2e6a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
2e6b0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2e6c0 20 64 32 33 36 34 63 34 66 66 63 30 39 61 63 32   d2364c4ffc09ac2
2e6d0 63 66 31 66 36 66 61 34 64 37 36 37 64 38 62 30  cf1f6fa4d767d8b0
2e6e0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2e6f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2e700 6f 6c 31 20 2b 20 39 36 20 41 53 20 63 6f 6c 32  ol1 + 96 AS col2
2e710 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2e720 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 31  r0..----..182..1
2e730 38 37 0d 0a 31 39 33 0d 0a 0d 0a 71 75 65 72 79  87..193....query
2e740 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e750 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
2e760 2e 63 6f 6c 31 20 2b 20 2b 20 28 20 2d 20 63 6f  .col1 + + ( - co
2e770 72 30 2e 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30  r0.col2 ) + col0
2e780 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
2e790 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
2e7a0 2d 31 38 35 0d 0a 2d 31 39 39 35 0d 0a 2d 33 30  -185..-1995..-30
2e7b0 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  23....query I ro
2e7c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2e7d0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
2e7e0 2d 20 36 35 20 46 52 4f 4d 20 74 61 62 31 20 41  - 65 FROM tab1 A
2e7f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2e800 0d 0a 2d 36 32 0d 0a 31 35 0d 0a 0d 0a 71 75 65  ..-62..15....que
2e810 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e820 4c 45 43 54 20 2d 20 2b 20 38 33 20 41 53 20 63  LECT - + 83 AS c
2e830 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
2e840 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 33 0d 0a 2d  r0..----..-83..-
2e850 38 33 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79  83..-83....query
2e860 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e870 43 54 20 41 4c 4c 20 2b 20 2b 20 36 32 20 2b 20  CT ALL + + 62 + 
2e880 2b 20 34 35 20 46 52 4f 4d 20 74 61 62 30 20 41  + 45 FROM tab0 A
2e890 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
2e8a0 37 0d 0a 31 30 37 0d 0a 31 30 37 0d 0a 0d 0a 71  7..107..107....q
2e8b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e8c0 53 45 4c 45 43 54 20 2b 20 33 33 20 2a 20 2d 20  SELECT + 33 * - 
2e8d0 32 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  25 AS col2 FROM 
2e8e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2e8f0 2d 2d 0d 0a 2d 38 32 35 0d 0a 2d 38 32 35 0d 0a  --..-825..-825..
2e900 2d 38 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -825....query I 
2e910 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e920 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 74 61  - tab1.col1 * ta
2e930 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  b1.col1 AS col0 
2e940 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2e950 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37  .-100..-169..-67
2e960 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2e970 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2e980 54 49 4e 43 54 20 2b 20 28 20 38 35 20 29 20 2a  TINCT + ( 85 ) *
2e990 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63   col2 * - cor0.c
2e9a0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
2e9b0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
2e9c0 0d 0a 2d 32 34 37 38 36 30 0d 0a 2d 32 37 36 31  ..-247860..-2761
2e9d0 36 35 0d 0a 2d 37 38 33 33 36 30 0d 0a 0d 0a 71  65..-783360....q
2e9e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e9f0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 36 32  SELECT col2 + 62
2ea00 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41   * - cor0.col2 A
2ea10 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2ea20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
2ea30 31 33 0d 0a 2d 35 30 30 32 0d 0a 2d 36 31 0d 0a  13..-5002..-61..
2ea40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ea50 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f  t..SELECT - ( co
2ea60 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2a 20  l2 ) * - col2 * 
2ea70 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
2ea80 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2ea90 2d 2d 2d 2d 0d 0a 31 37 35 37 36 0d 0a 31 39 36  ----..17576..196
2eaa0 38 33 0d 0a 35 34 38 37 32 0d 0a 0d 0a 71 75 65  83..54872....que
2eab0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2eac0 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 37 37 20  LECT ALL + + 77 
2ead0 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  + - col1 AS col0
2eae0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
2eaf0 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 34 36 0d 0a 36  .----..18..46..6
2eb00 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2eb10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
2eb20 6f 6c 32 20 2b 20 63 6f 6c 32 20 29 20 2a 20 28  ol2 + col2 ) * (
2eb30 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   + col1 ) AS col
2eb40 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
2eb50 2d 0d 0a 31 31 34 30 0d 0a 32 34 39 36 0d 0a 32  -..1140..2496..2
2eb60 38 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  808....query I r
2eb70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2eb80 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 74 61 62  ol2 + col2 * tab
2eb90 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  2.col2 AS col2 F
2eba0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
2ebb0 31 34 38 32 0d 0a 37 30 32 0d 0a 37 35 36 0d 0a  1482..702..756..
2ebc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ebd0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2ebe0 43 54 20 2d 20 37 38 20 2d 20 63 6f 6c 31 20 41  CT - 78 - col1 A
2ebf0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2ec00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2ec10 2d 31 30 39 0d 0a 2d 31 33 37 0d 0a 2d 39 35 0d  -109..-137..-95.
2ec20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2ec30 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
2ec40 2a 20 34 31 20 46 52 4f 4d 20 74 61 62 32 20 63  * 41 FROM tab2 c
2ec50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 36 0d  or0..----..1066.
2ec60 0a 31 31 30 37 0d 0a 31 35 35 38 0d 0a 0d 0a 71  .1107..1558....q
2ec70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2ec80 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20  SELECT col2 * + 
2ec90 35 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  57 AS col2 FROM 
2eca0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2ecb0 2d 2d 0d 0a 33 30 37 38 0d 0a 33 32 34 39 0d 0a  --..3078..3249..
2ecc0 35 34 37 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  5472....onlyif m
2ecd0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
2ece0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
2ecf0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
2ed00 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
2ed10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2ed20 2d 31 32 37 34 0d 0a 53 45 4c 45 43 54 20 44 49  -1274..SELECT DI
2ed30 53 54 49 4e 43 54 20 63 6f 6c 31 20 2f 20 2d 20  STINCT col1 / - 
2ed40 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
2ed50 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 2b 20  GNED ) + col0 + 
2ed60 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  - col2 * cor0.co
2ed70 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2ed80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
2ed90 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2eda0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2edb0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2edc0 72 74 20 6c 61 62 65 6c 2d 31 32 37 34 0d 0a 53  rt label-1274..S
2edd0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
2ede0 6f 6c 31 20 2f 20 2d 20 43 41 53 54 20 28 20 4e  ol1 / - CAST ( N
2edf0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
2ee00 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32   + col0 + - col2
2ee10 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   * cor0.col1 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 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
2ee40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ee50 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2ee60 20 63 6f 6c 32 20 2a 20 2d 20 38 32 20 46 52 4f   col2 * - 82 FRO
2ee70 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2ee80 2d 2d 2d 2d 0d 0a 2d 32 37 30 36 0d 0a 2d 36 37  ----..-2706..-67
2ee90 32 34 0d 0a 2d 38 32 0d 0a 0d 0a 6f 6e 6c 79 69  24..-82....onlyi
2eea0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2eeb0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2eec0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2eed0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2eee0 20 6c 61 62 65 6c 2d 31 32 37 36 0d 0a 53 45 4c   label-1276..SEL
2eef0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2ef00 6f 72 30 2e 63 6f 6c 31 20 2b 20 39 34 20 44 49  or0.col1 + 94 DI
2ef10 56 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  V cor0.col1 + co
2ef20 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
2ef30 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2ef40 2d 2d 0d 0a 31 37 33 0d 0a 31 38 33 0d 0a 31 39  --..173..183..19
2ef50 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
2ef60 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2ef70 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2ef80 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 36 0d 0a  ort label-1276..
2ef90 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2efa0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 39 34  + cor0.col1 + 94
2efb0 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   / cor0.col1 + c
2efc0 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
2efd0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2efe0 2d 2d 2d 0d 0a 31 37 33 0d 0a 31 38 33 0d 0a 31  ---..173..183..1
2eff0 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  94....query I ro
2f000 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2f010 4c 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 34 30 20  L + col0 * + 40 
2f020 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
2f030 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2f040 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 33 0d 0a 33 34  ..----..1303..34
2f050 36 39 0d 0a 38 37 34 0d 0a 0d 0a 71 75 65 72 79  69..874....query
2f060 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f070 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
2f080 2b 20 63 6f 6c 31 20 2b 20 2b 20 32 35 20 46 52  + col1 + + 25 FR
2f090 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2f0a0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 31 38 0d 0a 2d 31  .----..-1318..-1
2f0b0 39 32 0d 0a 2d 34 35 37 37 0d 0a 0d 0a 6f 6e 6c  92..-4577....onl
2f0c0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2f0d0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2f0e0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2f0f0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2f100 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2f110 6c 61 62 65 6c 2d 31 32 37 39 0d 0a 53 45 4c 45  label-1279..SELE
2f120 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
2f130 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
2f140 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20  ED ) FROM tab2, 
2f150 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
2f160 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
2f170 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
2f180 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2f190 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2f1a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2f1b0 32 37 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  279..SELECT DIST
2f1c0 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55  INCT + CAST ( NU
2f1d0 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
2f1e0 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
2f1f0 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
2f200 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor1..----..NUL
2f210 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
2f220 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2f230 54 49 4e 43 54 20 2b 20 38 32 20 46 52 4f 4d 20  TINCT + 82 FROM 
2f240 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30 0d  tab0, tab1 cor0.
2f250 0a 2d 2d 2d 2d 0d 0a 38 32 0d 0a 0d 0a 71 75 65  .----..82....que
2f260 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f270 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2f280 36 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  62 FROM tab2, ta
2f290 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2f2a0 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-62....query I
2f2b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f2c0 20 35 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   52 FROM tab0, t
2f2d0 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab1, tab1 AS cor
2f2e0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  0..----..27 valu
2f2f0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 36  es hashing to 76
2f300 31 30 30 64 31 30 66 35 31 39 39 35 64 32 30 65  100d10f51995d20e
2f310 66 64 65 62 36 35 37 65 34 34 34 64 33 63 0d 0a  fdeb657e444d3c..
2f320 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f330 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
2f340 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   + col1 * - col0
2f350 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2f360 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2f370 0d 0a 2d 32 30 39 37 0d 0a 2d 33 33 39 36 0d 0a  ..-2097..-3396..
2f380 2d 38 31 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -8181....query I
2f390 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f3a0 20 32 30 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20   20 * - col1 AS 
2f3b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2f3c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
2f3d0 30 30 0d 0a 2d 32 36 30 0d 0a 2d 35 32 30 0d 0a  00..-260..-520..
2f3e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f3f0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2f400 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2a  CT + tab1.col1 *
2f410 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab1.col2 FROM 
2f420 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38  tab1..----..1248
2f430 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71  ..1404..570....q
2f440 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2f450 53 45 4c 45 43 54 20 2d 20 36 34 20 2b 20 2b 20  SELECT - 64 + + 
2f460 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
2f470 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 37 0d 0a 33  ----..-10..-7..3
2f480 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2f490 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2f4a0 6f 6c 31 20 2a 20 28 20 63 6f 6c 30 20 29 20 41  ol1 * ( col0 ) A
2f4b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
2f4c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d  ..----..-1040..-
2f4d0 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72  640..-78....quer
2f4e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2f4f0 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  ECT + col2 + - c
2f500 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ol0 + - col2 AS 
2f510 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
2f520 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a  ----..-24..-35..
2f530 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -89....query I r
2f540 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
2f550 20 36 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f   6 ) AS col1 FRO
2f560 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  M tab2, tab2 AS 
2f570 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
2f580 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2f590 35 64 31 63 62 39 30 65 64 35 38 66 61 37 35 37  5d1cb90ed58fa757
2f5a0 33 38 39 35 64 32 66 39 35 62 32 31 31 38 32 31  3895d2f95b211821
2f5b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2f5c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2f5d0 49 4e 43 54 20 63 6f 6c 32 20 2a 20 28 20 2d 20  INCT col2 * ( - 
2f5e0 74 61 62 31 2e 63 6f 6c 32 20 29 20 41 53 20 63  tab1.col2 ) AS c
2f5f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
2f600 2d 2d 2d 0d 0a 2d 32 39 31 36 0d 0a 2d 33 32 34  ---..-2916..-324
2f610 39 0d 0a 2d 39 32 31 36 0d 0a 0d 0a 73 6b 69 70  9..-9216....skip
2f620 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2f630 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2f640 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f650 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2a  CT - tab1.col0 *
2f660 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20   CAST ( col2 AS 
2f670 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 31  REAL ) FROM tab1
2f680 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33  ..----..-162..-3
2f690 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75  648..-7680....qu
2f6a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f6b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2f6c0 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2d 20 63 6f   col2 * - ( - co
2f6d0 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  l2 ) FROM tab2..
2f6e0 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d  ----..1444..676.
2f6f0 0a 37 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .729....onlyif m
2f700 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2f710 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2f720 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2f730 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f740 62 65 6c 2d 31 32 39 33 0d 0a 53 45 4c 45 43 54  bel-1293..SELECT
2f750 20 41 4c 4c 20 63 6f 6c 31 20 44 49 56 20 2d 20   ALL col1 DIV - 
2f760 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  4 AS col1 FROM t
2f770 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a  ab0..----..-21..
2f780 2d 32 32 0d 0a 2d 32 34 0d 0a 0d 0a 73 6b 69 70  -22..-24....skip
2f790 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2f7a0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2f7b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2f7c0 2d 31 32 39 33 0d 0a 53 45 4c 45 43 54 20 41 4c  -1293..SELECT AL
2f7d0 4c 20 63 6f 6c 31 20 2f 20 2d 20 34 20 41 53 20  L col1 / - 4 AS 
2f7e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
2f7f0 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 32 32 0d 0a  ----..-21..-22..
2f800 2d 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -24....query I r
2f810 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2f820 6f 6c 31 20 2a 20 2d 20 33 35 20 46 52 4f 4d 20  ol1 * - 35 FROM 
2f830 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 30  tab1..----..-350
2f840 0d 0a 2d 34 35 35 0d 0a 2d 39 31 30 0d 0a 0d 0a  ..-455..-910....
2f850 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f860 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
2f870 20 2d 20 38 39 20 46 52 4f 4d 20 74 61 62 30 0d   - 89 FROM tab0.
2f880 0a 2d 2d 2d 2d 0d 0a 2d 32 39 33 37 0d 0a 2d 37  .----..-2937..-7
2f890 32 39 38 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72  298..-89....quer
2f8a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2f8b0 45 43 54 20 2d 20 2d 20 28 20 2b 20 63 6f 6c 30  ECT - - ( + col0
2f8c0 20 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   ) + + col0 FROM
2f8d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2f8e0 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a 36  ---..128..160..6
2f8f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2f900 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
2f910 28 20 34 36 20 29 20 2a 20 63 6f 72 30 2e 63 6f  ( 46 ) * cor0.co
2f920 6c 30 20 2a 20 2d 20 35 30 20 46 52 4f 4d 20 74  l0 * - 50 FROM t
2f930 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2f940 2d 0d 0a 2d 31 34 37 32 30 30 0d 0a 2d 31 38 34  -..-147200..-184
2f950 30 30 30 0d 0a 2d 36 39 30 30 0d 0a 0d 0a 71 75  000..-6900....qu
2f960 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f970 45 4c 45 43 54 20 2b 20 28 20 2d 20 39 31 20 29  ELECT + ( - 91 )
2f980 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   + col0 * - col0
2f990 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   * + col2 + col0
2f9a0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2f9b0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2f9c0 0d 0a 2d 31 32 38 31 0d 0a 2d 31 39 30 37 35 0d  ..-1281..-19075.
2f9d0 0a 2d 36 34 39 35 32 34 0d 0a 0d 0a 73 6b 69 70  .-649524....skip
2f9e0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2f9f0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2fa00 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2fa10 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2fa20 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2fa30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28  sort..SELECT + (
2fa40 20 2b 20 35 36 20 29 20 2a 20 63 6f 6c 30 20 63   + 56 ) * col0 c
2fa50 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2fa60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38   cor0..----..168
2fa70 0d 0a 33 35 38 34 0d 0a 34 34 38 30 0d 0a 0d 0a  ..3584..4480....
2fa80 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
2fa90 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
2faa0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
2fab0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
2fac0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
2fad0 72 74 20 6c 61 62 65 6c 2d 31 33 30 30 0d 0a 53  rt label-1300..S
2fae0 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 2d 20  ELECT + CAST( - 
2faf0 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 53 49 47  cor0.col1 AS SIG
2fb00 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2b  NED ) * - col2 +
2fb10 20 33 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f   30 + col0 AS co
2fb20 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
2fb30 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 38 0d 0a 31  0..----..1358..1
2fb40 34 33 37 0d 0a 36 36 34 0d 0a 0d 0a 73 6b 69 70  437..664....skip
2fb50 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2fb60 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2fb70 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2fb80 2d 31 33 30 30 0d 0a 53 45 4c 45 43 54 20 2b 20  -1300..SELECT + 
2fb90 43 41 53 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f  CAST ( - cor0.co
2fba0 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
2fbb0 2a 20 2d 20 63 6f 6c 32 20 2b 20 33 30 20 2b 20  * - col2 + 30 + 
2fbc0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
2fbd0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
2fbe0 2d 0d 0a 31 33 35 38 0d 0a 31 34 33 37 0d 0a 36  -..1358..1437..6
2fbf0 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  64....onlyif mys
2fc00 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
2fc10 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
2fc20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
2fc30 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
2fc40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2fc50 33 30 31 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41  301..SELECT - CA
2fc60 53 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49  ST( + col2 AS SI
2fc70 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c 32 20  GNED ) * - col2 
2fc80 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2fc90 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36  2..----..1444..6
2fca0 37 36 0d 0a 37 32 39 0d 0a 0d 0a 73 6b 69 70 69  76..729....skipi
2fcb0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2fcc0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2fcd0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2fce0 31 33 30 31 0d 0a 53 45 4c 45 43 54 20 2d 20 43  1301..SELECT - C
2fcf0 41 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20  AST ( + col2 AS 
2fd00 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f  INTEGER ) * - co
2fd10 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
2fd20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34  tab2..----..1444
2fd30 0d 0a 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71 75  ..676..729....qu
2fd40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2fd50 45 4c 45 43 54 20 41 4c 4c 20 2b 20 33 35 20 2a  ELECT ALL + 35 *
2fd60 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 74   + tab1.col1 + t
2fd70 61 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  ab1.col0 AS col0
2fd80 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2fd90 0d 0a 34 31 34 0d 0a 35 33 35 0d 0a 39 31 33 0d  ..414..535..913.
2fda0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2fdb0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 20 2b  rt..SELECT - 3 +
2fdc0 20 2d 20 35 30 20 2a 20 63 6f 6c 30 20 46 52 4f   - 50 * col0 FRO
2fdd0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
2fde0 2d 0d 0a 2d 31 32 30 33 0d 0a 2d 31 37 35 33 0d  -..-1203..-1753.
2fdf0 0a 2d 34 34 35 33 0d 0a 0d 0a 71 75 65 72 79 20  .-4453....query 
2fe00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2fe10 54 20 2d 20 38 30 20 2a 20 63 6f 6c 32 20 2a 20  T - 80 * col2 * 
2fe20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 46 52  col0 + - col1 FR
2fe30 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2fe40 0a 2d 2d 2d 2d 0d 0a 2d 31 35 31 35 31 0d 0a 2d  .----..-15151..-
2fe50 31 36 32 32 39 39 0d 0a 2d 32 34 30 31 37 37 0d  162299..-240177.
2fe60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2fe70 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
2fe80 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol2 * cor0.col1 
2fe90 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  + - col2 * col1 
2fea0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2feb0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
2fec0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2fed0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2fee0 49 4e 43 54 20 2b 20 2d 20 32 32 20 2a 20 63 6f  INCT + - 22 * co
2fef0 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l1 + + col2 FROM
2ff00 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2ff10 2d 2d 2d 0d 0a 2d 31 38 35 39 0d 0a 2d 31 39 32  ---..-1859..-192
2ff20 30 0d 0a 2d 32 31 33 33 0d 0a 0d 0a 6f 6e 6c 79  0..-2133....only
2ff30 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2ff40 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2ff50 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2ff60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ff70 74 20 6c 61 62 65 6c 2d 31 33 30 37 0d 0a 53 45  t label-1307..SE
2ff80 4c 45 43 54 20 2d 20 2b 20 28 20 63 6f 6c 31 20  LECT - + ( col1 
2ff90 29 20 44 49 56 20 37 35 20 46 52 4f 4d 20 74 61  ) DIV 75 FROM ta
2ffa0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2ffb0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
2ffc0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2ffd0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2ffe0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2fff0 6c 2d 31 33 30 37 0d 0a 53 45 4c 45 43 54 20 2d  l-1307..SELECT -
30000 20 2b 20 28 20 63 6f 6c 31 20 29 20 2f 20 37 35   + ( col1 ) / 75
30010 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
30020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
30030 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
30040 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
30050 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
30060 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
30070 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30080 2d 31 33 30 38 0d 0a 53 45 4c 45 43 54 20 44 49  -1308..SELECT DI
30090 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
300a0 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 30 20  col1 DIV - col0 
300b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
300c0 30 0d 0a 2d 2d 2d 2d 0d 0a 38 33 0d 0a 39 30 0d  0..----..83..90.
300d0 0a 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .95....skipif my
300e0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
300f0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
30100 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30 38  wsort label-1308
30110 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
30120 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  T + col1 + col1 
30130 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  / - col0 FROM ta
30140 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
30150 0d 0a 38 33 0d 0a 39 30 0d 0a 39 35 0d 0a 0d 0a  ..83..90..95....
30160 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30170 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
30180 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41   * col1 + col0 A
30190 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
301a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
301b0 31 31 32 30 0d 0a 37 30 34 0d 0a 38 31 0d 0a 0d  1120..704..81...
301c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
301d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
301e0 54 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a  T + ( + col1 ) *
301f0 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
30200 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
30210 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d  .-1248..-1404..-
30220 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  570....query I r
30230 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
30240 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol1 + cor0.col0 
30250 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 38 35 20  * - col2 + - 85 
30260 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
30270 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
30280 0a 2d 32 33 0d 0a 2d 37 32 39 32 0d 0a 2d 37 39  .-23..-7292..-79
30290 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
302a0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
302b0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
302c0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
302d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
302e0 2d 31 33 31 32 0d 0a 53 45 4c 45 43 54 20 41 4c  -1312..SELECT AL
302f0 4c 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c  L + col2 DIV col
30300 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
30310 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
30320 2d 0d 0a 30 0d 0a 30 0d 0a 32 0d 0a 0d 0a 73 6b  -..0..0..2....sk
30330 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
30340 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
30350 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
30360 65 6c 2d 31 33 31 32 0d 0a 53 45 4c 45 43 54 20  el-1312..SELECT 
30370 41 4c 4c 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c  ALL + col2 / col
30380 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
30390 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
303a0 2d 0d 0a 30 0d 0a 30 0d 0a 32 0d 0a 0d 0a 71 75  -..0..0..2....qu
303b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
303c0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  ELECT + col2 * c
303d0 6f 72 30 2e 63 6f 6c 31 20 2a 20 37 33 20 2b 20  or0.col1 * 73 + 
303e0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  + col1 * col2 FR
303f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
30400 0a 2d 2d 2d 2d 0d 0a 31 31 33 35 31 36 0d 0a 34  .----..113516..4
30410 37 38 30 34 0d 0a 36 31 39 33 38 0d 0a 0d 0a 71  7804..61938....q
30420 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30430 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 32  SELECT tab1.col2
30440 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46   + + cor0.col2 F
30450 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
30460 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
30470 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
30480 6f 20 38 64 31 35 63 61 39 62 38 39 30 64 62 36  o 8d15ca9b890db6
30490 62 62 39 33 62 39 61 30 35 62 30 34 33 32 36 65  bb93b9a05b04326e
304a0 64 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  d3....onlyif mys
304b0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
304c0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
304d0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
304e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
304f0 6c 2d 31 33 31 35 0d 0a 53 45 4c 45 43 54 20 2d  l-1315..SELECT -
30500 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 44   col1 + + col1 D
30510 49 56 20 2d 20 39 35 20 46 52 4f 4d 20 74 61 62  IV - 95 FROM tab
30520 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
30530 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a  .-17..-31..-59..
30540 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
30550 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
30560 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30570 20 6c 61 62 65 6c 2d 31 33 31 35 0d 0a 53 45 4c   label-1315..SEL
30580 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  ECT - col1 + + c
30590 6f 6c 31 20 2f 20 2d 20 39 35 20 46 52 4f 4d 20  ol1 / - 95 FROM 
305a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
305b0 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35  --..-17..-31..-5
305c0 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
305d0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
305e0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
305f0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
30600 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30610 2d 31 33 31 36 0d 0a 53 45 4c 45 43 54 20 44 49  -1316..SELECT DI
30620 53 54 49 4e 43 54 20 63 6f 6c 31 20 44 49 56 20  STINCT col1 DIV 
30630 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32  - cor0.col0 col2
30640 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
30650 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 30 0d  r0..----..-8..0.
30660 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
30670 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
30680 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
30690 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
306a0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
306b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
306c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
306d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
306e0 2d 31 33 31 36 0d 0a 53 45 4c 45 43 54 20 44 49  -1316..SELECT DI
306f0 53 54 49 4e 43 54 20 63 6f 6c 31 20 2f 20 2d 20  STINCT col1 / - 
30700 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32 20 46  cor0.col0 col2 F
30710 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
30720 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 30 0d 0a 0d  ..----..-8..0...
30730 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30740 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
30750 20 33 38 20 46 52 4f 4d 20 74 61 62 32 20 41 53   38 FROM tab2 AS
30760 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 38   cor0..----..-38
30770 0d 0a 2d 33 38 0d 0a 2d 33 38 0d 0a 0d 0a 71 75  ..-38..-38....qu
30780 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30790 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
307a0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63   col2 * + cor0.c
307b0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 28  ol2 + - col1 * (
307c0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b   col1 * - col1 +
307d0 20 28 20 63 6f 6c 30 20 29 20 29 20 46 52 4f 4d   ( col0 ) ) FROM
307e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
307f0 2d 2d 2d 0d 0a 36 33 35 30 38 31 0d 0a 37 35 32  ---..635081..752
30800 31 39 36 0d 0a 39 30 39 32 37 39 0d 0a 0d 0a 71  196..909279....q
30810 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30820 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2d 20  SELECT - col0 - 
30830 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
30840 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
30850 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 38 0d 0a 2d 34  ..----..-178..-4
30860 38 0d 0a 2d 37 30 0d 0a 0d 0a 71 75 65 72 79 20  8..-70....query 
30870 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30880 54 20 63 6f 6c 31 20 2b 20 2d 20 39 33 20 2b 20  T col1 + - 93 + 
30890 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
308a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
308b0 2d 33 31 0d 0a 2d 35 39 0d 0a 32 35 0d 0a 0d 0a  -31..-59..25....
308c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
308d0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
308e0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 63  ol1 * + col1 - c
308f0 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
30900 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
30910 0d 0a 2d 33 30 36 0d 0a 2d 33 35 34 30 0d 0a 2d  ..-306..-3540..-
30920 39 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  992....query I r
30930 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
30940 20 2d 20 63 6f 6c 31 20 2d 20 2b 20 28 20 2d 20   - col1 - + ( - 
30950 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col0 + + col1 * 
30960 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46  col2 ) AS col2 F
30970 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
30980 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 37 0d 0a 2d  ..----..-1397..-
30990 35 35 30 0d 0a 2d 37 39 39 0d 0a 0d 0a 6f 6e 6c  550..-799....onl
309a0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
309b0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
309c0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
309d0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
309e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
309f0 6c 61 62 65 6c 2d 31 33 32 33 0d 0a 53 45 4c 45  label-1323..SELE
30a00 43 54 20 2b 20 63 6f 6c 32 20 2b 20 43 41 53 54  CT + col2 + CAST
30a10 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44  ( col0 AS SIGNED
30a20 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
30a30 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d  tab1..----..121.
30a40 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70  .176..57....skip
30a50 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
30a60 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
30a70 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30a80 2d 31 33 32 33 0d 0a 53 45 4c 45 43 54 20 2b 20  -1323..SELECT + 
30a90 63 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 63 6f  col2 + CAST ( co
30aa0 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
30ab0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
30ac0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37  1..----..121..17
30ad0 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  6..57....query I
30ae0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30af0 20 63 6f 6c 31 20 2b 20 2b 20 28 20 32 30 20 29   col1 + + ( 20 )
30b00 20 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   - + col0 FROM t
30b10 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 38  ab0..----..22..8
30b20 32 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  2..82....query I
30b30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30b40 20 2b 20 35 30 20 46 52 4f 4d 20 74 61 62 32 20   + 50 FROM tab2 
30b50 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
30b60 49 4e 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  IN tab0, tab0 AS
30b70 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
30b80 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
30b90 6f 20 33 31 34 61 61 63 65 34 30 65 37 30 34 63  o 314aace40e704c
30ba0 32 30 61 36 62 65 30 36 32 30 34 61 33 32 39 66  20a6be06204a329f
30bb0 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
30bc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
30bd0 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30  STINCT cor0.col0
30be0 20 2a 20 2b 20 32 30 20 2a 20 2b 20 63 6f 6c 31   * + 20 * + col1
30bf0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
30c00 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
30c10 0d 0a 32 36 38 36 30 0d 0a 34 33 34 30 0d 0a 39  ..26860..4340..9
30c20 32 30 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  2040....onlyif m
30c30 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
30c40 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
30c50 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
30c60 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
30c70 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30c80 2d 31 33 32 37 0d 0a 53 45 4c 45 43 54 20 2b 20  -1327..SELECT + 
30c90 63 6f 6c 31 20 2d 20 2b 20 43 41 53 54 28 20 2d  col1 - + CAST( -
30ca0 20 32 36 20 41 53 20 53 49 47 4e 45 44 20 29 20   26 AS SIGNED ) 
30cb0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
30cc0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  0 cor0..----..11
30cd0 32 0d 0a 31 31 37 0d 0a 31 32 33 0d 0a 0d 0a 73  2..117..123....s
30ce0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
30cf0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
30d00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
30d10 62 65 6c 2d 31 33 32 37 0d 0a 53 45 4c 45 43 54  bel-1327..SELECT
30d20 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 43 41 53 54   + col1 - + CAST
30d30 20 28 20 2d 20 32 36 20 41 53 20 49 4e 54 45 47   ( - 26 AS INTEG
30d40 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ER ) AS col0 FRO
30d50 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
30d60 2d 0d 0a 31 31 32 0d 0a 31 31 37 0d 0a 31 32 33  -..112..117..123
30d70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30d80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
30d90 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 41 53  col0 - - col2 AS
30da0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
30db0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
30dc0 34 31 0d 0a 2d 35 32 0d 0a 32 30 0d 0a 0d 0a 71  41..-52..20....q
30dd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30de0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
30df0 32 20 2a 20 37 36 20 46 52 4f 4d 20 74 61 62 32  2 * 76 FROM tab2
30e00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37   cor0..----..197
30e10 36 0d 0a 32 30 35 32 0d 0a 32 38 38 38 0d 0a 0d  6..2052..2888...
30e20 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
30e30 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
30e40 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
30e50 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
30e60 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
30e70 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 30 0d 0a  ort label-1330..
30e80 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20  SELECT + - col0 
30e90 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  * + col2 * col0 
30ea0 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  + + CAST( NULL A
30eb0 53 20 53 49 47 4e 45 44 20 29 20 2d 20 2b 20 32  S SIGNED ) - + 2
30ec0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
30ed0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
30ee0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
30ef0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
30f00 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
30f10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
30f20 62 65 6c 2d 31 33 33 30 0d 0a 53 45 4c 45 43 54  bel-1330..SELECT
30f30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   + - col0 * + co
30f40 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 43 41  l2 * col0 + + CA
30f50 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
30f60 45 47 45 52 20 29 20 2d 20 2b 20 32 30 20 46 52  EGER ) - + 20 FR
30f70 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
30f80 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
30f90 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
30fa0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30fb0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
30fc0 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52  col2 * + col1 FR
30fd0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
30fe0 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38  --..1534..646..8
30ff0 33 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  37....onlyif mys
31000 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
31010 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
31020 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
31030 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
31040 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
31050 33 33 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  332..SELECT DIST
31060 49 4e 43 54 20 2d 20 43 41 53 54 28 20 2b 20 63  INCT - CAST( + c
31070 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol2 AS SIGNED ) 
31080 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  * + col1 col0 FR
31090 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
310a0 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36  .----..-1534..-6
310b0 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 73 6b 69 70  46..-837....skip
310c0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
310d0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
310e0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
310f0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
31100 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
31110 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
31120 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
31130 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 32 0d 0a  ort label-1332..
31140 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31150 2d 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 32 20  - CAST ( + col2 
31160 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b  AS INTEGER ) * +
31170 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20   col1 col0 FROM 
31180 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
31190 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d  --..-1534..-646.
311a0 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .-837....query I
311b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
311c0 20 44 49 53 54 49 4e 43 54 20 2b 20 39 20 2a 20   DISTINCT + 9 * 
311d0 2d 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  - ( col1 ) AS co
311e0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
311f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 37 34  cor0..----..-774
31200 0d 0a 2d 38 31 39 0d 0a 2d 38 37 33 0d 0a 0d 0a  ..-819..-873....
31210 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31220 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31230 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 2a   col2 - + col1 *
31240 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
31250 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
31260 0a 2d 32 30 33 31 0d 0a 2d 33 33 39 34 0d 0a 2d  .-2031..-3394..-
31270 38 30 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8017....query I 
31280 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31290 41 4c 4c 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20  ALL + tab2.col1 
312a0 2a 20 2d 20 63 6f 6c 32 20 2d 20 37 30 20 2a 20  * - col2 - 70 * 
312b0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
312c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 32 37 0d 0a 2d  ..----..-2727..-
312d0 33 33 30 36 0d 0a 2d 33 33 35 34 0d 0a 0d 0a 71  3306..-3354....q
312e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
312f0 53 45 4c 45 43 54 20 41 4c 4c 20 33 30 20 46 52  SELECT ALL 30 FR
31300 4f 4d 20 74 61 62 31 20 63 6f 72 30 20 43 52 4f  OM tab1 cor0 CRO
31310 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61  SS JOIN tab2, ta
31320 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31  b1 AS cor1, tab1
31330 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
31340 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  81 values hashin
31350 67 20 74 6f 20 31 61 65 32 35 34 39 34 61 32 31  g to 1ae25494a21
31360 38 33 36 62 61 63 30 37 38 37 39 61 61 31 39 66  836bac07879aa19f
31370 64 34 36 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49  d4615....query I
31380 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31390 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 28 20   ALL - col0 * ( 
313a0 2d 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 31 20  - col2 ) * col1 
313b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
313c0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d 0a 36  0..----..3395..6
313d0 36 34 31 31 38 0d 0a 36 38 31 31 32 0d 0a 0d 0a  64118..68112....
313e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
313f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
31400 63 6f 6c 32 20 2b 20 2d 20 31 34 20 2a 20 2d 20  col2 + - 14 * - 
31410 34 38 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  48 + col2 FROM t
31420 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
31430 36 37 32 0d 0a 36 37 32 0d 0a 36 37 32 0d 0a 0d  672..672..672...
31440 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31450 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
31460 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  or0.col1 * - col
31470 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
31480 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
31490 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a 36 37 36  -..100..169..676
314a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
314b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
314c0 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  INCT + col2 * + 
314d0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 35 35  cor0.col2 + + 55
314e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
314f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 39 39 0d 0a  r0..----..1499..
31500 37 33 31 0d 0a 37 38 34 0d 0a 0d 0a 71 75 65 72  731..784....quer
31510 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31520 45 43 54 20 41 4c 4c 20 2b 20 37 32 20 46 52 4f  ECT ALL + 72 FRO
31530 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  M tab2, tab2 AS 
31540 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
31550 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
31560 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39  ues hashing to 9
31570 32 63 63 33 64 35 64 61 61 35 35 30 33 30 34 65  2cc3d5daa550304e
31580 39 36 63 31 35 34 32 37 38 37 36 39 31 63 37 0d  96c1542787691c7.
31590 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
315a0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
315b0 4e 43 54 20 2d 20 28 20 2d 20 37 31 20 29 20 41  NCT - ( - 71 ) A
315c0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
315d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 31 0d   cor0..----..71.
315e0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
315f0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
31600 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
31610 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
31620 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
31630 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34 33  wsort label-1343
31640 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28  ..SELECT - CAST(
31650 20 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45   + col1 AS SIGNE
31660 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  D ) AS col2 FROM
31670 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
31680 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d  ---..-17..-31..-
31690 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  59....skipif mys
316a0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
316b0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
316c0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34 33 0d  sort label-1343.
316d0 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28  .SELECT - CAST (
316e0 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   + col1 AS INTEG
316f0 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ER ) AS col2 FRO
31700 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
31710 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a  ----..-17..-31..
31720 2d 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -59....query I r
31730 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
31740 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 36 37  LL + col0 * - 67
31750 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
31760 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
31770 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 38 0d 0a 2d  0..----..-198..-
31780 34 32 32 34 0d 0a 2d 35 32 38 30 0d 0a 0d 0a 71  4224..-5280....q
31790 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
317a0 53 45 4c 45 43 54 20 2b 20 2d 20 37 35 20 2b 20  SELECT + - 75 + 
317b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
317c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
317d0 31 0d 0a 2d 37 32 0d 0a 35 0d 0a 0d 0a 71 75 65  1..-72..5....que
317e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
317f0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
31800 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32  l2 * col1 + col2
31810 20 2a 20 28 20 2d 20 63 6f 6c 31 20 2a 20 2b 20   * ( - col1 * + 
31820 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f 6c 32 20  col1 + + ( col2 
31830 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  ) * cor0.col1 ) 
31840 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
31850 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
31860 0a 2d 32 35 31 31 0d 0a 2d 34 39 30 38 38 0d 0a  .-2511..-49088..
31870 31 34 32 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49  14212....query I
31880 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31890 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   - + cor0.col1 *
318a0 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29   ( + cor0.col1 )
318b0 20 2b 20 2b 20 28 20 63 6f 6c 31 20 2b 20 2d 20   + + ( col1 + - 
318c0 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46  col2 ) AS col2 F
318d0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
318e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 0d 0a 2d 32  ..----..-147..-2
318f0 35 32 0d 0a 2d 37 30 34 0d 0a 0d 0a 71 75 65 72  52..-704....quer
31900 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31910 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  ECT - col1 + - c
31920 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d  ol2 * + col2 * -
31930 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30 20 41   col1 - - col0 A
31940 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
31950 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31960 33 35 0d 0a 36 31 31 38 38 32 0d 0a 39 33 35 39  35..611882..9359
31970 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
31980 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
31990 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
319a0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
319b0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
319c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
319d0 45 4c 45 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c  ELECT + tab1.col
319e0 31 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52  1 + col0 col1 FR
319f0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
31a00 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75 65  9..74..93....que
31a10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31a20 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 39 31  LECT col1 + - 91
31a30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
31a40 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 30 0d  b0..----..-5..0.
31a50 0a 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .6....skipif pos
31a60 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
31a70 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
31a80 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
31a90 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
31aa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31ab0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31ac0 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2d 20  + tab1.col0 * - 
31ad0 39 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  94 col1 FROM tab
31ae0 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  1, tab1 AS cor0.
31af0 0a 2d 2d 2d 2d 0d 0a 2d 32 38 32 0d 0a 2d 36 30  .----..-282..-60
31b00 31 36 0d 0a 2d 37 35 32 30 0d 0a 0d 0a 71 75 65  16..-7520....que
31b10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31b20 4c 45 43 54 20 2b 20 2d 20 28 20 38 31 20 29 20  LECT + - ( 81 ) 
31b30 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  * col1 FROM tab1
31b40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31b50 2d 31 30 35 33 0d 0a 2d 32 31 30 36 0d 0a 2d 38  -1053..-2106..-8
31b60 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
31b70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
31b80 53 54 49 4e 43 54 20 2b 20 38 32 20 2a 20 63 6f  STINCT + 82 * co
31b90 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
31ba0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34 32 38  cor0..----..4428
31bb0 0d 0a 34 36 37 34 0d 0a 37 38 37 32 0d 0a 0d 0a  ..4674..7872....
31bc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31bd0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
31be0 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
31bf0 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
31c00 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38  ..----..1..33..8
31c10 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
31c20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
31c30 54 49 4e 43 54 20 37 30 20 2b 20 2d 20 63 6f 6c  TINCT 70 + - col
31c40 30 20 2a 20 33 38 20 2b 20 2b 20 63 6f 6c 31 20  0 * 38 + + col1 
31c50 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
31c60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 36 33 0d 0a  0..----..-1163..
31c70 2d 33 32 32 31 0d 0a 2d 37 35 36 0d 0a 0d 0a 71  -3221..-756....q
31c80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31c90 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 28  SELECT ALL + + (
31ca0 20 63 6f 6c 31 20 29 20 2d 20 31 37 20 46 52 4f   col1 ) - 17 FRO
31cb0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
31cc0 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 37 0d 0a 39 0d  ----..-4..-7..9.
31cd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31ce0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
31cf0 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  2 * - cor0.col2 
31d00 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  * cor0.col2 AS c
31d10 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
31d20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
31d30 33 35 39 33 37 0d 0a 35 35 31 33 36 38 0d 0a 0d  35937..551368...
31d40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31d50 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63  ..SELECT + ( + c
31d60 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20 2d 20 63  or0.col0 ) * - c
31d70 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f  ol2 + + col0 FRO
31d80 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31d90 2d 2d 2d 2d 0d 0a 2d 37 32 30 39 0d 0a 2d 37 36  ----..-7209..-76
31da0 38 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8..0....query I 
31db0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31dc0 41 4c 4c 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c  ALL - col2 - col
31dd0 31 20 2a 20 2b 20 38 30 20 41 53 20 63 6f 6c 31  1 * + 80 AS col1
31de0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
31df0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 36 0d  r0..----..-1136.
31e00 0a 2d 32 31 33 34 0d 0a 2d 38 35 37 0d 0a 0d 0a  .-2134..-857....
31e10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31e20 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31e30 20 2d 20 39 33 20 41 53 20 63 6f 6c 30 20 46 52   - 93 AS col0 FR
31e40 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
31e50 2d 2d 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79  --..-93....query
31e60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31e70 43 54 20 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20  CT - + ( col1 ) 
31e80 2a 20 28 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29  * ( - ( - col0 )
31e90 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
31ea0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
31eb0 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d  .-2064..-3395..-
31ec0 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
31ed0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31ee0 41 4c 4c 20 2b 20 38 32 20 2a 20 63 6f 72 30 2e  ALL + 82 * cor0.
31ef0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53  col0 + - col2 AS
31f00 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
31f10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
31f20 39 33 35 0d 0a 32 38 36 39 0d 0a 37 32 31 36 0d  935..2869..7216.
31f30 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
31f40 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
31f50 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
31f60 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
31f70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
31f80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31f90 45 43 54 20 2d 20 34 30 20 63 6f 6c 30 20 46 52  ECT - 40 col0 FR
31fa0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
31fb0 0a 2d 2d 2d 2d 0d 0a 2d 34 30 0d 0a 2d 34 30 0d  .----..-40..-40.
31fc0 0a 2d 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-40....query I 
31fd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31fe0 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20  DISTINCT col0 + 
31ff0 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col1 * cor0.col0
32000 20 2a 20 35 32 20 46 52 4f 4d 20 74 61 62 30 20   * 52 FROM tab0 
32010 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
32020 30 37 33 35 32 0d 0a 31 37 36 35 37 35 0d 0a 34  07352..176575..4
32030 32 31 32 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  21237....query I
32040 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32050 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f   ALL + - cor0.co
32060 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  l0 * + col0 * co
32070 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
32080 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
32090 0a 2d 31 32 32 35 0d 0a 2d 31 39 30 30 38 0d 0a  .-1225..-19008..
320a0 2d 36 34 39 35 32 32 0d 0a 0d 0a 71 75 65 72 79  -649522....query
320b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
320c0 43 54 20 39 31 20 46 52 4f 4d 20 74 61 62 31 2c  CT 91 FROM tab1,
320d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
320e0 61 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor1..----..
320f0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
32100 67 20 74 6f 20 64 65 65 62 62 63 66 62 39 63 37  g to deebbcfb9c7
32110 38 30 33 61 33 34 64 63 61 36 62 64 38 36 30 38  803a34dca6bd8608
32120 34 39 61 66 65 0d 0a 0d 0a 71 75 65 72 79 20 49  49afe....query I
32130 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32140 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b   + cor0.col2 + +
32150 20 39 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   95 AS col1 FROM
32160 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
32170 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53  OSS JOIN tab1 AS
32180 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
32190 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
321a0 20 39 62 61 63 61 63 37 39 64 64 65 32 30 61 62   9bacac79dde20ab
321b0 39 33 39 33 35 35 61 35 38 37 35 35 65 64 36 65  939355a58755ed6e
321c0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
321d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
321e0 6f 6c 32 20 2a 20 31 35 20 46 52 4f 4d 20 74 61  ol2 * 15 FROM ta
321f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
32200 0d 0a 33 39 30 0d 0a 34 30 35 0d 0a 35 37 30 0d  ..390..405..570.
32210 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
32220 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
32230 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32240 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
32250 20 2a 20 2b 20 43 41 53 54 20 28 20 2b 20 39 39   * + CAST ( + 99
32260 20 41 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f   AS REAL ) AS co
32270 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
32280 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 38 33 0d 0a  0..----..-1683..
32290 2d 33 30 36 39 0d 0a 2d 35 38 34 31 0d 0a 0d 0a  -3069..-5841....
322a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
322b0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
322c0 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53   + ( - col1 ) AS
322d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
322e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
322f0 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39 34  7396..-8281..-94
32300 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  09....query I ro
32310 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
32320 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 38 20  col0 * col0 + 8 
32330 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
32340 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 37 0d 0a  0..----..-1217..
32350 2d 35 36 38 0d 0a 2d 37 39 31 33 0d 0a 0d 0a 71  -568..-7913....q
32360 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32370 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
32380 2b 20 63 6f 6c 31 20 2a 20 74 61 62 32 2e 63 6f  + col1 * tab2.co
32390 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 * col2 FROM t
323a0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 35  ab2..----..11965
323b0 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35 39 0d 0a  2..51034..5859..
323c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
323d0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f  t..SELECT + ( co
323e0 72 30 2e 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f  r0.col2 ) * + co
323f0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
32400 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38  cor0..----..2838
32410 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 73 6b  ..7462..97....sk
32420 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
32430 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
32440 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
32450 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
32460 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
32470 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32  owsort..SELECT 2
32480 39 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  9 col1 FROM tab0
32490 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
324a0 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
324b0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
324c0 73 68 69 6e 67 20 74 6f 20 31 65 37 31 32 30 62  shing to 1e7120b
324d0 61 38 65 39 31 39 31 30 38 34 31 37 32 64 64 63  a8e9191084172ddc
324e0 65 64 31 37 65 35 65 62 32 0d 0a 0d 0a 71 75 65  ed17e5eb2....que
324f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32500 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
32510 63 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d  cor0.col1 ) FROM
32520 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
32530 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  or0..----..10..1
32540 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  3..26....query I
32550 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32560 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b   DISTINCT col1 +
32570 20 28 20 34 31 20 29 20 46 52 4f 4d 20 74 61 62   ( 41 ) FROM tab
32580 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
32590 0a 31 32 37 0d 0a 31 33 32 0d 0a 31 33 38 0d 0a  .127..132..138..
325a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
325b0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  t..SELECT - cor0
325c0 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b  .col0 * - col1 +
325d0 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30   - col0 + - col0
325e0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
325f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
32600 0d 0a 31 31 38 35 0d 0a 32 30 33 0d 0a 34 34 34  ..1185..203..444
32610 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
32620 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
32630 6f 6c 30 20 2a 20 35 36 20 46 52 4f 4d 20 74 61  ol0 * 56 FROM ta
32640 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 39 32 0d 0a 34  b2..----..392..4
32650 33 36 38 0d 0a 34 34 32 34 0d 0a 0d 0a 71 75 65  368..4424....que
32660 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32670 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2d 20  LECT + col0 - - 
32680 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
32690 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a  or0..----..178..
326a0 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20  48..70....query 
326b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
326c0 54 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20  T - tab1.col2 * 
326d0 2d 20 34 34 20 46 52 4f 4d 20 74 61 62 31 0d 0a  - 44 FROM tab1..
326e0 2d 2d 2d 2d 0d 0a 32 33 37 36 0d 0a 32 35 30 38  ----..2376..2508
326f0 0d 0a 34 32 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..4224....onlyif
32700 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
32710 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
32720 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
32730 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
32740 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
32750 65 6c 2d 31 33 38 31 0d 0a 53 45 4c 45 43 54 20  el-1381..SELECT 
32760 41 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  ALL col2 + col1 
32770 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  * - CAST( NULL A
32780 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
32790 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
327a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
327b0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
327c0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
327d0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
327e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
327f0 61 62 65 6c 2d 31 33 38 31 0d 0a 53 45 4c 45 43  abel-1381..SELEC
32800 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c  T ALL col2 + col
32810 31 20 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  1 * - CAST ( NUL
32820 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  L AS INTEGER ) A
32830 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
32840 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32850 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
32860 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32870 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
32880 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20 2b  - ( - col2 ) + +
32890 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   ( col1 ) AS col
328a0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
328b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35  or0..----..55..5
328c0 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  8..85....query I
328d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
328e0 20 41 4c 4c 20 35 20 41 53 20 63 6f 6c 30 20 46   ALL 5 AS col0 F
328f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
32900 0d 0a 2d 2d 2d 2d 0d 0a 35 0d 0a 35 0d 0a 35 0d  ..----..5..5..5.
32910 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32920 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 35  rt..SELECT + ( 5
32930 37 20 29 20 2a 20 63 6f 6c 32 20 2b 20 34 39 20  7 ) * col2 + 49 
32940 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
32950 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 31 0d 0a 31  0..----..1531..1
32960 35 38 38 0d 0a 32 32 31 35 0d 0a 0d 0a 71 75 65  588..2215....que
32970 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32980 4c 45 43 54 20 2b 20 33 36 20 2b 20 63 6f 72 30  LECT + 36 + cor0
32990 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
329a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
329b0 30 30 0d 0a 31 31 36 0d 0a 33 39 0d 0a 0d 0a 71  00..116..39....q
329c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
329d0 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 31  SELECT tab1.col1
329e0 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 46   * + tab1.col1 F
329f0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
32a00 31 30 30 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d  100..169..676...
32a10 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
32a20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
32a30 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
32a40 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
32a50 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 38  owsort label-138
32a60 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  7..SELECT + col1
32a70 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f   + - col0 DIV co
32a80 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
32a90 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 32 36 0d  1..----..13..26.
32aa0 0a 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .9....skipif pos
32ab0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
32ac0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
32ad0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
32ae0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
32af0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
32b00 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
32b10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
32b20 62 65 6c 2d 31 33 38 37 0d 0a 53 45 4c 45 43 54  bel-1387..SELECT
32b30 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   + col1 + - col0
32b40 20 2f 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f   / col2 col1 FRO
32b50 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab1..----..13
32b60 0d 0a 32 36 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79  ..26..9....query
32b70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32b80 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34 20  CT DISTINCT - 4 
32b90 2b 20 2b 20 34 30 20 46 52 4f 4d 20 74 61 62 32  + + 40 FROM tab2
32ba0 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 0d 0a 71 75  ..----..36....qu
32bb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32bc0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b  ELECT + col2 + +
32bd0 20 39 37 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20   97 * col0 FROM 
32be0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
32bf0 2d 2d 0d 0a 33 34 35 0d 0a 36 32 36 35 0d 0a 37  --..345..6265..7
32c00 38 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  856....query I r
32c10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
32c20 49 53 54 49 4e 43 54 20 2b 20 2d 20 28 20 2d 20  ISTINCT + - ( - 
32c30 28 20 63 6f 6c 30 20 29 20 29 20 2b 20 2b 20 63  ( col0 ) ) + + c
32c40 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
32c50 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
32c60 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31 35  ---..14..156..15
32c70 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
32c80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
32c90 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  2 * col2 + col1 
32ca0 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  * + col1 AS col2
32cb0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
32cc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 30 0d 0a  r0..----..1690..
32cd0 31 37 33 33 0d 0a 34 31 35 37 0d 0a 0d 0a 71 75  1733..4157....qu
32ce0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32cf0 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 33  ELECT - col1 + 3
32d00 38 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  8 FROM tab2 cor0
32d10 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 32 31 0d  ..----..-21..21.
32d20 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .7....query I ro
32d30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
32d40 4c 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  L col2 + - col0 
32d50 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
32d60 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  1 cor0..----..-7
32d70 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72  ..16..51....quer
32d80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32d90 45 43 54 20 63 6f 72 31 2e 63 6f 6c 32 20 2b 20  ECT cor1.col2 + 
32da0 38 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  87 AS col2 FROM 
32db0 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
32dc0 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  r0, tab2 AS cor1
32dd0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
32de0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 30 30  s hashing to 500
32df0 30 39 38 37 61 65 66 63 62 62 66 39 32 62 33 39  0987aefcbbf92b39
32e00 66 34 66 39 32 36 37 34 64 65 32 38 36 0d 0a 0d  f4f92674de286...
32e10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32e20 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
32e30 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  T + col2 + + col
32e40 31 20 2a 20 2d 20 32 20 41 53 20 63 6f 6c 32 20  1 * - 2 AS col2 
32e50 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
32e60 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 37 0d 0a  0..----..2..37..
32e70 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  70....onlyif mys
32e80 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
32e90 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
32ea0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
32eb0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
32ec0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
32ed0 33 39 36 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  396..SELECT CAST
32ee0 28 20 2d 20 31 30 20 41 53 20 53 49 47 4e 45 44  ( - 10 AS SIGNED
32ef0 20 29 20 2a 20 74 61 62 32 2e 63 6f 6c 30 20 41   ) * tab2.col0 A
32f00 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
32f10 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a 2d 37 38  ..----..-70..-78
32f20 30 0d 0a 2d 37 39 30 0d 0a 0d 0a 73 6b 69 70 69  0..-790....skipi
32f30 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
32f40 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
32f50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
32f60 31 33 39 36 0d 0a 53 45 4c 45 43 54 20 43 41 53  1396..SELECT CAS
32f70 54 20 28 20 2d 20 31 30 20 41 53 20 49 4e 54 45  T ( - 10 AS INTE
32f80 47 45 52 20 29 20 2a 20 74 61 62 32 2e 63 6f 6c  GER ) * tab2.col
32f90 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
32fa0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a  ab2..----..-70..
32fb0 2d 37 38 30 0d 0a 2d 37 39 30 0d 0a 0d 0a 71 75  -780..-790....qu
32fc0 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
32fd0 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
32fe0 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c  ECT * FROM tab0,
32ff0 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
33000 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74  OSS JOIN tab2, t
33010 61 62 31 2c 20 74 61 62 30 20 63 6f 72 31 0d 0a  ab1, tab0 cor1..
33020 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65  ----..3645 value
33030 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 32 32  s hashing to b22
33040 35 64 33 37 36 35 66 33 33 35 35 31 63 31 32 35  5d3765f33551c125
33050 37 34 66 35 34 35 63 38 63 39 31 65 62 0d 0a 0d  74f545c8c91eb...
33060 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33070 0d 0a 53 45 4c 45 43 54 20 34 38 20 2a 20 2b 20  ..SELECT 48 * + 
33080 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  tab0.col2 FROM t
33090 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 34 0d  ab0..----..1584.
330a0 0a 33 39 33 36 0d 0a 34 38 0d 0a 0d 0a 71 75 65  .3936..48....que
330b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
330c0 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  LECT - cor0.col0
330d0 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 30   + + col1 - col0
330e0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
330f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 37 0d 0a 32  r0..----..-87..2
33100 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49  7..38....query I
33110 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33120 20 63 6f 6c 30 20 2d 20 28 20 2d 20 63 6f 6c 31   col0 - ( - col1
33130 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
33140 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d  cor0..----..110.
33150 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 6f 6e 6c  .132..180....onl
33160 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
33170 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
33180 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
33190 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
331a0 72 74 20 6c 61 62 65 6c 2d 31 34 30 31 0d 0a 53  rt label-1401..S
331b0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2d 20 2d  ELECT - col2 - -
331c0 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 41   col2 DIV col1 A
331d0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
331e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32   cor0..----..-52
331f0 0d 0a 2d 35 32 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b  ..-52..-89....sk
33200 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
33210 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
33220 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
33230 65 6c 2d 31 34 30 31 0d 0a 53 45 4c 45 43 54 20  el-1401..SELECT 
33240 2d 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32 20  - col2 - - col2 
33250 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  / col1 AS col1 F
33260 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
33270 2d 2d 2d 0d 0a 2d 35 32 0d 0a 2d 35 32 0d 0a 2d  ---..-52..-52..-
33280 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  89....query I ro
33290 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
332a0 53 54 49 4e 43 54 20 2b 20 38 35 20 2b 20 34 39  STINCT + 85 + 49
332b0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46   * + cor0.col0 F
332c0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
332d0 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
332e0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 32   cor1..----..232
332f0 0d 0a 33 32 32 31 0d 0a 34 30 30 35 0d 0a 0d 0a  ..3221..4005....
33300 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
33310 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
33320 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
33330 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
33340 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
33350 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33360 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c   col2 * cor0.col
33370 32 20 2a 20 2b 20 36 39 20 2d 20 63 6f 6c 30 20  2 * + 69 - col0 
33380 2a 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d  * col2 col2 FROM
33390 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
333a0 2d 2d 2d 0d 0a 34 34 36 31 36 0d 0a 35 30 31 31  ---..44616..5011
333b0 32 0d 0a 39 36 36 33 34 0d 0a 0d 0a 71 75 65 72  2..96634....quer
333c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
333d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
333e0 30 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  0 - + col0 * col
333f0 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 * col1 FROM ta
33400 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
33410 0d 0a 2d 31 31 38 37 39 30 0d 0a 2d 34 39 35 31  ..-118790..-4951
33420 32 0d 0a 2d 37 32 30 37 32 32 0d 0a 0d 0a 71 75  2..-720722....qu
33430 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33440 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 74 61 62  ELECT col2 * tab
33450 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  0.col0 * - col2 
33460 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
33470 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 31 33 36 0d  0..----..-26136.
33480 0a 2d 33 35 0d 0a 2d 35 39 38 34 33 36 0d 0a 0d  .-35..-598436...
33490 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
334a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
334b0 54 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20  T - tab2.col2 * 
334c0 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32  ( col2 ) AS col2
334d0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
334e0 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d  ..-1444..-676..-
334f0 37 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  729....onlyif my
33500 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
33510 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
33520 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
33530 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
33540 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
33550 31 34 30 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1407..SELECT ALL
33560 20 2d 20 2d 20 43 41 53 54 28 20 2d 20 39 31 20   - - CAST( - 91 
33570 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 2d 20  AS SIGNED ) - - 
33580 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
33590 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
335a0 35 0d 0a 2d 37 38 0d 0a 2d 38 31 0d 0a 0d 0a 73  5..-78..-81....s
335b0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
335c0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
335d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
335e0 62 65 6c 2d 31 34 30 37 0d 0a 53 45 4c 45 43 54  bel-1407..SELECT
335f0 20 41 4c 4c 20 2d 20 2d 20 43 41 53 54 20 28 20   ALL - - CAST ( 
33600 2d 20 39 31 20 41 53 20 49 4e 54 45 47 45 52 20  - 91 AS INTEGER 
33610 29 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  ) - - col1 FROM 
33620 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
33630 2d 2d 0d 0a 2d 36 35 0d 0a 2d 37 38 0d 0a 2d 38  --..-65..-78..-8
33640 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
33650 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
33660 54 49 4e 43 54 20 28 20 63 6f 6c 31 20 29 20 2b  TINCT ( col1 ) +
33670 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2d 20   + col2 * + ( - 
33680 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30  col1 ) FROM tab0
33690 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
336a0 2d 32 37 35 32 0d 0a 2d 37 33 37 31 0d 0a 30 0d  -2752..-7371..0.
336b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
336c0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
336d0 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32 20 2a   col2 - - col2 *
336e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
336f0 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35 34  .----..2871..754
33700 34 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..98....skipif 
33710 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
33720 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
33730 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
33740 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
33750 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33760 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
33770 43 54 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 31 20  CT + - ( + col1 
33780 29 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52  ) + col0 col0 FR
33790 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
337a0 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a  .----..-2..-62..
337b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
337c0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
337d0 43 54 20 2b 20 2d 20 28 20 2b 20 33 36 20 29 20  CT + - ( + 36 ) 
337e0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
337f0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 0d 0a  0..----..-36....
33800 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
33810 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
33820 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
33830 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
33840 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
33850 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33860 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2d   col2 + - col0 -
33870 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c   - cor0.col1 col
33880 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
33890 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a  or0..----..-24..
338a0 35 31 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  51..7....skipif 
338b0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
338c0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
338d0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
338e0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
338f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33900 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
33910 43 54 20 2b 20 63 6f 6c 30 20 2b 20 28 20 63 6f  CT + col0 + ( co
33920 6c 31 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 ) col2 FROM t
33930 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
33940 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d  110..132..180...
33950 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
33960 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
33970 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
33980 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
33990 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
339a0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 34 0d 0a  ort label-1414..
339b0 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28  SELECT ALL CAST(
339c0 20 33 33 20 41 53 20 53 49 47 4e 45 44 20 29 20   33 AS SIGNED ) 
339d0 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52  * - col1 col2 FR
339e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
339f0 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 33  .----..-2838..-3
33a00 30 30 33 0d 0a 2d 33 32 30 31 0d 0a 0d 0a 73 6b  003..-3201....sk
33a10 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
33a20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
33a30 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
33a40 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
33a50 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
33a60 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
33a70 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
33a80 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 34  wsort label-1414
33a90 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53  ..SELECT ALL CAS
33aa0 54 20 28 20 33 33 20 41 53 20 49 4e 54 45 47 45  T ( 33 AS INTEGE
33ab0 52 20 29 20 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c  R ) * - col1 col
33ac0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
33ad0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38  or0..----..-2838
33ae0 0d 0a 2d 33 30 30 33 0d 0a 2d 33 32 30 31 0d 0a  ..-3003..-3201..
33af0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
33b00 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
33b10 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
33b20 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
33b30 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
33b40 31 35 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 28  15..SELECT - - (
33b50 20 2b 20 63 6f 6c 30 20 29 20 44 49 56 20 63 6f   + col0 ) DIV co
33b60 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
33b70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
33b80 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .1..1..1....skip
33b90 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
33ba0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
33bb0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
33bc0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
33bd0 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
33be0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
33bf0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
33c00 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 35 0d 0a  ort label-1415..
33c10 53 45 4c 45 43 54 20 2d 20 2d 20 28 20 2b 20 63  SELECT - - ( + c
33c20 6f 6c 30 20 29 20 2f 20 63 6f 6c 30 20 63 6f 6c  ol0 ) / col0 col
33c30 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
33c40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d  or0..----..1..1.
33c50 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
33c60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
33c70 4c 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 74 61 62  L + col0 - + tab
33c80 32 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20  2.col1 * + col2 
33c90 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
33ca0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 36 0d 0a  2..----..-1456..
33cb0 2d 35 36 37 0d 0a 2d 38 33 30 0d 0a 0d 0a 71 75  -567..-830....qu
33cc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33cd0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
33ce0 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2b 20 63   tab0.col0 * + c
33cf0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d  ol0 + + col1 + -
33d00 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46   col1 * + col0 F
33d10 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
33d20 2d 31 34 30 32 0d 0a 2d 32 30 37 33 0d 0a 2d 38  -1402..-2073..-8
33d30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
33d40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
33d50 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 74 61   - ( col0 ) + ta
33d60 62 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32  b0.col0 * - col2
33d70 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
33d80 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37  0..----..-35..-7
33d90 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 73 6b 69  298..-792....ski
33da0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
33db0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
33dc0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
33dd0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
33de0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
33df0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
33e00 6c 32 20 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 31  l2 * col1 - col1
33e10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
33e20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32  cor0..----..0..2
33e30 37 35 32 0d 0a 37 33 37 31 0d 0a 0d 0a 71 75 65  752..7371....que
33e40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33e50 4c 45 43 54 20 2b 20 36 39 20 2a 20 2b 20 63 6f  LECT + 69 * + co
33e60 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
33e70 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
33e80 0a 31 37 39 34 0d 0a 31 38 36 33 0d 0a 32 36 32  .1794..1863..262
33e90 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
33ea0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
33eb0 54 49 4e 43 54 20 2b 20 33 35 20 2b 20 63 6f 6c  TINCT + 35 + col
33ec0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
33ed0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 0d 0a  or0..----..124..
33ee0 35 39 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20  59..70....query 
33ef0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33f00 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  T + - col0 * - c
33f10 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
33f20 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  0 + + col2 FROM 
33f30 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
33f40 2d 2d 0d 0a 31 33 35 30 0d 0a 31 35 38 32 31 30  --..1350..158210
33f50 0d 0a 32 33 37 31 39 36 0d 0a 0d 0a 71 75 65 72  ..237196....quer
33f60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33f70 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 63  ECT DISTINCT ( c
33f80 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f  or0.col2 ) AS co
33f90 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
33fa0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
33fb0 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73  ..1..33..82....s
33fc0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
33fd0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
33fe0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
33ff0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
34000 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
34010 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34020 41 4c 4c 20 34 35 20 2b 20 2b 20 37 30 20 2a 20  ALL 45 + + 70 * 
34030 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  + col2 col1 FROM
34040 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
34050 2d 2d 2d 0d 0a 31 38 36 35 0d 0a 31 39 33 35 0d  ---..1865..1935.
34060 0a 32 37 30 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .2705....query I
34070 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34080 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   - - cor0.col0 +
34090 20 2d 20 33 36 20 46 52 4f 4d 20 74 61 62 30 20   - 36 FROM tab0 
340a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
340b0 31 0d 0a 2d 31 32 0d 0a 35 33 0d 0a 0d 0a 71 75  1..-12..53....qu
340c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
340d0 45 4c 45 43 54 20 2b 20 2d 20 74 61 62 32 2e 63  ELECT + - tab2.c
340e0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
340f0 20 74 61 62 32 2c 20 74 61 62 30 2c 20 74 61 62   tab2, tab0, tab
34100 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
34110 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
34120 6e 67 20 74 6f 20 66 39 64 34 62 62 38 36 37 37  ng to f9d4bb8677
34130 64 62 37 62 39 38 63 37 65 64 38 39 64 30 36 65  db7b98c7ed89d06e
34140 36 65 38 63 64 36 0d 0a 0d 0a 71 75 65 72 79 20  6e8cd6....query 
34150 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34160 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  T - - cor0.col0 
34170 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
34180 31 2c 20 74 61 62 32 2c 20 74 61 62 30 20 63 6f  1, tab2, tab0 co
34190 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r0..----..27 val
341a0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39  ues hashing to 9
341b0 66 63 31 64 63 64 37 36 66 65 61 66 34 33 65 35  fc1dcd76feaf43e5
341c0 63 35 64 63 30 36 30 61 30 32 30 31 34 63 64 0d  c5dc060a02014cd.
341d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
341e0 72 74 0d 0a 53 45 4c 45 43 54 20 37 31 20 2d 20  rt..SELECT 71 - 
341f0 2d 20 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d  - tab1.col1 FROM
34200 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 0d   tab1..----..81.
34210 0a 38 34 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79  .84..97....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 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32  CT col0 + + col2
34240 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   * col1 AS col1 
34250 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
34260 0a 31 33 32 0d 0a 32 38 36 32 0d 0a 37 35 35 31  .132..2862..7551
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 63 6f  ort..SELECT + co
34290 6c 30 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32  l0 + ( cor0.col2
342a0 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) * col1 FROM t
342b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
342c0 2d 0d 0a 31 33 32 38 0d 0a 31 34 30 37 0d 0a 36  -..1328..1407..6
342d0 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
342e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
342f0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
34300 35 38 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  58 FROM tab0 AS 
34310 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 0d  cor0..----..147.
34320 0a 38 32 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79  .82..93....query
34330 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34340 43 54 20 41 4c 4c 20 2d 20 38 34 20 46 52 4f 4d  CT ALL - 84 FROM
34350 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30   tab1, tab2 cor0
34360 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
34370 20 68 61 73 68 69 6e 67 20 74 6f 20 39 37 35 65   hashing to 975e
34380 32 65 66 32 61 33 62 66 31 65 65 32 36 32 32 33  2ef2a3bf1ee26223
34390 36 32 66 34 65 34 33 35 37 35 32 66 0d 0a 0d 0a  62f4e435752f....
343a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
343b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
343c0 20 2b 20 63 6f 6c 30 20 2b 20 38 20 41 53 20 63   + col0 + 8 AS c
343d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
343e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d   cor0..----..11.
343f0 0a 37 32 0d 0a 38 38 0d 0a 0d 0a 71 75 65 72 79  .72..88....query
34400 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34410 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20  CT ALL - + col2 
34420 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  * - col1 AS col0
34430 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
34440 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30  .----..1248..140
34450 34 0d 0a 35 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  4..570....onlyif
34460 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
34470 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
34480 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
34490 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
344a0 6c 61 62 65 6c 2d 31 34 33 35 0d 0a 53 45 4c 45  label-1435..SELE
344b0 43 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 32 20  CT - col0 DIV 2 
344c0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
344d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31  0..----..-12..-1
344e0 37 0d 0a 2d 34 34 0d 0a 0d 0a 73 6b 69 70 69 66  7..-44....skipif
344f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
34500 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
34510 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
34520 34 33 35 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  435..SELECT - co
34530 6c 30 20 2f 20 32 20 46 52 4f 4d 20 74 61 62 30  l0 / 2 FROM tab0
34540 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34550 2d 31 32 0d 0a 2d 31 37 0d 0a 2d 34 34 0d 0a 0d  -12..-17..-44...
34560 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
34570 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
34580 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
34590 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
345a0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
345b0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 36 0d 0a  ort label-1436..
345c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
345d0 2d 20 2d 20 63 6f 6c 32 20 2b 20 43 41 53 54 28  - - col2 + CAST(
345e0 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20   col1 AS SIGNED 
345f0 29 20 2a 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52  ) * col2 col0 FR
34600 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
34610 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35 34 34 0d 0a  --..2871..7544..
34620 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  98....skipif pos
34630 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
34640 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
34650 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
34660 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
34670 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
34680 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
34690 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
346a0 62 65 6c 2d 31 34 33 36 0d 0a 53 45 4c 45 43 54  bel-1436..SELECT
346b0 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
346c0 6c 32 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 31  l2 + CAST ( col1
346d0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
346e0 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
346f0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
34700 32 38 37 31 0d 0a 37 35 34 34 0d 0a 39 38 0d 0a  2871..7544..98..
34710 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
34720 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
34730 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34740 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
34750 31 20 2a 20 43 41 53 54 20 28 20 2b 20 63 6f 6c  1 * CAST ( + col
34760 32 20 41 53 20 52 45 41 4c 20 29 20 41 53 20 63  2 AS REAL ) AS c
34770 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
34780 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
34790 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a  34..-646..-837..
347a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
347b0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
347c0 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20   + ( - col1 ) * 
347d0 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
347e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
347f0 32 37 32 0d 0a 33 34 32 32 0d 0a 39 33 30 0d 0a  272..3422..930..
34800 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34810 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
34820 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  CT + - cor0.col2
34830 20 2a 20 35 33 20 2b 20 63 6f 6c 32 20 41 53 20   * 53 + col2 AS 
34840 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
34850 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
34860 38 30 38 0d 0a 2d 32 39 36 34 0d 0a 2d 34 39 39  808..-2964..-499
34870 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
34880 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
34890 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
348a0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
348b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
348c0 2d 31 34 34 30 0d 0a 53 45 4c 45 43 54 20 41 4c  -1440..SELECT AL
348d0 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49  L - cor0.col2 DI
348e0 56 20 2b 20 35 20 46 52 4f 4d 20 74 61 62 31 20  V + 5 FROM tab1 
348f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d  cor0..----..-10.
34900 0a 2d 31 31 0d 0a 2d 31 39 0d 0a 0d 0a 73 6b 69  .-11..-19....ski
34910 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
34920 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
34930 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
34940 6c 2d 31 34 34 30 0d 0a 53 45 4c 45 43 54 20 41  l-1440..SELECT A
34950 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2f  LL - cor0.col2 /
34960 20 2b 20 35 20 46 52 4f 4d 20 74 61 62 31 20 63   + 5 FROM tab1 c
34970 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a  or0..----..-10..
34980 2d 31 31 0d 0a 2d 31 39 0d 0a 0d 0a 6f 6e 6c 79  -11..-19....only
34990 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
349a0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
349b0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
349c0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
349d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
349e0 61 62 65 6c 2d 31 34 34 31 0d 0a 53 45 4c 45 43  abel-1441..SELEC
349f0 54 20 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 4e  T col1 * CAST( N
34a00 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
34a10 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
34a20 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
34a30 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
34a40 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
34a50 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
34a60 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
34a70 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34 31 0d 0a  ort label-1441..
34a80 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 43 41  SELECT col1 * CA
34a90 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
34aa0 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46  EGER ) AS col2 F
34ab0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
34ac0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
34ad0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
34ae0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34af0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
34b00 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 28 20 2b  ol0 + col0 * ( +
34b10 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
34b20 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
34b30 0a 32 30 34 30 0d 0a 33 33 36 30 0d 0a 38 30 31  .2040..3360..801
34b40 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
34b50 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
34b60 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
34b70 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
34b80 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
34b90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34ba0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b  ELECT + - col2 +
34bb0 20 28 20 31 39 20 29 20 2a 20 2d 20 63 6f 6c 32   ( 19 ) * - col2
34bc0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
34bd0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
34be0 31 30 38 30 0d 0a 2d 31 31 34 30 0d 0a 2d 31 39  1080..-1140..-19
34bf0 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  20....skipif pos
34c00 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
34c10 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
34c20 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
34c30 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
34c40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34c50 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
34c60 63 6f 6c 31 20 2a 20 2b 20 32 37 20 63 6f 6c 30  col1 * + 27 col0
34c70 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
34c80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 33 0d 0a  r0..----..1593..
34c90 34 35 39 0d 0a 38 33 37 0d 0a 0d 0a 6f 6e 6c 79  459..837....only
34ca0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
34cb0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
34cc0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
34cd0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
34ce0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
34cf0 61 62 65 6c 2d 31 34 34 35 0d 0a 53 45 4c 45 43  abel-1445..SELEC
34d00 54 20 2d 20 43 41 53 54 28 20 2b 20 28 20 2d 20  T - CAST( + ( - 
34d10 63 6f 6c 30 20 29 20 41 53 20 53 49 47 4e 45 44  col0 ) AS SIGNED
34d20 20 29 20 2b 20 31 37 20 46 52 4f 4d 20 74 61 62   ) + 17 FROM tab
34d30 31 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 38 31 0d  1..----..20..81.
34d40 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .97....skipif my
34d50 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
34d60 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
34d70 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34 35  wsort label-1445
34d80 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20  ..SELECT - CAST 
34d90 28 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 41  ( + ( - col0 ) A
34da0 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 31 37  S INTEGER ) + 17
34db0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
34dc0 0d 0a 32 30 0d 0a 38 31 0d 0a 39 37 0d 0a 0d 0a  ..20..81..97....
34dd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34de0 0a 53 45 4c 45 43 54 20 2b 20 36 39 20 2a 20 63  .SELECT + 69 * c
34df0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20  ol1 + + col0 AS 
34e00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
34e10 2d 2d 2d 2d 0d 0a 31 32 35 32 0d 0a 32 31 34 36  ----..1252..2146
34e20 0d 0a 34 31 34 39 0d 0a 0d 0a 71 75 65 72 79 20  ..4149....query 
34e30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34e40 54 20 44 49 53 54 49 4e 43 54 20 38 33 20 41 53  T DISTINCT 83 AS
34e50 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
34e60 0a 2d 2d 2d 2d 0d 0a 38 33 0d 0a 0d 0a 71 75 65  .----..83....que
34e70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34e80 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  LECT - col0 + - 
34e90 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab0.col1 AS col
34ea0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
34eb0 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 33 32 0d 0a 2d  -..-110..-132..-
34ec0 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  180....query I r
34ed0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
34ee0 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  LL + col2 * + co
34ef0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
34f00 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
34f10 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30  .1248..1404..570
34f20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34f30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
34f40 2d 20 28 20 33 32 20 29 20 2a 20 74 61 62 31 2e  - ( 32 ) * tab1.
34f50 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
34f60 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab1..----..-2
34f70 30 34 38 0d 0a 2d 32 35 36 30 0d 0a 2d 39 36 0d  048..-2560..-96.
34f80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34f90 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 39  rt..SELECT + ( 9
34fa0 32 20 29 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f  2 ) + + col2 FRO
34fb0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab2..----..11
34fc0 38 0d 0a 31 31 39 0d 0a 31 33 30 0d 0a 0d 0a 73  8..119..130....s
34fd0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
34fe0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
34ff0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
35000 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
35010 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
35020 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35030 63 6f 6c 31 20 2a 20 28 20 2b 20 63 6f 6c 30 20  col1 * ( + col0 
35040 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  ) col1 FROM tab1
35050 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34  ..----..1040..64
35060 30 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  0..78....skipif 
35070 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
35080 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
35090 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
350a0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
350b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
350c0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 36 20 63  t..SELECT + 36 c
350d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
350e0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
350f0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
35100 69 6e 67 20 74 6f 20 65 65 65 39 36 61 38 35 35  ing to eee96a855
35110 31 39 66 39 32 38 35 36 61 37 35 30 30 64 63 38  19f92856a7500dc8
35120 62 36 63 66 37 35 32 0d 0a 0d 0a 71 75 65 72 79  b6cf752....query
35130 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35140 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
35150 74 61 62 30 2e 63 6f 6c 31 20 29 20 2a 20 2b 20  tab0.col1 ) * + 
35160 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
35170 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33  ----..-2064..-33
35180 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 6f 6e 6c  95..-8099....onl
35190 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
351a0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
351b0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
351c0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
351d0 72 74 20 6c 61 62 65 6c 2d 31 34 35 35 0d 0a 53  rt label-1455..S
351e0 45 4c 45 43 54 20 2b 20 28 20 2d 20 74 61 62 31  ELECT + ( - tab1
351f0 2e 63 6f 6c 30 20 29 20 44 49 56 20 2d 20 63 6f  .col0 ) DIV - co
35200 6c 32 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 46  l2 + tab1.col1 F
35210 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
35220 31 31 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 73 6b  11..13..26....sk
35230 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
35240 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
35250 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
35260 65 6c 2d 31 34 35 35 0d 0a 53 45 4c 45 43 54 20  el-1455..SELECT 
35270 2b 20 28 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  + ( - tab1.col0 
35280 29 20 2f 20 2d 20 63 6f 6c 32 20 2b 20 74 61 62  ) / - col2 + tab
35290 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  1.col1 FROM tab1
352a0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 33 0d 0a  ..----..11..13..
352b0 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  26....onlyif mys
352c0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
352d0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
352e0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
352f0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
35300 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
35310 34 35 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  456..SELECT DIST
35320 49 4e 43 54 20 37 31 20 2a 20 2d 20 63 6f 6c 32  INCT 71 * - col2
35330 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   + + CAST( NULL 
35340 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
35350 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
35360 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
35370 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
35380 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
35390 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
353a0 20 6c 61 62 65 6c 2d 31 34 35 36 0d 0a 53 45 4c   label-1456..SEL
353b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 37 31 20  ECT DISTINCT 71 
353c0 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 43 41 53  * - col2 + + CAS
353d0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
353e0 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52  GER ) AS col1 FR
353f0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
35400 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  --..NULL....quer
35410 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35420 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
35430 20 63 6f 6c 30 20 2a 20 2b 20 32 35 20 41 53 20   col0 * + 25 AS 
35440 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
35450 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
35460 36 34 0d 0a 32 30 38 30 0d 0a 37 38 0d 0a 0d 0a  64..2080..78....
35470 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
35480 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
35490 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
354a0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
354b0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
354c0 72 74 20 6c 61 62 65 6c 2d 31 34 35 38 0d 0a 53  rt label-1458..S
354d0 45 4c 45 43 54 20 41 4c 4c 20 33 37 20 2a 20 2d  ELECT ALL 37 * -
354e0 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 63 6f   col1 + CAST( co
354f0 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 53 49 47  l0 * col2 AS SIG
35500 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20  NED ) FROM tab2 
35510 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
35520 31 35 35 0d 0a 2d 39 35 38 0d 0a 32 33 37 33 0d  155..-958..2373.
35530 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
35540 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
35550 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35560 74 20 6c 61 62 65 6c 2d 31 34 35 38 0d 0a 53 45  t label-1458..SE
35570 4c 45 43 54 20 41 4c 4c 20 33 37 20 2a 20 2d 20  LECT ALL 37 * - 
35580 63 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 63 6f  col1 + CAST ( co
35590 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 49 4e 54  l0 * col2 AS INT
355a0 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32  EGER ) FROM tab2
355b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
355c0 2d 31 35 35 0d 0a 2d 39 35 38 0d 0a 32 33 37 33  -155..-958..2373
355d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
355e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
355f0 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  INCT cor0.col0 *
35600 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a   col1 + + col0 *
35610 20 2b 20 39 35 20 2a 20 63 6f 6c 32 20 46 52 4f   + 95 * col2 FRO
35620 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
35630 2d 2d 2d 2d 0d 0a 31 38 31 37 32 0d 0a 31 39 37  ----..18172..197
35640 32 36 32 0d 0a 32 38 36 35 33 33 0d 0a 0d 0a 6f  262..286533....o
35650 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
35660 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
35670 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
35680 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
35690 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 30 0d  sort label-1460.
356a0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 37 37 20 2a  .SELECT - - 77 *
356b0 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 31   col2 DIV - col1
356c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
356d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32  cor0..----..-172
356e0 0d 0a 2d 33 33 0d 0a 2d 36 37 0d 0a 0d 0a 73 6b  ..-33..-67....sk
356f0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
35700 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
35710 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
35720 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
35730 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
35740 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
35750 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
35760 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 30  wsort label-1460
35770 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 37 37 20  ..SELECT - - 77 
35780 2a 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20  * col2 / - col1 
35790 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
357a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32 0d  or0..----..-172.
357b0 0a 2d 33 33 0d 0a 2d 36 37 0d 0a 0d 0a 71 75 65  .-33..-67....que
357c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
357d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
357e0 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  l0 + col1 * - co
357f0 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l1 * + col0 FROM
35800 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
35810 2d 2d 2d 0d 0a 2d 32 32 37 35 32 0d 0a 2d 32 37  ---..-22752..-27
35820 31 34 34 30 0d 0a 2d 36 37 32 30 0d 0a 0d 0a 6f  1440..-6720....o
35830 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
35840 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
35850 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
35860 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
35870 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 32 0d  sort label-1462.
35880 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
35890 2d 20 63 6f 6c 32 20 29 20 44 49 56 20 33 33 20  - col2 ) DIV 33 
358a0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
358b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
358c0 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  .-1..0..0....ski
358d0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
358e0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
358f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
35900 6c 2d 31 34 36 32 0d 0a 53 45 4c 45 43 54 20 41  l-1462..SELECT A
35910 4c 4c 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20  LL + ( - col2 ) 
35920 2f 20 33 33 20 41 53 20 63 6f 6c 31 20 46 52 4f  / 33 AS col1 FRO
35930 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
35940 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a  ----..-1..0..0..
35950 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35960 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f  t..SELECT + ( co
35970 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 31 20 41 53  l1 ) + + col1 AS
35980 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
35990 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
359a0 30 0d 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 71 75 65  0..26..52....que
359b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
359c0 4c 45 43 54 20 2d 20 2b 20 36 35 20 2a 20 2d 20  LECT - + 65 * - 
359d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
359e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35  S cor0..----..35
359f0 31 30 0d 0a 33 37 30 35 0d 0a 36 32 34 30 0d 0a  10..3705..6240..
35a00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35a10 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
35a20 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41  .col1 + - col1 A
35a30 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
35a40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35a50 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
35a60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35a70 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 33 38  CT + + col0 * 38
35a80 20 2b 20 34 38 20 46 52 4f 4d 20 74 61 62 31 20   + 48 FROM tab1 
35a90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
35aa0 36 32 0d 0a 32 34 38 30 0d 0a 33 30 38 38 0d 0a  62..2480..3088..
35ab0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35ac0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
35ad0 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 39 30  CT - - col0 + 90
35ae0 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d   * cor0.col0 * -
35af0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
35b00 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
35b10 0a 2d 2d 2d 2d 0d 0a 2d 33 31 31 35 0d 0a 2d 36  .----..-3115..-6
35b20 35 36 37 33 31 0d 0a 2d 37 31 32 35 36 0d 0a 0d  56731..-71256...
35b30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35b40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
35b50 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 63   col1 * col2 + c
35b60 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  or0.col2 AS col2
35b70 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
35b80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d 0a  r0..----..2871..
35b90 37 35 34 34 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72  7544..98....quer
35ba0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35bb0 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30  ECT ALL + + col0
35bc0 20 2b 20 34 20 46 52 4f 4d 20 74 61 62 30 20 41   + 4 FROM tab0 A
35bd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  S cor0..----..28
35be0 0d 0a 33 39 0d 0a 39 33 0d 0a 0d 0a 73 6b 69 70  ..39..93....skip
35bf0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
35c00 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
35c10 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
35c20 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
35c30 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
35c40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
35c50 30 20 2b 20 37 30 20 63 6f 6c 30 20 46 52 4f 4d  0 + 70 col0 FROM
35c60 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
35c70 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 35 39 0d 0a 39  ---..105..159..9
35c80 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
35c90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
35ca0 20 63 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 32   col1 + ( + col2
35cb0 20 29 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2b 20   ) * - col0 * + 
35cc0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
35cd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
35ce0 33 35 34 0d 0a 2d 31 35 38 32 34 33 0d 0a 2d 32  354..-158243..-2
35cf0 33 37 31 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  37175....query I
35d00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35d10 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2d 20   ALL - + col1 - 
35d20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
35d30 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
35d40 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 0d 0a 2d 33  ..----..-118..-3
35d50 34 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72 79 20  4..-62....query 
35d60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35d70 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 39 37 20  T ALL col2 + 97 
35d80 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
35d90 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a 31 37  0..----..130..17
35da0 39 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  9..98....query I
35db0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35dc0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b   DISTINCT col2 +
35dd0 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63   ( + col1 ) AS c
35de0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
35df0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d   cor0..----..55.
35e00 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 6f 6e 6c 79 69  .58..85....onlyi
35e10 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
35e20 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
35e30 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
35e40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35e50 20 6c 61 62 65 6c 2d 31 34 37 35 0d 0a 53 45 4c   label-1475..SEL
35e60 45 43 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 63  ECT - col0 DIV c
35e70 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d  ol2 + - col0 * -
35e80 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
35e90 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
35ea0 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 36 30 0d 0a  --..2064..3360..
35eb0 38 30 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  8098....skipif m
35ec0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
35ed0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
35ee0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37  owsort label-147
35ef0 35 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  5..SELECT - col0
35f00 20 2f 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30   / col2 + - col0
35f10 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * - cor0.col1 F
35f20 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
35f30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33  ..----..2064..33
35f40 36 30 0d 0a 38 30 39 38 0d 0a 0d 0a 71 75 65 72  60..8098....quer
35f50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35f60 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
35f70 20 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d   ( - col1 ) FROM
35f80 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
35f90 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
35fa0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
35fb0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
35fc0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
35fd0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
35fe0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
35ff0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36000 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2d 20 63   col1 * col0 - c
36010 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c  ol0 * + col0 col
36020 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
36030 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 35 36  or0..----..-3456
36040 0d 0a 2d 35 33 36 30 0d 0a 36 39 0d 0a 0d 0a 71  ..-5360..69....q
36050 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36060 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
36070 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20 37 30  cor0.col1 + ( 70
36080 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
36090 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 30 0d 0a  cor0..----..80..
360a0 38 33 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  83..96....onlyif
360b0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
360c0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
360d0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
360e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
360f0 6c 61 62 65 6c 2d 31 34 37 39 0d 0a 53 45 4c 45  label-1479..SELE
36100 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 63 6f  CT DISTINCT ( co
36110 6c 30 20 29 20 44 49 56 20 2d 20 63 6f 6c 31 20  l0 ) DIV - col1 
36120 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
36130 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 34 0d  0..----..-1..-4.
36140 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
36150 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
36160 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
36170 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 39 0d  sort label-1479.
36180 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
36190 20 28 20 63 6f 6c 30 20 29 20 2f 20 2d 20 63 6f   ( col0 ) / - co
361a0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
361b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
361c0 2d 34 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -4..0....skipif 
361d0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
361e0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
361f0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
36200 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
36210 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36220 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
36230 31 34 20 2b 20 2b 20 31 39 20 63 6f 6c 31 20 46  14 + + 19 col1 F
36240 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
36250 2d 2d 2d 0d 0a 33 33 0d 0a 33 33 0d 0a 33 33 0d  ---..33..33..33.
36260 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
36270 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 34  rt..SELECT - - 4
36280 37 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  7 * + cor0.col0 
36290 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
362a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
362b0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 34 0d 0a 31 37  ..----..1214..17
362c0 34 32 0d 0a 34 32 37 34 0d 0a 0d 0a 71 75 65 72  42..4274....quer
362d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
362e0 45 43 54 20 2b 20 28 20 2d 20 34 35 20 29 20 46  ECT + ( - 45 ) F
362f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
36300 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a 2d 34 35  ..----..-45..-45
36310 0d 0a 2d 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-45....query I
36320 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36330 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
36340 20 2d 20 2b 20 32 36 20 2a 20 63 6f 6c 32 20 46   - + 26 * col2 F
36350 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
36360 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 37 0d 0a 2d  ..----..-1067..-
36370 37 30 39 0d 0a 2d 37 35 34 0d 0a 0d 0a 71 75 65  709..-754....que
36380 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36390 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  LECT + col0 * + 
363a0 63 6f 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c 30  col2 * tab1.col0
363b0 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   - + col2 AS col
363c0 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
363d0 2d 0d 0a 32 33 33 34 31 35 0d 0a 34 33 32 0d 0a  -..233415..432..
363e0 36 31 34 33 30 34 0d 0a 0d 0a 71 75 65 72 79 20  614304....query 
363f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36400 54 20 44 49 53 54 49 4e 43 54 20 31 38 20 2a 20  T DISTINCT 18 * 
36410 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  - col2 FROM tab2
36420 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36430 2d 34 36 38 0d 0a 2d 34 38 36 0d 0a 2d 36 38 34  -468..-486..-684
36440 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36450 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
36460 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  l1 + + col2 * - 
36470 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
36480 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 35  or0..----..-1475
36490 0d 0a 2d 36 32 39 0d 0a 2d 38 30 36 0d 0a 0d 0a  ..-629..-806....
364a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
364b0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
364c0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
364d0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
364e0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
364f0 72 74 20 6c 61 62 65 6c 2d 31 34 38 37 0d 0a 53  rt label-1487..S
36500 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 43 41  ELECT ALL + - CA
36510 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
36520 45 44 20 29 20 2a 20 2b 20 63 6f 6c 30 20 63 6f  ED ) * + col0 co
36530 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
36540 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
36550 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
36560 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
36570 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
36580 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
36590 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
365a0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
365b0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
365c0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
365d0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 37 0d  sort label-1487.
365e0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
365f0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
36600 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c  NTEGER ) * + col
36610 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0 col1 FROM tab0
36620 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
36630 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
36640 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36650 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 32 20  ..SELECT ( col2 
36660 29 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  ) * - col0 AS co
36670 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
36680 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d  cor0..----..-35.
36690 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a  .-7298..-792....
366a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
366b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 30 20 2a  .SELECT ALL 60 *
366c0 20 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab1.col1 FROM 
366d0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30  tab1..----..1560
366e0 0d 0a 36 30 30 0d 0a 37 38 30 0d 0a 0d 0a 6f 6e  ..600..780....on
366f0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
36700 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
36710 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
36720 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
36730 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36740 20 6c 61 62 65 6c 2d 31 34 39 30 0d 0a 53 45 4c   label-1490..SEL
36750 45 43 54 20 41 4c 4c 20 2d 20 2d 20 43 41 53 54  ECT ALL - - CAST
36760 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  ( col1 AS SIGNED
36770 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) + col1 FROM t
36780 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
36790 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a 36 32 0d 0a  -..118..34..62..
367a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
367b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
367c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
367d0 20 6c 61 62 65 6c 2d 31 34 39 30 0d 0a 53 45 4c   label-1490..SEL
367e0 45 43 54 20 41 4c 4c 20 2d 20 2d 20 43 41 53 54  ECT ALL - - CAST
367f0 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   ( col1 AS INTEG
36800 45 52 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  ER ) + col1 FROM
36810 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
36820 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a 36 32  ---..118..34..62
36830 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36840 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
36850 34 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  40 * col2 AS col
36860 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
36870 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 30  or0..----..-1320
36880 0d 0a 2d 33 32 38 30 0d 0a 2d 34 30 0d 0a 0d 0a  ..-3280..-40....
36890 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
368a0 0a 53 45 4c 45 43 54 20 33 20 2b 20 33 38 20 41  .SELECT 3 + 38 A
368b0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
368c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
368d0 34 31 0d 0a 34 31 0d 0a 34 31 0d 0a 0d 0a 71 75  41..41..41....qu
368e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
368f0 45 4c 45 43 54 20 2d 20 2d 20 31 31 20 2d 20 63  ELECT - - 11 - c
36900 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
36910 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
36920 0d 0a 2d 32 34 0d 0a 2d 37 38 0d 0a 0d 0a 71 75  ..-24..-78....qu
36930 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36940 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2d  ELECT - - col2 -
36950 20 2d 20 31 36 20 41 53 20 63 6f 6c 30 20 46 52   - 16 AS col0 FR
36960 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
36970 0a 2d 2d 2d 2d 0d 0a 31 31 32 0d 0a 37 30 0d 0a  .----..112..70..
36980 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  73....query I ro
36990 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
369a0 36 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  60 + + col2 FROM
369b0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
369c0 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 0d 0a 33 36 0d  ---..-3..-6..36.
369d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
369e0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 35  rt..SELECT - - 5
369f0 35 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  5 * + col0 FROM 
36a00 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
36a10 2d 2d 0d 0a 31 33 32 30 0d 0a 31 39 32 35 0d 0a  --..1320..1925..
36a20 34 38 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4895....query I 
36a30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36a40 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col0 + - col0 * 
36a50 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
36a60 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
36a70 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 34 30 0d 0a 2d  ..----..-2040..-
36a80 33 33 36 30 0d 0a 2d 38 30 31 30 0d 0a 0d 0a 71  3360..-8010....q
36a90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36aa0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
36ab0 31 37 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  17 FROM tab0, ta
36ac0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36ad0 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..17....query I 
36ae0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36af0 39 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  94 AS col2 FROM 
36b00 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
36b10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
36b20 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 30  es hashing to b0
36b30 66 66 62 37 35 32 37 66 34 66 62 66 34 34 66 33  ffb7527f4fbf44f3
36b40 30 39 34 35 65 31 63 63 62 35 38 63 32 34 0d 0a  0945e1ccb58c24..
36b50 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
36b60 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
36b70 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
36b80 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
36b90 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
36ba0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36bb0 43 54 20 37 35 20 63 6f 6c 30 20 46 52 4f 4d 20  CT 75 col0 FROM 
36bc0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 37 35 0d 0a  tab1..----..75..
36bd0 37 35 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20  75..75....query 
36be0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36bf0 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 38 33 20  T - col1 + - 83 
36c00 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * + col2 AS col2
36c10 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
36c20 0d 0a 2d 31 38 30 0d 0a 2d 32 38 32 35 0d 0a 2d  ..-180..-2825..-
36c30 36 38 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  6897....onlyif m
36c40 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
36c50 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
36c60 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
36c70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
36c80 62 65 6c 2d 31 35 30 32 0d 0a 53 45 4c 45 43 54  bel-1502..SELECT
36c90 20 41 4c 4c 20 2d 20 32 37 20 44 49 56 20 38 37   ALL - 27 DIV 87
36ca0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
36cb0 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
36cc0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
36cd0 20 68 61 73 68 69 6e 67 20 74 6f 20 38 62 37 35   hashing to 8b75
36ce0 31 33 36 62 32 62 35 31 63 37 37 33 34 35 63 30  136b2b51c77345c0
36cf0 33 38 30 34 65 63 31 63 64 61 35 63 0d 0a 0d 0a  3804ec1cda5c....
36d00 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
36d10 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
36d20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
36d30 61 62 65 6c 2d 31 35 30 32 0d 0a 53 45 4c 45 43  abel-1502..SELEC
36d40 54 20 41 4c 4c 20 2d 20 32 37 20 2f 20 38 37 20  T ALL - 27 / 87 
36d50 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
36d60 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  0, tab2 AS cor0.
36d70 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
36d80 68 61 73 68 69 6e 67 20 74 6f 20 38 62 37 35 31  hashing to 8b751
36d90 33 36 62 32 62 35 31 63 37 37 33 34 35 63 30 33  36b2b51c77345c03
36da0 38 30 34 65 63 31 63 64 61 35 63 0d 0a 0d 0a 6f  804ec1cda5c....o
36db0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
36dc0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
36dd0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
36de0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
36df0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 33 0d  sort label-1503.
36e00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
36e10 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f   - col0 DIV + co
36e20 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l0 + - col0 FROM
36e30 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35   tab0..----..-25
36e40 0d 0a 2d 33 36 0d 0a 2d 39 30 0d 0a 0d 0a 73 6b  ..-36..-90....sk
36e50 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
36e60 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
36e70 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
36e80 65 6c 2d 31 35 30 33 0d 0a 53 45 4c 45 43 54 20  el-1503..SELECT 
36e90 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
36ea0 2f 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  / + col0 + - col
36eb0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
36ec0 2d 0d 0a 2d 32 35 0d 0a 2d 33 36 0d 0a 2d 39 30  -..-25..-36..-90
36ed0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36ee0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
36ef0 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 36 34  col0 * col2 + 64
36f00 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
36f10 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 32 0d 0a  b2..----..2092..
36f20 32 35 33 0d 0a 33 30 36 36 0d 0a 0d 0a 6f 6e 6c  253..3066....onl
36f30 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
36f40 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
36f50 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
36f60 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
36f70 72 74 20 6c 61 62 65 6c 2d 31 35 30 35 0d 0a 53  rt label-1505..S
36f80 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
36f90 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f   + col2 DIV - co
36fa0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
36fb0 2d 2d 0d 0a 38 35 0d 0a 39 31 0d 0a 39 37 0d 0a  --..85..91..97..
36fc0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
36fd0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
36fe0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36ff0 20 6c 61 62 65 6c 2d 31 35 30 35 0d 0a 53 45 4c   label-1505..SEL
37000 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
37010 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 46   col2 / - col0 F
37020 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
37030 38 35 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75  85..91..97....qu
37040 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37050 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b  ELECT - + col2 +
37060 20 2d 20 36 31 20 2d 20 63 6f 6c 32 20 46 52 4f   - 61 - col2 FRO
37070 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
37080 2d 2d 2d 2d 0d 0a 2d 31 36 39 0d 0a 2d 31 37 35  ----..-169..-175
37090 0d 0a 2d 32 35 33 0d 0a 0d 0a 71 75 65 72 79 20  ..-253....query 
370a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
370b0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
370c0 30 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29  0 + + ( - col0 )
370d0 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   * col1 AS col0 
370e0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
370f0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 34 30 0d 0a  0..----..-2040..
37100 2d 33 33 36 30 0d 0a 2d 38 30 31 30 0d 0a 0d 0a  -3360..-8010....
37110 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
37120 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
37130 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
37140 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
37150 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 38  wsort label-1508
37160 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
37170 54 20 63 6f 6c 31 20 44 49 56 20 2b 20 33 36 20  T col1 DIV + 36 
37180 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
37190 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d  0..----..0..1...
371a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
371b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
371c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
371d0 6c 61 62 65 6c 2d 31 35 30 38 0d 0a 53 45 4c 45  label-1508..SELE
371e0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
371f0 20 2f 20 2b 20 33 36 20 46 52 4f 4d 20 74 61 62   / + 36 FROM tab
37200 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
37210 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..1....query I
37220 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37230 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 28 20 63 6f   + + col2 * ( co
37240 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 29 20 46 52  l0 * + col1 ) FR
37250 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
37260 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30 0d 0a 34 32  .----..36480..42
37270 31 32 0d 0a 39 39 38 34 30 0d 0a 0d 0a 71 75 65  12..99840....que
37280 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37290 4c 45 43 54 20 41 4c 4c 20 31 34 20 2a 20 2d 20  LECT ALL 14 * - 
372a0 38 37 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  87 + - cor0.col0
372b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
372c0 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
372d0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
372e0 20 68 61 73 68 69 6e 67 20 74 6f 20 38 34 66 36   hashing to 84f6
372f0 37 34 63 35 66 66 62 36 35 30 37 64 35 34 35 61  74c5ffb6507d545a
37300 61 35 37 38 38 35 64 34 62 63 38 30 0d 0a 0d 0a  a57885d4bc80....
37310 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
37320 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
37330 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
37340 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
37350 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 31 31  wsort label-1511
37360 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
37370 31 20 2b 20 37 38 20 44 49 56 20 2d 20 63 6f 6c  1 + 78 DIV - col
37380 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0 col2 FROM tab2
37390 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
373a0 31 37 0d 0a 32 30 0d 0a 35 38 0d 0a 0d 0a 73 6b  17..20..58....sk
373b0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
373c0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
373d0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
373e0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
373f0 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
37400 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
37410 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
37420 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 31 31  wsort label-1511
37430 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
37440 31 20 2b 20 37 38 20 2f 20 2d 20 63 6f 6c 30 20  1 + 78 / - col0 
37450 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
37460 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
37470 0d 0a 32 30 0d 0a 35 38 0d 0a 0d 0a 71 75 65 72  ..20..58....quer
37480 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37490 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74  ECT DISTINCT - t
374a0 61 62 31 2e 63 6f 6c 32 20 2a 20 2d 20 28 20 2d  ab1.col2 * - ( -
374b0 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62   col0 ) FROM tab
374c0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d  1..----..-162..-
374d0 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71  3648..-7680....q
374e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
374f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
37500 2d 20 37 34 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 74 AS col1 FRO
37510 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
37520 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d  cor0, tab2 cor1.
37530 0a 2d 2d 2d 2d 0d 0a 2d 37 34 0d 0a 0d 0a 71 75  .----..-74....qu
37540 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37550 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d  ELECT + col0 * -
37560 20 63 6f 6c 32 20 2b 20 38 38 20 41 53 20 63 6f   col2 + 88 AS co
37570 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
37580 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 36  cor0..----..-356
37590 30 0d 0a 2d 37 34 0d 0a 2d 37 35 39 32 0d 0a 0d  0..-74..-7592...
375a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
375b0 0d 0a 53 45 4c 45 43 54 20 30 20 41 53 20 63 6f  ..SELECT 0 AS co
375c0 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l0 FROM tab2, ta
375d0 62 32 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  b2 cor0, tab2 AS
375e0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
375f0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
37600 6f 20 65 32 35 36 38 62 30 31 64 64 34 31 31 62  o e2568b01dd411b
37610 35 61 32 30 36 30 36 38 36 39 37 64 30 65 64 30  5a206068697d0ed0
37620 64 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  d2....query I ro
37630 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
37640 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20  L col1 * col0 * 
37650 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  + col0 + - col0 
37660 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
37670 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 31 0d 0a 34 30  1..----..231..40
37680 38 39 36 0d 0a 38 33 31 32 30 0d 0a 0d 0a 6f 6e  896..83120....on
37690 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
376a0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
376b0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
376c0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
376d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
376e0 20 6c 61 62 65 6c 2d 31 35 31 37 0d 0a 53 45 4c   label-1517..SEL
376f0 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 43 41 53  ECT + col1 + CAS
37700 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
37710 44 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  D ) * + col1 AS 
37720 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
37730 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
37740 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
37750 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
37760 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
37770 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37780 62 65 6c 2d 31 35 31 37 0d 0a 53 45 4c 45 43 54  bel-1517..SELECT
37790 20 2b 20 63 6f 6c 31 20 2b 20 43 41 53 54 20 28   + col1 + CAST (
377a0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
377b0 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63   ) * + col1 AS c
377c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
377d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
377e0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
377f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37800 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 39  ELECT + col1 + 9
37810 37 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  7 * col2 * + col
37820 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
37830 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 34 30  or0..----..15740
37840 0d 0a 33 35 33 38 36 36 0d 0a 37 34 34 39 37 33  ..353866..744973
37850 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
37860 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
37870 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
37880 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
37890 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
378a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
378b0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20  LECT - col0 + + 
378c0 34 35 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  45 col2 FROM tab
378d0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
378e0 0a 2d 31 39 0d 0a 2d 33 35 0d 0a 34 32 0d 0a 0d  .-19..-35..42...
378f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37900 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
37910 2a 20 2d 20 39 36 20 46 52 4f 4d 20 74 61 62 31  * - 96 FROM tab1
37920 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31   cor0..----..-51
37930 38 34 0d 0a 2d 35 34 37 32 0d 0a 2d 39 32 31 36  84..-5472..-9216
37940 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37950 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
37960 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r1.col1 FROM tab
37970 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  1, tab0 AS cor0,
37980 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab1 cor1..----
37990 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
379a0 69 6e 67 20 74 6f 20 63 37 38 39 30 34 36 39 65  ing to c7890469e
379b0 61 62 62 32 63 36 66 63 38 31 34 35 34 62 33 35  abb2c6fc81454b35
379c0 64 32 33 33 33 62 36 0d 0a 0d 0a 71 75 65 72 79  d2333b6....query
379d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
379e0 43 54 20 28 20 74 61 62 30 2e 63 6f 6c 31 20 29  CT ( tab0.col1 )
379f0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
37a00 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31  b0..----..86..91
37a10 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
37a20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37a30 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  - col2 * cor0.co
37a40 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63  l1 + - col2 AS c
37a50 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
37a60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
37a70 36 30 0d 0a 2d 36 38 34 0d 0a 2d 38 36 34 0d 0a  60..-684..-864..
37a80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37a90 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 39 38  t..SELECT + + 98
37aa0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
37ab0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
37ac0 0d 0a 39 38 0d 0a 39 38 0d 0a 39 38 0d 0a 0d 0a  ..98..98..98....
37ad0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
37ae0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
37af0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
37b00 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
37b10 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
37b20 72 74 20 6c 61 62 65 6c 2d 31 35 32 35 0d 0a 53  rt label-1525..S
37b30 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c  ELECT CAST( NULL
37b40 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 28   AS SIGNED ) + (
37b50 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   + col2 ) AS col
37b60 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
37b70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
37b80 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
37b90 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
37ba0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
37bb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37bc0 62 65 6c 2d 31 35 32 35 0d 0a 53 45 4c 45 43 54  bel-1525..SELECT
37bd0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
37be0 49 4e 54 45 47 45 52 20 29 20 2b 20 28 20 2b 20  INTEGER ) + ( + 
37bf0 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46  col2 ) AS col0 F
37c00 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
37c10 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
37c20 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
37c30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37c40 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29  ECT + ( + col1 )
37c50 20 2b 20 2d 20 35 38 20 46 52 4f 4d 20 74 61 62   + - 58 FROM tab
37c60 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
37c70 0a 32 38 0d 0a 33 33 0d 0a 33 39 0d 0a 0d 0a 6f  .28..33..39....o
37c80 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
37c90 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
37ca0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
37cb0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
37cc0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 32 37 0d  sort label-1527.
37cd0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
37ce0 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f   + - col1 DIV co
37cf0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
37d00 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
37d10 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 39 37 0d  --..-1..-2..-97.
37d20 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
37d30 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
37d40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37d50 74 20 6c 61 62 65 6c 2d 31 35 32 37 0d 0a 53 45  t label-1527..SE
37d60 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
37d70 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 41 53  - col1 / col2 AS
37d80 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
37d90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
37da0 31 0d 0a 2d 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75  1..-2..-97....qu
37db0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37dc0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
37dd0 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a   - col0 + col2 *
37de0 20 28 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f   ( - ( + cor0.co
37df0 6c 30 20 29 20 29 20 46 52 4f 4d 20 74 61 62 32  l0 ) ) FROM tab2
37e00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37e10 2d 31 39 36 0d 0a 2d 32 31 30 36 0d 0a 2d 33 30  -196..-2106..-30
37e20 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
37e30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
37e40 4c 20 63 6f 6c 32 20 2d 20 63 6f 72 30 2e 63 6f  L col2 - cor0.co
37e50 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
37e60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a  cor0..----..-7..
37e70 31 36 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20  16..51....query 
37e80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37e90 54 20 31 36 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  T 16 - col0 * co
37ea0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
37eb0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
37ec0 2d 2d 0d 0a 2d 31 34 36 0d 0a 2d 33 36 33 32 0d  --..-146..-3632.
37ed0 0a 2d 37 36 36 34 0d 0a 0d 0a 71 75 65 72 79 20  .-7664....query 
37ee0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37ef0 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d 20  T col0 * col0 - 
37f00 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  - cor0.col0 AS c
37f10 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
37f20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d   cor0..----..12.
37f30 0a 34 31 36 30 0d 0a 36 34 38 30 0d 0a 0d 0a 73  .4160..6480....s
37f40 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
37f50 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
37f60 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
37f70 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
37f80 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
37f90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37fa0 41 4c 4c 20 2d 20 2d 20 36 38 20 63 6f 6c 32 20  ALL - - 68 col2 
37fb0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
37fc0 30 0d 0a 2d 2d 2d 2d 0d 0a 36 38 0d 0a 36 38 0d  0..----..68..68.
37fd0 0a 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .68....query I r
37fe0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
37ff0 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   - col2 * + col1
38000 20 2a 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63   * ( col2 ) AS c
38010 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
38020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31 31 38 38  r0..----..-61188
38030 34 0d 0a 2d 39 33 36 35 34 0d 0a 2d 39 37 0d 0a  4..-93654..-97..
38040 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
38050 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
38060 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
38070 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
38080 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
38090 33 34 0d 0a 53 45 4c 45 43 54 20 2d 20 35 36 20  34..SELECT - 56 
380a0 2b 20 36 30 20 44 49 56 20 63 6f 72 30 2e 63 6f  + 60 DIV cor0.co
380b0 6c 32 20 2b 20 2b 20 36 20 41 53 20 63 6f 6c 31  l2 + + 6 AS col1
380c0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
380d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
380e0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
380f0 20 74 6f 20 62 36 64 65 64 38 65 61 38 65 39 32   to b6ded8ea8e92
38100 66 35 31 66 34 35 39 32 30 64 38 62 35 37 39 64  f51f45920d8b579d
38110 33 65 34 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  3e48....skipif m
38120 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
38130 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
38140 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33  owsort label-153
38150 34 0d 0a 53 45 4c 45 43 54 20 2d 20 35 36 20 2b  4..SELECT - 56 +
38160 20 36 30 20 2f 20 63 6f 72 30 2e 63 6f 6c 32 20   60 / cor0.col2 
38170 2b 20 2b 20 36 20 41 53 20 63 6f 6c 31 20 46 52  + + 6 AS col1 FR
38180 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
38190 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
381a0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
381b0 20 62 36 64 65 64 38 65 61 38 65 39 32 66 35 31   b6ded8ea8e92f51
381c0 66 34 35 39 32 30 64 38 62 35 37 39 64 33 65 34  f45920d8b579d3e4
381d0 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
381e0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
381f0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
38200 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
38210 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
38220 2d 31 35 33 35 0d 0a 53 45 4c 45 43 54 20 44 49  -1535..SELECT DI
38230 53 54 49 4e 43 54 20 2b 20 38 20 44 49 56 20 2d  STINCT + 8 DIV -
38240 20 63 6f 6c 30 20 2d 20 2b 20 31 33 20 44 49 56   col0 - + 13 DIV
38250 20 2d 20 28 20 2b 20 63 6f 6c 31 20 2a 20 28 20   - ( + col1 * ( 
38260 2b 20 34 38 20 29 20 2b 20 2d 20 63 6f 6c 32 20  + 48 ) + - col2 
38270 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
38280 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
38290 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
382a0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
382b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
382c0 61 62 65 6c 2d 31 35 33 35 0d 0a 53 45 4c 45 43  abel-1535..SELEC
382d0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 38 20 2f  T DISTINCT + 8 /
382e0 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 31 33 20 2f   - col0 - + 13 /
382f0 20 2d 20 28 20 2b 20 63 6f 6c 31 20 2a 20 28 20   - ( + col1 * ( 
38300 2b 20 34 38 20 29 20 2b 20 2d 20 63 6f 6c 32 20  + 48 ) + - col2 
38310 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
38320 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
38330 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
38340 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
38350 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
38360 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
38370 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 36  wsort label-1536
38380 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
38390 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T + cor0.col2 * 
383a0 2b 20 63 6f 6c 32 20 2d 20 2d 20 28 20 2b 20 63  + col2 - - ( + c
383b0 6f 6c 30 20 29 20 44 49 56 20 63 6f 6c 31 20 46  ol0 ) DIV col1 F
383c0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
383d0 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 38 0d 0a 36 37  ..----..1448..67
383e0 37 0d 0a 37 32 39 0d 0a 0d 0a 73 6b 69 70 69 66  7..729....skipif
383f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
38400 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
38410 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
38420 35 33 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  536..SELECT DIST
38430 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  INCT + cor0.col2
38440 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 28 20   * + col2 - - ( 
38450 2b 20 63 6f 6c 30 20 29 20 2f 20 63 6f 6c 31 20  + col0 ) / col1 
38460 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
38470 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 38 0d 0a 36  0..----..1448..6
38480 37 37 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79  77..729....query
38490 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
384a0 43 54 20 41 4c 4c 20 2d 20 34 33 20 2a 20 63 6f  CT ALL - 43 * co
384b0 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
384c0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
384d0 0a 2d 31 30 33 32 0d 0a 2d 31 35 30 35 0d 0a 2d  .-1032..-1505..-
384e0 33 38 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3827....query I 
384f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
38500 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
38510 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col0 * - col1 + 
38520 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
38530 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
38540 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 33 31 0d 0a 2d  ..----..-2031..-
38550 33 33 39 34 0d 0a 2d 38 30 31 37 0d 0a 0d 0a 6f  3394..-8017....o
38560 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
38570 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
38580 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
38590 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
385a0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 39 0d  sort label-1539.
385b0 0a 53 45 4c 45 43 54 20 2d 20 33 37 20 44 49 56  .SELECT - 37 DIV
385c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
385d0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
385e0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
385f0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
38600 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38610 20 6c 61 62 65 6c 2d 31 35 33 39 0d 0a 53 45 4c   label-1539..SEL
38620 45 43 54 20 2d 20 33 37 20 2f 20 63 6f 6c 32 20  ECT - 37 / col2 
38630 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
38640 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .0..0..0....only
38650 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
38660 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
38670 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
38680 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38690 74 20 6c 61 62 65 6c 2d 31 35 34 30 0d 0a 53 45  t label-1540..SE
386a0 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
386b0 31 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d  1 + - col1 DIV -
386c0 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
386d0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
386e0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d  0..----..10..13.
386f0 0a 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .26....skipif my
38700 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
38710 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
38720 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 30  wsort label-1540
38730 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
38740 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2f   col1 + - col1 /
38750 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   - cor0.col2 AS 
38760 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
38770 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  or0..----..10..1
38780 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  3..26....query I
38790 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
387a0 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2a 20   ALL - + col2 * 
387b0 2d 20 33 36 20 2d 20 2d 20 33 31 20 2a 20 63 6f  - 36 - - 31 * co
387c0 6c 30 20 2a 20 28 20 2b 20 63 6f 6c 31 20 29 20  l0 * ( + col1 ) 
387d0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
387e0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 33 35 39 38 0d  0..----..143598.
387f0 0a 34 33 30 30 31 0d 0a 37 36 39 39 0d 0a 0d 0a  .43001..7699....
38800 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
38810 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
38820 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
38830 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
38840 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 32  wsort label-1542
38850 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
38860 54 20 2b 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c  T + - col2 - col
38870 32 20 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c  2 DIV + cor0.col
38880 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
38890 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
388a0 2d 0d 0a 2d 32 0d 0a 2d 33 34 0d 0a 2d 38 33 0d  -..-2..-34..-83.
388b0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
388c0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
388d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
388e0 74 20 6c 61 62 65 6c 2d 31 35 34 32 0d 0a 53 45  t label-1542..SE
388f0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
38900 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 2f 20  - col2 - col2 / 
38910 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  + cor0.col2 AS c
38920 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
38930 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
38940 0a 2d 33 34 0d 0a 2d 38 33 0d 0a 0d 0a 6f 6e 6c  .-34..-83....onl
38950 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
38960 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
38970 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
38980 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
38990 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
389a0 6c 61 62 65 6c 2d 31 35 34 33 0d 0a 53 45 4c 45  label-1543..SELE
389b0 43 54 20 2b 20 63 6f 6c 31 20 2d 20 43 41 53 54  CT + col1 - CAST
389c0 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41  ( NULL AS DECIMA
389d0 4c 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  L ) FROM tab1 AS
389e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
389f0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
38a00 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
38a10 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
38a20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
38a30 6c 61 62 65 6c 2d 31 35 34 33 0d 0a 53 45 4c 45  label-1543..SELE
38a40 43 54 20 2b 20 63 6f 6c 31 20 2d 20 43 41 53 54  CT + col1 - CAST
38a50 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20   ( NULL AS REAL 
38a60 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
38a70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
38a80 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
38a90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
38aa0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
38ab0 31 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  1 + - col2 + + c
38ac0 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 * col1 AS co
38ad0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
38ae0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 34 39 0d 0a 38  0..----..7449..8
38af0 32 39 30 0d 0a 39 35 30 35 0d 0a 0d 0a 71 75 65  290..9505....que
38b00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38b10 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
38b20 2d 20 63 6f 6c 31 20 2a 20 2b 20 28 20 63 6f 6c  - col1 * + ( col
38b30 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  1 ) AS col2 FROM
38b40 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33   tab0..----..-73
38b50 37 32 0d 0a 2d 38 31 39 32 0d 0a 2d 39 33 37 34  72..-8192..-9374
38b60 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
38b70 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
38b80 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
38b90 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
38ba0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
38bb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38bc0 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  LECT + col2 + co
38bd0 6c 30 20 2d 20 2b 20 33 35 20 2a 20 28 20 63 6f  l0 - + 35 * ( co
38be0 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 74 61  l1 + col1 * - ta
38bf0 62 30 2e 63 6f 6c 32 20 29 20 63 6f 6c 30 20 46  b0.col2 ) col0 F
38c00 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
38c10 32 35 38 31 35 36 0d 0a 33 36 0d 0a 39 36 33 37  258156..36..9637
38c20 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
38c30 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
38c40 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
38c50 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when re