sqllogictest
Hex Artifact Content
Not logged in

Artifact 55b070d4fc4ff20468428686d66096f60a458db6:


0000: 68 61 73 68 2d 74 68 72 65 73 68 6f 6c 64 20 38  hash-threshold 8
0010: 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b  ....statement ok
0020: 0d 0a 43 52 45 41 54 45 20 54 41 42 4c 45 20 74  ..CREATE TABLE t
0030: 61 62 30 28 63 6f 6c 30 20 49 4e 54 45 47 45 52  ab0(col0 INTEGER
0040: 2c 20 63 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20  , col1 INTEGER, 
0050: 63 6f 6c 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d  col2 INTEGER)...
0060: 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43  .statement ok..C
0070: 52 45 41 54 45 20 54 41 42 4c 45 20 74 61 62 31  REATE TABLE tab1
0080: 28 63 6f 6c 30 20 49 4e 54 45 47 45 52 2c 20 63  (col0 INTEGER, c
0090: 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c  ol1 INTEGER, col
00a0: 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74  2 INTEGER)....st
00b0: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43 52 45 41  atement ok..CREA
00c0: 54 45 20 54 41 42 4c 45 20 74 61 62 32 28 63 6f  TE TABLE tab2(co
00d0: 6c 30 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 31  l0 INTEGER, col1
00e0: 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 32 20 49   INTEGER, col2 I
00f0: 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74 61 74 65  NTEGER)....state
0100: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0110: 49 4e 54 4f 20 74 61 62 30 20 56 41 4c 55 45 53  INTO tab0 VALUES
0120: 28 38 39 2c 39 31 2c 38 32 29 0d 0a 0d 0a 73 74  (89,91,82)....st
0130: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45  atement ok..INSE
0140: 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56 41 4c  RT INTO tab0 VAL
0150: 55 45 53 28 33 35 2c 39 37 2c 31 29 0d 0a 0d 0a  UES(35,97,1)....
0160: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
0170: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56  SERT INTO tab0 V
0180: 41 4c 55 45 53 28 32 34 2c 38 36 2c 33 33 29 0d  ALUES(24,86,33).
0190: 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d  ...statement ok.
01a0: 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 61 62  .INSERT INTO tab
01b0: 31 20 56 41 4c 55 45 53 28 36 34 2c 31 30 2c 35  1 VALUES(64,10,5
01c0: 37 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20  7)....statement 
01d0: 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20  ok..INSERT INTO 
01e0: 74 61 62 31 20 56 41 4c 55 45 53 28 33 2c 32 36  tab1 VALUES(3,26
01f0: 2c 35 34 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e  ,54)....statemen
0200: 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54  t ok..INSERT INT
0210: 4f 20 74 61 62 31 20 56 41 4c 55 45 53 28 38 30  O tab1 VALUES(80
0220: 2c 31 33 2c 39 36 29 0d 0a 0d 0a 73 74 61 74 65  ,13,96)....state
0230: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0240: 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55 45 53  INTO tab2 VALUES
0250: 28 37 2c 33 31 2c 32 37 29 0d 0a 0d 0a 73 74 61  (7,31,27)....sta
0260: 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52  tement ok..INSER
0270: 54 20 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55  T INTO tab2 VALU
0280: 45 53 28 37 39 2c 31 37 2c 33 38 29 0d 0a 0d 0a  ES(79,17,38)....
0290: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
02a0: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 32 20 56  SERT INTO tab2 V
02b0: 41 4c 55 45 53 28 37 38 2c 35 39 2c 32 36 29 0d  ALUES(78,59,26).
02c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
02d0: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
02e0: 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  * col0 * - col2 
02f0: 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
0300: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
0310: 0d 0a 2d 33 32 39 38 0d 0a 2d 36 36 34 30 32 37  ..-3298..-664027
0320: 0d 0a 2d 36 38 30 32 36 0d 0a 0d 0a 73 6b 69 70  ..-68026....skip
0330: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
0340: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
0350: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
0360: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
0370: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
0380: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74  sort..SELECT + t
0390: 61 62 32 2e 63 6f 6c 32 20 2a 20 37 38 20 63 6f  ab2.col2 * 78 co
03a0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
03b0: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b2 cor0..----..9
03c0: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
03d0: 74 6f 20 39 35 64 31 31 30 39 38 34 37 65 36 37  to 95d1109847e67
03e0: 62 65 32 32 39 64 35 30 63 64 37 36 32 35 33 64  be229d50cd76253d
03f0: 63 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  c34....query I r
0400: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36  owsort..SELECT 6
0410: 34 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  4 + + col2 AS co
0420: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
0430: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36 0d  cor0..----..146.
0440: 0a 36 35 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79  .65..97....query
0450: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0460: 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f  CT ALL col2 + co
0470: 6c 30 20 2a 20 31 31 20 41 53 20 63 6f 6c 32 20  l0 * 11 AS col2 
0480: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
0490: 0a 37 36 31 0d 0a 38 37 0d 0a 39 37 36 0d 0a 0d  .761..87..976...
04a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
04b0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
04c0: 2b 20 31 31 20 46 52 4f 4d 20 74 61 62 31 20 41  + 11 FROM tab1 A
04d0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
04e0: 37 0d 0a 36 35 0d 0a 36 38 0d 0a 0d 0a 71 75 65  7..65..68....que
04f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0500: 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c  LECT ALL - + col
0510: 31 20 2b 20 2d 20 31 33 20 46 52 4f 4d 20 74 61  1 + - 13 FROM ta
0520: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
0530: 32 33 0d 0a 2d 32 36 0d 0a 2d 33 39 0d 0a 0d 0a  23..-26..-39....
0540: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0550: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
0560: 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   + col2 * + col2
0570: 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 41   * + tab2.col1 A
0580: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
0590: 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36 33 30 0d 0a 32  ..----..22630..2
05a0: 34 35 36 35 0d 0a 33 39 39 34 33 0d 0a 0d 0a 71  4565..39943....q
05b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
05c0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
05d0: 2d 20 63 6f 6c 32 20 2d 20 2b 20 28 20 31 38 20  - col2 - + ( 18 
05e0: 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
05f0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 0d  or0..----..-114.
0600: 0a 2d 37 32 0d 0a 2d 37 35 0d 0a 0d 0a 71 75 65  .-72..-75....que
0610: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0620: 4c 45 43 54 20 28 20 2b 20 32 32 20 29 20 2a 20  LECT ( + 22 ) * 
0630: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 36 35  cor0.col2 + - 65
0640: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
0650: 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
0660: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
0670: 20 68 61 73 68 69 6e 67 20 74 6f 20 65 39 33 32   hashing to e932
0680: 31 30 36 65 62 33 39 32 31 30 66 37 39 64 66 33  106eb39210f79df3
0690: 39 31 61 39 62 30 62 61 37 31 66 64 0d 0a 0d 0a  91a9b0ba71fd....
06a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
06b0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
06c0: 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d   + col0 * col0 -
06d0: 20 36 37 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20   67 * - col0 AS 
06e0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
06f0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
0700: 33 31 30 0d 0a 31 31 35 33 34 0d 0a 35 31 38 0d  310..11534..518.
0710: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
0720: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
0730: 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 28 20 63 6f   + col1 * - ( co
0740: 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l0 ) FROM tab0 A
0750: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
0760: 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d 0a  64..3395..8099..
0770: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
0780: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
0790: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
07a0: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
07b0: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
07c0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 0d 0a 53  sort label-11..S
07d0: 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 43  ELECT col0 + - C
07e0: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
07f0: 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52  NED ) AS col1 FR
0800: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
0810: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
0820: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
0830: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
0840: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
0850: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
0860: 31 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  11..SELECT col0 
0870: 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + - CAST ( NULL 
0880: 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
0890: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
08a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
08b0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
08c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
08d0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
08e0: 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 39 32  CT - - col1 * 92
08f0: 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 72 30   * + col2 - cor0
0900: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
0910: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
0920: 0a 2d 2d 2d 2d 0d 0a 31 34 31 30 36 39 0d 0a 35  .----..141069..5
0930: 39 34 31 35 0d 0a 37 36 39 37 33 0d 0a 0d 0a 6f  9415..76973....o
0940: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
0950: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
0960: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
0970: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
0980: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 0d 0a 53  sort label-13..S
0990: 45 4c 45 43 54 20 28 20 2d 20 63 6f 6c 30 20 29  ELECT ( - col0 )
09a0: 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20 33 33   DIV - col1 + 33
09b0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
09c0: 0d 0a 33 33 0d 0a 33 33 0d 0a 33 33 0d 0a 0d 0a  ..33..33..33....
09d0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
09e0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
09f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
0a00: 61 62 65 6c 2d 31 33 0d 0a 53 45 4c 45 43 54 20  abel-13..SELECT 
0a10: 28 20 2d 20 63 6f 6c 30 20 29 20 2f 20 2d 20 63  ( - col0 ) / - c
0a20: 6f 6c 31 20 2b 20 33 33 20 46 52 4f 4d 20 74 61  ol1 + 33 FROM ta
0a30: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a 33 33  b0..----..33..33
0a40: 0d 0a 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..33....query I 
0a50: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0a60: 2d 20 32 34 20 46 52 4f 4d 20 74 61 62 31 2c 20  - 24 FROM tab1, 
0a70: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
0a80: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
0a90: 68 69 6e 67 20 74 6f 20 37 39 37 64 30 66 37 63  hing to 797d0f7c
0aa0: 31 34 35 66 38 61 63 36 32 33 39 32 34 34 34 38  145f8ac623924448
0ab0: 63 37 31 34 62 62 63 63 0d 0a 0d 0a 6f 6e 6c 79  c714bbcc....only
0ac0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
0ad0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
0ae0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
0af0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0b00: 74 20 6c 61 62 65 6c 2d 31 35 0d 0a 53 45 4c 45  t label-15..SELE
0b10: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
0b20: 20 44 49 56 20 32 37 20 46 52 4f 4d 20 74 61 62   DIV 27 FROM tab
0b30: 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 0d  1..----..0..2...
0b40: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
0b50: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
0b60: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
0b70: 6c 61 62 65 6c 2d 31 35 0d 0a 53 45 4c 45 43 54  label-15..SELECT
0b80: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2f   DISTINCT col0 /
0b90: 20 32 37 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   27 FROM tab1..-
0ba0: 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 0d 0a 6f 6e 6c  ---..0..2....onl
0bb0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
0bc0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
0bd0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
0be0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
0bf0: 72 74 20 6c 61 62 65 6c 2d 31 36 0d 0a 53 45 4c  rt label-16..SEL
0c00: 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  ECT - col1 * col
0c10: 32 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f  2 DIV col1 AS co
0c20: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
0c30: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32  0..----..-26..-2
0c40: 37 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70 69 66  7..-38....skipif
0c50: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
0c60: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
0c70: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
0c80: 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  6..SELECT - col1
0c90: 20 2a 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 41   * col2 / col1 A
0ca0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
0cb0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   cor0..----..-26
0cc0: 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 71 75  ..-27..-38....qu
0cd0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0ce0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
0cf0: 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b  ol2 + - col1 * +
0d00: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
0d10: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
0d20: 2d 2d 0d 0a 2d 32 30 33 31 0d 0a 2d 33 33 39 34  --..-2031..-3394
0d30: 0d 0a 2d 38 30 31 37 0d 0a 0d 0a 6f 6e 6c 79 69  ..-8017....onlyi
0d40: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
0d50: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
0d60: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
0d70: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
0d80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
0d90: 62 65 6c 2d 31 38 0d 0a 53 45 4c 45 43 54 20 2d  bel-18..SELECT -
0da0: 20 2b 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53   + CAST( col2 AS
0db0: 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30   SIGNED ) * col0
0dc0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
0dd0: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
0de0: 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30  189..-2028..-300
0df0: 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
0e00: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
0e10: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
0e20: 6f 72 74 20 6c 61 62 65 6c 2d 31 38 0d 0a 53 45  ort label-18..SE
0e30: 4c 45 43 54 20 2d 20 2b 20 43 41 53 54 20 28 20  LECT - + CAST ( 
0e40: 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
0e50: 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  ) * col0 AS col0
0e60: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
0e70: 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30  .----..-189..-20
0e80: 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65  28..-3002....que
0e90: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0ea0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
0eb0: 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 32 20 46  ( + col0 ) + 2 F
0ec0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
0ed0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 36 32 0d  ..----..-1..-62.
0ee0: 0a 2d 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-78....onlyif m
0ef0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
0f00: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
0f10: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
0f20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
0f30: 62 65 6c 2d 32 30 0d 0a 53 45 4c 45 43 54 20 2d  bel-20..SELECT -
0f40: 20 37 38 20 44 49 56 20 63 6f 6c 31 20 2b 20 63   78 DIV col1 + c
0f50: 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol2 DIV cor0.col
0f60: 30 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  0 - col1 AS col1
0f70: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
0f80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d  r0..----..-85..-
0f90: 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69  91..-97....skipi
0fa0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
0fb0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
0fc0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
0fd0: 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20 37 38 20  20..SELECT - 78 
0fe0: 2f 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2f 20  / col1 + col2 / 
0ff0: 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c 31  cor0.col0 - col1
1000: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1010: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1020: 0d 0a 2d 38 35 0d 0a 2d 39 31 0d 0a 2d 39 37 0d  ..-85..-91..-97.
1030: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1040: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
1050: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
1060: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
1070: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
1080: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31 0d 0a  wsort label-21..
1090: 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f  SELECT col1 * co
10a0: 6c 31 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  l1 + CAST( NULL 
10b0: 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 2b 20  AS SIGNED ) - + 
10c0: 28 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  ( + col2 ) FROM 
10d0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
10e0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
10f0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
1100: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1110: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1120: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31 0d  owsort label-21.
1130: 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63  .SELECT col1 * c
1140: 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ol1 + CAST ( NUL
1150: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d  L AS INTEGER ) -
1160: 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 46 52   + ( + col2 ) FR
1170: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1180: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
1190: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
11a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11b0: 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20 2b 20 63  CT ALL + - ( + c
11c0: 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20 63 6f 6c  or0.col2 ) * col
11d0: 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  2 + col0 FROM ta
11e0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
11f0: 0d 0a 2d 31 30 36 35 0d 0a 2d 36 36 33 35 0d 0a  ..-1065..-6635..
1200: 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
1210: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1220: 4c 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 72  L + col1 - - cor
1230: 30 2e 63 6f 6c 32 20 2a 20 2d 20 28 20 2b 20 28  0.col2 * - ( + (
1240: 20 2b 20 63 6f 6c 32 20 29 20 29 20 2a 20 2d 20   + col2 ) ) * - 
1250: 31 39 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  19 FROM tab0 AS 
1260: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 0d  cor0..----..116.
1270: 0a 31 32 37 38 34 37 0d 0a 32 30 37 37 37 0d 0a  .127847..20777..
1280: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1290: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
12a0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
12b0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
12c0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
12d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12e0: 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20  CT + - col1 + + 
12f0: 63 6f 6c 32 20 2a 20 37 39 20 63 6f 6c 32 20 46  col2 * 79 col2 F
1300: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1310: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 32 35 32  ..----..-18..252
1320: 31 0d 0a 36 33 38 37 0d 0a 0d 0a 71 75 65 72 79  1..6387....query
1330: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1340: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
1350: 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  l1 + - col2 * + 
1360: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
1370: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1380: 2d 0d 0a 2d 31 31 37 35 0d 0a 2d 36 38 31 35 0d  -..-1175..-6815.
1390: 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-98....query I 
13a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13b0: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
13c0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
13d0: 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab1 AS cor0, tab
13e0: 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
13f0: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
1400: 6e 67 20 74 6f 20 64 36 37 31 61 30 36 34 65 32  ng to d671a064e2
1410: 64 61 37 30 39 63 61 34 63 64 66 65 61 33 31 37  da709ca4cdfea317
1420: 62 38 65 38 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  b8e892....onlyif
1430: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1440: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1450: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1460: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1470: 6c 61 62 65 6c 2d 32 37 0d 0a 53 45 4c 45 43 54  label-27..SELECT
1480: 20 2d 20 43 41 53 54 28 20 63 6f 6c 30 20 2b 20   - CAST( col0 + 
1490: 2d 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44  - col0 AS SIGNED
14a0: 20 29 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53   ) DIV - col1 AS
14b0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
14c0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
14d0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
14e0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
14f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1500: 20 6c 61 62 65 6c 2d 32 37 0d 0a 53 45 4c 45 43   label-27..SELEC
1510: 54 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 30 20  T - CAST ( col0 
1520: 2b 20 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54 45  + - col0 AS INTE
1530: 47 45 52 20 29 20 2f 20 2d 20 63 6f 6c 31 20 41  GER ) / - col1 A
1540: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
1550: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
1560: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1570: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35  rt..SELECT ALL 5
1580: 31 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  1 * col2 * + col
1590: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
15a0: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 37 33  ab0..----..14473
15b0: 38 0d 0a 33 38 30 35 36 32 0d 0a 34 39 34 37 0d  8..380562..4947.
15c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
15d0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
15e0: 20 63 6f 6c 30 20 2d 20 2b 20 39 32 20 46 52 4f   col0 - + 92 FRO
15f0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1600: 2d 2d 2d 2d 0d 0a 2d 31 37 30 0d 0a 2d 31 37 31  ----..-170..-171
1610: 0d 0a 2d 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-99....onlyif 
1620: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1630: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1640: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1650: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1660: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1670: 6c 2d 33 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  l-30..SELECT ALL
1680: 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53   CAST( col1 AS S
1690: 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 32  IGNED ) + - col2
16a0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
16b0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
16c0: 0d 0a 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 73  ..53..9..96....s
16d0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
16e0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
16f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1700: 62 65 6c 2d 33 30 0d 0a 53 45 4c 45 43 54 20 41  bel-30..SELECT A
1710: 4c 4c 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41  LL CAST ( col1 A
1720: 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20  S INTEGER ) + - 
1730: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
1740: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1750: 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39 36 0d  ----..53..9..96.
1760: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1770: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1780: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1790: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
17a0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
17b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17c0: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b  ECT ALL - col0 +
17d0: 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a   - col0 * col2 *
17e0: 20 31 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   12 col1 FROM ta
17f0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1800: 0d 0a 2d 31 39 34 37 0d 0a 2d 34 33 38 34 30 0d  ..-1947..-43840.
1810: 0a 2d 39 32 32 34 30 0d 0a 0d 0a 71 75 65 72 79  .-92240....query
1820: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1830: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
1840: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col1 * - col1 + 
1850: 2d 20 63 6f 6c 31 20 2a 20 2b 20 28 20 63 6f 6c  - col1 * + ( col
1860: 32 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  2 ) * col1 FROM 
1870: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1880: 2d 2d 0d 0a 2d 32 33 36 36 37 32 0d 0a 2d 36 37  --..-236672..-67
1890: 30 37 36 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0761..0....query
18a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18b0: 43 54 20 38 38 20 2d 20 2d 20 63 6f 6c 32 20 2a  CT 88 - - col2 *
18c0: 20 63 6f 6c 31 20 2a 20 2d 20 37 35 20 46 52 4f   col1 * - 75 FRO
18d0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
18e0: 2d 2d 2d 2d 0d 0a 2d 31 31 34 39 36 32 0d 0a 2d  ----..-114962..-
18f0: 34 38 33 36 32 0d 0a 2d 36 32 36 38 37 0d 0a 0d  48362..-62687...
1900: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1910: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72  ..SELECT + + cor
1920: 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  0.col0 * + col0 
1930: 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  * + col0 + col0 
1940: 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  * + cor0.col1 FR
1950: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1960: 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 32 36 32 37  .----..105..2627
1970: 38 34 0d 0a 35 31 33 30 34 30 0d 0a 0d 0a 6f 6e  84..513040....on
1980: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1990: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
19a0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
19b0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
19c0: 6f 72 74 20 6c 61 62 65 6c 2d 33 35 0d 0a 53 45  ort label-35..SE
19d0: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20  LECT + col0 DIV 
19e0: 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  col1 + col0 * + 
19f0: 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
1a00: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1a10: 2d 0d 0a 34 39 0d 0a 36 30 38 35 0d 0a 36 32 34  -..49..6085..624
1a20: 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  5....skipif post
1a30: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1a40: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1a50: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1a60: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
1a70: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1a80: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1a90: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1aa0: 65 6c 2d 33 35 0d 0a 53 45 4c 45 43 54 20 2b 20  el-35..SELECT + 
1ab0: 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 2b 20 63 6f  col0 / col1 + co
1ac0: 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c 30  l0 * + col0 col0
1ad0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1ae0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30  r0..----..49..60
1af0: 38 35 0d 0a 36 32 34 35 0d 0a 0d 0a 73 6b 69 70  85..6245....skip
1b00: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1b10: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1b20: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1b30: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1b40: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1b50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1b60: 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63  TINCT - col2 + c
1b70: 6f 6c 31 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20  ol1 * col1 col2 
1b80: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1b90: 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 36 33 0d 0a 38  0..----..7363..8
1ba0: 31 39 39 0d 0a 39 34 30 38 0d 0a 0d 0a 71 75 65  199..9408....que
1bb0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1bc0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1bd0: 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63  r0.col2 + cor0.c
1be0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
1bf0: 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
1c00: 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
1c10: 0a 35 32 0d 0a 35 34 0d 0a 37 36 0d 0a 0d 0a 6f  .52..54..76....o
1c20: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1c30: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1c40: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1c50: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1c60: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 0d 0a 53  sort label-38..S
1c70: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1c80: 20 38 36 20 2b 20 63 6f 6c 30 20 44 49 56 20 63   86 + col0 DIV c
1c90: 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
1ca0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 32 0d 0a 2d  b2..----..-82..-
1cb0: 38 35 0d 0a 2d 38 36 0d 0a 0d 0a 73 6b 69 70 69  85..-86....skipi
1cc0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1cd0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1ce0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1cf0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1d00: 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
1d10: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1d20: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1d30: 72 74 20 6c 61 62 65 6c 2d 33 38 0d 0a 53 45 4c  rt label-38..SEL
1d40: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38  ECT DISTINCT - 8
1d50: 36 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20  6 + col0 / col1 
1d60: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
1d70: 2d 2d 2d 2d 0d 0a 2d 38 32 0d 0a 2d 38 35 0d 0a  ----..-82..-85..
1d80: 2d 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -86....query I r
1d90: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1da0: 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 74  ol2 * col2 + - t
1db0: 61 62 32 2e 63 6f 6c 31 20 2b 20 2b 20 74 61 62  ab2.col1 + + tab
1dc0: 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  2.col2 AS col2 F
1dd0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1de0: 31 34 36 35 0d 0a 36 34 33 0d 0a 37 32 35 0d 0a  1465..643..725..
1df0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e00: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  t..SELECT ALL ( 
1e10: 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 30 20  col1 ) + + col0 
1e20: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1e30: 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a  .110..132..180..
1e40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e50: 74 0d 0a 53 45 4c 45 43 54 20 35 34 20 41 53 20  t..SELECT 54 AS 
1e60: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
1e70: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1e80: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
1e90: 67 20 74 6f 20 64 32 33 36 34 63 34 66 66 63 30  g to d2364c4ffc0
1ea0: 39 61 63 32 63 66 31 66 36 66 61 34 64 37 36 37  9ac2cf1f6fa4d767
1eb0: 64 38 62 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49  d8b09....query I
1ec0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ed0: 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2a 20   ALL - - col0 * 
1ee0: 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  + col0 + + col0 
1ef0: 2b 20 2d 20 38 38 20 2a 20 2b 20 63 6f 6c 32 20  + - 88 * + col2 
1f00: 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  * + col1 AS col1
1f10: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1f20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 38 33  r0..----..-12883
1f30: 30 0d 0a 2d 35 30 35 32 38 0d 0a 2d 37 33 36 30  0..-50528..-7360
1f40: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1f50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1f60: 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b   - col2 + col2 +
1f70: 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
1f80: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
1f90: 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75  .1..33..82....qu
1fa0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1fb0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 35 20 46  ELECT ALL + 95 F
1fc0: 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
1fd0: 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  S cor0, tab1 AS 
1fe0: 63 6f 72 31 2c 20 74 61 62 32 20 41 53 20 63 6f  cor1, tab2 AS co
1ff0: 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  r2..----..81 val
2000: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39  ues hashing to 9
2010: 38 39 36 66 62 63 37 63 39 38 61 62 65 38 34 63  896fbc7c98abe84c
2020: 62 35 38 35 65 36 66 35 66 32 35 62 35 38 61 0d  b585e6f5f25b58a.
2030: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2040: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2050: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2060: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2070: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
2080: 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 44  5..SELECT col1 D
2090: 49 56 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63  IV col2 + cor0.c
20a0: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
20b0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
20c0: 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d  ---..10..13..26.
20d0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
20e0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
20f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2100: 74 20 6c 61 62 65 6c 2d 34 35 0d 0a 53 45 4c 45  t label-45..SELE
2110: 43 54 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 2b  CT col1 / col2 +
2120: 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
2130: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
2140: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a  cor0..----..10..
2150: 31 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20  13..26....query 
2160: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2170: 54 20 41 4c 4c 20 2b 20 28 20 37 36 20 2b 20 63  T ALL + ( 76 + c
2180: 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 30 20 41  ol1 ) * - col0 A
2190: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
21a0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 38 36 33 0d 0a  ..----..-14863..
21b0: 2d 33 38 38 38 0d 0a 2d 36 30 35 35 0d 0a 0d 0a  -3888..-6055....
21c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21d0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
21e0: 20 2d 20 2b 20 36 35 20 41 53 20 63 6f 6c 30 20   - + 65 AS col0 
21f0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2200: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 35 0d 0a 0d 0a  0..----..-65....
2210: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2220: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2230: 72 31 2e 63 6f 6c 32 20 2b 20 35 20 2b 20 63 6f  r1.col2 + 5 + co
2240: 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
2250: 30 2c 20 74 61 62 31 20 63 6f 72 30 2c 20 74 61  0, tab1 cor0, ta
2260: 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
2270: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
2280: 69 6e 67 20 74 6f 20 63 66 34 38 30 63 39 32 37  ing to cf480c927
2290: 64 62 65 61 66 35 36 65 62 32 34 65 65 38 38 31  dbeaf56eb24ee881
22a0: 39 30 39 65 63 62 62 0d 0a 0d 0a 71 75 65 72 79  909ecbb....query
22b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22c0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61  CT DISTINCT + ta
22d0: 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  b0.col2 AS col2 
22e0: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
22f0: 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
2300: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor1..----..1..
2310: 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20  33..82....query 
2320: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2330: 54 20 41 4c 4c 20 34 32 20 2a 20 2d 20 63 6f 6c  T ALL 42 * - col
2340: 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
2350: 2d 0d 0a 2d 32 32 36 38 0d 0a 2d 32 33 39 34 0d  -..-2268..-2394.
2360: 0a 2d 34 30 33 32 0d 0a 0d 0a 71 75 65 72 79 20  .-4032....query 
2370: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2380: 54 20 39 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  T 92 AS col0 FRO
2390: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
23a0: 2d 0d 0a 39 32 0d 0a 39 32 0d 0a 39 32 0d 0a 0d  -..92..92..92...
23b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23c0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
23d0: 2d 20 37 38 20 46 52 4f 4d 20 74 61 62 30 20 41  - 78 FROM tab0 A
23e0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
23f0: 37 30 38 0d 0a 2d 37 30 39 38 0d 0a 2d 37 35 36  708..-7098..-756
2400: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
2410: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2420: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2430: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2440: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2450: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33  rowsort label-53
2460: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
2470: 31 20 2b 20 2b 20 43 41 53 54 28 20 2b 20 35 20  1 + + CAST( + 5 
2480: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
2490: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
24a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d   cor0..----..15.
24b0: 0a 31 38 0d 0a 33 31 0d 0a 0d 0a 73 6b 69 70 69  .18..31....skipi
24c0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
24d0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
24e0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24f0: 35 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  53..SELECT + + c
2500: 6f 6c 31 20 2b 20 2b 20 43 41 53 54 20 28 20 2b  ol1 + + CAST ( +
2510: 20 35 20 41 53 20 49 4e 54 45 47 45 52 20 29 20   5 AS INTEGER ) 
2520: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2530: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2540: 0a 31 35 0d 0a 31 38 0d 0a 33 31 0d 0a 0d 0a 6f  .15..18..31....o
2550: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2560: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2570: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2580: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2590: 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34 0d 0a 53  sort label-54..S
25a0: 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 28 20 2b  ELECT col1 * ( +
25b0: 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 31 20 44   col1 ) + col1 D
25c0: 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  IV col0 AS col2 
25d0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
25e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d 0a 33 34  0..----..289..34
25f0: 38 31 0d 0a 39 36 35 0d 0a 0d 0a 73 6b 69 70 69  81..965....skipi
2600: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2610: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2620: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2630: 35 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  54..SELECT col1 
2640: 2a 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 63  * ( + col1 ) + c
2650: 6f 6c 31 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 / col0 AS co
2660: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
2670: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d  cor0..----..289.
2680: 0a 33 34 38 31 0d 0a 39 36 35 0d 0a 0d 0a 71 75  .3481..965....qu
2690: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26a0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
26b0: 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32   + col1 * - col2
26c0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
26d0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
26e0: 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d  ..-1534..-646..-
26f0: 38 33 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  837....skipif po
2700: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2710: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2720: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2730: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2740: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2750: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2760: 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a   - col0 + col1 *
2770: 20 2b 20 32 30 20 2a 20 63 6f 6c 32 20 63 6f 6c   + 20 * col2 col
2780: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2790: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 33 36  or0..----..11336
27a0: 0d 0a 32 34 38 38 30 0d 0a 32 38 30 37 37 0d 0a  ..24880..28077..
27b0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
27c0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
27d0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
27e0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
27f0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37  rowsort label-57
2800: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
2810: 2b 20 2d 20 35 37 20 44 49 56 20 28 20 63 6f 6c  + - 57 DIV ( col
2820: 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  2 ) FROM tab0 co
2830: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d  r0..----..-34..-
2840: 35 38 0d 0a 2d 38 32 0d 0a 0d 0a 73 6b 69 70 69  58..-82....skipi
2850: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2860: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2870: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2880: 35 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  57..SELECT - col
2890: 32 20 2b 20 2d 20 35 37 20 2f 20 28 20 63 6f 6c  2 + - 57 / ( col
28a0: 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  2 ) FROM tab0 co
28b0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d  r0..----..-34..-
28c0: 35 38 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79  58..-82....query
28d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28e0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
28f0: 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
2900: 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  0 AS cor0 CROSS 
2910: 4a 4f 49 4e 20 74 61 62 31 20 63 6f 72 31 0d 0a  JOIN tab1 cor1..
2920: 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d  ----..1..33..82.
2930: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2940: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
2950: 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 28 20 2d  or0.col2 + - ( -
2960: 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 29   col1 + - col2 )
2970: 20 2a 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63   * ( col2 ) AS c
2980: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2990: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35   cor0..----..105
29a0: 36 30 0d 0a 33 38 37 36 0d 0a 34 33 37 34 0d 0a  60..3876..4374..
29b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29c0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
29d0: 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  CT - + col1 + + 
29e0: 28 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  ( + col1 ) AS co
29f0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
2a00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  cor0..----..0...
2a10: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2a20: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2a30: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2a40: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2a50: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 0d  owsort label-61.
2a60: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2a70: 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31   - + col0 + col1
2a80: 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 30   DIV - cor0.col0
2a90: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2aa0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d  r0..----..-11..-
2ab0: 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69  64..-80....skipi
2ac0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2ad0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2ae0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2af0: 36 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  61..SELECT DISTI
2b00: 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 63  NCT - + col0 + c
2b10: 6f 6c 31 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 / - cor0.col
2b20: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2b30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a  or0..----..-11..
2b40: 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70  -64..-80....skip
2b50: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2b60: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2b70: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2b80: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2b90: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2ba0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2bb0: 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a  TINCT + + col0 *
2bc0: 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20   - ( + col0 ) + 
2bd0: 63 6f 6c 32 20 2a 20 2d 20 28 20 2d 20 63 6f 72  col2 * - ( - cor
2be0: 30 2e 63 6f 6c 31 20 29 20 63 6f 6c 32 20 46 52  0.col1 ) col2 FR
2bf0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2c00: 0a 2d 2d 2d 2d 0d 0a 2d 34 35 35 30 0d 0a 2d 35  .----..-4550..-5
2c10: 35 39 35 0d 0a 37 38 38 0d 0a 0d 0a 73 6b 69 70  595..788....skip
2c20: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2c30: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2c40: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2c50: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2c60: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2c70: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2c80: 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   + - col2 + col1
2c90: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2ca0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
2cb0: 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70  3..9..96....skip
2cc0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2cd0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2ce0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2cf0: 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 43 41  CT + + col0 * CA
2d00: 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 52  ST ( + col2 AS R
2d10: 45 41 4c 20 29 20 41 53 20 63 6f 6c 30 20 46 52  EAL ) AS col0 FR
2d20: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2d30: 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38  .----..189..2028
2d40: 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20  ..3002....query 
2d50: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d60: 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 2d  T ALL - col2 + -
2d70: 20 39 34 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f   94 * - col0 FRO
2d80: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2d90: 2d 2d 2d 2d 0d 0a 32 32 38 0d 0a 35 39 35 39 0d  ----..228..5959.
2da0: 0a 37 34 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .7424....onlyif 
2db0: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2dc0: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2dd0: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2de0: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2df0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2e00: 6c 2d 36 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-66..SELECT DIS
2e10: 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a  TINCT + + col1 *
2e20: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
2e30: 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c 30  IGNED ) * - col0
2e40: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2e50: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2e60: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
2e70: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2e80: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2e90: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
2ea0: 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
2eb0: 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 43 41  CT + + col1 * CA
2ec0: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
2ed0: 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 30 20  EGER ) * - col0 
2ee0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2ef0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2f00: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
2f10: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f20: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
2f30: 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46   * col1 + col1 F
2f40: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2f50: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 36 0d 0a 2d  ..----..-1326..-
2f60: 31 38 36 0d 0a 2d 34 35 34 33 0d 0a 0d 0a 6f 6e  186..-4543....on
2f70: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2f80: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2f90: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2fa0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2fb0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fc0: 20 6c 61 62 65 6c 2d 36 38 0d 0a 53 45 4c 45 43   label-68..SELEC
2fd0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
2fe0: 30 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  0 * + CAST( NULL
2ff0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
3000: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab0..----..NU
3010: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
3020: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
3030: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
3040: 73 6f 72 74 20 6c 61 62 65 6c 2d 36 38 0d 0a 53  sort label-68..S
3050: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
3060: 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 20 28   col0 * + CAST (
3070: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
3080: 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
3090: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  --..NULL....quer
30a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30b0: 45 43 54 20 63 6f 6c 30 20 2b 20 39 31 20 2a 20  ECT col0 + 91 * 
30c0: 2d 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20 63  - tab1.col0 AS c
30d0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
30e0: 2d 2d 2d 0d 0a 2d 32 37 30 0d 0a 2d 35 37 36 30  ---..-270..-5760
30f0: 0d 0a 2d 37 32 30 30 0d 0a 0d 0a 71 75 65 72 79  ..-7200....query
3100: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3110: 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  CT + col1 * + co
3120: 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l0 + - col1 FROM
3130: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37   tab0..----..197
3140: 38 0d 0a 33 32 39 38 0d 0a 38 30 30 38 0d 0a 0d  8..3298..8008...
3150: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3160: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
3170: 54 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20  T tab1.col1 * - 
3180: 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col2 * col1 FROM
3190: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   tab1..----..-16
31a0: 32 32 34 0d 0a 2d 33 36 35 30 34 0d 0a 2d 35 37  224..-36504..-57
31b0: 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  00....onlyif mys
31c0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
31d0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
31e0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
31f0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
3200: 6c 2d 37 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  l-72..SELECT - -
3210: 20 63 6f 6c 32 20 44 49 56 20 28 20 38 34 20 29   col2 DIV ( 84 )
3220: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
3230: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
3240: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
3250: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
3260: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
3270: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
3280: 6c 2d 37 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  l-72..SELECT - -
3290: 20 63 6f 6c 32 20 2f 20 28 20 38 34 20 29 20 41   col2 / ( 84 ) A
32a0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
32b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32c0: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69  0..0..0....onlyi
32d0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
32e0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
32f0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
3300: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3310: 20 6c 61 62 65 6c 2d 37 33 0d 0a 53 45 4c 45 43   label-73..SELEC
3320: 54 20 63 6f 6c 30 20 2a 20 31 35 20 44 49 56 20  T col0 * 15 DIV 
3330: 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20  - col0 + col1 * 
3340: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20  - cor0.col0 + - 
3350: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
3360: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
3370: 34 33 37 0d 0a 2d 32 33 39 0d 0a 2d 34 36 39 35  437..-239..-4695
3380: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
3390: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
33a0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
33b0: 72 74 20 6c 61 62 65 6c 2d 37 33 0d 0a 53 45 4c  rt label-73..SEL
33c0: 45 43 54 20 63 6f 6c 30 20 2a 20 31 35 20 2f 20  ECT col0 * 15 / 
33d0: 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20  - col0 + col1 * 
33e0: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20  - cor0.col0 + - 
33f0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
3400: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
3410: 34 33 37 0d 0a 2d 32 33 39 0d 0a 2d 34 36 39 35  437..-239..-4695
3420: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
3430: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
3440: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
3450: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
3460: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
3470: 37 34 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63  74..SELECT - ( c
3480: 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63  ol1 ) * + cor0.c
3490: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  ol0 + + col0 * c
34a0: 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 + - cor0.col
34b0: 30 20 44 49 56 20 28 20 2d 20 63 6f 6c 31 20 29  0 DIV ( - col1 )
34c0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
34d0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 31 34 0d 0a  r0..----..3014..
34e0: 36 36 34 36 0d 0a 38 34 0d 0a 0d 0a 73 6b 69 70  6646..84....skip
34f0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
3500: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
3510: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
3520: 2d 37 34 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  -74..SELECT - ( 
3530: 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 72 30 2e  col1 ) * + cor0.
3540: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  col0 + + col0 * 
3550: 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col2 + - cor0.co
3560: 6c 30 20 2f 20 28 20 2d 20 63 6f 6c 31 20 29 20  l0 / ( - col1 ) 
3570: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
3580: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 31 34 0d 0a 36  0..----..3014..6
3590: 36 34 36 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72 79  646..84....query
35a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35b0: 43 54 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20  CT - ( - col2 ) 
35c0: 2d 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  - + col2 FROM ta
35d0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
35e0: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
35f0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
3600: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
3610: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
3620: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
3630: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
3640: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
3650: 4c 20 37 33 20 2a 20 2b 20 32 38 20 63 6f 6c 30  L 73 * + 28 col0
3660: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
3670: 0a 2d 2d 2d 2d 0d 0a 32 30 34 34 0d 0a 32 30 34  .----..2044..204
3680: 34 0d 0a 32 30 34 34 0d 0a 0d 0a 73 6b 69 70 69  4..2044....skipi
3690: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
36a0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
36b0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
36c0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
36d0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
36e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
36f0: 2b 20 2d 20 37 39 20 2a 20 38 39 20 63 6f 6c 31  + - 79 * 89 col1
3700: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
3710: 0a 2d 2d 2d 2d 0d 0a 2d 37 30 33 31 0d 0a 2d 37  .----..-7031..-7
3720: 30 33 31 0d 0a 2d 37 30 33 31 0d 0a 0d 0a 6f 6e  031..-7031....on
3730: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
3740: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
3750: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
3760: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
3770: 6f 72 74 20 6c 61 62 65 6c 2d 37 38 0d 0a 53 45  ort label-78..SE
3780: 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 28 20 63  LECT ALL + + ( c
3790: 6f 6c 30 20 29 20 44 49 56 20 63 6f 6c 31 20 41  ol0 ) DIV col1 A
37a0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
37b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37c0: 30 0d 0a 36 0d 0a 36 0d 0a 0d 0a 73 6b 69 70 69  0..6..6....skipi
37d0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
37e0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
37f0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
3800: 37 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  78..SELECT ALL +
3810: 20 2b 20 28 20 63 6f 6c 30 20 29 20 2f 20 63 6f   + ( col0 ) / co
3820: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
3830: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
3840: 2d 2d 0d 0a 30 0d 0a 36 0d 0a 36 0d 0a 0d 0a 6f  --..0..6..6....o
3850: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
3860: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
3870: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
3880: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
3890: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38a0: 74 20 6c 61 62 65 6c 2d 37 39 0d 0a 53 45 4c 45  t label-79..SELE
38b0: 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  CT + CAST( NULL 
38c0: 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 63 6f  AS SIGNED ) - co
38d0: 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63  l1 * - col1 AS c
38e0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
38f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
3900: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
3910: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
3920: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
3930: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
3940: 6c 61 62 65 6c 2d 37 39 0d 0a 53 45 4c 45 43 54  label-79..SELECT
3950: 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
3960: 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 63 6f  S INTEGER ) - co
3970: 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63  l1 * - col1 AS c
3980: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
3990: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
39a0: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
39b0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
39c0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
39d0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
39e0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
39f0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 0d  owsort label-80.
3a00: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2d  .SELECT + col1 -
3a10: 20 28 20 63 6f 6c 30 20 29 20 44 49 56 20 2b 20   ( col0 ) DIV + 
3a20: 43 41 53 54 28 20 2d 20 38 37 20 41 53 20 53 49  CAST( - 87 AS SI
3a30: 47 4e 45 44 20 29 20 63 6f 6c 30 20 46 52 4f 4d  GNED ) col0 FROM
3a40: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
3a50: 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d  ---..10..13..26.
3a60: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
3a70: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
3a80: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
3a90: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
3aa0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
3ab0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
3ac0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
3ad0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
3ae0: 2d 38 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  -80..SELECT + co
3af0: 6c 31 20 2d 20 28 20 63 6f 6c 30 20 29 20 2f 20  l1 - ( col0 ) / 
3b00: 2b 20 43 41 53 54 20 28 20 2d 20 38 37 20 41 53  + CAST ( - 87 AS
3b10: 20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 30 20   INTEGER ) col0 
3b20: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
3b30: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d  0..----..10..13.
3b40: 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .26....query I r
3b50: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
3b60: 20 32 35 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20   25 - col1 FROM 
3b70: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
3b80: 2d 2d 0d 0a 2d 31 31 31 0d 0a 2d 31 31 36 0d 0a  --..-111..-116..
3b90: 2d 31 32 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -122....onlyif m
3ba0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
3bb0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
3bc0: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
3bd0: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
3be0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
3bf0: 2d 38 32 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  -82..SELECT CAST
3c00: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
3c10: 20 29 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20   ) + + ( - col0 
3c20: 29 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  ) * - CAST( NULL
3c30: 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
3c40: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
3c50: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
3c60: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
3c70: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
3c80: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
3c90: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
3ca0: 32 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  2..SELECT CAST (
3cb0: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
3cc0: 20 29 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20   ) + + ( - col0 
3cd0: 29 20 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  ) * - CAST ( NUL
3ce0: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
3cf0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
3d00: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
3d10: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
3d20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3d30: 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20 36 39 20  ECT + col2 - 69 
3d40: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
3d50: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31  0..----..-12..-1
3d60: 35 0d 0a 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49  5..27....query I
3d70: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3d80: 20 41 4c 4c 20 2d 20 34 39 20 2b 20 2d 20 63 6f   ALL - 49 + - co
3d90: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
3da0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 31  cor0..----..-131
3db0: 0d 0a 2d 35 30 0d 0a 2d 38 32 0d 0a 0d 0a 71 75  ..-50..-82....qu
3dc0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3dd0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
3de0: 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63  .col2 * - cor0.c
3df0: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
3e00: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
3e10: 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32 38  ---..-189..-2028
3e20: 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79  ..-3002....query
3e30: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3e40: 43 54 20 35 35 20 2b 20 2d 20 63 6f 6c 30 20 2b  CT 55 + - col0 +
3e50: 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
3e60: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
3e70: 2d 2d 0d 0a 31 31 37 0d 0a 31 31 37 0d 0a 35 37  --..117..117..57
3e80: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3e90: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
3ea0: 35 36 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46  56 + cor0.col1 F
3eb0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
3ec0: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 0d 0a 37 33 0d  ..----..115..73.
3ed0: 0a 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .87....query I r
3ee0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
3ef0: 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63  ol0 * col0 * - c
3f00: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
3f10: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   tab0..----..-12
3f20: 32 35 0d 0a 2d 31 39 30 30 38 0d 0a 2d 36 34 39  25..-19008..-649
3f30: 35 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  522....query I r
3f40: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
3f50: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
3f60: 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41   col0 * - col0 A
3f70: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
3f80: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3f90: 2d 31 32 32 36 0d 0a 2d 36 30 39 0d 0a 2d 38 30  -1226..-609..-80
3fa0: 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  03....query I ro
3fb0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
3fc0: 2d 20 63 6f 6c 31 20 29 20 2a 20 2d 20 30 20 41  - col1 ) * - 0 A
3fd0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
3fe0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
3ff0: 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
4000: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4010: 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c  DISTINCT + + col
4020: 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  1 * - cor0.col1 
4030: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20  + col1 + col1 * 
4040: 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
4050: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
4060: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 37 0d 0a 2d  ..----..-1147..-
4070: 31 36 31 35 0d 0a 2d 38 30 32 34 0d 0a 0d 0a 6f  1615..-8024....o
4080: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
4090: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
40a0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
40b0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
40c0: 73 6f 72 74 20 6c 61 62 65 6c 2d 39 32 0d 0a 53  sort label-92..S
40d0: 45 4c 45 43 54 20 2b 20 36 32 20 44 49 56 20 2d  ELECT + 62 DIV -
40e0: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a   col0 + - col2 *
40f0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
4100: 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37 0d 0a 2d 32 30  .----..-197..-20
4110: 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 73 6b 69  28..-3002....ski
4120: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
4130: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
4140: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
4150: 6c 2d 39 32 0d 0a 53 45 4c 45 43 54 20 2b 20 36  l-92..SELECT + 6
4160: 32 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  2 / - col0 + - c
4170: 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 * col0 FROM 
4180: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37  tab2..----..-197
4190: 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a  ..-2028..-3002..
41a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
41b0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
41c0: 37 34 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  74 + + col0 * + 
41d0: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col0 * - col2 + 
41e0: 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  + col2 * + col2 
41f0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
4200: 0a 2d 31 35 37 34 33 34 0d 0a 2d 32 33 35 36 34  .-157434..-23564
4210: 30 0d 0a 2d 35 32 30 0d 0a 0d 0a 6f 6e 6c 79 69  0..-520....onlyi
4220: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
4230: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
4240: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
4250: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
4260: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
4270: 62 65 6c 2d 39 34 0d 0a 53 45 4c 45 43 54 20 43  bel-94..SELECT C
4280: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
4290: 49 4d 41 4c 20 29 20 2a 20 2b 20 63 6f 6c 30 20  IMAL ) * + col0 
42a0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
42b0: 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  2..----..NULL..N
42c0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
42d0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
42e0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
42f0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
4300: 6c 2d 39 34 0d 0a 53 45 4c 45 43 54 20 43 41 53  l-94..SELECT CAS
4310: 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c  T ( NULL AS REAL
4320: 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63   ) * + col0 AS c
4330: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
4340: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
4350: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
4360: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
4370: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
4380: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
4390: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
43a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
43b0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
43c0: 20 2d 20 2b 20 31 33 20 63 6f 6c 31 20 46 52 4f   - + 13 col1 FRO
43d0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  M tab0..----..73
43e0: 0d 0a 37 38 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72  ..78..84....quer
43f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4400: 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b  ECT + + col1 * +
4410: 20 63 6f 6c 31 20 2b 20 2d 20 31 39 20 2a 20 2b   col1 + - 19 * +
4420: 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20   col0 + col2 AS 
4430: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
4440: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
4450: 31 37 34 0d 0a 32 30 32 35 0d 0a 38 35 35 0d 0a  174..2025..855..
4460: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4470: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
4480: 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 31 20   * + col1 * - 1 
4490: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  + col0 * col0 + 
44a0: 28 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  ( + col2 ) FROM 
44b0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
44c0: 2d 2d 0d 0a 2d 32 32 32 39 0d 0a 31 31 32 39 0d  --..-2229..1129.
44d0: 0a 35 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .541....query I 
44e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
44f0: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2a 20  col1 * + col0 * 
4500: 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
4510: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
4520: 2d 0d 0a 31 31 39 36 35 32 0d 0a 35 31 30 33 34  -..119652..51034
4530: 0d 0a 35 38 35 39 0d 0a 0d 0a 71 75 65 72 79 20  ..5859....query 
4540: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4550: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
4560: 31 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 35 33 20  1 + col0 + - 53 
4570: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
4580: 0a 2d 32 34 0d 0a 32 31 0d 0a 34 30 0d 0a 0d 0a  .-24..21..40....
4590: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
45a0: 0a 53 45 4c 45 43 54 20 35 32 20 2b 20 74 61 62  .SELECT 52 + tab
45b0: 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  1.col0 FROM tab1
45c0: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 0d 0a 31 33 32  ..----..116..132
45d0: 0d 0a 35 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..55....skipif p
45e0: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
45f0: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
4600: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
4610: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
4620: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4630: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
4640: 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 2d  T - ( col0 ) + -
4650: 20 63 6f 6c 31 20 2a 20 2b 20 39 37 20 63 6f 6c   col1 * + 97 col
4660: 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
4670: 2d 0d 0a 2d 31 37 32 38 0d 0a 2d 33 30 31 34 0d  -..-1728..-3014.
4680: 0a 2d 35 38 30 31 0d 0a 0d 0a 71 75 65 72 79 20  .-5801....query 
4690: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
46a0: 54 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e  T col0 + - tab1.
46b0: 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 46 52  col2 - + col0 FR
46c0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
46d0: 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a  54..-57..-96....
46e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
46f0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
4700: 20 37 35 20 2a 20 74 61 62 31 2e 63 6f 6c 32 20   75 * tab1.col2 
4710: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
4720: 31 0d 0a 2d 2d 2d 2d 0d 0a 34 30 35 30 0d 0a 34  1..----..4050..4
4730: 32 37 35 0d 0a 37 32 30 30 0d 0a 0d 0a 71 75 65  275..7200....que
4740: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4750: 4c 45 43 54 20 41 4c 4c 20 38 37 20 41 53 20 63  LECT ALL 87 AS c
4760: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol0 FROM tab2, t
4770: 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab1 AS cor0, tab
4780: 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
4790: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
47a0: 6e 67 20 74 6f 20 38 36 36 31 66 66 62 64 31 61  ng to 8661ffbd1a
47b0: 37 32 38 39 37 63 34 39 35 34 30 35 63 35 33 62  72897c495405c53b
47c0: 38 31 36 65 35 30 0d 0a 0d 0a 71 75 65 72 79 20  816e50....query 
47d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
47e0: 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72  T + - col1 + cor
47f0: 30 2e 63 6f 6c 32 20 2a 20 2d 20 39 39 20 46 52  0.col2 * - 99 FR
4800: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
4810: 0a 2d 2d 2d 2d 0d 0a 2d 35 33 37 32 0d 0a 2d 35  .----..-5372..-5
4820: 36 35 33 0d 0a 2d 39 35 31 37 0d 0a 0d 0a 6f 6e  653..-9517....on
4830: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
4840: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
4850: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
4860: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
4870: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4880: 20 6c 61 62 65 6c 2d 31 30 36 0d 0a 53 45 4c 45   label-106..SELE
4890: 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 43 41  CT - - col0 + CA
48a0: 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
48b0: 4d 41 4c 20 29 20 2a 20 31 38 20 46 52 4f 4d 20  MAL ) * 18 FROM 
48c0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
48d0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
48e0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
48f0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
4900: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
4910: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 36  owsort label-106
4920: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
4930: 30 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  0 + CAST ( NULL 
4940: 41 53 20 52 45 41 4c 20 29 20 2a 20 31 38 20 46  AS REAL ) * 18 F
4950: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
4960: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
4970: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
4980: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4990: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
49a0: 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 30 20 29  ol0 * - ( col0 )
49b0: 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   * col2 AS col1 
49c0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
49d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 31  0..----..1225..1
49e0: 39 30 30 38 0d 0a 36 34 39 35 32 32 0d 0a 0d 0a  9008..649522....
49f0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
4a00: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
4a10: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
4a20: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
4a30: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 0d  wsort label-108.
4a40: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
4a50: 6c 32 20 44 49 56 20 28 20 63 6f 6c 30 20 2b 20  l2 DIV ( col0 + 
4a60: 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46  col0 ) AS col2 F
4a70: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
4a80: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 39 0d  ..----..0..0..9.
4a90: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
4aa0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
4ab0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4ac0: 74 20 6c 61 62 65 6c 2d 31 30 38 0d 0a 53 45 4c  t label-108..SEL
4ad0: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2f  ECT ALL + col2 /
4ae0: 20 28 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 29   ( col0 + col0 )
4af0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
4b00: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
4b10: 0d 0a 30 0d 0a 30 0d 0a 39 0d 0a 0d 0a 71 75 65  ..0..0..9....que
4b20: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4b30: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  LECT + col0 + - 
4b40: 28 20 2d 20 39 34 20 29 20 41 53 20 63 6f 6c 30  ( - 94 ) AS col0
4b50: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
4b60: 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d 0a 31 37 34 0d  .----..158..174.
4b70: 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .97....query I r
4b80: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
4b90: 20 63 6f 6c 31 20 2a 20 28 20 31 36 20 29 20 46   col1 * ( 16 ) F
4ba0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
4bb0: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32 0d 0a 34 39 36  ..----..272..496
4bc0: 0d 0a 39 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..944....query I
4bd0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4be0: 20 63 6f 6c 30 20 2a 20 28 20 2d 20 36 30 20 29   col0 * ( - 60 )
4bf0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
4c00: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
4c10: 0d 0a 2d 34 32 30 0d 0a 2d 34 36 38 30 0d 0a 2d  ..-420..-4680..-
4c20: 34 37 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4740....query I 
4c30: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4c40: 41 4c 4c 20 2b 20 39 30 20 2a 20 63 6f 6c 30 20  ALL + 90 * col0 
4c50: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
4c60: 32 0d 0a 2d 2d 2d 2d 0d 0a 36 33 30 0d 0a 37 30  2..----..630..70
4c70: 32 30 0d 0a 37 31 31 30 0d 0a 0d 0a 73 6b 69 70  20..7110....skip
4c80: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
4c90: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
4ca0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
4cb0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
4cc0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
4cd0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
4ce0: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2d   col1 * + col0 -
4cf0: 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20   col1 col1 FROM 
4d00: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 36  tab2..----..1326
4d10: 0d 0a 31 38 36 0d 0a 34 35 34 33 0d 0a 0d 0a 71  ..186..4543....q
4d20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4d30: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
4d40: 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  + + col2 * + col
4d50: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
4d60: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 37 0d  ab2..----..2087.
4d70: 0a 32 32 30 0d 0a 33 30 31 39 0d 0a 0d 0a 71 75  .220..3019....qu
4d80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4d90: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2d 20 74  ELECT - col0 - t
4da0: 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ab0.col1 FROM ta
4db0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a  b0..----..-110..
4dc0: 2d 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 6f 6e  -132..-180....on
4dd0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
4de0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
4df0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
4e00: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
4e10: 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 0d 0a 53  ort label-116..S
4e20: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 44  ELECT ALL col0 D
4e30: 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c  IV - col2 AS col
4e40: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
4e50: 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  -..-1..0..0....s
4e60: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
4e70: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
4e80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
4e90: 62 65 6c 2d 31 31 36 0d 0a 53 45 4c 45 43 54 20  bel-116..SELECT 
4ea0: 41 4c 4c 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  ALL col0 / - col
4eb0: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
4ec0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30  ab1..----..-1..0
4ed0: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
4ee0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
4ef0: 6f 6c 31 20 2f 20 2d 20 74 61 62 32 2e 63 6f 6c  ol1 / - tab2.col
4f00: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
4f10: 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 63 6f  ab2 WHERE NOT co
4f20: 6c 32 20 2a 20 74 61 62 32 2e 63 6f 6c 30 20 2d  l2 * tab2.col0 -
4f30: 20 2b 20 63 6f 6c 31 20 3c 3e 20 28 20 2b 20 63   + col1 <> ( + c
4f40: 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f  ol1 )..----....o
4f50: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
4f60: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
4f70: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
4f80: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
4f90: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 0d 0a  sort label-118..
4fa0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
4fb0: 31 20 2a 20 63 6f 6c 31 20 44 49 56 20 2b 20 74  1 * col1 DIV + t
4fc0: 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  ab2.col1 AS col1
4fd0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
4fe0: 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a  ..17..31..59....
4ff0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
5000: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
5010: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5020: 61 62 65 6c 2d 31 31 38 0d 0a 53 45 4c 45 43 54  abel-118..SELECT
5030: 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f   ALL + col1 * co
5040: 6c 31 20 2f 20 2b 20 74 61 62 32 2e 63 6f 6c 31  l1 / + tab2.col1
5050: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
5060: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31  b2..----..17..31
5070: 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..59....query I 
5080: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5090: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53  col0 * - col0 AS
50a0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
50b0: 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 30 20 3d  WHERE NOT col0 =
50c0: 20 28 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   ( col1 * + col2
50d0: 20 29 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d   )..----..-4096.
50e0: 0a 2d 36 34 30 30 0d 0a 2d 39 0d 0a 0d 0a 73 6b  .-6400..-9....sk
50f0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
5100: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
5110: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
5120: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
5130: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
5140: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
5150: 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30  LL col0 + + col0
5160: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
5170: 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a  .----..14..156..
5180: 31 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  158....query III
5190: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
51a0: 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45   * FROM tab0 WHE
51b0: 52 45 20 4e 4f 54 20 63 6f 6c 31 20 2a 20 63 6f  RE NOT col1 * co
51c0: 6c 30 20 2a 20 63 6f 6c 31 20 3e 20 28 20 4e 55  l0 * col1 > ( NU
51d0: 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  LL )..----....qu
51e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
51f0: 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 41 53 20  ELECT + col2 AS 
5200: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 57  col2 FROM tab2 W
5210: 48 45 52 45 20 4e 4f 54 20 28 20 4e 55 4c 4c 20  HERE NOT ( NULL 
5220: 29 20 3d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 0d  ) = col2 * col2.
5230: 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
5240: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5250: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
5260: 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a   * - tab2.col1 *
5270: 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
5280: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
5290: 0a 2d 31 31 39 36 35 32 0d 0a 2d 35 31 30 33 34  .-119652..-51034
52a0: 0d 0a 2d 35 38 35 39 0d 0a 0d 0a 71 75 65 72 79  ..-5859....query
52b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
52c0: 43 54 20 74 61 62 32 2e 63 6f 6c 32 20 2d 20 63  CT tab2.col2 - c
52d0: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
52e0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33   tab2..----..-33
52f0: 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72  ..-4..21....quer
5300: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5310: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33  ECT DISTINCT + 3
5320: 34 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  4 * - col0 AS co
5330: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
5340: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32  cor0..----..-102
5350: 0d 0a 2d 32 31 37 36 0d 0a 2d 32 37 32 30 0d 0a  ..-2176..-2720..
5360: 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
5370: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
5380: 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 63 6f  OM tab0 WHERE co
5390: 6c 30 20 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f  l0 NOT IN ( + co
53a0: 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l0 )..----....qu
53b0: 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
53c0: 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
53d0: 61 62 32 20 57 48 45 52 45 20 28 20 4e 55 4c 4c  ab2 WHERE ( NULL
53e0: 20 29 20 42 45 54 57 45 45 4e 20 2d 20 63 6f 6c   ) BETWEEN - col
53f0: 31 20 41 4e 44 20 28 20 2b 20 63 6f 6c 32 20 29  1 AND ( + col2 )
5400: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
5410: 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
5420: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
5430: 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e  ROM tab0 WHERE N
5440: 4f 54 20 28 20 4e 55 4c 4c 20 29 20 3c 3d 20 2b  OT ( NULL ) <= +
5450: 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f   col1..----....o
5460: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
5470: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
5480: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
5490: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
54a0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 0d 0a  sort label-129..
54b0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44 49  SELECT - col2 DI
54c0: 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  V col1 + col0 * 
54d0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
54e0: 2d 2d 2d 2d 0d 0a 31 33 34 31 0d 0a 32 31 37 0d  ----..1341..217.
54f0: 0a 34 36 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .4602....skipif 
5500: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
5510: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
5520: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
5530: 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  9..SELECT - col2
5540: 20 2f 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a   / col1 + col0 *
5550: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
5560: 0a 2d 2d 2d 2d 0d 0a 31 33 34 31 0d 0a 32 31 37  .----..1341..217
5570: 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20  ..4602....query 
5580: 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
5590: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
55a0: 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 28  ROM tab2 WHERE (
55b0: 20 4e 55 4c 4c 20 29 20 3c 3e 20 4e 55 4c 4c 0d   NULL ) <> NULL.
55c0: 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
55d0: 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
55e0: 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61  CT ALL * FROM ta
55f0: 62 30 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c  b0 WHERE NOT NUL
5600: 4c 20 3c 3d 20 2b 20 63 6f 6c 32 20 2d 20 2d 20  L <= + col2 - - 
5610: 63 6f 6c 32 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e  col2..----....on
5620: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
5630: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
5640: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
5650: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
5660: 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 0d 0a 53  ort label-132..S
5670: 45 4c 45 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c  ELECT + tab2.col
5680: 31 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20 2b  1 DIV + col0 + +
5690: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
56a0: 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 35 0d 0a 35  .----..17..35..5
56b0: 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
56c0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
56d0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
56e0: 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 0d 0a 53  ort label-132..S
56f0: 45 4c 45 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c  ELECT + tab2.col
5700: 31 20 2f 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  1 / + col0 + + c
5710: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
5720: 2d 2d 2d 0d 0a 31 37 0d 0a 33 35 0d 0a 35 39 0d  ---..17..35..59.
5730: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
5740: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
5750: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
5760: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
5770: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
5780: 33 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  33..SELECT + col
5790: 32 20 44 49 56 20 74 61 62 30 2e 63 6f 6c 30 20  2 DIV tab0.col0 
57a0: 2b 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  + tab0.col0 AS c
57b0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 57 48  ol1 FROM tab0 WH
57c0: 45 52 45 20 28 20 63 6f 6c 31 20 2a 20 2b 20 63  ERE ( col1 * + c
57d0: 6f 6c 32 20 29 20 4e 4f 54 20 49 4e 20 28 20 2d  ol2 ) NOT IN ( -
57e0: 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 32   col1 )..----..2
57f0: 35 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69  5..35..89....ski
5800: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
5810: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
5820: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
5830: 6c 2d 31 33 33 0d 0a 53 45 4c 45 43 54 20 2b 20  l-133..SELECT + 
5840: 63 6f 6c 32 20 2f 20 74 61 62 30 2e 63 6f 6c 30  col2 / tab0.col0
5850: 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20   + tab0.col0 AS 
5860: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 57  col1 FROM tab0 W
5870: 48 45 52 45 20 28 20 63 6f 6c 31 20 2a 20 2b 20  HERE ( col1 * + 
5880: 63 6f 6c 32 20 29 20 4e 4f 54 20 49 4e 20 28 20  col2 ) NOT IN ( 
5890: 2d 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a  - col1 )..----..
58a0: 32 35 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75  25..35..89....qu
58b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
58c0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
58d0: 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a   col1 + + col0 *
58e0: 20 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   0 AS col0 FROM 
58f0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
5900: 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35  --..-17..-31..-5
5910: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
5920: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
5930: 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   + - col0 * - co
5940: 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  l1 + - col0 + co
5950: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
5960: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
5970: 2d 2d 0d 0a 32 30 37 33 0d 0a 33 33 36 31 0d 0a  --..2073..3361..
5980: 38 30 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8092....query I 
5990: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
59a0: 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  ALL cor0.col1 * 
59b0: 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  - col0 + - col1 
59c0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
59d0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
59e0: 30 34 0d 0a 2d 31 30 35 33 0d 0a 2d 36 35 30 0d  04..-1053..-650.
59f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5a00: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
5a10: 4e 43 54 20 2d 20 2d 20 35 37 20 2a 20 2b 20 63  NCT - - 57 * + c
5a20: 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f  ol2 - + col1 FRO
5a30: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
5a40: 2d 2d 2d 2d 0d 0a 31 34 32 33 0d 0a 31 35 30 38  ----..1423..1508
5a50: 0d 0a 32 31 34 39 0d 0a 0d 0a 71 75 65 72 79 20  ..2149....query 
5a60: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5a70: 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 63  T ALL col0 * + c
5a80: 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 72  or0.col2 + - cor
5a90: 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52  0.col1 + col2 FR
5aa0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
5ab0: 0a 2d 2d 2d 2d 0d 0a 31 39 30 0d 0a 33 36 39 35  .----..190..3695
5ac0: 0d 0a 37 37 36 33 0d 0a 0d 0a 71 75 65 72 79 20  ..7763....query 
5ad0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5ae0: 54 20 2b 20 37 34 20 2a 20 2b 20 63 6f 6c 30 20  T + 74 * + col0 
5af0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
5b00: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 37 36 0d 0a 32  0..----..1776..2
5b10: 35 39 30 0d 0a 36 35 38 36 0d 0a 0d 0a 71 75 65  590..6586....que
5b20: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5b30: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
5b40: 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  - col2 * + col2 
5b50: 2a 20 34 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  * 40 + col0 FROM
5b60: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
5b70: 2d 2d 2d 0d 0a 32 36 39 30 34 39 0d 0a 34 33 35  ---..269049..435
5b80: 38 34 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20  84..75....query 
5b90: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5ba0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 31  T DISTINCT - ( 1
5bb0: 35 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  5 ) AS col0 FROM
5bc0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
5bd0: 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 63 6f  OSS JOIN tab2 co
5be0: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 0d  r1..----..-15...
5bf0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5c00: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34  ..SELECT ALL + 4
5c10: 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  6 AS col0 FROM t
5c20: 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab0 AS cor0 CROS
5c30: 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63  S JOIN tab2 AS c
5c40: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
5c50: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33  ues hashing to 3
5c60: 31 38 31 38 63 39 64 34 64 33 32 35 65 62 32 34  1818c9d4d325eb24
5c70: 38 37 33 35 63 39 37 63 62 31 64 63 65 33 39 0d  8735c97cb1dce39.
5c80: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
5c90: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
5ca0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
5cb0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
5cc0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
5cd0: 34 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  43..SELECT ALL c
5ce0: 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56  ol0 - + col2 DIV
5cf0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
5d00: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 35 39 0d 0a 37 33  .----..1..59..73
5d10: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
5d20: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
5d30: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
5d40: 72 74 20 6c 61 62 65 6c 2d 31 34 33 0d 0a 53 45  rt label-143..SE
5d50: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d 20  LECT ALL col0 - 
5d60: 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 46 52  + col2 / col1 FR
5d70: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
5d80: 0d 0a 35 39 0d 0a 37 33 0d 0a 0d 0a 73 6b 69 70  ..59..73....skip
5d90: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
5da0: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
5db0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
5dc0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
5dd0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
5de0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
5df0: 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63  ol0 * col1 + - c
5e00: 6f 6c 30 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ol0 - cor0.col1 
5e10: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
5e20: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
5e30: 34 37 0d 0a 31 37 39 0d 0a 34 34 36 35 0d 0a 0d  47..179..4465...
5e40: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
5e50: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
5e60: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
5e70: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
5e80: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
5e90: 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 0d 0a 53  ort label-145..S
5ea0: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d  ELECT - col1 * -
5eb0: 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2d 20 43   cor0.col2 - - C
5ec0: 41 53 54 28 20 2d 20 63 6f 6c 32 20 2b 20 2d 20  AST( - col2 + - 
5ed0: 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29  col0 AS SIGNED )
5ee0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
5ef0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
5f00: 0d 0a 32 37 38 31 0d 0a 36 31 0d 0a 37 32 39 31  ..2781..61..7291
5f10: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
5f20: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
5f30: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
5f40: 72 74 20 6c 61 62 65 6c 2d 31 34 35 0d 0a 53 45  rt label-145..SE
5f50: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  LECT - col1 * - 
5f60: 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2d 20 43 41  cor0.col2 - - CA
5f70: 53 54 20 28 20 2d 20 63 6f 6c 32 20 2b 20 2d 20  ST ( - col2 + - 
5f80: 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20  col0 AS INTEGER 
5f90: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
5fa0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
5fb0: 2d 0d 0a 32 37 38 31 0d 0a 36 31 0d 0a 37 32 39  -..2781..61..729
5fc0: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
5fd0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
5fe0: 20 34 38 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20   48 + col1 FROM 
5ff0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
6000: 2d 2d 0d 0a 35 38 0d 0a 36 31 0d 0a 37 34 0d 0a  --..58..61..74..
6010: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6020: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
6030: 39 38 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46  98 * cor0.col0 F
6040: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
6050: 2d 2d 2d 0d 0a 32 33 35 32 0d 0a 33 34 33 30 0d  ---..2352..3430.
6060: 0a 38 37 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .8722....query I
6070: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6080: 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   - col1 + + col1
6090: 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
60a0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
60b0: 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a  .-17..-31..-59..
60c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
60d0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
60e0: 43 54 20 31 31 20 2a 20 2d 20 63 6f 6c 32 20 2b  CT 11 * - col2 +
60f0: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
6100: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
6110: 0a 2d 33 31 32 0d 0a 2d 33 32 34 0d 0a 2d 34 35  .-312..-324..-45
6120: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
6130: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
6140: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
6150: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
6160: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
6170: 2d 31 35 30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -150..SELECT col
6180: 31 20 2a 20 32 33 20 2b 20 2b 20 32 20 44 49 56  1 * 23 + + 2 DIV
6190: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
61a0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 38  cor0..----..1978
61b0: 0d 0a 32 30 39 33 0d 0a 32 32 33 31 0d 0a 0d 0a  ..2093..2231....
61c0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
61d0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
61e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
61f0: 61 62 65 6c 2d 31 35 30 0d 0a 53 45 4c 45 43 54  abel-150..SELECT
6200: 20 63 6f 6c 31 20 2a 20 32 33 20 2b 20 2b 20 32   col1 * 23 + + 2
6210: 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
6220: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  0 cor0..----..19
6230: 37 38 0d 0a 32 30 39 33 0d 0a 32 32 33 31 0d 0a  78..2093..2231..
6240: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6250: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
6260: 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
6270: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
6280: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
6290: 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab1, tab0 AS cor
62a0: 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 32 0d  1, tab1 AS cor2.
62b0: 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73  .----..81 values
62c0: 20 68 61 73 68 69 6e 67 20 74 6f 20 30 35 38 33   hashing to 0583
62d0: 35 66 32 39 64 64 39 63 64 34 66 61 31 36 38 38  5f29dd9cd4fa1688
62e0: 39 64 65 35 34 64 65 63 33 63 62 36 0d 0a 0d 0a  9de54dec3cb6....
62f0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
6300: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
6310: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
6320: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
6330: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
6340: 72 74 20 6c 61 62 65 6c 2d 31 35 32 0d 0a 53 45  rt label-152..SE
6350: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
6360: 2b 20 43 41 53 54 28 20 74 61 62 31 2e 63 6f 6c  + CAST( tab1.col
6370: 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  2 AS SIGNED ) AS
6380: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c   col0 FROM tab1,
6390: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
63a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  or0..----..54..5
63b0: 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  7..96....skipif 
63c0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
63d0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
63e0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
63f0: 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
6400: 43 54 20 2b 20 2b 20 43 41 53 54 20 28 20 74 61  CT + + CAST ( ta
6410: 62 31 2e 63 6f 6c 32 20 41 53 20 49 4e 54 45 47  b1.col2 AS INTEG
6420: 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ER ) AS col0 FRO
6430: 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61  M tab1, tab0, ta
6440: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
6450: 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a  ..54..57..96....
6460: 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
6470: 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
6480: 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52  CT DISTINCT * FR
6490: 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 63 6f  OM tab2, tab2 co
64a0: 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
64b0: 2c 20 74 61 62 30 20 63 6f 72 32 0d 0a 2d 2d 2d  , tab0 cor2..---
64c0: 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61  -..972 values ha
64d0: 73 68 69 6e 67 20 74 6f 20 65 38 34 31 35 32 63  shing to e84152c
64e0: 30 62 66 34 33 36 31 37 37 64 33 62 33 64 38 30  0bf436177d3b3d80
64f0: 65 34 32 38 33 32 64 34 66 0d 0a 0d 0a 71 75 65  e42832d4f....que
6500: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
6510: 4c 45 43 54 20 63 6f 6c 32 20 2a 20 31 37 20 2b  LECT col2 * 17 +
6520: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
6530: 0a 2d 2d 2d 2d 0d 0a 31 34 37 36 0d 0a 31 38 0d  .----..1476..18.
6540: 0a 35 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .594....query I 
6550: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6560: 41 4c 4c 20 2d 20 2d 20 34 35 20 2a 20 63 6f 6c  ALL - - 45 * col
6570: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
6580: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 37 30 0d  or0..----..3870.
6590: 0a 34 30 39 35 0d 0a 34 33 36 35 0d 0a 0d 0a 71  .4095..4365....q
65a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
65b0: 53 45 4c 45 43 54 20 2d 20 35 39 20 2a 20 63 6f  SELECT - 59 * co
65c0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
65d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 33 0d 0a 2d  0..----..-413..-
65e0: 34 36 30 32 0d 0a 2d 34 36 36 31 0d 0a 0d 0a 71  4602..-4661....q
65f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6600: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
6610: 2b 20 2b 20 38 20 2a 20 2b 20 63 6f 6c 32 20 41  + + 8 * + col2 A
6620: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
6630: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6640: 32 30 38 0d 0a 32 31 36 0d 0a 33 30 34 0d 0a 0d  208..216..304...
6650: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6660: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 34  ..SELECT ALL - 4
6670: 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  0 * + col0 AS co
6680: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
6690: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 30  cor0..----..-120
66a0: 0d 0a 2d 32 35 36 30 0d 0a 2d 33 32 30 30 0d 0a  ..-2560..-3200..
66b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
66c0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
66d0: 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  CT - col2 * - co
66e0: 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41  l0 * cor0.col2 A
66f0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
6700: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6710: 32 30 37 39 33 36 0d 0a 37 33 37 32 38 30 0d 0a  207936..737280..
6720: 38 37 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8748....query I 
6730: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6740: 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 39 33 20  DISTINCT + - 93 
6750: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
6760: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6770: 2d 33 30 36 39 0d 0a 2d 37 36 32 36 0d 0a 2d 39  -3069..-7626..-9
6780: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
6790: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
67a0: 20 2d 20 39 20 2b 20 63 6f 6c 32 20 41 53 20 63   - 9 + col2 AS c
67b0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
67c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d   cor0..----..-8.
67d0: 0a 32 34 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79  .24..73....query
67e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
67f0: 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  CT + + col0 * - 
6800: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53  col0 * - col2 AS
6810: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
6820: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
6830: 32 32 35 0d 0a 31 39 30 30 38 0d 0a 36 34 39 35  225..19008..6495
6840: 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  22....query I ro
6850: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
6860: 53 54 49 4e 43 54 20 32 20 2b 20 63 6f 6c 31 20  STINCT 2 + col1 
6870: 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * + col0 FROM ta
6880: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
6890: 0d 0a 31 33 34 35 0d 0a 32 31 39 0d 0a 34 36 30  ..1345..219..460
68a0: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
68b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
68c0: 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  ol2 + col0 + - c
68d0: 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63  ol0 * col1 * - c
68e0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
68f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35   cor0..----..135
6900: 30 34 0d 0a 31 39 37 37 0d 0a 36 34 30 37 0d 0a  04..1977..6407..
6910: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6920: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
6930: 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a   - col0 * col1 *
6940: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
6950: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
6960: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 35 39 33 0d 0a  .----..-119593..
6970: 2d 35 31 30 31 37 0d 0a 2d 35 38 32 38 0d 0a 0d  -51017..-5828...
6980: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6990: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
69a0: 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  * + col0 + + col
69b0: 31 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  1 + - col0 FROM 
69c0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
69d0: 2d 2d 0d 0a 2d 34 31 35 30 0d 0a 2d 36 34 36 37  --..-4150..-6467
69e0: 0d 0a 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..14....query I 
69f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6a00: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
6a10: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2b 20  col2 * col2 + + 
6a20: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53  col1 * + col2 AS
6a30: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
6a40: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
6a50: 31 35 31 32 0d 0a 2d 32 36 37 39 0d 0a 2d 37 39  1512..-2679..-79
6a60: 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  68....onlyif mys
6a70: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
6a80: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
6a90: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
6aa0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
6ab0: 6c 2d 31 36 38 0d 0a 53 45 4c 45 43 54 20 41 4c  l-168..SELECT AL
6ac0: 4c 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20  L col2 DIV col2 
6ad0: 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  + col2 * - col0 
6ae0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
6af0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
6b00: 34 0d 0a 2d 37 32 39 37 0d 0a 2d 37 39 31 0d 0a  4..-7297..-791..
6b10: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
6b20: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
6b30: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
6b40: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
6b50: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
6b60: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
6b70: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
6b80: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
6b90: 31 36 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  168..SELECT ALL 
6ba0: 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 2b 20 63 6f  col2 / col2 + co
6bb0: 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 31  l2 * - col0 col1
6bc0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
6bd0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d  r0..----..-34..-
6be0: 37 32 39 37 0d 0a 2d 37 39 31 0d 0a 0d 0a 71 75  7297..-791....qu
6bf0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6c00: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 28 20  ELECT ALL + + ( 
6c10: 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31  + col0 ) AS col1
6c20: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
6c30: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d  r0..----..7..78.
6c40: 0a 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .79....onlyif my
6c50: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
6c60: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
6c70: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
6c80: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
6c90: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
6ca0: 31 37 30 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  170..SELECT CAST
6cb0: 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41  ( NULL AS DECIMA
6cc0: 4c 20 29 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20  L ) + col0 col2 
6cd0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
6ce0: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
6cf0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
6d00: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
6d10: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
6d20: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
6d30: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
6d40: 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
6d50: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
6d60: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
6d70: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 30 0d 0a  sort label-170..
6d80: 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55  SELECT CAST ( NU
6d90: 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2b 20 63  LL AS REAL ) + c
6da0: 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol0 col2 FROM ta
6db0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
6dc0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
6dd0: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
6de0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
6df0: 4c 20 2b 20 2d 20 34 31 20 2a 20 2d 20 33 33 20  L + - 41 * - 33 
6e00: 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  * - col1 AS col0
6e10: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
6e20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 30 30 31  r0..----..-23001
6e30: 0d 0a 2d 34 31 39 34 33 0d 0a 2d 37 39 38 32 37  ..-41943..-79827
6e40: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6e50: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
6e60: 34 30 20 2b 20 2b 20 34 39 20 2b 20 63 6f 6c 30  40 + + 49 + col0
6e70: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
6e80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 37 0d 0a 31  r0..----..167..1
6e90: 36 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  68..96....query 
6ea0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6eb0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2b  T DISTINCT + ( +
6ec0: 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20 2d   cor0.col0 ) + -
6ed0: 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 46   col1 * - col2 F
6ee0: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
6ef0: 2d 2d 2d 0d 0a 31 33 32 38 0d 0a 31 34 30 37 0d  ---..1328..1407.
6f00: 0a 36 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .634....query I 
6f10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6f20: 44 49 53 54 49 4e 43 54 20 2d 20 28 20 63 6f 6c  DISTINCT - ( col
6f30: 32 20 29 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  2 ) * col1 AS co
6f40: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
6f50: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33  cor0..----..-283
6f60: 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d  8..-7462..-97...
6f70: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6f80: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
6f90: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63  ol2 * - col0 * c
6fa0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
6fb0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   cor0..----..-23
6fc0: 33 34 37 32 0d 0a 2d 34 38 36 0d 0a 2d 36 31 34  3472..-486..-614
6fd0: 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  400....query I r
6fe0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
6ff0: 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62 32 2e 63   col0 * + tab2.c
7000: 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol1 + col1 * col
7010: 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  0 * + col1 AS co
7020: 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
7030: 2d 2d 0d 0a 32 31 34 38 38 0d 0a 32 36 36 39 31  --..21488..26691
7040: 36 0d 0a 36 35 31 30 0d 0a 0d 0a 73 6b 69 70 69  6..6510....skipi
7050: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
7060: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
7070: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
7080: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
7090: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
70a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
70b0: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 63 6f  col2 * + col2 co
70c0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
70d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39  0..----..1..1089
70e0: 0d 0a 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20  ..6724....query 
70f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7100: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33 31 20  T DISTINCT + 31 
7110: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
7120: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a  cor0..----..31..
7130: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7140: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
7150: 28 20 36 37 20 29 20 41 53 20 63 6f 6c 30 20 46  ( 67 ) AS col0 F
7160: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
7170: 36 37 0d 0a 36 37 0d 0a 36 37 0d 0a 0d 0a 71 75  67..67..67....qu
7180: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7190: 45 4c 45 43 54 20 2d 20 32 35 20 2a 20 2d 20 63  ELECT - 25 * - c
71a0: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
71b0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
71c0: 0d 0a 31 36 30 30 0d 0a 32 30 30 30 0d 0a 37 35  ..1600..2000..75
71d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
71e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
71f0: 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  l0 + col1 * + co
7200: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
7210: 2d 2d 0d 0a 33 36 0d 0a 36 37 33 0d 0a 38 39 0d  --..36..673..89.
7220: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
7230: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
7240: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
7250: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
7260: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
7270: 38 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  82..SELECT ALL +
7280: 20 39 34 20 44 49 56 20 28 20 2d 20 63 6f 6c 30   94 DIV ( - col0
7290: 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 29   * + tab1.col1 )
72a0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
72b0: 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  ..-1..0..0....sk
72c0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
72d0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
72e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
72f0: 65 6c 2d 31 38 32 0d 0a 53 45 4c 45 43 54 20 41  el-182..SELECT A
7300: 4c 4c 20 2b 20 39 34 20 2f 20 28 20 2d 20 63 6f  LL + 94 / ( - co
7310: 6c 30 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 31  l0 * + tab1.col1
7320: 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d   ) FROM tab1..--
7330: 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a  --..-1..0..0....
7340: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7350: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
7360: 20 2d 20 28 20 28 20 2d 20 63 6f 6c 32 20 29 20   - ( ( - col2 ) 
7370: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
7380: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33  ab0..----..1..33
7390: 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..82....query I 
73a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
73b0: 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c  DISTINCT ( + col
73c0: 30 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  0 ) * col0 AS co
73d0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
73e0: 2d 2d 0d 0a 34 30 39 36 0d 0a 36 34 30 30 0d 0a  --..4096..6400..
73f0: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
7400: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
7410: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
7420: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
7430: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
7440: 2d 31 38 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -185..SELECT col
7450: 31 20 44 49 56 20 2d 20 33 39 20 41 53 20 63 6f  1 DIV - 39 AS co
7460: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
7470: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
7480: 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
7490: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
74a0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
74b0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38 35 0d  wsort label-185.
74c0: 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20 2d  .SELECT col1 / -
74d0: 20 33 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   39 AS col2 FROM
74e0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
74f0: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
7500: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
7510: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
7520: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
7530: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
7540: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
7550: 72 74 20 6c 61 62 65 6c 2d 31 38 36 0d 0a 53 45  rt label-186..SE
7560: 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 28  LECT ALL + CAST(
7570: 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
7580: 20 29 20 2a 20 2b 20 39 30 20 63 6f 6c 32 20 46   ) * + 90 col2 F
7590: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
75a0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
75b0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
75c0: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
75d0: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
75e0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
75f0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
7600: 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
7610: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
7620: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
7630: 6f 72 74 20 6c 61 62 65 6c 2d 31 38 36 0d 0a 53  ort label-186..S
7640: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54  ELECT ALL + CAST
7650: 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20   ( NULL AS REAL 
7660: 29 20 2a 20 2b 20 39 30 20 63 6f 6c 32 20 46 52  ) * + 90 col2 FR
7670: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
7680: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
7690: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
76a0: 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
76b0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20  LECT DISTINCT * 
76c0: 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
76d0: 4e 55 4c 4c 20 3c 20 63 6f 6c 32 0d 0a 2d 2d 2d  NULL < col2..---
76e0: 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  -....query III r
76f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
7700: 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74  ISTINCT * FROM t
7710: 61 62 30 20 57 48 45 52 45 20 2b 20 63 6f 6c 30  ab0 WHERE + col0
7720: 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e   BETWEEN NULL AN
7730: 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  D NULL..----....
7740: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
7750: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
7760: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
7770: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
7780: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
7790: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
77a0: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a   col0 + - col2 *
77b0: 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f   + col2 col1 FRO
77c0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
77d0: 30 36 35 0d 0a 2d 36 36 33 35 0d 0a 33 34 0d 0a  065..-6635..34..
77e0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
77f0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
7800: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
7810: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
7820: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
7830: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7840: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20  CT ALL - col1 + 
7850: 74 61 62 31 2e 63 6f 6c 32 20 63 6f 6c 32 20 46  tab1.col2 col2 F
7860: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
7870: 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 71 75  28..47..83....qu
7880: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7890: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
78a0: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ol0 + - col2 AS 
78b0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
78c0: 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34 31 0d 0a 35  ----..-20..41..5
78d0: 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
78e0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
78f0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
7900: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
7910: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
7920: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7930: 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c  ELECT col1 + col
7940: 32 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  2 * - tab1.col0 
7950: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
7960: 2d 2d 2d 2d 0d 0a 2d 31 33 36 0d 0a 2d 33 36 33  ----..-136..-363
7970: 38 0d 0a 2d 37 36 36 37 0d 0a 0d 0a 71 75 65 72  8..-7667....quer
7980: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7990: 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63  ECT ALL col0 * c
79a0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 57 48  ol2 FROM tab2 WH
79b0: 45 52 45 20 4e 4f 54 20 28 20 2b 20 63 6f 6c 32  ERE NOT ( + col2
79c0: 20 2f 20 2b 20 63 6f 6c 31 20 29 20 3c 3e 20 4e   / + col1 ) <> N
79d0: 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ULL..----....que
79e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
79f0: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 41 53 20 63  LECT - col0 AS c
7a00: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
7a10: 20 63 6f 72 30 20 57 48 45 52 45 20 4e 4f 54 20   cor0 WHERE NOT 
7a20: 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  col1 + cor0.col2
7a30: 20 2d 20 63 6f 6c 31 20 4e 4f 54 20 49 4e 20 28   - col1 NOT IN (
7a40: 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 29   + col0 * col0 )
7a50: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
7a60: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7a70: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
7a80: 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col0 * + cor0.co
7a90: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
7aa0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35  cor0..----..1225
7ab0: 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a 71  ..576..7921....q
7ac0: 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
7ad0: 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
7ae0: 74 61 62 31 20 41 53 20 63 6f 72 30 20 57 48 45  tab1 AS cor0 WHE
7af0: 52 45 20 2d 20 63 6f 6c 32 20 4e 4f 54 20 49 4e  RE - col2 NOT IN
7b00: 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( - cor0.col0 )
7b10: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
7b20: 20 68 61 73 68 69 6e 67 20 74 6f 20 38 64 36 36   hashing to 8d66
7b30: 39 32 65 36 64 34 31 35 30 35 63 33 61 64 34 32  92e6d41505c3ad42
7b40: 64 39 31 39 62 64 39 65 63 64 30 64 0d 0a 0d 0a  d919bd9ecd0d....
7b50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7b60: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
7b70: 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  l2 * col1 + col1
7b80: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
7b90: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 35 0d  b1..----..-1235.
7ba0: 0a 2d 31 33 37 38 0d 0a 2d 35 36 30 0d 0a 0d 0a  .-1378..-560....
7bb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7bc0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
7bd0: 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l1 * col1 + + co
7be0: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
7bf0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 35 35 39  tab2..----..3559
7c00: 0d 0a 33 36 38 0d 0a 39 36 38 0d 0a 0d 0a 71 75  ..368..968....qu
7c10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7c20: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
7c30: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63   col0 + - cor0.c
7c40: 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 * col0 AS co
7c50: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
7c60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 36  cor0..----..-576
7c70: 0d 0a 2d 37 35 0d 0a 2d 39 36 30 0d 0a 0d 0a 71  ..-75..-960....q
7c80: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7c90: 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32  SELECT cor0.col2
7ca0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
7cb0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
7cc0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a  or0..----..171..
7cd0: 33 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20  36..57....query 
7ce0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7cf0: 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 63  T ALL + col1 + c
7d00: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63  ol1 * + col1 + c
7d10: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
7d20: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  b2 cor0..----..3
7d30: 36 31 38 0d 0a 33 38 35 0d 0a 39 39 39 0d 0a 0d  618..385..999...
7d40: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7d50: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
7d60: 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  T - col0 + - col
7d70: 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  0 * cor0.col1 FR
7d80: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
7d90: 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 38 0d 0a 2d 33  .----..-2088..-3
7da0: 34 33 30 0d 0a 2d 38 31 38 38 0d 0a 0d 0a 6f 6e  430..-8188....on
7db0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
7dc0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
7dd0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
7de0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
7df0: 6f 72 74 20 6c 61 62 65 6c 2d 32 30 33 0d 0a 53  ort label-203..S
7e00: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 44  ELECT ALL col0 D
7e10: 49 56 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  IV - col0 + - co
7e20: 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46  l2 * cor0.col2 F
7e30: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
7e40: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 37 0d 0a 2d  ..----..-2917..-
7e50: 33 32 35 30 0d 0a 2d 39 32 31 37 0d 0a 0d 0a 73  3250..-9217....s
7e60: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
7e70: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
7e80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
7e90: 62 65 6c 2d 32 30 33 0d 0a 53 45 4c 45 43 54 20  bel-203..SELECT 
7ea0: 41 4c 4c 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  ALL col0 / - col
7eb0: 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72  0 + - col2 * cor
7ec0: 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0.col2 FROM tab1
7ed0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7ee0: 2d 32 39 31 37 0d 0a 2d 33 32 35 30 0d 0a 2d 39  -2917..-3250..-9
7ef0: 32 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  217....query I r
7f00: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
7f10: 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63   col1 * - cor0.c
7f20: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63  ol0 + - col0 * c
7f30: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
7f40: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37   cor0..----..-47
7f50: 33 36 0d 0a 2d 37 34 34 30 0d 0a 2d 38 37 0d 0a  36..-7440..-87..
7f60: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
7f70: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
7f80: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
7f90: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
7fa0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30  rowsort label-20
7fb0: 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
7fc0: 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 44  CT - cor0.col2 D
7fd0: 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  IV + cor0.col0 +
7fe0: 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2d   col2 * + col1 -
7ff0: 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
8000: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
8010: 2d 2d 2d 2d 0d 0a 31 35 36 30 0d 0a 36 38 34 0d  ----..1560..684.
8020: 0a 38 36 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .861....skipif m
8030: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
8040: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
8050: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30 35  owsort label-205
8060: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
8070: 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20  T - cor0.col2 / 
8080: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f  + cor0.col0 + co
8090: 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 2d 20  l2 * + col1 - - 
80a0: 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
80b0: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
80c0: 2d 0d 0a 31 35 36 30 0d 0a 36 38 34 0d 0a 38 36  -..1560..684..86
80d0: 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
80e0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
80f0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
8100: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
8110: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8120: 2d 32 30 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -206..SELECT ALL
8130: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56   - cor0.col1 DIV
8140: 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   + col1 + + col1
8150: 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
8160: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
8170: 2d 0d 0a 31 36 38 0d 0a 36 37 35 0d 0a 39 39 0d  -..168..675..99.
8180: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
8190: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
81a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
81b0: 74 20 6c 61 62 65 6c 2d 32 30 36 0d 0a 53 45 4c  t label-206..SEL
81c0: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
81d0: 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20 2b 20 2b  ol1 / + col1 + +
81e0: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46   col1 * + col1 F
81f0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
8200: 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 0d 0a 36 37 35  ..----..168..675
8210: 0d 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..99....query I 
8220: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8230: 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + - col2 * - col
8240: 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  1 + cor0.col0 FR
8250: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
8260: 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36 32  .----..132..2862
8270: 0d 0a 37 35 35 31 0d 0a 0d 0a 71 75 65 72 79 20  ..7551....query 
8280: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8290: 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 31 2e  T DISTINCT tab1.
82a0: 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53  col1 + - col1 AS
82b0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
82c0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .----..0....only
82d0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
82e0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
82f0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
8300: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8310: 74 20 6c 61 62 65 6c 2d 32 30 39 0d 0a 53 45 4c  t label-209..SEL
8320: 45 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20  ECT + tab2.col2 
8330: 44 49 56 20 2b 20 32 32 20 46 52 4f 4d 20 74 61  DIV + 22 FROM ta
8340: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a  b2..----..1..1..
8350: 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
8360: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
8370: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
8380: 6f 72 74 20 6c 61 62 65 6c 2d 32 30 39 0d 0a 53  ort label-209..S
8390: 45 4c 45 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c  ELECT + tab2.col
83a0: 32 20 2f 20 2b 20 32 32 20 46 52 4f 4d 20 74 61  2 / + 22 FROM ta
83b0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a  b2..----..1..1..
83c0: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
83d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
83e0: 6f 6c 30 20 2b 20 2b 20 38 37 20 2a 20 2d 20 63  ol0 + + 87 * - c
83f0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
8400: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
8410: 30 30 0d 0a 2d 32 36 39 30 0d 0a 2d 35 30 35 35  00..-2690..-5055
8420: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8430: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
8440: 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41   - - cor0.col1 A
8450: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
8460: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8470: 31 31 38 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71  118..34..62....q
8480: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8490: 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32  SELECT cor0.col2
84a0: 20 2a 20 32 34 20 2a 20 2b 20 63 6f 6c 32 20 2b   * 24 * + col2 +
84b0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
84c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 34  cor0..----..1614
84d0: 36 35 0d 0a 32 36 31 36 30 0d 0a 35 39 0d 0a 0d  65..26160..59...
84e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
84f0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
8500: 35 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  58 AS col0 FROM 
8510: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
8520: 2d 2d 0d 0a 31 37 39 38 0d 0a 33 34 32 32 0d 0a  --..1798..3422..
8530: 39 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  986....query I r
8540: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
8550: 49 53 54 49 4e 43 54 20 2d 20 2d 20 33 30 20 2b  ISTINCT - - 30 +
8560: 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46   col2 * + col1 F
8570: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
8580: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 34 0d 0a 36 37  ..----..1564..67
8590: 36 0d 0a 38 36 37 0d 0a 0d 0a 71 75 65 72 79 20  6..867....query 
85a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
85b0: 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 28 20 2d  T - - col1 + ( -
85c0: 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f   cor0.col2 ) FRO
85d0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
85e0: 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39 36 0d  ----..53..9..96.
85f0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
8600: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
8610: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
8620: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
8630: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
8640: 31 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  16..SELECT ALL +
8650: 20 43 41 53 54 28 20 2d 20 63 6f 6c 31 20 41 53   CAST( - col1 AS
8660: 20 53 49 47 4e 45 44 20 29 20 2d 20 63 6f 6c 30   SIGNED ) - col0
8670: 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c   DIV col1 AS col
8680: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
8690: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a  or0..----..-21..
86a0: 2d 33 31 0d 0a 2d 36 30 0d 0a 0d 0a 73 6b 69 70  -31..-60....skip
86b0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
86c0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
86d0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
86e0: 2d 32 31 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -216..SELECT ALL
86f0: 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 31   + CAST ( - col1
8700: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20   AS INTEGER ) - 
8710: 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 41 53 20 63  col0 / col1 AS c
8720: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
8730: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   cor0..----..-21
8740: 0d 0a 2d 33 31 0d 0a 2d 36 30 0d 0a 0d 0a 71 75  ..-31..-60....qu
8750: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8760: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b  ELECT - col0 + +
8770: 20 31 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   19 AS col2 FROM
8780: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
8790: 2d 2d 2d 0d 0a 2d 34 35 0d 0a 2d 36 31 0d 0a 31  ---..-45..-61..1
87a0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
87b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
87c0: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30   + col1 * + col0
87d0: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   + - col2 * col1
87e0: 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t
87f0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
8800: 2d 0d 0a 2d 38 30 37 0d 0a 33 32 39 37 0d 0a 35  -..-807..3297..5
8810: 35 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  55....onlyif mys
8820: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
8830: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
8840: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
8850: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
8860: 6c 2d 32 31 39 0d 0a 53 45 4c 45 43 54 20 44 49  l-219..SELECT DI
8870: 53 54 49 4e 43 54 20 2d 20 28 20 2d 20 36 33 20  STINCT - ( - 63 
8880: 29 20 2d 20 2d 20 63 6f 6c 32 20 44 49 56 20 43  ) - - col2 DIV C
8890: 41 53 54 28 20 2b 20 28 20 63 6f 6c 31 20 29 20  AST( + ( col1 ) 
88a0: 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
88b0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
88c0: 2d 2d 2d 0d 0a 36 35 0d 0a 36 38 0d 0a 37 30 0d  ---..65..68..70.
88d0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
88e0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
88f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8900: 74 20 6c 61 62 65 6c 2d 32 31 39 0d 0a 53 45 4c  t label-219..SEL
8910: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
8920: 20 2d 20 36 33 20 29 20 2d 20 2d 20 63 6f 6c 32   - 63 ) - - col2
8930: 20 2f 20 43 41 53 54 20 28 20 2b 20 28 20 63 6f   / CAST ( + ( co
8940: 6c 31 20 29 20 41 53 20 49 4e 54 45 47 45 52 20  l1 ) AS INTEGER 
8950: 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
8960: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 35 0d 0a 36  or0..----..65..6
8970: 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  8..70....query I
8980: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8990: 20 2d 20 2b 20 34 20 2b 20 2b 20 63 6f 6c 31 20   - + 4 + + col1 
89a0: 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  * + col2 * + cor
89b0: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0.col0 FROM tab2
89c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
89d0: 31 31 39 36 34 38 0d 0a 35 31 30 33 30 0d 0a 35  119648..51030..5
89e0: 38 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  855....query I r
89f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
8a00: 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   - col1 * - col0
8a10: 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + + col0 AS col
8a20: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
8a30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d  or0..----..1120.
8a40: 0a 37 30 34 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70  .704..81....skip
8a50: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
8a60: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
8a70: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
8a80: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
8a90: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
8aa0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
8ab0: 20 37 20 2b 20 2d 20 63 6f 6c 32 20 63 6f 6c 30   7 + - col2 col0
8ac0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
8ad0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 0d 0a  r0..----..-103..
8ae0: 2d 36 31 0d 0a 2d 36 34 0d 0a 0d 0a 71 75 65 72  -61..-64....quer
8af0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8b00: 45 43 54 20 2b 20 38 38 20 2a 20 63 6f 6c 32 20  ECT + 88 * col2 
8b10: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
8b20: 30 0d 0a 2d 2d 2d 2d 0d 0a 34 37 35 32 0d 0a 35  0..----..4752..5
8b30: 30 31 36 0d 0a 38 34 34 38 0d 0a 0d 0a 73 6b 69  016..8448....ski
8b40: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
8b50: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
8b60: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
8b70: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
8b80: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
8b90: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
8ba0: 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col0 + - cor0.co
8bb0: 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
8bc0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
8bd0: 0a 2d 32 30 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a  .-20..41..52....
8be0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
8bf0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
8c00: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
8c10: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
8c20: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 35 0d  wsort label-225.
8c30: 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 30  .SELECT ( + col0
8c40: 20 29 20 2a 20 63 6f 6c 30 20 44 49 56 20 33 38   ) * col0 DIV 38
8c50: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
8c60: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 30 37  r0..----..0..107
8c70: 0d 0a 31 36 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..168....skipif 
8c80: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
8c90: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
8ca0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32  rowsort label-22
8cb0: 35 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f  5..SELECT ( + co
8cc0: 6c 30 20 29 20 2a 20 63 6f 6c 30 20 2f 20 33 38  l0 ) * col0 / 38
8cd0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
8ce0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 30 37  r0..----..0..107
8cf0: 0d 0a 31 36 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..168....skipif 
8d00: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
8d10: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
8d20: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
8d30: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
8d40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8d50: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
8d60: 20 2b 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46   + - col2 col0 F
8d70: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
8d80: 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 31 31 34 0d  ---..-108..-114.
8d90: 0a 2d 31 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-192....query I
8da0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8db0: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   + col1 * + col1
8dc0: 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + + col1 * + co
8dd0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
8de0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 32  cor0..----..1922
8df0: 0d 0a 35 37 38 0d 0a 36 39 36 32 0d 0a 0d 0a 71  ..578..6962....q
8e00: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8e10: 53 45 4c 45 43 54 20 2d 20 34 20 46 52 4f 4d 20  SELECT - 4 FROM 
8e20: 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
8e30: 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
8e40: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
8e50: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 39 65  s hashing to 39e
8e60: 64 32 33 34 37 35 34 31 32 63 33 63 62 62 61 30  d23475412c3cbba0
8e70: 32 65 63 64 64 32 64 37 30 31 38 65 36 0d 0a 0d  2ecdd2d7018e6...
8e80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8e90: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72  ..SELECT + + cor
8ea0: 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53  0.col2 + col1 AS
8eb0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
8ec0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
8ed0: 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 73  19..173..98....s
8ee0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
8ef0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
8f00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8f10: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
8f20: 6f 6c 32 20 2f 20 2d 20 43 41 53 54 20 28 20 63  ol2 / - CAST ( c
8f30: 6f 6c 32 20 41 53 20 52 45 41 4c 20 29 20 2b 20  ol2 AS REAL ) + 
8f40: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
8f50: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
8f60: 0d 0a 32 35 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79  ..25..9....query
8f70: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8f80: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
8f90: 6c 30 20 2b 20 2d 20 28 20 28 20 2b 20 63 6f 6c  l0 + - ( ( + col
8fa0: 31 20 29 20 29 20 46 52 4f 4d 20 74 61 62 30 20  1 ) ) FROM tab0 
8fb0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
8fc0: 32 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72 79 20  2..-62....query 
8fd0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8fe0: 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63  T + + col1 + - c
8ff0: 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 * col0 FROM 
9000: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
9010: 2d 2d 0d 0a 2d 31 39 37 38 0d 0a 2d 33 32 39 38  --..-1978..-3298
9020: 0d 0a 2d 38 30 30 38 0d 0a 0d 0a 71 75 65 72 79  ..-8008....query
9030: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9040: 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  CT + - col2 * + 
9050: 28 20 36 31 20 29 20 46 52 4f 4d 20 74 61 62 30  ( 61 ) FROM tab0
9060: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9070: 2d 32 30 31 33 0d 0a 2d 35 30 30 32 0d 0a 2d 36  -2013..-5002..-6
9080: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
9090: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
90a0: 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63  TINCT col2 * - c
90b0: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  or0.col1 AS col1
90c0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
90d0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d  r0..----..-1534.
90e0: 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 73  .-646..-837....s
90f0: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
9100: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
9110: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
9120: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
9130: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
9140: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9150: 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ALL + - cor0.col
9160: 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  0 + - col1 * col
9170: 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0 col0 FROM tab0
9180: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
9190: 38 38 0d 0a 2d 33 34 33 30 0d 0a 2d 38 31 38 38  88..-3430..-8188
91a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
91b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
91c0: 2d 20 2d 20 63 6f 6c 30 20 2a 20 31 36 20 2a 20  - - col0 * 16 * 
91d0: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
91e0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
91f0: 2d 2d 2d 2d 0d 0a 31 30 32 34 30 0d 0a 31 32 34  ----..10240..124
9200: 38 0d 0a 31 36 36 34 30 0d 0a 0d 0a 73 6b 69 70  8..16640....skip
9210: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
9220: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
9230: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
9240: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
9250: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
9260: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
9270: 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20  TINCT cor0.col0 
9280: 2b 20 63 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c  + col0 * ( - col
9290: 31 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 ) col1 FROM ta
92a0: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
92b0: 32 30 34 30 0d 0a 2d 33 33 36 30 0d 0a 2d 38 30  2040..-3360..-80
92c0: 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
92d0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
92e0: 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20  STINCT + - col0 
92f0: 2a 20 2b 20 28 20 2d 20 28 20 63 6f 6c 30 20 29  * + ( - ( col0 )
9300: 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
9310: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a  cor0..----..49..
9320: 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a 71 75  6084..6241....qu
9330: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9340: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
9350: 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 28 20 63 6f  r0.col1 * - ( co
9360: 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52  l2 ) * - col0 FR
9370: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
9380: 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30 0d 0a 34 32  .----..36480..42
9390: 31 32 0d 0a 39 39 38 34 30 0d 0a 0d 0a 73 6b 69  12..99840....ski
93a0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
93b0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
93c0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
93d0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
93e0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
93f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
9400: 63 6f 6c 30 20 2a 20 28 20 28 20 2d 20 63 6f 6c  col0 * ( ( - col
9410: 31 20 29 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20  1 ) ) col0 FROM 
9420: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
9430: 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35  --..-2064..-3395
9440: 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 6f 6e 6c 79 69  ..-8099....onlyi
9450: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
9460: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
9470: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
9480: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9490: 20 6c 61 62 65 6c 2d 32 34 31 0d 0a 53 45 4c 45   label-241..SELE
94a0: 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e  CT ALL - + cor0.
94b0: 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 31 20  col1 DIV + col1 
94c0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
94d0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
94e0: 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73  .-1..-1..-1....s
94f0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
9500: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
9510: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9520: 62 65 6c 2d 32 34 31 0d 0a 53 45 4c 45 43 54 20  bel-241..SELECT 
9530: 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ALL - + cor0.col
9540: 31 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  1 / + col1 AS co
9550: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
9560: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
9570: 2d 31 0d 0a 2d 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  -1..-1....onlyif
9580: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
9590: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
95a0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
95b0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
95c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
95d0: 65 6c 2d 32 34 32 0d 0a 53 45 4c 45 43 54 20 2b  el-242..SELECT +
95e0: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
95f0: 49 47 4e 45 44 20 29 20 2b 20 2b 20 63 6f 72 30  IGNED ) + + cor0
9600: 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20  .col0 * col2 AS 
9610: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
9620: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
9630: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
9640: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
9650: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
9660: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9670: 20 6c 61 62 65 6c 2d 32 34 32 0d 0a 53 45 4c 45   label-242..SELE
9680: 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT + CAST ( NULL
9690: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
96a0: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  + cor0.col0 * co
96b0: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
96c0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
96d0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
96e0: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
96f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9700: 41 4c 4c 20 63 6f 6c 32 20 2a 20 31 38 20 41 53  ALL col2 * 18 AS
9710: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
9720: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
9730: 30 32 36 0d 0a 31 37 32 38 0d 0a 39 37 32 0d 0a  026..1728..972..
9740: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9750: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
9760: 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  CT + col2 + + co
9770: 72 30 2e 63 6f 6c 31 20 2d 20 34 39 20 46 52 4f  r0.col1 - 49 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 31 38 0d 0a 33 31 0d 0a 36 30  ----..18..31..60
97a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
97b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
97c0: 2b 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 72  + - col0 - + cor
97d0: 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
97e0: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
97f0: 2d 2d 2d 0d 0a 2d 31 32 38 0d 0a 2d 31 36 30 0d  ---..-128..-160.
9800: 0a 2d 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .-6....onlyif my
9810: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
9820: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
9830: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
9840: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
9850: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
9860: 32 34 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  246..SELECT DIST
9870: 49 4e 43 54 20 2b 20 37 37 20 2a 20 63 6f 6c 30  INCT + 77 * col0
9880: 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
9890: 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 63 6f   SIGNED ) + + co
98a0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
98b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
98c0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
98d0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
98e0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
98f0: 72 74 20 6c 61 62 65 6c 2d 32 34 36 0d 0a 53 45  rt label-246..SE
9900: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
9910: 37 37 20 2a 20 63 6f 6c 30 20 2b 20 43 41 53 54  77 * col0 + CAST
9920: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
9930: 45 52 20 29 20 2b 20 2b 20 63 6f 6c 32 20 46 52  ER ) + + col2 FR
9940: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
9950: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
9960: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
9970: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
9980: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
9990: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
99a0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
99b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
99c0: 2d 20 2d 20 35 30 20 2b 20 63 6f 6c 30 20 63 6f  - - 50 + col0 co
99d0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
99e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 39 0d  cor0..----..139.
99f0: 0a 37 34 0d 0a 38 35 0d 0a 0d 0a 73 6b 69 70 69  .74..85....skipi
9a00: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
9a10: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
9a20: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9a30: 54 20 2b 20 2d 20 35 30 20 2a 20 63 6f 6c 32 20  T + - 50 * col2 
9a40: 2b 20 2b 20 43 41 53 54 20 28 20 2b 20 63 6f 6c  + + CAST ( + col
9a50: 32 20 41 53 20 52 45 41 4c 20 29 20 2a 20 2d 20  2 AS REAL ) * - 
9a60: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
9a70: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
9a80: 31 38 37 0d 0a 2d 32 35 34 36 0d 0a 2d 32 38 33  187..-2546..-283
9a90: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
9aa0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
9ab0: 54 49 4e 43 54 20 31 36 20 46 52 4f 4d 20 74 61  TINCT 16 FROM ta
9ac0: 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
9ad0: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  , tab0 AS cor1..
9ae0: 2d 2d 2d 2d 0d 0a 31 36 0d 0a 0d 0a 73 6b 69 70  ----..16....skip
9af0: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
9b00: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
9b10: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
9b20: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
9b30: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
9b40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
9b50: 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b  TINCT - col1 * +
9b60: 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 30 20   cor0.col0 col0 
9b70: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
9b80: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a  0..----..-1040..
9b90: 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65  -640..-78....que
9ba0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9bb0: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
9bc0: 2a 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2d  * - col1 * + ( -
9bd0: 20 63 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 32   col2 ) + + col2
9be0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
9bf0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 32 30 0d  b2..----..11020.
9c00: 0a 32 35 39 37 34 0d 0a 39 30 35 33 32 0d 0a 0d  .25974..90532...
9c10: 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
9c20: 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
9c30: 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f  SELECT ALL * FRO
9c40: 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
9c50: 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
9c60: 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62 31  tab1, tab2, tab1
9c70: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
9c80: 33 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68  3645 values hash
9c90: 69 6e 67 20 74 6f 20 64 62 35 36 64 30 35 32 65  ing to db56d052e
9ca0: 38 31 61 31 63 65 65 62 62 34 63 33 61 65 61 31  81a1ceebb4c3aea1
9cb0: 32 34 36 37 30 62 65 0d 0a 0d 0a 71 75 65 72 79  24670be....query
9cc0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9cd0: 43 54 20 2b 20 28 20 2b 20 63 6f 6c 30 20 2a 20  CT + ( + col0 * 
9ce0: 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46  col1 ) AS col1 F
9cf0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
9d00: 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39  2064..3395..8099
9d10: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
9d20: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
9d30: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
9d40: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
9d50: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
9d60: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 34  owsort label-254
9d70: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
9d80: 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T - CAST( NULL A
9d90: 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 74  S SIGNED ) * + t
9da0: 61 62 31 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  ab1.col0 * col0 
9db0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
9dc0: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
9dd0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
9de0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
9df0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35  rowsort label-25
9e00: 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
9e10: 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT - CAST ( NULL
9e20: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
9e30: 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 63 6f  + tab1.col0 * co
9e40: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
9e50: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  --..NULL....only
9e60: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
9e70: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
9e80: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
9e90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9ea0: 74 20 6c 61 62 65 6c 2d 32 35 35 0d 0a 53 45 4c  t label-255..SEL
9eb0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
9ec0: 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 30   col1 DIV - col0
9ed0: 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   - + col0 AS col
9ee0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
9ef0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a  or0..----..-11..
9f00: 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70  -64..-80....skip
9f10: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
9f20: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
9f30: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
9f40: 2d 32 35 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  -255..SELECT DIS
9f50: 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2f  TINCT - - col1 /
9f60: 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30   - col0 - + col0
9f70: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
9f80: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
9f90: 0d 0a 2d 31 31 0d 0a 2d 36 34 0d 0a 2d 38 30 0d  ..-11..-64..-80.
9fa0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9fb0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 37 20  rt..SELECT + 27 
9fc0: 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  * - col0 + col0 
9fd0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
9fe0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
9ff0: 36 36 34 0d 0a 2d 32 30 38 30 0d 0a 2d 37 38 0d  664..-2080..-78.
a000: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a010: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
a020: 4e 43 54 20 63 6f 6c 32 20 2b 20 2d 20 39 37 20  NCT col2 + - 97 
a030: 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
a040: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a050: 2d 32 33 37 0d 0a 2d 36 31 35 31 0d 0a 2d 37 36  -237..-6151..-76
a060: 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
a070: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
a080: 4c 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 39 34 20  L + col0 + - 94 
a090: 2a 20 2b 20 63 6f 6c 30 20 2b 20 34 35 20 41 53  * + col0 + 45 AS
a0a0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
a0b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
a0c0: 32 33 34 0d 0a 2d 35 39 30 37 0d 0a 2d 37 33 39  234..-5907..-739
a0d0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
a0e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
a0f0: 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63  TINCT + col2 + c
a100: 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 32  ol0 * - col1 + 2
a110: 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  4 AS col1 FROM t
a120: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
a130: 2d 0d 0a 2d 31 32 38 31 0d 0a 2d 31 36 36 0d 0a  -..-1281..-166..
a140: 2d 34 35 35 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -4552....onlyif 
a150: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
a160: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
a170: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
a180: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
a190: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
a1a0: 6c 2d 32 36 30 0d 0a 53 45 4c 45 43 54 20 41 4c  l-260..SELECT AL
a1b0: 4c 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  L + CAST( NULL A
a1c0: 53 20 44 45 43 49 4d 41 4c 20 29 20 2d 20 2d 20  S DECIMAL ) - - 
a1d0: 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col1 * col0 FROM
a1e0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
a1f0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
a200: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
a210: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
a220: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
a230: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36  rowsort label-26
a240: 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  0..SELECT ALL + 
a250: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52  CAST ( NULL AS R
a260: 45 41 4c 20 29 20 2d 20 2d 20 63 6f 6c 31 20 2a  EAL ) - - col1 *
a270: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
a280: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
a290: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
a2a0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
a2b0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
a2c0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
a2d0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
a2e0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
a2f0: 36 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  61..SELECT DISTI
a300: 4e 43 54 20 31 35 20 2b 20 63 6f 72 30 2e 63 6f  NCT 15 + cor0.co
a310: 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52  l2 DIV + col1 FR
a320: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
a330: 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 0d 0a 73 6b 69  .----..15....ski
a340: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
a350: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
a360: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
a370: 6c 2d 32 36 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-261..SELECT DI
a380: 53 54 49 4e 43 54 20 31 35 20 2b 20 63 6f 72 30  STINCT 15 + cor0
a390: 2e 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31 20 46  .col2 / + col1 F
a3a0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
a3b0: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 0d 0a 6f 6e  ..----..15....on
a3c0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
a3d0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
a3e0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
a3f0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
a400: 6f 72 74 20 6c 61 62 65 6c 2d 32 36 32 0d 0a 53  ort label-262..S
a410: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
a420: 20 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20 2d 20   + ( col2 ) + - 
a430: 63 6f 6c 31 20 2a 20 39 36 20 44 49 56 20 2b 20  col1 * 96 DIV + 
a440: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
a450: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
a460: 2d 0d 0a 2d 33 39 38 0d 0a 2d 34 36 0d 0a 31 38  -..-398..-46..18
a470: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
a480: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
a490: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
a4a0: 72 74 20 6c 61 62 65 6c 2d 32 36 32 0d 0a 53 45  rt label-262..SE
a4b0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
a4c0: 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63  + ( col2 ) + - c
a4d0: 6f 6c 31 20 2a 20 39 36 20 2f 20 2b 20 63 6f 6c  ol1 * 96 / + col
a4e0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
a4f0: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
a500: 2d 33 39 38 0d 0a 2d 34 36 0d 0a 31 38 0d 0a 0d  -398..-46..18...
a510: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a520: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2b  ..SELECT ALL ( +
a530: 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 31   col2 ) + - col1
a540: 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   * col1 AS col1 
a550: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
a560: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 36 33 0d 0a  0..----..-7363..
a570: 2d 38 31 39 39 0d 0a 2d 39 34 30 38 0d 0a 0d 0a  -8199..-9408....
a580: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
a590: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
a5a0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
a5b0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
a5c0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
a5d0: 72 74 20 6c 61 62 65 6c 2d 32 36 34 0d 0a 53 45  rt label-264..SE
a5e0: 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 28  LECT ALL + CAST(
a5f0: 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
a600: 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
a610: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab2..----..NULL
a620: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
a630: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
a640: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
a650: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
a660: 61 62 65 6c 2d 32 36 34 0d 0a 53 45 4c 45 43 54  abel-264..SELECT
a670: 20 41 4c 4c 20 2b 20 43 41 53 54 20 28 20 4e 55   ALL + CAST ( NU
a680: 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 41 53 20  LL AS REAL ) AS 
a690: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
a6a0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
a6b0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
a6c0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
a6d0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
a6e0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
a6f0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
a700: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
a710: 65 6c 2d 32 36 35 0d 0a 53 45 4c 45 43 54 20 43  el-265..SELECT C
a720: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
a730: 4e 45 44 20 29 20 2b 20 39 38 20 46 52 4f 4d 20  NED ) + 98 FROM 
a740: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab1..----..NULL
a750: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
a760: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
a770: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
a780: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
a790: 61 62 65 6c 2d 32 36 35 0d 0a 53 45 4c 45 43 54  abel-265..SELECT
a7a0: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
a7b0: 49 4e 54 45 47 45 52 20 29 20 2b 20 39 38 20 46  INTEGER ) + 98 F
a7c0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
a7d0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
a7e0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
a7f0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
a800: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
a810: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
a820: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
a830: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a840: 4c 45 43 54 20 2d 20 34 36 20 63 6f 6c 30 20 46  LECT - 46 col0 F
a850: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
a860: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36 0d 0a 2d 34 36  ..----..-46..-46
a870: 0d 0a 2d 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-46....query I
a880: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a890: 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b 20   ALL + col0 + + 
a8a0: 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  ( col1 ) FROM ta
a8b0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
a8c0: 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a  ..29..74..93....
a8d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a8e0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 31  .SELECT ALL tab1
a8f0: 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a  .col0 + + col2 *
a900: 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
a910: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 36 38 0d 0a  1..----..-1168..
a920: 2d 31 34 30 31 0d 0a 2d 35 30 36 0d 0a 0d 0a 71  -1401..-506....q
a930: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a940: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
a950: 2b 20 31 36 20 2b 20 32 32 20 46 52 4f 4d 20 74  + 16 + 22 FROM t
a960: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
a970: 2d 0d 0a 2d 31 30 30 32 0d 0a 2d 31 32 35 38 0d  -..-1002..-1258.
a980: 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-26....query I 
a990: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a9a0: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
a9b0: 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + - cor0.col2 * 
a9c0: 28 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  ( + col1 ) AS co
a9d0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
a9e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 35 32 0d 0a  0..----..-2752..
a9f0: 2d 37 33 37 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -7371..0....skip
aa00: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
aa10: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
aa20: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
aa30: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
aa40: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
aa50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 38 20  sort..SELECT 98 
aa60: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20  col2 FROM tab1, 
aa70: 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
aa80: 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
aa90: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
aaa0: 69 6e 67 20 74 6f 20 63 37 35 38 65 38 61 66 62  ing to c758e8afb
aab0: 64 66 61 36 61 61 65 32 37 39 30 34 35 62 30 65  dfa6aae279045b0e
aac0: 39 63 62 61 63 63 32 0d 0a 0d 0a 71 75 65 72 79  9cbacc2....query
aad0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
aae0: 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20  CT ALL + col1 + 
aaf0: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 46 52  col1 * - col0 FR
ab00: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
ab10: 2d 2d 0d 0a 2d 31 30 32 37 0d 0a 2d 35 32 0d 0a  --..-1027..-52..
ab20: 2d 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -630....query I 
ab30: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ab40: 63 6f 6c 32 20 2a 20 36 38 20 2a 20 63 6f 6c 31  col2 * 68 * col1
ab50: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
ab60: 0a 2d 2d 2d 2d 0d 0a 33 38 37 36 30 0d 0a 38 34  .----..38760..84
ab70: 38 36 34 0d 0a 39 35 34 37 32 0d 0a 0d 0a 71 75  864..95472....qu
ab80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ab90: 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a  ELECT + + col2 *
aba0: 20 2d 20 37 20 46 52 4f 4d 20 74 61 62 31 20 41   - 7 FROM tab1 A
abb0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
abc0: 37 38 0d 0a 2d 33 39 39 0d 0a 2d 36 37 32 0d 0a  78..-399..-672..
abd0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
abe0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 33  t..SELECT ALL 23
abf0: 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
ac00: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
ac10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 34 37  or0..----..-2047
ac20: 0d 0a 2d 35 35 32 0d 0a 2d 38 30 35 0d 0a 0d 0a  ..-552..-805....
ac30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ac40: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
ac50: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2b   col2 + - col2 +
ac60: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
ac70: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
ac80: 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71  .24..35..89....q
ac90: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
aca0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
acb0: 31 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20  1 + tab1.col0 + 
acc0: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
acd0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab1..----..-2
ace0: 30 0d 0a 31 31 38 0d 0a 31 34 37 0d 0a 0d 0a 71  0..118..147....q
acf0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ad00: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2d 20  SELECT - col0 - 
ad10: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52  + col1 * col1 FR
ad20: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
ad30: 37 34 32 30 0d 0a 2d 38 33 37 30 0d 0a 2d 39 34  7420..-8370..-94
ad40: 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  44....query I ro
ad50: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
ad60: 37 37 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 30 20  77 * - ( + col0 
ad70: 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
ad80: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 34 38  or0..----..-1848
ad90: 0d 0a 2d 32 36 39 35 0d 0a 2d 36 38 35 33 0d 0a  ..-2695..-6853..
ada0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
adb0: 74 0d 0a 53 45 4c 45 43 54 20 39 34 20 2b 20 2d  t..SELECT 94 + -
adc0: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b   col1 * + col0 +
add0: 20 2d 20 37 37 20 41 53 20 63 6f 6c 30 20 46 52   - 77 AS col0 FR
ade0: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
adf0: 2d 2d 0d 0a 2d 31 30 32 33 0d 0a 2d 36 31 0d 0a  --..-1023..-61..
ae00: 2d 36 32 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -623....onlyif m
ae10: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
ae20: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
ae30: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
ae40: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
ae50: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
ae60: 2d 32 38 31 0d 0a 53 45 4c 45 43 54 20 2d 20 43  -281..SELECT - C
ae70: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
ae80: 4e 45 44 20 29 20 2b 20 2b 20 63 6f 6c 31 20 2a  NED ) + + col1 *
ae90: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
aea0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
aeb0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
aec0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
aed0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
aee0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
aef0: 74 20 6c 61 62 65 6c 2d 32 38 31 0d 0a 53 45 4c  t label-281..SEL
af00: 45 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  ECT - CAST ( NUL
af10: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  L AS INTEGER ) +
af20: 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46   + col1 * col1 F
af30: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
af40: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
af50: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
af60: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
af70: 45 43 54 20 38 34 20 2a 20 28 20 2b 20 63 6f 6c  ECT 84 * ( + col
af80: 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  0 ) AS col1 FROM
af90: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
afa0: 2d 2d 2d 0d 0a 32 30 31 36 0d 0a 32 39 34 30 0d  ---..2016..2940.
afb0: 0a 37 34 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  .7476....skipif 
afc0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
afd0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
afe0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
aff0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
b000: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b010: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
b020: 74 61 62 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32  tab0.col0 * col2
b030: 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f   + col1 col0 FRO
b040: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab0..----..-7
b050: 30 36 0d 0a 2d 37 32 30 37 0d 0a 36 32 0d 0a 0d  06..-7207..62...
b060: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b070: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
b080: 54 20 63 6f 6c 31 20 2a 20 2b 20 38 35 20 2b 20  T col1 * + 85 + 
b090: 35 38 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  58 FROM tab0..--
b0a0: 2d 2d 0d 0a 37 33 36 38 0d 0a 37 37 39 33 0d 0a  --..7368..7793..
b0b0: 38 33 30 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8303....onlyif m
b0c0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
b0d0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
b0e0: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
b0f0: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
b100: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
b110: 2d 32 38 35 0d 0a 53 45 4c 45 43 54 20 2d 20 43  -285..SELECT - C
b120: 41 53 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53  AST( + col2 AS S
b130: 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 31  IGNED ) + - col1
b140: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
b150: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
b160: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35  0..----..-54..-5
b170: 37 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  7..-96....skipif
b180: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
b190: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
b1a0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
b1b0: 38 35 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  85..SELECT - CAS
b1c0: 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e  T ( + col2 AS IN
b1d0: 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c 31  TEGER ) + - col1
b1e0: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
b1f0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
b200: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35  0..----..-54..-5
b210: 37 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20  7..-96....query 
b220: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b230: 54 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b  T - ( - col2 ) +
b240: 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2b 20   - col0 + + ( + 
b250: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 29 20  col2 * - col0 ) 
b260: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
b270: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 39 0d 0a 2d 37  0..----..-69..-7
b280: 33 30 35 0d 0a 2d 37 38 33 0d 0a 0d 0a 71 75 65  305..-783....que
b290: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b2a0: 4c 45 43 54 20 2d 20 39 20 2a 20 63 6f 72 31 2e  LECT - 9 * cor1.
b2b0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
b2c0: 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
b2d0: 4e 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  N tab2, tab1 AS 
b2e0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
b2f0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
b300: 20 63 32 34 30 65 65 30 38 34 31 36 62 37 36 32   c240ee08416b762
b310: 65 35 32 35 36 37 64 65 38 35 34 39 33 65 39 36  e52567de85493e96
b320: 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  9....skipif post
b330: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
b340: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
b350: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
b360: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
b370: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
b380: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32 33 20 63  ELECT ALL - 23 c
b390: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
b3a0: 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
b3b0: 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
b3c0: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
b3d0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
b3e0: 39 62 64 37 32 31 66 39 39 64 37 39 64 63 65 32  9bd721f99d79dce2
b3f0: 31 62 31 64 65 32 38 36 30 66 64 35 31 65 64 35  1b1de2860fd51ed5
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 2b 20 63 6f  ort..SELECT + co
b420: 6c 30 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 30 20  l0 + - ( - col0 
b430: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
b440: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a  ab1..----..128..
b450: 31 36 30 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20  160..6....query 
b460: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b470: 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f  T cor0.col0 + co
b480: 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31  r0.col0 + - col1
b490: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41   * - cor0.col1 A
b4a0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
b4b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
b4c0: 32 32 38 0d 0a 33 32 39 0d 0a 36 38 32 0d 0a 0d  228..329..682...
b4d0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
b4e0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
b4f0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
b500: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
b510: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
b520: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b530: 54 20 44 49 53 54 49 4e 43 54 20 31 38 20 2a 20  T DISTINCT 18 * 
b540: 2b 20 37 33 20 2a 20 2d 20 63 6f 6c 30 20 63 6f  + 73 * - col0 co
b550: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
b560: 2d 2d 0d 0a 2d 31 30 35 31 32 30 0d 0a 2d 33 39  --..-105120..-39
b570: 34 32 0d 0a 2d 38 34 30 39 36 0d 0a 0d 0a 6f 6e  42..-84096....on
b580: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
b590: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
b5a0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
b5b0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
b5c0: 6f 72 74 20 6c 61 62 65 6c 2d 32 39 32 0d 0a 53  ort label-292..S
b5d0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
b5e0: 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56  ol2 + + col2 DIV
b5f0: 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
b600: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
b610: 2d 2d 0d 0a 35 37 0d 0a 37 32 0d 0a 39 37 0d 0a  --..57..72..97..
b620: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
b630: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
b640: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b650: 20 6c 61 62 65 6c 2d 32 39 32 0d 0a 53 45 4c 45   label-292..SELE
b660: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
b670: 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 72 30   + + col2 / cor0
b680: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
b690: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
b6a0: 37 0d 0a 37 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65  7..72..97....que
b6b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b6c0: 4c 45 43 54 20 2d 20 2b 20 36 30 20 2b 20 63 6f  LECT - + 60 + co
b6d0: 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30  r0.col2 * - cor0
b6e0: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
b6f0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
b700: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 37 0d 0a 2d 32 38  .----..-157..-28
b710: 39 38 0d 0a 2d 37 35 32 32 0d 0a 0d 0a 71 75 65  98..-7522....que
b720: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b730: 4c 45 43 54 20 2b 20 38 38 20 2a 20 74 61 62 30  LECT + 88 * tab0
b740: 2e 63 6f 6c 31 20 2b 20 37 32 20 41 53 20 63 6f  .col1 + 72 AS co
b750: 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
b760: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
b770: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
b780: 6e 67 20 74 6f 20 30 65 34 31 33 34 31 64 65 33  ng to 0e41341de3
b790: 32 63 63 64 38 66 39 63 35 38 35 35 66 65 37 37  2ccd8f9c5855fe77
b7a0: 37 36 35 66 63 65 0d 0a 0d 0a 6f 6e 6c 79 69 66  765fce....onlyif
b7b0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
b7c0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
b7d0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
b7e0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
b7f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b800: 65 6c 2d 32 39 35 0d 0a 53 45 4c 45 43 54 20 41  el-295..SELECT A
b810: 4c 4c 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30  LL col1 - - col0
b820: 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   * + CAST( NULL 
b830: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
b840: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
b850: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
b860: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
b870: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
b880: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
b890: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 39  rowsort label-29
b8a0: 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  5..SELECT ALL co
b8b0: 6c 31 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  l1 - - col0 * + 
b8c0: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
b8d0: 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32  NTEGER ) AS col2
b8e0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
b8f0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
b900: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
b910: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
b920: 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2b 20  col1 * col1 * + 
b930: 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 32 20 29 20  col2 + ( col2 ) 
b940: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
b950: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 32 37 0d 0a  ..----..-10927..
b960: 2d 32 35 38 38 39 0d 0a 2d 39 30 34 32 31 0d 0a  -25889..-90421..
b970: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b980: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
b990: 33 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  36 AS col0 FROM 
b9a0: 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
b9b0: 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
b9c0: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
b9d0: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 64 31  s hashing to 4d1
b9e0: 38 39 32 65 38 38 30 31 32 35 64 63 39 30 33 34  892e880125dc9034
b9f0: 35 37 32 31 31 35 31 61 63 62 32 32 63 0d 0a 0d  5721151acb22c...
ba00: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ba10: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
ba20: 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  2 * - col2 + + c
ba30: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
ba40: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 35 0d  r0..----..-1065.
ba50: 0a 2d 36 36 33 35 0d 0a 33 34 0d 0a 0d 0a 71 75  .-6635..34....qu
ba60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ba70: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
ba80: 6c 31 20 2b 20 2d 20 32 37 20 2a 20 63 6f 6c 30  l1 + - 27 * col0
ba90: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
baa0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 31 32 0d  r0..----..-2312.
bab0: 0a 2d 35 36 32 0d 0a 2d 38 34 38 0d 0a 0d 0a 6f  .-562..-848....o
bac0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
bad0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
bae0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
baf0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
bb00: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 30 0d 0a  sort label-300..
bb10: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
bb20: 31 20 44 49 56 20 28 20 63 6f 6c 30 20 29 20 2b  1 DIV ( col0 ) +
bb30: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
bb40: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
bb50: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 33 37 0d  0..----..27..37.
bb60: 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .90....skipif my
bb70: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
bb80: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
bb90: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 30 0d  wsort label-300.
bba0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
bbb0: 6c 31 20 2f 20 28 20 63 6f 6c 30 20 29 20 2b 20  l1 / ( col0 ) + 
bbc0: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
bbd0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
bbe0: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 33 37 0d 0a  ..----..27..37..
bbf0: 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
bc00: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
bc10: 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20  STINCT - - col1 
bc20: 2a 20 2b 20 38 35 20 46 52 4f 4d 20 74 61 62 30  * + 85 FROM tab0
bc30: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
bc40: 37 33 31 30 0d 0a 37 37 33 35 0d 0a 38 32 34 35  7310..7735..8245
bc50: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
bc60: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
bc70: 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2b  + - col1 * + ( +
bc80: 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 2a   col2 ) + col0 *
bc90: 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63   ( + col1 ) AS c
bca0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
bcb0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 37   cor0..----..-77
bcc0: 34 0d 0a 33 32 39 38 0d 0a 36 33 37 0d 0a 0d 0a  4..3298..637....
bcd0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
bce0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
bcf0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
bd00: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
bd10: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 33 0d  wsort label-303.
bd20: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
bd30: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col0 * + col1 + 
bd40: 34 32 20 2a 20 2d 20 63 6f 6c 32 20 44 49 56 20  42 * - col2 DIV 
bd50: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
bd60: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
bd70: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30 36 0d 0a 2d  ..----..-2106..-
bd80: 33 34 33 37 0d 0a 2d 38 31 34 31 0d 0a 0d 0a 73  3437..-8141....s
bd90: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
bda0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
bdb0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
bdc0: 62 65 6c 2d 33 30 33 0d 0a 53 45 4c 45 43 54 20  bel-303..SELECT 
bdd0: 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b  ALL - + col0 * +
bde0: 20 63 6f 6c 31 20 2b 20 34 32 20 2a 20 2d 20 63   col1 + 42 * - c
bdf0: 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20  ol2 / + col2 AS 
be00: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
be10: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
be20: 31 30 36 0d 0a 2d 33 34 33 37 0d 0a 2d 38 31 34  106..-3437..-814
be30: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
be40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
be50: 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  or0.col2 + col2 
be60: 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  + - col0 * col2 
be70: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
be80: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
be90: 0a 2d 31 33 35 0d 0a 2d 31 39 37 36 0d 0a 2d 32  .-135..-1976..-2
bea0: 39 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  926....query I r
beb0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
bec0: 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20 33 37 20 41  LL col1 * - 37 A
bed0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
bee0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31   cor0..----..-31
bef0: 38 32 0d 0a 2d 33 33 36 37 0d 0a 2d 33 35 38 39  82..-3367..-3589
bf00: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
bf10: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
bf20: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
bf30: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
bf40: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
bf50: 33 30 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  306..SELECT + co
bf60: 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 44  l2 * cor0.col1 D
bf70: 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20  IV cor0.col1 AS 
bf80: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
bf90: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
bfa0: 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69  .33..82....skipi
bfb0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
bfc0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
bfd0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
bfe0: 33 30 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  306..SELECT + co
bff0: 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2f  l2 * cor0.col1 /
c000: 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
c010: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
c020: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33  cor0..----..1..3
c030: 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  3..82....query I
c040: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c050: 20 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   4 AS col1 FROM 
c060: 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
c070: 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
c080: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
c090: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 33 30  s hashing to 730
c0a0: 64 66 66 37 38 65 38 33 31 31 32 33 37 34 39 36  dff78e8311237496
c0b0: 31 65 61 37 31 31 66 39 38 65 62 61 61 0d 0a 0d  1ea711f98ebaa...
c0c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c0d0: 0d 0a 53 45 4c 45 43 54 20 2d 20 37 36 20 2b 20  ..SELECT - 76 + 
c0e0: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
c0f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c100: 2d 31 30 32 0d 0a 2d 38 36 0d 0a 2d 38 39 0d 0a  -102..-86..-89..
c110: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c120: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
c130: 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41   * + cor0.col1 A
c140: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
c150: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c160: 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36  -100..-169..-676
c170: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c180: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
c190: 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 36 35  l2 + col2 * + 65
c1a0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
c1b0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
c1c0: 0d 0a 31 37 31 36 0d 0a 31 37 38 32 0d 0a 32 35  ..1716..1782..25
c1d0: 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  08....onlyif mys
c1e0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
c1f0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
c200: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
c210: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
c220: 6c 2d 33 31 31 0d 0a 53 45 4c 45 43 54 20 41 4c  l-311..SELECT AL
c230: 4c 20 2d 20 38 20 44 49 56 20 37 30 20 46 52 4f  L - 8 DIV 70 FRO
c240: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
c250: 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
c260: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
c270: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
c280: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31  rowsort label-31
c290: 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  1..SELECT ALL - 
c2a0: 38 20 2f 20 37 30 20 46 52 4f 4d 20 74 61 62 30  8 / 70 FROM tab0
c2b0: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
c2c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
c2d0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
c2e0: 4e 43 54 20 36 31 20 2b 20 63 6f 72 30 2e 63 6f  NCT 61 + cor0.co
c2f0: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
c300: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
c310: 2d 2d 0d 0a 31 32 35 0d 0a 31 34 31 0d 0a 36 34  --..125..141..64
c320: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
c330: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
c340: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
c350: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
c360: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
c370: 33 31 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  313..SELECT ALL 
c380: 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2d 20 74 61  tab0.col1 * - ta
c390: 62 30 2e 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31  b0.col1 DIV col1
c3a0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
c3b0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d  b0..----..-86..-
c3c0: 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69  91..-97....skipi
c3d0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
c3e0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
c3f0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
c400: 33 31 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  313..SELECT ALL 
c410: 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2d 20 74 61  tab0.col1 * - ta
c420: 62 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 41  b0.col1 / col1 A
c430: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
c440: 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31  ..----..-86..-91
c450: 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-97....query I
c460: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c470: 20 44 49 53 54 49 4e 43 54 20 2d 20 36 31 20 2a   DISTINCT - 61 *
c480: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
c490: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
c4a0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 34 36 0d 0a  0..----..-5246..
c4b0: 2d 35 35 35 31 0d 0a 2d 35 39 31 37 0d 0a 0d 0a  -5551..-5917....
c4c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c4d0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 37 20 2b  .SELECT ALL 67 +
c4e0: 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
c4f0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
c500: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a 33 0d  0..----..-13..3.
c510: 0a 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .64....onlyif my
c520: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
c530: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
c540: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
c550: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
c560: 65 6c 2d 33 31 36 0d 0a 53 45 4c 45 43 54 20 44  el-316..SELECT D
c570: 49 53 54 49 4e 43 54 20 2b 20 2b 20 43 41 53 54  ISTINCT + + CAST
c580: 28 20 2d 20 63 6f 6c 31 20 41 53 20 53 49 47 4e  ( - col1 AS SIGN
c590: 45 44 20 29 20 44 49 56 20 63 6f 6c 31 20 41 53  ED ) DIV col1 AS
c5a0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
c5b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
c5c0: 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
c5d0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
c5e0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
c5f0: 6f 72 74 20 6c 61 62 65 6c 2d 33 31 36 0d 0a 53  ort label-316..S
c600: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
c610: 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 31   + CAST ( - col1
c620: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20   AS INTEGER ) / 
c630: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
c640: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
c650: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72  ----..-1....quer
c660: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c670: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
c680: 6f 6c 31 20 2a 20 39 31 20 2b 20 63 6f 6c 32 20  ol1 * 91 + col2 
c690: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
c6a0: 0a 31 35 38 35 0d 0a 32 38 34 38 0d 0a 35 33 39  .1585..2848..539
c6b0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
c6c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
c6d0: 20 2b 20 63 6f 6c 30 20 2b 20 28 20 2d 20 63 6f   + col0 + ( - co
c6e0: 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l0 ) AS col2 FRO
c6f0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
c700: 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
c710: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c720: 20 2b 20 63 6f 6c 31 20 2a 20 32 37 20 2b 20 63   + col1 * 27 + c
c730: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63  ol1 * + col2 * c
c740: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
c750: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35   cor0..----..165
c760: 37 35 0d 0a 33 37 32 30 36 0d 0a 35 39 37 30 0d  75..37206..5970.
c770: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
c780: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
c790: 31 20 2a 20 2b 20 36 34 20 46 52 4f 4d 20 74 61  1 * + 64 FROM ta
c7a0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 38 0d 0a  b2..----..1088..
c7b0: 31 39 38 34 0d 0a 33 37 37 36 0d 0a 0d 0a 71 75  1984..3776....qu
c7c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c7d0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
c7e0: 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 34 35 20   cor0.col2 * 45 
c7f0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
c800: 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  1 AS cor0 CROSS 
c810: 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72  JOIN tab1 AS cor
c820: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 33 30 0d 0a  1..----..-2430..
c830: 2d 32 35 36 35 0d 0a 2d 34 33 32 30 0d 0a 0d 0a  -2565..-4320....
c840: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c850: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a  .SELECT + col0 *
c860: 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32   + col0 + - col2
c870: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
c880: 0d 0a 2d 34 35 0d 0a 34 30 33 39 0d 0a 36 33 30  ..-45..4039..630
c890: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
c8a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 31 20  sort..SELECT 61 
c8b0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
c8c0: 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  2, tab2 AS cor0 
c8d0: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 0d  CROSS JOIN tab1.
c8e0: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
c8f0: 20 68 61 73 68 69 6e 67 20 74 6f 20 38 64 34 64   hashing to 8d4d
c900: 66 65 36 34 39 34 33 33 61 35 39 39 66 63 34 62  fe649433a599fc4b
c910: 31 30 38 33 30 63 63 37 63 65 35 35 0d 0a 0d 0a  10830cc7ce55....
c920: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
c930: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
c940: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
c950: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
c960: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 34 0d  wsort label-324.
c970: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
c980: 20 44 49 56 20 2b 20 38 33 20 2b 20 63 6f 6c 32   DIV + 83 + col2
c990: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
c9a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d  r0..----..2..34.
c9b0: 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .83....skipif my
c9c0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
c9d0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
c9e0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 34 0d  wsort label-324.
c9f0: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
ca00: 20 2f 20 2b 20 38 33 20 2b 20 63 6f 6c 32 20 46   / + 83 + col2 F
ca10: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
ca20: 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d 0a 38  ..----..2..34..8
ca30: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
ca40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
ca50: 6f 6c 32 20 2b 20 2b 20 35 32 20 46 52 4f 4d 20  ol2 + + 52 FROM 
ca60: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
ca70: 2d 2d 0d 0a 2d 32 0d 0a 2d 34 34 0d 0a 2d 35 0d  --..-2..-44..-5.
ca80: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
ca90: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 36 20  rt..SELECT - 56 
caa0: 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  + col0 * + col0 
cab0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
cac0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
cad0: 0a 31 31 36 39 0d 0a 35 32 30 0d 0a 37 38 36 35  .1169..520..7865
cae0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
caf0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
cb00: 36 39 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20  69 + ( + col2 ) 
cb10: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
cb20: 0a 31 32 33 0d 0a 31 32 36 0d 0a 31 36 35 0d 0a  .123..126..165..
cb30: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cb40: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  t..SELECT ALL ( 
cb50: 2d 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c  - col0 ) * + col
cb60: 31 20 2b 20 28 20 63 6f 6c 32 20 29 20 46 52 4f  1 + ( col2 ) FRO
cb70: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
cb80: 33 30 35 0d 0a 2d 31 39 30 0d 0a 2d 34 35 37 36  305..-190..-4576
cb90: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
cba0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 31  ort..SELECT + 61
cbb0: 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + + col0 FROM t
cbc0: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 0d 0a  ab0..----..150..
cbd0: 38 35 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  85..96....query 
cbe0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
cbf0: 54 20 28 20 38 33 20 29 20 46 52 4f 4d 20 74 61  T ( 83 ) FROM ta
cc00: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 38 33 0d 0a 38 33  b2..----..83..83
cc10: 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..83....query I 
cc20: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
cc30: 44 49 53 54 49 4e 43 54 20 74 61 62 32 2e 63 6f  DISTINCT tab2.co
cc40: 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l2 + - col2 * co
cc50: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
cc60: 2d 2d 0d 0a 2d 31 34 30 36 0d 0a 2d 36 35 30 0d  --..-1406..-650.
cc70: 0a 2d 37 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-702....query I
cc80: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
cc90: 20 34 37 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f   47 + + col1 FRO
cca0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab2..----..10
ccb0: 36 0d 0a 36 34 0d 0a 37 38 0d 0a 0d 0a 71 75 65  6..64..78....que
ccc0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
ccd0: 4c 45 43 54 20 63 6f 6c 31 20 2d 20 38 30 20 46  LECT col1 - 80 F
cce0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
ccf0: 2d 35 34 0d 0a 2d 36 37 0d 0a 2d 37 30 0d 0a 0d  -54..-67..-70...
cd00: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
cd10: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
cd20: 2a 20 2d 20 33 31 20 2b 20 63 6f 6c 31 20 46 52  * - 31 + col1 FR
cd30: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
cd40: 31 36 34 38 0d 0a 2d 31 37 35 37 0d 0a 2d 32 39  1648..-1757..-29
cd50: 36 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  63....skipif pos
cd60: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
cd70: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
cd80: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
cd90: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
cda0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
cdb0: 53 45 4c 45 43 54 20 2b 20 37 38 20 2b 20 2d 20  SELECT + 78 + - 
cdc0: 34 39 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  49 col0 FROM tab
cdd0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
cde0: 0a 32 39 0d 0a 32 39 0d 0a 32 39 0d 0a 0d 0a 71  .29..29..29....q
cdf0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ce00: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
ce10: 28 20 2d 20 32 32 20 29 20 2d 20 2b 20 63 6f 6c  ( - 22 ) - + col
ce20: 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
ce30: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
ce40: 33 31 31 0d 0a 2d 33 35 30 33 0d 0a 2d 39 38 33  311..-3503..-983
ce50: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ce60: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f  ort..SELECT ( co
ce70: 72 30 2e 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 30  r0.col1 ) + col0
ce80: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
ce90: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33  r0..----..137..3
cea0: 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  8..96....query I
ceb0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
cec0: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
ced0: 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2d  .col1 * col0 + -
cee0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
cef0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
cf00: 32 30 38 38 0d 0a 2d 33 34 33 30 0d 0a 2d 38 31  2088..-3430..-81
cf10: 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  88....skipif pos
cf20: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
cf30: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
cf40: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
cf50: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
cf60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
cf70: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 32 39 20  SELECT ALL + 29 
cf80: 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 63 6f  - col2 * col0 co
cf90: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
cfa0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a  cor0..----..-6..
cfb0: 2d 37 32 36 39 0d 0a 2d 37 36 33 0d 0a 0d 0a 71  -7269..-763....q
cfc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
cfd0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
cfe0: 31 20 2a 20 2b 20 31 37 20 41 53 20 63 6f 6c 32  1 * + 17 AS col2
cff0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
d000: 0d 0a 31 34 36 32 0d 0a 31 35 34 37 0d 0a 31 36  ..1462..1547..16
d010: 34 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  49....skipif pos
d020: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
d030: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
d040: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
d050: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
d060: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d070: 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32  SELECT cor0.col2
d080: 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c   * cor0.col1 col
d090: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
d0a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d  or0..----..2838.
d0b0: 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65  .7462..97....que
d0c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d0d0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
d0e0: 2a 20 63 6f 6c 31 20 2a 20 2d 20 38 31 20 2b 20  * col1 * - 81 + 
d0f0: 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52  - col2 * col1 FR
d100: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
d110: 2d 2d 0d 0a 32 32 37 36 33 0d 0a 32 38 30 34 32  --..22763..28042
d120: 37 0d 0a 37 37 30 30 34 0d 0a 0d 0a 71 75 65 72  7..77004....quer
d130: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
d140: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
d150: 6f 72 30 2e 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c  or0.col2 - + col
d160: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
d170: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d  or0..----..-164.
d180: 0a 2d 32 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65 72  .-2..-66....quer
d190: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
d1a0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
d1b0: 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2a   col0 * - col1 *
d1c0: 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 46 52 4f   col1 - col1 FRO
d1d0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
d1e0: 2d 2d 2d 2d 0d 0a 2d 31 33 35 33 33 0d 0a 2d 32  ----..-13533..-2
d1f0: 30 35 34 0d 0a 2d 36 34 31 30 0d 0a 0d 0a 71 75  054..-6410....qu
d200: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d210: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
d220: 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 31   ( col1 ) + col1
d230: 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
d240: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
d250: 2d 0d 0a 2d 31 32 36 31 0d 0a 2d 31 34 33 30 0d  -..-1261..-1430.
d260: 0a 2d 35 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-580....query I
d270: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
d280: 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2b 20   ALL + + col1 + 
d290: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
d2a0: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
d2b0: 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d  -..55..58..85...
d2c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d2d0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
d2e0: 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63  T - + col1 + - c
d2f0: 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol2 * col2 AS co
d300: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
d310: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37  cor0..----..-117
d320: 35 0d 0a 2d 36 38 31 35 0d 0a 2d 39 38 0d 0a 0d  5..-6815..-98...
d330: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
d340: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
d350: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
d360: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
d370: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
d380: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d390: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
d3a0: 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d  ol2 + - col2 * -
d3b0: 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20   col0 col1 FROM 
d3c0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
d3d0: 2d 2d 0d 0a 33 34 0d 0a 37 32 31 36 0d 0a 37 35  --..34..7216..75
d3e0: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
d3f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
d400: 20 28 20 63 6f 6c 31 20 29 20 2a 20 2d 20 39 32   ( col1 ) * - 92
d410: 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + - col1 * + co
d420: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
d430: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 35  cor0..----..1275
d440: 0d 0a 31 38 39 31 0d 0a 31 39 34 37 0d 0a 0d 0a  ..1891..1947....
d450: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d460: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 31  .SELECT ALL + 91
d470: 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 37 39   * - col0 * - 79
d480: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
d490: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 35 33 36  r0..----..172536
d4a0: 0d 0a 32 35 31 36 31 35 0d 0a 36 33 39 38 32 31  ..251615..639821
d4b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d4c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
d4d0: 49 4e 43 54 20 2b 20 2d 20 33 38 20 2a 20 63 6f  INCT + - 38 * co
d4e0: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
d4f0: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
d500: 0a 2d 31 32 35 34 0d 0a 2d 33 31 31 36 0d 0a 2d  .-1254..-3116..-
d510: 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
d520: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
d530: 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  + col1 * cor0.co
d540: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
d550: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
d560: 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31  --..-7396..-8281
d570: 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 73 6b 69 70 69  ..-9409....skipi
d580: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
d590: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
d5a0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
d5b0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
d5c0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
d5d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
d5e0: 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  INCT + col0 * + 
d5f0: 63 6f 6c 31 20 2b 20 2b 20 30 20 63 6f 6c 32 20  col1 + + 0 col2 
d600: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
d610: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32  0..----..1343..2
d620: 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 6f 6e 6c 79  17..4602....only
d630: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
d640: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
d650: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
d660: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d670: 74 20 6c 61 62 65 6c 2d 33 35 34 0d 0a 53 45 4c  t label-354..SEL
d680: 45 43 54 20 2b 20 33 39 20 2b 20 63 6f 6c 30 20  ECT + 39 + col0 
d690: 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  DIV col0 FROM ta
d6a0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
d6b0: 0d 0a 34 30 0d 0a 34 30 0d 0a 34 30 0d 0a 0d 0a  ..40..40..40....
d6c0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
d6d0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
d6e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
d6f0: 61 62 65 6c 2d 33 35 34 0d 0a 53 45 4c 45 43 54  abel-354..SELECT
d700: 20 2b 20 33 39 20 2b 20 63 6f 6c 30 20 2f 20 63   + 39 + col0 / c
d710: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
d720: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 0d   cor0..----..40.
d730: 0a 34 30 0d 0a 34 30 0d 0a 0d 0a 71 75 65 72 79  .40..40....query
d740: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d750: 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  CT - - col1 * - 
d760: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f  cor0.col2 + - co
d770: 6c 32 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 31 36  l2 - - col2 * 16
d780: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
d790: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 34 0d 0a 2d 34  .----..-1144..-4
d7a0: 33 32 0d 0a 2d 37 36 0d 0a 0d 0a 73 6b 69 70 69  32..-76....skipi
d7b0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
d7c0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
d7d0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
d7e0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
d7f0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
d800: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
d810: 63 6f 6c 32 20 2a 20 38 20 2b 20 63 6f 6c 31 20  col2 * 8 + col1 
d820: 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  + col2 * - col2 
d830: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
d840: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
d850: 37 33 31 0d 0a 2d 38 32 35 0d 0a 2d 39 31 34 0d  731..-825..-914.
d860: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
d870: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
d880: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
d890: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
d8a0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
d8b0: 35 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  57..SELECT ALL +
d8c0: 20 63 6f 6c 30 20 2b 20 2d 20 30 20 44 49 56 20   col0 + - 0 DIV 
d8d0: 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
d8e0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
d8f0: 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69  3..64..80....ski
d900: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
d910: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
d920: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
d930: 6c 2d 33 35 37 0d 0a 53 45 4c 45 43 54 20 41 4c  l-357..SELECT AL
d940: 4c 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 30 20 2f  L + col0 + - 0 /
d950: 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
d960: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
d970: 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75  .3..64..80....qu
d980: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d990: 45 4c 45 43 54 20 35 20 46 52 4f 4d 20 74 61 62  ELECT 5 FROM tab
d9a0: 32 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  2, tab0 cor0..--
d9b0: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
d9c0: 68 69 6e 67 20 74 6f 20 36 30 33 35 36 32 38 36  hing to 60356286
d9d0: 39 34 62 64 65 61 33 36 66 35 38 34 66 33 36 34  94bdea36f584f364
d9e0: 39 30 38 38 35 35 31 64 0d 0a 0d 0a 71 75 65 72  9088551d....quer
d9f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
da00: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32  ECT ALL - + col2
da10: 20 2a 20 2b 20 36 32 20 2b 20 34 20 46 52 4f 4d   * + 62 + 4 FROM
da20: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
da30: 2d 2d 2d 0d 0a 2d 31 36 30 38 0d 0a 2d 31 36 37  ---..-1608..-167
da40: 30 0d 0a 2d 32 33 35 32 0d 0a 0d 0a 71 75 65 72  0..-2352....quer
da50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
da60: 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2d 20 63  ECT + + col0 - c
da70: 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol2 * col1 AS co
da80: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
da90: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 36  cor0..----..-116
daa0: 38 0d 0a 2d 31 34 30 31 0d 0a 2d 35 30 36 0d 0a  8..-1401..-506..
dab0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
dac0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
dad0: 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63   * cor0.col0 + c
dae0: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
daf0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
db00: 2d 2d 2d 0d 0a 2d 31 33 30 35 0d 0a 2d 31 39 30  ---..-1305..-190
db10: 0d 0a 2d 34 35 37 36 0d 0a 0d 0a 73 6b 69 70 69  ..-4576....skipi
db20: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
db30: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
db40: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
db50: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
db60: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
db70: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
db80: 20 2b 20 2d 20 28 20 2b 20 37 37 20 29 20 63 6f   + - ( + 77 ) co
db90: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
dba0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d  cor0..----..-51.
dbb0: 0a 2d 36 34 0d 0a 2d 36 37 0d 0a 0d 0a 71 75 65  .-64..-67....que
dbc0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
dbd0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
dbe0: 63 6f 6c 32 20 2b 20 34 37 20 46 52 4f 4d 20 74  col2 + 47 FROM t
dbf0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
dc00: 2d 0d 0a 32 30 0d 0a 32 31 0d 0a 39 0d 0a 0d 0a  -..20..21..9....
dc10: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
dc20: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
dc30: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2a 20  col0 * + col1 * 
dc40: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
dc50: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
dc60: 32 32 38 33 31 0d 0a 32 37 31 35 31 38 0d 0a 36  22831..271518..6
dc70: 37 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  727....query I r
dc80: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
dc90: 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30  ISTINCT + - cor0
dca0: 2e 63 6f 6c 30 20 2a 20 2b 20 28 20 2d 20 63 6f  .col0 * + ( - co
dcb0: 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l0 ) AS col0 FRO
dcc0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
dcd0: 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d 0a  ----..49..6084..
dce0: 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6241....query I 
dcf0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
dd00: 2d 20 2b 20 63 6f 6c 32 20 2a 20 35 38 20 2b 20  - + col2 * 58 + 
dd10: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
dd20: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
dd30: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 37 38 0d 0a 2d  ..----..-3078..-
dd40: 33 32 34 39 0d 0a 2d 35 34 37 32 0d 0a 0d 0a 71  3249..-5472....q
dd50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
dd60: 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20  SELECT col0 + - 
dd70: 37 33 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  73 + - col1 FROM
dd80: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
dd90: 2d 2d 2d 0d 0a 2d 31 33 35 0d 0a 2d 31 33 35 0d  ---..-135..-135.
dda0: 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-75....query I 
ddb0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ddc0: 41 4c 4c 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72  ALL col1 + - cor
ddd0: 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  0.col0 AS col0 F
dde0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
ddf0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32  ..----..-19..-62
de00: 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..24....query I 
de10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
de20: 41 4c 4c 20 63 6f 6c 31 20 2a 20 28 20 63 6f 72  ALL col1 * ( cor
de30: 30 2e 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c  0.col1 ) * - col
de40: 31 20 2b 20 28 20 37 30 20 29 20 2a 20 2b 20 63  1 + ( 70 ) * + c
de50: 6f 6c 30 20 2b 20 2d 20 32 37 20 46 52 4f 4d 20  ol0 + - 27 FROM 
de60: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
de70: 2d 2d 0d 0a 2d 31 37 33 39 33 0d 0a 33 33 37 36  --..-17393..3376
de80: 0d 0a 33 34 35 33 0d 0a 0d 0a 71 75 65 72 79 20  ..3453....query 
de90: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
dea0: 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 38  T - + col1 + - 8
deb0: 39 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  9 * cor0.col2 + 
dec0: 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
ded0: 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
dee0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 39 35 0d 0a 2d  ..----..-2295..-
def0: 32 34 32 37 0d 0a 2d 33 33 32 30 0d 0a 0d 0a 6f  2427..-3320....o
df00: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
df10: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
df20: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
df30: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
df40: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 31 0d 0a  sort label-371..
df50: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
df60: 2b 20 38 36 20 2b 20 2b 20 63 6f 6c 31 20 44 49  + 86 + + col1 DI
df70: 56 20 2d 20 63 6f 6c 30 20 2d 20 34 30 20 46 52  V - col0 - 40 FR
df80: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
df90: 0a 2d 2d 2d 2d 0d 0a 2d 36 34 36 0d 0a 2d 36 37  .----..-646..-67
dfa0: 34 38 0d 0a 2d 36 38 33 34 0d 0a 0d 0a 73 6b 69  48..-6834....ski
dfb0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
dfc0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
dfd0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
dfe0: 6c 2d 33 37 31 0d 0a 53 45 4c 45 43 54 20 2d 20  l-371..SELECT - 
dff0: 63 6f 6c 30 20 2a 20 2b 20 38 36 20 2b 20 2b 20  col0 * + 86 + + 
e000: 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 30 20 2d 20  col1 / - col0 - 
e010: 34 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  40 FROM tab2 AS 
e020: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 34 36  cor0..----..-646
e030: 0d 0a 2d 36 37 34 38 0d 0a 2d 36 38 33 34 0d 0a  ..-6748..-6834..
e040: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e050: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
e060: 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31  CT col1 * + col1
e070: 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   - + col1 FROM t
e080: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
e090: 2d 0d 0a 31 35 36 0d 0a 36 35 30 0d 0a 39 30 0d  -..156..650..90.
e0a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e0b0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
e0c0: 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 36   cor0.col1 * + 6
e0d0: 39 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  9 FROM tab1 AS c
e0e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 39 34 0d  or0..----..1794.
e0f0: 0a 36 39 30 0d 0a 38 39 37 0d 0a 0d 0a 71 75 65  .690..897....que
e100: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
e110: 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  LECT - - cor0.co
e120: 6c 32 20 2a 20 34 34 20 46 52 4f 4d 20 74 61 62  l2 * 44 FROM tab
e130: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
e140: 0a 31 31 34 34 0d 0a 31 31 38 38 0d 0a 31 36 37  .1144..1188..167
e150: 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
e160: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
e170: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
e180: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
e190: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
e1a0: 2d 33 37 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  -375..SELECT + +
e1b0: 20 39 34 20 2b 20 36 30 20 44 49 56 20 2d 20 63   94 + 60 DIV - c
e1c0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
e1d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 34 0d   cor0..----..94.
e1e0: 0a 39 34 0d 0a 39 34 0d 0a 0d 0a 73 6b 69 70 69  .94..94....skipi
e1f0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
e200: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
e210: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
e220: 33 37 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  375..SELECT + + 
e230: 39 34 20 2b 20 36 30 20 2f 20 2d 20 63 6f 6c 31  94 + 60 / - col1
e240: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
e250: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 34 0d 0a 39 34  r0..----..94..94
e260: 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..94....query I 
e270: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e280: 44 49 53 54 49 4e 43 54 20 2d 20 34 35 20 2a 20  DISTINCT - 45 * 
e290: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
e2a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
e2b0: 2d 31 33 39 35 0d 0a 2d 32 36 35 35 0d 0a 2d 37  -1395..-2655..-7
e2c0: 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  65....query I ro
e2d0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
e2e0: 4c 20 63 6f 6c 31 20 2a 20 2d 20 32 34 20 46 52  L col1 * - 24 FR
e2f0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
e300: 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 32  .----..-2064..-2
e310: 31 38 34 0d 0a 2d 32 33 32 38 0d 0a 0d 0a 71 75  184..-2328....qu
e320: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
e330: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
e340: 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 63 6f   ( + col0 ) + co
e350: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
e360: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
e370: 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d 0a 32 30  --..-41..-52..20
e380: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
e390: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
e3a0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
e3b0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
e3c0: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
e3d0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 39  owsort label-379
e3e0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
e3f0: 31 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  1 + + CAST( NULL
e400: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
e410: 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63   ( - col1 ) AS c
e420: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
e430: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
e440: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
e450: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
e460: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
e470: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
e480: 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  9..SELECT ALL co
e490: 6c 31 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55  l1 + + CAST ( NU
e4a0: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
e4b0: 2a 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20 41  * - ( - col1 ) A
e4c0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
e4d0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
e4e0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
e4f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e500: 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  ECT col2 + col1 
e510: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
e520: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
e530: 2d 2d 2d 0d 0a 31 33 33 0d 0a 31 34 33 0d 0a 32  ---..133..143..2
e540: 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
e550: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
e560: 53 54 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 31  STINCT tab0.col1
e570: 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * + col1 + + co
e580: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
e590: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 32 39  tab0..----..7429
e5a0: 0d 0a 38 33 36 33 0d 0a 39 34 31 30 0d 0a 0d 0a  ..8363..9410....
e5b0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
e5c0: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
e5d0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
e5e0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
e5f0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
e600: 72 74 20 6c 61 62 65 6c 2d 33 38 32 0d 0a 53 45  rt label-382..SE
e610: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
e620: 2b 20 63 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e  + col0 * CAST( N
e630: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
e640: 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20  + + tab1.col0 * 
e650: 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
e660: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
e670: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
e680: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
e690: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
e6a0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
e6b0: 72 74 20 6c 61 62 65 6c 2d 33 38 32 0d 0a 53 45  rt label-382..SE
e6c0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
e6d0: 2b 20 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20  + col0 * CAST ( 
e6e0: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
e6f0: 29 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ) + + tab1.col0 
e700: 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  * - col0 AS col0
e710: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
e720: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
e730: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
e740: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
e750: 31 34 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46  14 * cor0.col2 F
e760: 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20  ROM tab0, tab1, 
e770: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
e780: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
e790: 73 68 69 6e 67 20 74 6f 20 33 66 33 33 62 66 66  shing to 3f33bff
e7a0: 36 36 35 61 31 36 34 31 37 31 62 37 38 61 36 63  665a164171b78a6c
e7b0: 64 32 30 62 30 62 62 33 66 0d 0a 0d 0a 73 6b 69  d20b0bb3f....ski
e7c0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
e7d0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
e7e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e7f0: 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28  ECT ALL - CAST (
e800: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 52 45   cor0.col2 AS RE
e810: 41 4c 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  AL ) AS col1 FRO
e820: 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  M tab0, tab0 AS 
e830: 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
e840: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
e850: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36  ues hashing to 6
e860: 61 34 33 65 37 66 31 35 31 39 34 61 66 37 33 66  a43e7f15194af73f
e870: 65 31 63 38 33 33 38 35 65 36 65 62 65 62 63 0d  e1c83385e6ebebc.
e880: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
e890: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
e8a0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
e8b0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
e8c0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
e8d0: 38 35 0d 0a 53 45 4c 45 43 54 20 2d 20 33 33 20  85..SELECT - 33 
e8e0: 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  DIV - col1 + - c
e8f0: 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol2 * col1 * col
e900: 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  2 + - col2 * - c
e910: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
e920: 2d 2d 2d 0d 0a 2d 36 30 34 34 32 32 0d 0a 2d 39  ---..-604422..-9
e930: 30 38 31 36 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0816..0....skipi
e940: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
e950: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
e960: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
e970: 33 38 35 0d 0a 53 45 4c 45 43 54 20 2d 20 33 33  385..SELECT - 33
e980: 20 2f 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   / - col1 + - co
e990: 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  l2 * col1 * col2
e9a0: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   + - col2 * - co
e9b0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
e9c0: 2d 2d 0d 0a 2d 36 30 34 34 32 32 0d 0a 2d 39 30  --..-604422..-90
e9d0: 38 31 36 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  816..0....query 
e9e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e9f0: 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 34  T ALL col0 * + 4
ea00: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
ea10: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
ea20: 0d 0a 31 32 0d 0a 32 35 36 0d 0a 33 32 30 0d 0a  ..12..256..320..
ea30: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
ea40: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
ea50: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
ea60: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
ea70: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
ea80: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ea90: 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e  CT ALL - + cor0.
eaa0: 63 6f 6c 31 20 2b 20 31 39 20 63 6f 6c 32 20 46  col1 + 19 col2 F
eab0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
eac0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 34 30  ..----..-12..-40
ead0: 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..2....query I r
eae0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
eaf0: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b  ISTINCT - col1 +
eb00: 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53   + ( + col1 ) AS
eb10: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
eb20: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
eb30: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
eb40: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
eb50: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
eb60: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
eb70: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
eb80: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
eb90: 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  LECT - col2 * co
eba0: 6c 32 20 2b 20 2b 20 28 20 63 6f 6c 31 20 29 20  l2 + + ( col1 ) 
ebb0: 2a 20 2b 20 35 31 20 2b 20 2b 20 63 6f 6c 30 20  * + 51 + + col0 
ebc0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
ebd0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
ebe0: 39 39 34 0d 0a 33 33 32 31 0d 0a 34 39 38 31 0d  994..3321..4981.
ebf0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
ec00: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
ec10: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
ec20: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
ec30: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
ec40: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ec50: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63  ECT ALL + cor0.c
ec60: 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
ec70: 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  2 col1 FROM tab1
ec80: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ec90: 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31 36  2916..3249..9216
eca0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
ecb0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
ecc0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
ecd0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
ece0: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
ecf0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 31  owsort label-391
ed00: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
ed10: 20 63 6f 6c 30 20 2b 20 28 20 2b 20 63 6f 72 30   col0 + ( + cor0
ed20: 2e 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20 2a  .col0 ) * col1 *
ed30: 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c 32 20   + CAST( - col2 
ed40: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
ed50: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
ed60: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
ed70: 39 37 33 30 0d 0a 2d 35 31 31 31 33 0d 0a 2d 35  9730..-51113..-5
ed80: 38 36 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  866....skipif my
ed90: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
eda0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
edb0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 31 0d  wsort label-391.
edc0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
edd0: 63 6f 6c 30 20 2b 20 28 20 2b 20 63 6f 72 30 2e  col0 + ( + cor0.
ede0: 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20 2a 20  col0 ) * col1 * 
edf0: 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20  + CAST ( - col2 
ee00: 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
ee10: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
ee20: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
ee30: 31 39 37 33 30 0d 0a 2d 35 31 31 31 33 0d 0a 2d  19730..-51113..-
ee40: 35 38 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5866....query I 
ee50: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ee60: 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2d 20 35  + col0 * - ( - 5
ee70: 34 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  4 ) AS col2 FROM
ee80: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
ee90: 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 34 35 36 0d 0a  ---..162..3456..
eea0: 34 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 49  4320....query II
eeb0: 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
eec0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
eed0: 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c  NCT * FROM tab1,
eee0: 20 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53   tab1 cor0 CROSS
eef0: 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 31   JOIN tab2, tab1
ef00: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32   cor1..----..972
ef10: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
ef20: 74 6f 20 34 36 33 34 64 31 30 65 38 62 36 62 33  to 4634d10e8b6b3
ef30: 37 35 31 30 62 62 39 39 37 34 35 61 61 64 65 33  7510bb99745aade3
ef40: 36 61 62 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  6ab....onlyif my
ef50: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
ef60: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
ef70: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
ef80: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
ef90: 65 6c 2d 33 39 34 0d 0a 53 45 4c 45 43 54 20 41  el-394..SELECT A
efa0: 4c 4c 20 28 20 28 20 63 6f 6c 30 20 29 20 29 20  LL ( ( col0 ) ) 
efb0: 44 49 56 20 2b 20 37 35 20 2b 20 63 6f 6c 32 20  DIV + 75 + col2 
efc0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
efd0: 0a 35 34 0d 0a 35 37 0d 0a 39 37 0d 0a 0d 0a 73  .54..57..97....s
efe0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
eff0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
f000: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
f010: 62 65 6c 2d 33 39 34 0d 0a 53 45 4c 45 43 54 20  bel-394..SELECT 
f020: 41 4c 4c 20 28 20 28 20 63 6f 6c 30 20 29 20 29  ALL ( ( col0 ) )
f030: 20 2f 20 2b 20 37 35 20 2b 20 63 6f 6c 32 20 46   / + 75 + col2 F
f040: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
f050: 35 34 0d 0a 35 37 0d 0a 39 37 0d 0a 0d 0a 71 75  54..57..97....qu
f060: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f070: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32 37 20 2b  ELECT ALL - 27 +
f080: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
f090: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
f0a0: 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 31 31 0d 0a 0d  --..-1..0..11...
f0b0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
f0c0: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
f0d0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
f0e0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
f0f0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
f100: 6f 72 74 20 6c 61 62 65 6c 2d 33 39 36 0d 0a 53  ort label-396..S
f110: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54  ELECT ALL + CAST
f120: 28 20 37 31 20 41 53 20 53 49 47 4e 45 44 20 29  ( 71 AS SIGNED )
f130: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
f140: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 31 0d 0a 37 31  r0..----..71..71
f150: 0d 0a 37 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..71....skipif m
f160: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
f170: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
f180: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 36  owsort label-396
f190: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43  ..SELECT ALL + C
f1a0: 41 53 54 20 28 20 37 31 20 41 53 20 49 4e 54 45  AST ( 71 AS INTE
f1b0: 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20  GER ) FROM tab0 
f1c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
f1d0: 31 0d 0a 37 31 0d 0a 37 31 0d 0a 0d 0a 73 6b 69  1..71..71....ski
f1e0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
f1f0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
f200: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
f210: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
f220: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
f230: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
f240: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 36 34  - cor0.col0 + 64
f250: 20 2a 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f   * col2 col2 FRO
f260: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
f270: 2d 2d 2d 2d 0d 0a 31 37 33 35 0d 0a 31 37 34 32  ----..1735..1742
f280: 0d 0a 32 35 31 31 0d 0a 0d 0a 71 75 65 72 79 20  ..2511....query 
f290: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f2a0: 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a  T ALL + - col1 *
f2b0: 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2b   col2 + col0 * +
f2c0: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c   cor0.col0 * col
f2d0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
f2e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 37 32  or0..----..11872
f2f0: 38 0d 0a 34 36 36 39 38 0d 0a 37 31 33 33 34 39  8..46698..713349
f300: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f310: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
f320: 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
f330: 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
f340: 30 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d 2d  0, tab2 cor1..--
f350: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
f360: 73 68 69 6e 67 20 74 6f 20 37 37 38 36 37 31 38  shing to 7786718
f370: 62 64 38 30 34 32 30 32 32 35 33 37 33 37 38 64  bd8042022537378d
f380: 34 30 65 63 38 37 34 37 35 0d 0a 0d 0a 6f 6e 6c  40ec87475....onl
f390: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
f3a0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
f3b0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
f3c0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
f3d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
f3e0: 6c 61 62 65 6c 2d 34 30 30 0d 0a 53 45 4c 45 43  label-400..SELEC
f3f0: 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  T - + col0 + + c
f400: 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 63 6f  ol1 * + CAST( co
f410: 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 63  l0 AS SIGNED ) c
f420: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
f430: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34   cor0..----..204
f440: 30 0d 0a 33 33 36 30 0d 0a 38 30 31 30 0d 0a 0d  0..3360..8010...
f450: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
f460: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
f470: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
f480: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
f490: 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
f4a0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
f4b0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
f4c0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
f4d0: 30 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  00..SELECT - + c
f4e0: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b  ol0 + + col1 * +
f4f0: 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20   CAST ( col0 AS 
f500: 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 31 20 46  INTEGER ) col1 F
f510: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
f520: 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 30 0d 0a 33 33  ..----..2040..33
f530: 36 30 0d 0a 38 30 31 30 0d 0a 0d 0a 71 75 65 72  60..8010....quer
f540: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f550: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
f560: 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol2 + col0 * col
f570: 31 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  1 + - col1 FROM 
f580: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
f590: 0a 31 30 36 0d 0a 31 31 32 33 0d 0a 36 38 37 0d  .106..1123..687.
f5a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
f5b0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
f5c0: 4e 43 54 20 28 20 63 6f 6c 32 20 29 20 2b 20 2d  NCT ( col2 ) + -
f5d0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
f5e0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
f5f0: 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d  .----..-41..-52.
f600: 0a 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .20....onlyif my
f610: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
f620: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
f630: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
f640: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
f650: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
f660: 34 30 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  403..SELECT - + 
f670: 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 43 41  col1 * col1 + CA
f680: 53 54 28 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  ST( - col1 + + c
f690: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20  ol2 * - col2 AS 
f6a0: 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
f6b0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
f6c0: 0d 0a 2d 33 33 35 39 0d 0a 2d 33 36 31 38 0d 0a  ..-3359..-3618..
f6d0: 2d 39 33 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  -9398....skipif 
f6e0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
f6f0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
f700: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30  rowsort label-40
f710: 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  3..SELECT - + co
f720: 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 43 41 53 54  l1 * col1 + CAST
f730: 20 28 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   ( - col1 + + co
f740: 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 49  l2 * - col2 AS I
f750: 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
f760: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
f770: 0d 0a 2d 33 33 35 39 0d 0a 2d 33 36 31 38 0d 0a  ..-3359..-3618..
f780: 2d 39 33 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -9398....query I
f790: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f7a0: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
f7b0: 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   * - col2 + + co
f7c0: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
f7d0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
f7e0: 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 33 35 39 31 0d  --..-108..-3591.
f7f0: 0a 2d 37 35 38 34 0d 0a 0d 0a 71 75 65 72 79 20  .-7584....query 
f800: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f810: 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
f820: 30 20 2a 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 72  0 * col0 - + cor
f830: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
f840: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
f850: 2d 31 32 0d 0a 2d 34 31 36 30 0d 0a 2d 36 34 38  -12..-4160..-648
f860: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
f870: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
f880: 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 72 30 2e 63   col1 - - cor0.c
f890: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
f8a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   cor0..----..-23
f8b0: 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72  ..54..67....quer
f8c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f8d0: 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  ECT + col0 * - c
f8e0: 6f 6c 31 20 2b 20 2d 20 36 33 20 2b 20 2b 20 63  ol1 + - 63 + + c
f8f0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
f900: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   cor0..----..-21
f910: 30 33 0d 0a 2d 33 34 32 33 0d 0a 2d 38 30 37 33  03..-3423..-8073
f920: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
f930: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
f940: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
f950: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
f960: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
f970: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f980: 4c 45 43 54 20 2d 20 34 35 20 2a 20 2b 20 63 6f  LECT - 45 * + co
f990: 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
f9a0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 38 35 0d 0a  0..----..-1485..
f9b0: 2d 33 36 39 30 0d 0a 2d 34 35 0d 0a 0d 0a 71 75  -3690..-45....qu
f9c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f9d0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 37 38  ELECT ALL + - 78
f9e0: 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
f9f0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
fa00: 2d 0d 0a 2d 31 33 32 36 0d 0a 2d 32 34 31 38 0d  -..-1326..-2418.
fa10: 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20  .-4602....query 
fa20: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fa30: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
fa40: 30 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  0 * col0 * col2 
fa50: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
fa60: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 33 0d 0a 31  0..----..1323..1
fa70: 35 38 31 38 34 0d 0a 32 33 37 31 35 38 0d 0a 0d  58184..237158...
fa80: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
fa90: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
faa0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
fab0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
fac0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
fad0: 6f 72 74 20 6c 61 62 65 6c 2d 34 31 31 0d 0a 53  ort label-411..S
fae0: 45 4c 45 43 54 20 2b 20 2b 20 28 20 2b 20 63 6f  ELECT + + ( + co
faf0: 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2a 20  l1 ) * + col0 * 
fb00: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  - cor0.col1 + + 
fb10: 63 6f 6c 32 20 2b 20 43 41 53 54 28 20 4e 55 4c  col2 + CAST( NUL
fb20: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
fb30: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
fb40: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
fb50: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
fb60: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
fb70: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
fb80: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
fb90: 61 62 65 6c 2d 34 31 31 0d 0a 53 45 4c 45 43 54  abel-411..SELECT
fba0: 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20   + + ( + col1 ) 
fbb0: 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72  * + col0 * - cor
fbc0: 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  0.col1 + + col2 
fbd0: 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
fbe0: 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
fbf0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
fc00: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
fc10: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
fc20: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
fc30: 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  LECT + - cor0.co
fc40: 6c 31 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 32 38  l1 * col0 - - 28
fc50: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
fc60: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
fc70: 0d 0a 2d 31 33 31 35 0d 0a 2d 31 38 39 0d 0a 2d  ..-1315..-189..-
fc80: 34 35 37 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  4574....skipif p
fc90: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
fca0: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
fcb0: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
fcc0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
fcd0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
fce0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
fcf0: 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 36 37 20  + + col2 * + 67 
fd00: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
fd10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a  or0..----..102..
fd20: 32 32 33 35 0d 0a 35 35 38 33 0d 0a 0d 0a 71 75  2235..5583....qu
fd30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
fd40: 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b  ELECT + + col1 +
fd50: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d   - cor0.col0 * -
fd60: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
fd70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35 30  cor0..----..2150
fd80: 0d 0a 33 34 39 32 0d 0a 38 31 39 30 0d 0a 0d 0a  ..3492..8190....
fd90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
fda0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 34 35  .SELECT ALL - 45
fdb0: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
fdc0: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 32  2..----..-14..-2
fdd0: 38 0d 0a 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49  8..14....query I
fde0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
fdf0: 20 37 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   79 AS col0 FROM
fe00: 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
fe10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
fe20: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
fe30: 30 61 32 32 36 31 63 61 61 32 63 35 63 64 62 66  0a2261caa2c5cdbf
fe40: 64 38 30 39 36 35 64 37 64 66 31 32 33 31 66 0d  d80965d7df1231f.
fe50: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
fe60: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
fe70: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
fe80: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
fe90: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
fea0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 37 0d  wsort label-417.
feb0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54  .SELECT ALL CAST
fec0: 28 20 2b 20 32 38 20 41 53 20 53 49 47 4e 45 44  ( + 28 AS SIGNED
fed0: 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) * col2 FROM t
fee0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
fef0: 2d 0d 0a 31 30 36 34 0d 0a 37 32 38 0d 0a 37 35  -..1064..728..75
ff00: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
ff10: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
ff20: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
ff30: 6f 72 74 20 6c 61 62 65 6c 2d 34 31 37 0d 0a 53  ort label-417..S
ff40: 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28  ELECT ALL CAST (
ff50: 20 2b 20 32 38 20 41 53 20 49 4e 54 45 47 45 52   + 28 AS INTEGER
ff60: 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) * col2 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 31 30 36 34 0d 0a 37 32 38 0d 0a 37 35  -..1064..728..75
ff90: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
ffa0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
ffb0: 6f 72 30 2e 63 6f 6c 31 20 2a 20 74 61 62 30 2e  or0.col1 * tab0.
ffc0: 63 6f 6c 32 20 2a 20 28 20 2b 20 35 36 20 29 20  col2 * ( + 56 ) 
ffd0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
ffe0: 30 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  0, tab2 cor0..--
fff0: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
10000 68 69 6e 67 20 74 6f 20 31 36 63 39 34 36 66 63  hing to 16c946fc
10010 62 30 34 36 30 34 38 35 39 63 62 66 66 34 64 38  b04604859cbff4d8
10020 38 37 65 30 63 34 37 34 0d 0a 0d 0a 6f 6e 6c 79  87e0c474....only
10030 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
10040 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
10050 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
10060 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
10070 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
10080 61 62 65 6c 2d 34 31 39 0d 0a 53 45 4c 45 43 54  abel-419..SELECT
10090 20 2d 20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20   - - CAST( col1 
100a0 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f  AS SIGNED ) * co
100b0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
100c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38  cor0..----..1248
100d0 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 73  ..1404..570....s
100e0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
100f0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
10100 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10110 62 65 6c 2d 34 31 39 0d 0a 53 45 4c 45 43 54 20  bel-419..SELECT 
10120 2d 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 31 20  - - CAST ( col1 
10130 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63  AS INTEGER ) * c
10140 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
10150 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   cor0..----..124
10160 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a  8..1404..570....
10170 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
10180 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
10190 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
101a0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
101b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 32 30 0d  wsort label-420.
101c0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
101d0 33 34 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d 20  34 + col2 DIV - 
101e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
101f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33  S cor0..----..33
10200 0d 0a 33 33 0d 0a 33 33 0d 0a 0d 0a 73 6b 69 70  ..33..33....skip
10210 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
10220 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
10230 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10240 2d 34 32 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -420..SELECT ALL
10250 20 2d 20 2d 20 33 34 20 2b 20 63 6f 6c 32 20 2f   - - 34 + col2 /
10260 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
10270 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
10280 0a 33 33 0d 0a 33 33 0d 0a 33 33 0d 0a 0d 0a 6f  .33..33..33....o
10290 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
102a0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
102b0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
102c0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
102d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
102e0 74 20 6c 61 62 65 6c 2d 34 32 31 0d 0a 53 45 4c  t label-421..SEL
102f0 45 43 54 20 43 41 53 54 28 20 31 38 20 41 53 20  ECT CAST( 18 AS 
10300 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
10310 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
10320 0d 0a 31 38 0d 0a 31 38 0d 0a 31 38 0d 0a 0d 0a  ..18..18..18....
10330 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
10340 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
10350 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
10360 61 62 65 6c 2d 34 32 31 0d 0a 53 45 4c 45 43 54  abel-421..SELECT
10370 20 43 41 53 54 20 28 20 31 38 20 41 53 20 49 4e   CAST ( 18 AS IN
10380 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
10390 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
103a0 0a 31 38 0d 0a 31 38 0d 0a 31 38 0d 0a 0d 0a 71  .18..18..18....q
103b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
103c0 53 45 4c 45 43 54 20 2d 20 2d 20 28 20 63 6f 6c  SELECT - - ( col
103d0 30 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  0 ) * + cor0.col
103e0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
103f0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
10400 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d 0a 36 32 34  -..49..6084..624
10410 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
10420 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
10430 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
10440 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
10450 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10460 2d 34 32 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -423..SELECT col
10470 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  0 * - cor0.col0 
10480 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  DIV - col0 FROM 
10490 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
104a0 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d  --..7..78..79...
104b0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
104c0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
104d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
104e0 6c 61 62 65 6c 2d 34 32 33 0d 0a 53 45 4c 45 43  label-423..SELEC
104f0 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e  T col0 * - cor0.
10500 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20 46 52  col0 / - col0 FR
10510 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
10520 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39  .----..7..78..79
10530 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10540 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 39 20 46  ort..SELECT 49 F
10550 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63  ROM tab0, tab1 c
10560 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
10570 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
10580 62 34 30 37 38 33 63 30 66 66 66 37 32 65 38 38  b40783c0fff72e88
10590 30 32 63 64 66 30 36 38 32 65 37 63 62 35 35 0d  02cdf0682e7cb55.
105a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
105b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
105c0 20 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab1.col1 FROM 
105d0 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61 62 30  tab1, tab0, tab0
105e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
105f0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
10600 67 20 74 6f 20 64 36 37 31 61 30 36 34 65 32 64  g to d671a064e2d
10610 61 37 30 39 63 61 34 63 64 66 65 61 33 31 37 62  a709ca4cdfea317b
10620 38 65 38 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  8e892....query I
10630 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10640 20 2d 20 37 30 20 2d 20 63 6f 72 30 2e 63 6f 6c   - 70 - cor0.col
10650 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
10660 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  1, tab0 AS cor0.
10670 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
10680 20 68 61 73 68 69 6e 67 20 74 6f 20 39 66 31 66   hashing to 9f1f
10690 61 32 38 62 38 34 65 35 36 39 38 38 31 64 32 38  a28b84e569881d28
106a0 32 63 30 63 63 31 66 63 35 35 61 31 0d 0a 0d 0a  2c0cc1fc55a1....
106b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
106c0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
106d0 20 63 6f 6c 31 20 2a 20 2d 20 32 38 20 41 53 20   col1 * - 28 AS 
106e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
106f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
10700 37 33 30 0d 0a 2d 35 35 35 0d 0a 2d 38 37 35 0d  730..-555..-875.
10710 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10720 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
10730 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  NCT - col1 * col
10740 31 20 2b 20 2d 20 34 33 20 2a 20 63 6f 6c 32 20  1 + - 43 * col2 
10750 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
10760 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
10770 0a 2d 31 39 32 33 0d 0a 2d 32 31 32 32 0d 0a 2d  .-1923..-2122..-
10780 34 35 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4599....query I 
10790 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
107a0 2b 20 63 6f 6c 32 20 2a 20 32 38 20 46 52 4f 4d  + col2 * 28 FROM
107b0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
107c0 2d 2d 2d 0d 0a 32 32 39 36 0d 0a 32 38 0d 0a 39  ---..2296..28..9
107d0 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  24....query I ro
107e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 33  wsort..SELECT 93
107f0 20 2a 20 28 20 2b 20 63 6f 6c 30 20 2a 20 2d 20   * ( + col0 * - 
10800 33 37 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  37 ) FROM tab2 A
10810 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
10820 34 30 38 37 0d 0a 2d 32 36 38 33 39 38 0d 0a 2d  4087..-268398..-
10830 32 37 31 38 33 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  271839....onlyif
10840 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
10850 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
10860 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
10870 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
10880 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
10890 65 6c 2d 34 33 31 0d 0a 53 45 4c 45 43 54 20 41  el-431..SELECT A
108a0 4c 4c 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  LL + CAST( NULL 
108b0 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20  AS SIGNED ) * - 
108c0 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  6 AS col1 FROM t
108d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
108e0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
108f0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
10900 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
10910 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
10920 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33 31 0d  wsort label-431.
10930 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41  .SELECT ALL + CA
10940 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
10950 45 47 45 52 20 29 20 2a 20 2d 20 36 20 41 53 20  EGER ) * - 6 AS 
10960 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
10970 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
10980 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
10990 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
109a0 74 0d 0a 53 45 4c 45 43 54 20 31 33 20 2a 20 2b  t..SELECT 13 * +
109b0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
109c0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
109d0 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 33 39 0d  .----..1040..39.
109e0 0a 38 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .832....query I 
109f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10a00 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 28  ALL - col2 * + (
10a10 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f   cor0.col2 ) FRO
10a20 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
10a30 2d 2d 2d 2d 0d 0a 2d 32 39 31 36 0d 0a 2d 33 32  ----..-2916..-32
10a40 34 39 0d 0a 2d 39 32 31 36 0d 0a 0d 0a 71 75 65  49..-9216....que
10a50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10a60 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  LECT + col2 + - 
10a70 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS c
10a80 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
10a90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
10aa0 32 0d 0a 2d 32 30 30 32 0d 0a 2d 32 39 36 34 0d  2..-2002..-2964.
10ab0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10ac0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
10ad0 2d 20 2b 20 28 20 36 36 20 29 20 2a 20 63 6f 6c  - + ( 66 ) * col
10ae0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
10af0 2d 0d 0a 2d 31 34 34 0d 0a 2d 34 31 36 37 0d 0a  -..-144..-4167..
10b00 2d 35 31 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -5184....query I
10b10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10b20 20 39 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   92 AS col1 FROM
10b30 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
10b40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
10b50 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
10b60 31 36 66 61 34 35 63 38 62 30 36 66 39 66 36 37  16fa45c8b06f9f67
10b70 64 36 65 35 30 30 62 66 64 34 33 35 63 31 61 0d  d6e500bfd435c1a.
10b80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10b90 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
10ba0 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  or0.col2 * col0 
10bb0 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  + + col2 AS col1
10bc0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
10bd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a  r0..----..-108..
10be0 2d 33 35 39 31 0d 0a 2d 37 35 38 34 0d 0a 0d 0a  -3591..-7584....
10bf0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10c00 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
10c10 20 63 6f 6c 30 20 2b 20 33 31 20 2a 20 2b 20 63   col0 + 31 * + c
10c20 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol1 * + col0 AS 
10c30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
10c40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
10c50 37 32 36 34 0d 0a 34 32 39 37 36 0d 0a 36 39 34  7264..42976..694
10c60 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
10c70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
10c80 20 35 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f   51 * + col1 FRO
10c90 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
10ca0 2d 2d 2d 2d 0d 0a 2d 34 33 38 36 0d 0a 2d 34 36  ----..-4386..-46
10cb0 34 31 0d 0a 2d 34 39 34 37 0d 0a 0d 0a 71 75 65  41..-4947....que
10cc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10cd0 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 72  LECT ALL + + cor
10ce0 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  0.col1 + + col2 
10cf0 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  * col2 FROM tab2
10d00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10d10 31 34 36 31 0d 0a 37 33 35 0d 0a 37 36 30 0d 0a  1461..735..760..
10d20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10d30 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
10d40 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a  .col0 + - col2 *
10d50 20 36 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   61 AS col1 FROM
10d60 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
10d70 2d 2d 2d 0d 0a 2d 31 39 38 39 0d 0a 2d 32 36 0d  ---..-1989..-26.
10d80 0a 2d 34 39 31 33 0d 0a 0d 0a 71 75 65 72 79 20  .-4913....query 
10d90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10da0 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T - col2 * + col
10db0 31 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 46  1 + ( - col2 ) F
10dc0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
10dd0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 34 0d 0a 2d  ..----..-1344..-
10de0 31 34 35 38 0d 0a 2d 36 32 37 0d 0a 0d 0a 71 75  1458..-627....qu
10df0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10e00 45 4c 45 43 54 20 41 4c 4c 20 2b 20 38 33 20 2a  ELECT ALL + 83 *
10e10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
10e20 0a 2d 2d 2d 2d 0d 0a 31 39 39 32 0d 0a 32 39 30  .----..1992..290
10e30 35 0d 0a 37 33 38 37 0d 0a 0d 0a 6f 6e 6c 79 69  5..7387....onlyi
10e40 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
10e50 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
10e60 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
10e70 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
10e80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10e90 62 65 6c 2d 34 34 34 0d 0a 53 45 4c 45 43 54 20  bel-444..SELECT 
10ea0 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20  + col2 + col0 * 
10eb0 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
10ec0 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31  SIGNED ) AS col1
10ed0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
10ee0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
10ef0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
10f00 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
10f10 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
10f20 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
10f30 65 6c 2d 34 34 34 0d 0a 53 45 4c 45 43 54 20 2b  el-444..SELECT +
10f40 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2b   col2 + col0 * +
10f50 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
10f60 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
10f70 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
10f80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
10f90 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
10fa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10fb0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
10fc0 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  - col0 * cor0.co
10fd0 6c 31 20 2d 20 28 20 2d 20 63 6f 6c 31 20 2b 20  l1 - ( - col1 + 
10fe0 28 20 2d 20 39 20 29 20 29 20 46 52 4f 4d 20 74  ( - 9 ) ) FROM t
10ff0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
11000 2d 0d 0a 2d 31 39 39 0d 0a 2d 34 30 39 34 31 0d  -..-199..-40941.
11010 0a 2d 38 33 31 37 38 0d 0a 0d 0a 6f 6e 6c 79 69  .-83178....onlyi
11020 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
11030 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
11040 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
11050 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11060 20 6c 61 62 65 6c 2d 34 34 36 0d 0a 53 45 4c 45   label-446..SELE
11070 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
11080 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20  l2 DIV + col1 + 
11090 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col1 * col2 FROM
110a0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33   tab2..----..153
110b0 34 0d 0a 36 34 34 0d 0a 38 33 37 0d 0a 0d 0a 73  4..644..837....s
110c0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
110d0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
110e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
110f0 62 65 6c 2d 34 34 36 0d 0a 53 45 4c 45 43 54 20  bel-446..SELECT 
11100 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
11110 2f 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  / + col1 + col1 
11120 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  * col2 FROM tab2
11130 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34  ..----..1534..64
11140 34 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20  4..837....query 
11150 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11160 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20 63  T ALL col0 * - c
11170 6f 6c 32 20 2d 20 28 20 32 36 20 2b 20 2d 20 63  ol2 - ( 26 + - c
11180 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol2 ) AS col1 FR
11190 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
111a0 36 30 0d 0a 2d 37 32 34 32 0d 0a 2d 37 38 35 0d  60..-7242..-785.
111b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
111c0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
111d0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
111e0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
111f0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
11200 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 38 0d  wsort label-448.
11210 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 74  .SELECT col2 + t
11220 61 62 32 2e 63 6f 6c 32 20 2d 20 2d 20 43 41 53  ab2.col2 - - CAS
11230 54 28 20 2d 20 31 32 20 41 53 20 53 49 47 4e 45  T( - 12 AS SIGNE
11240 44 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  D ) * col1 FROM 
11250 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38  tab2..----..-128
11260 0d 0a 2d 33 31 38 0d 0a 2d 36 35 36 0d 0a 0d 0a  ..-318..-656....
11270 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
11280 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
11290 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
112a0 61 62 65 6c 2d 34 34 38 0d 0a 53 45 4c 45 43 54  abel-448..SELECT
112b0 20 63 6f 6c 32 20 2b 20 74 61 62 32 2e 63 6f 6c   col2 + tab2.col
112c0 32 20 2d 20 2d 20 43 41 53 54 20 28 20 2d 20 31  2 - - CAST ( - 1
112d0 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  2 AS INTEGER ) *
112e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
112f0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 0d 0a 2d 33 31  .----..-128..-31
11300 38 0d 0a 2d 36 35 36 0d 0a 0d 0a 71 75 65 72 79  8..-656....query
11310 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11320 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32  CT + col2 + col2
11330 20 2a 20 2d 20 31 36 20 46 52 4f 4d 20 74 61 62   * - 16 FROM tab
11340 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
11350 0a 2d 31 34 34 30 0d 0a 2d 38 31 30 0d 0a 2d 38  .-1440..-810..-8
11360 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  55....query I ro
11370 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
11380 4c 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  L - col1 + col2 
11390 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
113a0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
113b0 0d 0a 2d 31 38 38 0d 0a 2d 33 36 35 38 0d 0a 2d  ..-188..-3658..-
113c0 37 36 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  7693....skipif p
113d0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
113e0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
113f0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
11400 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
11410 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11420 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
11430 2a 20 35 37 20 63 6f 6c 30 20 46 52 4f 4d 20 74  * 57 col0 FROM t
11440 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
11450 2d 0d 0a 34 39 30 32 0d 0a 35 31 38 37 0d 0a 35  -..4902..5187..5
11460 35 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  529....query I r
11470 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
11480 20 28 20 63 6f 6c 32 20 29 20 2b 20 2b 20 33 20   ( col2 ) + + 3 
11490 2b 20 33 38 20 46 52 4f 4d 20 74 61 62 30 0d 0a  + 38 FROM tab0..
114a0 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 34 30 0d 0a 38  ----..-41..40..8
114b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
114c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
114d0 62 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32  b0.col1 + - col2
114e0 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 34   * tab0.col0 * 4
114f0 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  4 AS col1 FROM t
11500 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 33  ab0..----..-1443
11510 0d 0a 2d 33 32 31 30 32 31 0d 0a 2d 33 34 37 36  ..-321021..-3476
11520 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
11530 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
11540 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20  TINCT cor0.col0 
11550 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
11560 30 2c 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f  0, tab1, tab2 co
11570 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d  r0..----..7..78.
11580 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .79....query I r
11590 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
115a0 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 74  ISTINCT col1 * t
115b0 61 62 31 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  ab1.col2 + col1 
115c0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
115d0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a 31  1..----..1261..1
115e0 34 33 30 0d 0a 35 38 30 0d 0a 0d 0a 71 75 65 72  430..580....quer
115f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11600 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT - col2 * col
11610 30 20 2a 20 2d 20 28 20 63 6f 6c 32 20 29 20 41  0 * - ( col2 ) A
11620 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
11630 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 30 37 36 0d 0a  ..----..114076..
11640 35 31 30 33 0d 0a 35 32 37 32 38 0d 0a 0d 0a 71  5103..52728....q
11650 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11660 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
11670 37 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  70 FROM tab2 AS 
11680 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 0d 0a  cor0..----..32..
11690 34 33 0d 0a 34 34 0d 0a 0d 0a 71 75 65 72 79 20  43..44....query 
116a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
116b0 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63 6f 6c  T ALL col0 + col
116c0 31 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  1 - col1 * col1 
116d0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
116e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 38 36 0d 0a  0..----..-7286..
116f0 2d 38 31 30 31 0d 0a 2d 39 32 37 37 0d 0a 0d 0a  -8101..-9277....
11700 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
11710 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
11720 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
11730 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
11740 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
11750 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11760 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   + - col0 + col2
11770 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
11780 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
11790 34 31 0d 0a 2d 35 32 0d 0a 32 30 0d 0a 0d 0a 73  41..-52..20....s
117a0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
117b0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
117c0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
117d0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
117e0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
117f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11800 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
11810 2d 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63  - ( col0 ) * + c
11820 6f 6c 31 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20  ol1 + col0 col2 
11830 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
11840 0a 2d 32 33 31 0d 0a 2d 34 30 38 39 36 0d 0a 2d  .-231..-40896..-
11850 38 33 31 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  83120....query I
11860 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11870 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f   ALL + col1 * co
11880 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l1 + + col1 FROM
11890 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
118a0 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 38 32 0d 0a 37  ---..110..182..7
118b0 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
118c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
118d0 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f  STINCT - cor0.co
118e0 6c 30 20 2b 20 2d 20 34 38 20 46 52 4f 4d 20 74  l0 + - 48 FROM t
118f0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
11900 2d 0d 0a 2d 31 33 37 0d 0a 2d 37 32 0d 0a 2d 38  -..-137..-72..-8
11910 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
11920 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
11930 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b   col2 + col1 * +
11940 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f   col0 + col0 FRO
11950 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
11960 2d 2d 2d 2d 0d 0a 32 31 32 31 0d 0a 33 34 33 31  ----..2121..3431
11970 0d 0a 38 32 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..8270....onlyif
11980 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
11990 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
119a0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
119b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
119c0 6c 61 62 65 6c 2d 34 36 34 0d 0a 53 45 4c 45 43  label-464..SELEC
119d0 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 44 49 56  T ALL - col2 DIV
119e0 20 2d 20 39 38 20 2b 20 2b 20 63 6f 6c 31 20 2a   - 98 + + col1 *
119f0 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f   - col2 col0 FRO
11a00 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
11a10 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d  -..-1248..-1404.
11a20 0a 2d 35 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-570....skipif 
11a30 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
11a40 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
11a50 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
11a60 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
11a70 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
11a80 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
11a90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11aa0 20 6c 61 62 65 6c 2d 34 36 34 0d 0a 53 45 4c 45   label-464..SELE
11ab0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2f 20  CT ALL - col2 / 
11ac0 2d 20 39 38 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  - 98 + + col1 * 
11ad0 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d  - col2 col0 FROM
11ae0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
11af0 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a  ..-1248..-1404..
11b00 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -570....query I 
11b10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11b20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20  DISTINCT col1 * 
11b30 2b 20 36 38 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 68 AS col2 FRO
11b40 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
11b50 2d 0d 0a 31 37 36 38 0d 0a 36 38 30 0d 0a 38 38  -..1768..680..88
11b60 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
11b70 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
11b80 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
11b90 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
11ba0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
11bb0 2d 34 36 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  -466..SELECT DIS
11bc0 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  TINCT + cor0.col
11bd0 32 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20  2 DIV col0 FROM 
11be0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
11bf0 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a  --..0..1..18....
11c00 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
11c10 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
11c20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
11c30 61 62 65 6c 2d 34 36 36 0d 0a 53 45 4c 45 43 54  abel-466..SELECT
11c40 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30   DISTINCT + cor0
11c50 2e 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 46 52 4f  .col2 / col0 FRO
11c60 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
11c70 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a  ----..0..1..18..
11c80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11c90 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
11ca0 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 36 35 20 46  l2 + col2 * 65 F
11cb0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
11cc0 0d 0a 2d 2d 2d 2d 0d 0a 32 31 31 32 0d 0a 35 32  ..----..2112..52
11cd0 34 38 0d 0a 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  48..64....onlyif
11ce0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
11cf0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
11d00 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
11d10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
11d20 6c 61 62 65 6c 2d 34 36 38 0d 0a 53 45 4c 45 43  label-468..SELEC
11d30 54 20 2d 20 63 6f 6c 30 20 2a 20 37 30 20 44 49  T - col0 * 70 DI
11d40 56 20 2d 20 34 31 20 2b 20 2d 20 63 6f 6c 31 20  V - 41 + - col1 
11d50 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
11d60 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
11d70 0d 0a 31 35 31 0d 0a 34 30 0d 0a 35 39 0d 0a 0d  ..151..40..59...
11d80 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
11d90 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
11da0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
11db0 6c 61 62 65 6c 2d 34 36 38 0d 0a 53 45 4c 45 43  label-468..SELEC
11dc0 54 20 2d 20 63 6f 6c 30 20 2a 20 37 30 20 2f 20  T - col0 * 70 / 
11dd0 2d 20 34 31 20 2b 20 2d 20 63 6f 6c 31 20 2b 20  - 41 + - col1 + 
11de0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
11df0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11e00 31 35 31 0d 0a 34 30 0d 0a 35 39 0d 0a 0d 0a 71  151..40..59....q
11e10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11e20 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20  SELECT col2 * + 
11e30 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col0 + col0 * - 
11e40 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
11e50 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
11e60 35 37 34 0d 0a 2d 32 38 0d 0a 31 36 35 39 0d 0a  574..-28..1659..
11e70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11e80 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 33 30  t..SELECT - - 30
11e90 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11ea0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
11eb0 0d 0a 33 30 0d 0a 33 30 0d 0a 33 30 0d 0a 0d 0a  ..30..30..30....
11ec0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11ed0 0a 53 45 4c 45 43 54 20 2d 20 36 37 20 2b 20 63  .SELECT - 67 + c
11ee0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
11ef0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
11f00 2d 2d 2d 0d 0a 31 39 0d 0a 32 34 0d 0a 33 30 0d  ---..19..24..30.
11f10 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
11f20 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
11f30 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
11f40 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
11f50 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
11f60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11f70 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
11f80 20 35 37 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c   57 * + col0 col
11f90 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
11fa0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 38  or0..----..-1368
11fb0 0d 0a 2d 31 39 39 35 0d 0a 2d 35 30 37 33 0d 0a  ..-1995..-5073..
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 2b 20 39 36 20 2a  t..SELECT + 96 *
11fe0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
11ff0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
12000 2d 2d 2d 2d 0d 0a 32 38 38 0d 0a 36 31 34 34 0d  ----..288..6144.
12010 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .7680....query I
12020 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12030 20 28 20 2d 20 37 35 20 29 20 41 53 20 63 6f 6c   ( - 75 ) AS col
12040 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
12050 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 35 0d 0a  or0..----..-75..
12060 2d 37 35 0d 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72  -75..-75....quer
12070 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12080 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
12090 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63  ol1 * + col0 * c
120a0 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 + col2 AS co
120b0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
120c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38 36  cor0..----..2286
120d0 39 0d 0a 32 37 31 35 34 34 0d 0a 36 37 35 34 0d  9..271544..6754.
120e0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
120f0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
12100 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
12110 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
12120 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
12130 37 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  76..SELECT DISTI
12140 4e 43 54 20 34 36 20 44 49 56 20 2b 20 63 6f 72  NCT 46 DIV + cor
12150 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
12160 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12170 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..1....skipif m
12180 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
12190 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
121a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 36  owsort label-476
121b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
121c0 54 20 34 36 20 2f 20 2b 20 63 6f 72 30 2e 63 6f  T 46 / + cor0.co
121d0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
121e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
121f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12200 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
12210 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col1 * + col1 + 
12220 2b 20 38 37 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 87 AS col0 FRO
12230 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
12240 2d 2d 2d 2d 0d 0a 31 38 37 0d 0a 32 35 36 0d 0a  ----..187..256..
12250 37 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  763....query I r
12260 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31  owsort..SELECT 1
12270 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  5 AS col2 FROM t
12280 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab1, tab1 AS cor
12290 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
122a0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
122b0 20 68 61 73 68 69 6e 67 20 74 6f 20 37 31 64 64   hashing to 71dd
122c0 61 39 61 37 31 66 63 39 37 38 65 61 37 62 30 61  a9a71fc978ea7b0a
122d0 63 35 64 38 63 64 32 65 66 31 66 30 0d 0a 0d 0a  c5d8cd2ef1f0....
122e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
122f0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31  .SELECT + - col1
12300 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32   + col0 + + col2
12310 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
12320 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d  r0..----..-29..-
12330 36 31 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20  61..80....query 
12340 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
12350 54 20 2b 20 32 37 20 46 52 4f 4d 20 74 61 62 32  T + 27 FROM tab2
12360 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab0 cor0..---
12370 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
12380 69 6e 67 20 74 6f 20 37 30 31 62 66 31 32 64 38  ing to 701bf12d8
12390 36 33 39 32 63 62 31 35 38 35 64 39 65 34 66 33  6392cb1585d9e4f3
123a0 63 37 32 65 39 61 38 0d 0a 0d 0a 71 75 65 72 79  c72e9a8....query
123b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
123c0 43 54 20 41 4c 4c 20 2d 20 2d 20 37 36 20 41 53  CT ALL - - 76 AS
123d0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
123e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
123f0 36 0d 0a 37 36 0d 0a 37 36 0d 0a 0d 0a 71 75 65  6..76..76....que
12400 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12410 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
12420 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  col1 + col2 * co
12430 6c 30 20 2a 20 35 30 20 41 53 20 63 6f 6c 32 20  l0 * 50 AS col2 
12440 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
12450 2d 2d 2d 2d 0d 0a 31 30 31 34 35 39 0d 0a 31 35  ----..101459..15
12460 30 31 31 37 0d 0a 39 34 38 31 0d 0a 0d 0a 71 75  0117..9481....qu
12470 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12480 45 4c 45 43 54 20 41 4c 4c 20 37 20 2b 20 63 6f  ELECT ALL 7 + co
12490 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
124a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a  cor0..----..31..
124b0 34 32 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  42..96....onlyif
124c0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
124d0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
124e0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
124f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
12500 6c 61 62 65 6c 2d 34 38 34 0d 0a 53 45 4c 45 43  label-484..SELEC
12510 54 20 2d 20 2b 20 36 33 20 44 49 56 20 2d 20 39  T - + 63 DIV - 9
12520 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
12530 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 0d 0a 37 0d 0a  .----..7..7..7..
12540 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
12550 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
12560 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12570 20 6c 61 62 65 6c 2d 34 38 34 0d 0a 53 45 4c 45   label-484..SELE
12580 43 54 20 2d 20 2b 20 36 33 20 2f 20 2d 20 39 20  CT - + 63 / - 9 
12590 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
125a0 2d 2d 2d 2d 0d 0a 37 0d 0a 37 0d 0a 37 0d 0a 0d  ----..7..7..7...
125b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
125c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
125d0 54 20 2b 20 31 33 20 2b 20 2b 20 32 34 20 41 53  T + 13 + + 24 AS
125e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
125f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
12600 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
12610 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
12620 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31   + col0 * + col1
12630 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + - col1 AS col
12640 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
12650 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 37 0d  or0..----..1027.
12660 0a 35 32 0d 0a 36 33 30 0d 0a 0d 0a 71 75 65 72  .52..630....quer
12670 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12680 45 43 54 20 2b 20 31 37 20 2a 20 2b 20 31 32 20  ECT + 17 * + 12 
12690 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
126a0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 0d 0a 32 30  0..----..204..20
126b0 34 0d 0a 32 30 34 0d 0a 0d 0a 71 75 65 72 79 20  4..204....query 
126c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
126d0 54 20 39 35 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  T 95 + cor0.col2
126e0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
126f0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
12700 0d 0a 31 34 39 0d 0a 31 35 32 0d 0a 31 39 31 0d  ..149..152..191.
12710 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12720 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
12730 6f 6c 31 20 2b 20 2d 20 33 31 20 2a 20 63 6f 6c  ol1 + - 31 * col
12740 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
12750 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
12760 2d 0d 0a 2d 31 31 36 31 0d 0a 2d 37 34 37 0d 0a  -..-1161..-747..
12770 2d 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -806....query I 
12780 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12790 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 63  ALL - + col1 + c
127a0 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 * col1 FROM 
127b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
127c0 2d 2d 0d 0a 31 32 33 35 0d 0a 31 33 37 38 0d 0a  --..1235..1378..
127d0 35 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  560....query I r
127e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
127f0 4c 4c 20 63 6f 6c 30 20 2d 20 28 20 2b 20 63 6f  LL col0 - ( + co
12800 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  l1 ) FROM tab2..
12810 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36  ----..-24..19..6
12820 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
12830 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
12840 54 49 4e 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c  TINCT + tab1.col
12850 31 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20  1 - tab1.col1 * 
12860 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
12870 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 0d 0a 2d 36  ..----..-156..-6
12880 35 30 0d 0a 2d 39 30 0d 0a 0d 0a 6f 6e 6c 79 69  50..-90....onlyi
12890 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
128a0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
128b0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
128c0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
128d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
128e0 62 65 6c 2d 34 39 33 0d 0a 53 45 4c 45 43 54 20  bel-493..SELECT 
128f0 2d 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 4e  - col1 + CAST( N
12900 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
12910 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62 30   + col0 * + tab0
12920 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d  .col2 FROM tab0.
12930 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
12940 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
12950 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
12960 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
12970 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
12980 34 39 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  493..SELECT - co
12990 6c 31 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  l1 + CAST ( NULL
129a0 20 41 53 20 52 45 41 4c 20 29 20 2b 20 63 6f 6c   AS REAL ) + col
129b0 30 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20  0 * + tab0.col2 
129c0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
129d0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
129e0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
129f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
12a00 20 2b 20 39 34 20 29 20 2a 20 2b 20 63 6f 6c 32   + 94 ) * + col2
12a10 20 2d 20 32 38 20 2a 20 63 6f 6c 32 20 41 53 20   - 28 * col2 AS 
12a20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
12a30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
12a40 31 37 31 32 0d 0a 2d 36 35 38 38 0d 0a 2d 36 39  1712..-6588..-69
12a50 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  54....onlyif mys
12a60 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
12a70 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
12a80 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
12a90 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
12aa0 6c 2d 34 39 35 0d 0a 53 45 4c 45 43 54 20 2b 20  l-495..SELECT + 
12ab0 2d 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20  - CAST( col1 AS 
12ac0 53 49 47 4e 45 44 20 29 20 44 49 56 20 63 6f 6c  SIGNED ) DIV col
12ad0 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 + col1 FROM ta
12ae0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
12af0 0d 0a 38 35 0d 0a 39 30 0d 0a 39 36 0d 0a 0d 0a  ..85..90..96....
12b00 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
12b10 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
12b20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
12b30 61 62 65 6c 2d 34 39 35 0d 0a 53 45 4c 45 43 54  abel-495..SELECT
12b40 20 2b 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 31   + - CAST ( col1
12b50 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20   AS INTEGER ) / 
12b60 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col1 + col1 FROM
12b70 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
12b80 2d 2d 2d 0d 0a 38 35 0d 0a 39 30 0d 0a 39 36 0d  ---..85..90..96.
12b90 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
12ba0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
12bb0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
12bc0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
12bd0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
12be0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 36 0d  wsort label-496.
12bf0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54  .SELECT ALL CAST
12c00 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
12c10 20 29 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 41   ) + tab2.col0 A
12c20 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
12c30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
12c40 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
12c50 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
12c60 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
12c70 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12c80 2d 34 39 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -496..SELECT ALL
12c90 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
12ca0 49 4e 54 45 47 45 52 20 29 20 2b 20 74 61 62 32  INTEGER ) + tab2
12cb0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
12cc0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab2..----..N
12cd0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
12ce0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
12cf0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
12d00 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
12d10 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
12d20 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
12d30 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 37 0d  wsort label-497.
12d40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41  .SELECT ALL - CA
12d50 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
12d60 45 44 20 29 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  ED ) / col1 FROM
12d70 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
12d80 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
12d90 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
12da0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
12db0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
12dc0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39  rowsort label-49
12dd0 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  7..SELECT ALL - 
12de0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
12df0 4e 54 45 47 45 52 20 29 20 2f 20 63 6f 6c 31 20  NTEGER ) / col1 
12e00 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
12e10 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
12e20 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
12e30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12e40 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20  LECT - + col2 + 
12e50 36 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  61 FROM tab1 AS 
12e60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d  cor0..----..-35.
12e70 0a 34 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  .4..7....skipif 
12e80 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
12e90 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
12ea0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
12eb0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
12ec0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12ed0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
12ee0 6f 6c 30 20 2b 20 39 30 20 63 6f 6c 31 20 46 52  ol0 + 90 col1 FR
12ef0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
12f00 0a 2d 2d 2d 2d 0d 0a 31 35 34 0d 0a 31 37 30 0d  .----..154..170.
12f10 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .93....query I r
12f20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
12f30 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b  ISTINCT - col1 +
12f40 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   + col1 + + col1
12f50 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
12f60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31  r0..----..86..91
12f70 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
12f80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12f90 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL - cor0.col0 
12fa0 2a 20 35 36 20 46 52 4f 4d 20 74 61 62 30 20 41  * 56 FROM tab0 A
12fb0 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
12fc0 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  N tab2 AS cor1..
12fd0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
12fe0 61 73 68 69 6e 67 20 74 6f 20 62 35 33 39 66 61  ashing to b539fa
12ff0 30 64 65 34 31 35 34 36 34 34 36 61 63 35 36 32  0de41546446ac562
13000 62 64 62 32 33 39 65 36 34 36 0d 0a 0d 0a 71 75  bdb239e646....qu
13010 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13020 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 74  ELECT + col1 * t
13030 61 62 31 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  ab1.col0 + + col
13040 31 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  1 + + col1 FROM 
13050 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 36  tab1..----..1066
13060 0d 0a 31 33 30 0d 0a 36 36 30 0d 0a 0d 0a 6f 6e  ..130..660....on
13070 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
13080 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
13090 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
130a0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
130b0 6f 72 74 20 6c 61 62 65 6c 2d 35 30 33 0d 0a 53  ort label-503..S
130c0 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 74  ELECT col1 * + t
130d0 61 62 32 2e 63 6f 6c 32 20 2b 20 2b 20 39 38 20  ab2.col2 + + 98 
130e0 44 49 56 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52  DIV col0 col2 FR
130f0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
13100 35 33 35 0d 0a 36 34 37 0d 0a 38 35 31 0d 0a 0d  535..647..851...
13110 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
13120 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
13130 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
13140 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
13150 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
13160 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
13170 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
13180 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
13190 30 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  03..SELECT col1 
131a0 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20  * + tab2.col2 + 
131b0 2b 20 39 38 20 2f 20 63 6f 6c 30 20 63 6f 6c 32  + 98 / col0 col2
131c0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
131d0 0d 0a 31 35 33 35 0d 0a 36 34 37 0d 0a 38 35 31  ..1535..647..851
131e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
131f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 35 20 2b  ort..SELECT 35 +
13200 20 2b 20 35 37 20 41 53 20 63 6f 6c 31 20 46 52   + 57 AS col1 FR
13210 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  OM tab2, tab0 AS
13220 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
13230 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
13240 20 35 31 36 66 61 34 35 63 38 62 30 36 66 39 66   516fa45c8b06f9f
13250 36 37 64 36 65 35 30 30 62 66 64 34 33 35 63 31  67d6e500bfd435c1
13260 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  a....query I row
13270 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74  sort..SELECT + t
13280 61 62 31 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  ab1.col1 + + col
13290 32 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  2 + - col2 FROM 
132a0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a  tab1..----..10..
132b0 31 33 0d 0a 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  13..26....onlyif
132c0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
132d0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
132e0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
132f0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
13300 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
13310 65 6c 2d 35 30 36 0d 0a 53 45 4c 45 43 54 20 63  el-506..SELECT c
13320 6f 6c 30 20 2b 20 43 41 53 54 28 20 63 6f 6c 30  ol0 + CAST( col0
13330 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b   AS SIGNED ) * +
13340 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
13350 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d  tab1..----..165.
13360 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a 73  .3712..7760....s
13370 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
13380 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
13390 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
133a0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
133b0 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
133c0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
133d0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
133e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 36  owsort label-506
133f0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
13400 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49  CAST ( col0 AS I
13410 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c  NTEGER ) * + col
13420 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  2 col1 FROM tab1
13430 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31  ..----..165..371
13440 32 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79  2..7760....query
13450 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13460 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 32  CT DISTINCT tab2
13470 2e 63 6f 6c 30 20 2b 20 32 32 20 2b 20 2b 20 63  .col0 + 22 + + c
13480 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 * col0 FROM 
13490 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 31 38 34  tab2..----..6184
134a0 0d 0a 36 33 34 32 0d 0a 37 38 0d 0a 0d 0a 71 75  ..6342..78....qu
134b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
134c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74  ELECT DISTINCT t
134d0 61 62 30 2e 63 6f 6c 30 20 2b 20 2b 20 39 30 20  ab0.col0 + + 90 
134e0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
134f0 0a 31 31 34 0d 0a 31 32 35 0d 0a 31 37 39 0d 0a  .114..125..179..
13500 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13510 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
13520 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a  CT col1 * col2 *
13530 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46   + col2 + col0 F
13540 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
13550 31 33 32 0d 0a 36 31 31 39 37 33 0d 0a 39 33 36  132..611973..936
13560 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  78....query I ro
13570 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
13580 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  L + cor0.col0 + 
13590 2b 20 28 20 36 36 20 29 20 41 53 20 63 6f 6c 30  + ( 66 ) AS col0
135a0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
135b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 0d 0a 31  r0..----..101..1
135c0 35 35 0d 0a 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  55..90....onlyif
135d0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
135e0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
135f0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
13600 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
13610 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
13620 65 6c 2d 35 31 31 0d 0a 53 45 4c 45 43 54 20 2d  el-511..SELECT -
13630 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20 2d   cor0.col1 + ( -
13640 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 32   col0 ) * + col2
13650 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20   * - CAST( NULL 
13660 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
13670 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
13680 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
13690 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
136a0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
136b0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
136c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31  rowsort label-51
136d0 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  1..SELECT - cor0
136e0 2e 63 6f 6c 31 20 2b 20 28 20 2d 20 63 6f 6c 30  .col1 + ( - col0
136f0 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d 20   ) * + col2 * - 
13700 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
13710 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
13720 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
13730 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
13740 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
13750 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 37  wsort..SELECT 37
13760 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
13770 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
13780 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
13790 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
137a0 74 6f 20 63 30 32 33 35 30 39 66 36 33 66 61 61  to c023509f63faa
137b0 30 34 34 64 36 35 34 39 34 33 65 36 64 66 35 35  044d654943e6df55
137c0 63 61 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ca2....onlyif my
137d0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
137e0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
137f0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
13800 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
13810 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
13820 35 31 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  513..SELECT ALL 
13830 43 41 53 54 28 20 2d 20 35 37 20 41 53 20 53 49  CAST( - 57 AS SI
13840 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46  GNED ) AS col2 F
13850 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
13860 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
13870 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
13880 6f 20 35 32 30 64 63 33 39 33 38 39 36 39 36 39  o 520dc393896969
13890 65 30 32 61 37 32 61 62 36 63 35 64 39 32 31 32  e02a72ab6c5d9212
138a0 36 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  6b....skipif mys
138b0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
138c0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
138d0 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 33 0d 0a  sort label-513..
138e0 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20  SELECT ALL CAST 
138f0 28 20 2d 20 35 37 20 41 53 20 49 4e 54 45 47 45  ( - 57 AS INTEGE
13900 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  R ) AS col2 FROM
13910 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
13920 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
13930 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
13940 32 30 64 63 33 39 33 38 39 36 39 36 39 65 30 32  20dc393896969e02
13950 61 37 32 61 62 36 63 35 64 39 32 31 32 36 62 0d  a72ab6c5d92126b.
13960 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
13970 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
13980 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
13990 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
139a0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
139b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
139c0 45 43 54 20 41 4c 4c 20 2d 20 28 20 2b 20 33 33  ECT ALL - ( + 33
139d0 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   ) col0 FROM tab
139e0 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  1, tab2 AS cor0.
139f0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
13a00 68 61 73 68 69 6e 67 20 74 6f 20 38 30 33 35 63  hashing to 8035c
13a10 36 36 35 61 37 35 64 32 32 62 65 35 39 32 32 62  665a75d22be5922b
13a20 65 31 61 34 65 35 37 34 65 30 33 0d 0a 0d 0a 6f  e1a4e574e03....o
13a30 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
13a40 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
13a50 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
13a60 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
13a70 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 35 0d 0a  sort label-515..
13a80 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
13a90 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f  cor0.col2 + - co
13aa0 6c 32 20 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f  l2 DIV col1 + co
13ab0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
13ac0 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 38 0d  0..----..53..58.
13ad0 0a 38 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .85....skipif my
13ae0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
13af0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
13b00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 35 0d  wsort label-515.
13b10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
13b20 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63   cor0.col2 + - c
13b30 6f 6c 32 20 2f 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol2 / col1 + col
13b40 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
13b50 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 38 0d 0a  ..----..53..58..
13b60 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
13b70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 32  wsort..SELECT 92
13b80 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
13b90 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
13ba0 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  b1, tab2 AS cor1
13bb0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a  , tab2 AS cor2..
13bc0 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20  ----..81 values 
13bd0 68 61 73 68 69 6e 67 20 74 6f 20 63 66 63 66 30  hashing to cfcf0
13be0 31 32 63 65 31 61 38 64 64 36 30 61 37 34 32 38  12ce1a8dd60a7428
13bf0 62 34 65 66 36 62 39 35 38 34 33 0d 0a 0d 0a 71  b4ef6b95843....q
13c00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13c10 53 45 4c 45 43 54 20 2d 20 2d 20 33 32 20 2b 20  SELECT - - 32 + 
13c20 28 20 2b 20 63 6f 6c 32 20 2b 20 38 38 20 29 20  ( + col2 + 88 ) 
13c30 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
13c40 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36 0d 0a 31 34  0..----..146..14
13c50 37 0d 0a 31 35 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  7..158....onlyif
13c60 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
13c70 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
13c80 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
13c90 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
13ca0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
13cb0 65 6c 2d 35 31 38 0d 0a 53 45 4c 45 43 54 20 2d  el-518..SELECT -
13cc0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
13cd0 49 47 4e 45 44 20 29 20 2b 20 2b 20 32 39 20 2a  IGNED ) + + 29 *
13ce0 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
13cf0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
13d00 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
13d10 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
13d20 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
13d30 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
13d40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
13d50 31 38 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  18..SELECT - CAS
13d60 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
13d70 47 45 52 20 29 20 2b 20 2b 20 32 39 20 2a 20 2b  GER ) + + 29 * +
13d80 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
13d90 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
13da0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
13db0 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
13dc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13dd0 39 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  91 AS col1 FROM 
13de0 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 0d  tab1, tab2 cor0.
13df0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
13e00 68 61 73 68 69 6e 67 20 74 6f 20 35 37 34 38 36  hashing to 57486
13e10 32 37 65 66 35 66 64 38 36 61 32 31 63 64 35 35  27ef5fd86a21cd55
13e20 39 66 64 32 37 38 64 37 32 37 37 0d 0a 0d 0a 6f  9fd278d7277....o
13e30 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
13e40 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
13e50 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
13e60 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
13e70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13e80 74 20 6c 61 62 65 6c 2d 35 32 30 0d 0a 53 45 4c  t label-520..SEL
13e90 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  ECT CAST( NULL A
13ea0 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c  S SIGNED ) + col
13eb0 32 20 2a 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52  2 * col0 col0 FR
13ec0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
13ed0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
13ee0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
13ef0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
13f00 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
13f10 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
13f20 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
13f30 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
13f40 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
13f50 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
13f60 72 74 20 6c 61 62 65 6c 2d 35 32 30 0d 0a 53 45  rt label-520..SE
13f70 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c  LECT CAST ( NULL
13f80 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
13f90 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 63 6f 6c 30  col2 * col0 col0
13fa0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
13fb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
13fc0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
13fd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13fe0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
13ff0 20 63 6f 6c 31 20 2a 20 74 61 62 31 2e 63 6f 6c   col1 * tab1.col
14000 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
14010 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d  ab1..----..-100.
14020 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 71  .-169..-676....q
14030 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14040 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
14050 2b 20 2d 20 33 34 20 46 52 4f 4d 20 74 61 62 31  + - 34 FROM tab1
14060 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34   cor0..----..-34
14070 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
14080 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14090 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61   * FROM tab1, ta
140a0 62 30 20 63 6f 72 30 20 57 48 45 52 45 20 4e 55  b0 cor0 WHERE NU
140b0 4c 4c 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20  LL BETWEEN NULL 
140c0 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a  AND NULL..----..
140d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
140e0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
140f0 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b  r0.col2 * col2 +
14100 20 28 20 28 20 2d 20 63 6f 6c 30 20 29 20 29 20   ( ( - col0 ) ) 
14110 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
14120 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
14130 0a 2d 31 31 31 33 0d 0a 2d 33 36 0d 0a 2d 36 38  .-1113..-36..-68
14140 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  13....query I ro
14150 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
14160 39 35 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  95 * - col0 AS c
14170 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
14180 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 35   cor0..----..285
14190 0d 0a 36 30 38 30 0d 0a 37 36 30 30 0d 0a 0d 0a  ..6080..7600....
141a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
141b0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30  .SELECT + + cor0
141c0 2e 63 6f 6c 32 20 2b 20 2b 20 28 20 28 20 2b 20  .col2 + + ( ( + 
141d0 63 6f 6c 32 20 29 20 29 20 46 52 4f 4d 20 74 61  col2 ) ) FROM ta
141e0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
141f0 0d 0a 35 32 0d 0a 35 34 0d 0a 37 36 0d 0a 0d 0a  ..52..54..76....
14200 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14210 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
14220 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a   + col1 * col1 *
14230 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   - cor0.col0 FRO
14240 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
14250 2d 2d 2d 2d 0d 0a 2d 32 32 38 34 38 0d 0a 2d 32  ----..-22848..-2
14260 37 31 35 37 37 0d 0a 2d 36 37 35 38 0d 0a 0d 0a  71577..-6758....
14270 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14280 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 33 35  .SELECT ALL + 35
14290 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
142a0 62 30 2c 20 74 61 62 32 2c 20 74 61 62 31 20 41  b0, tab2, tab1 A
142b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
142c0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
142d0 74 6f 20 30 64 31 33 64 66 64 34 63 34 61 39 64  to 0d13dfd4c4a9d
142e0 35 31 61 63 65 33 35 38 32 63 33 31 63 61 64 63  51ace3582c31cadc
142f0 64 62 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  dbc....query I r
14300 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
14310 20 2b 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 32   + col1 * ( col2
14320 20 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   ) + col0 AS col
14330 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
14340 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 36  or0..----..-1456
14350 0d 0a 2d 35 36 37 0d 0a 2d 38 33 30 0d 0a 0d 0a  ..-567..-830....
14360 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
14370 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
14380 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
14390 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
143a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33 30 0d  wsort label-530.
143b0 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30  .SELECT - + col0
143c0 20 44 49 56 20 2d 20 28 20 63 6f 6c 31 20 29 20   DIV - ( col1 ) 
143d0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
143e0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
143f0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .0..0..0....skip
14400 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
14410 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
14420 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
14430 2d 35 33 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -530..SELECT - +
14440 20 63 6f 6c 30 20 2f 20 2d 20 28 20 63 6f 6c 31   col0 / - ( col1
14450 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
14460 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
14470 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
14480 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14490 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63 6f 6c  SELECT + ( - col
144a0 32 20 29 20 2b 20 2d 20 32 37 20 46 52 4f 4d 20  2 ) + - 27 FROM 
144b0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d  tab2..----..-53.
144c0 0a 2d 35 34 0d 0a 2d 36 35 0d 0a 0d 0a 71 75 65  .-54..-65....que
144d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
144e0 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  LECT + + col0 * 
144f0 2b 20 63 6f 6c 32 20 2a 20 28 20 2d 20 28 20 63  + col2 * ( - ( c
14500 6f 6c 31 20 29 20 29 20 2b 20 2b 20 63 6f 6c 31  ol1 ) ) + + col1
14510 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
14520 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 37 30  r0..----..-36470
14530 0d 0a 2d 34 31 38 36 0d 0a 2d 39 39 38 32 37 0d  ..-4186..-99827.
14540 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
14550 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
14560 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
14570 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
14580 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
14590 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
145a0 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  ECT - col2 * + c
145b0 6f 6c 32 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20  ol2 + col1 col1 
145c0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
145d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 30 0d 0a  0..----..-2890..
145e0 2d 33 32 33 39 0d 0a 2d 39 32 30 33 0d 0a 0d 0a  -3239..-9203....
145f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14600 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
14610 72 30 2e 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30  r0.col1 - + col0
14620 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
14630 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d  r0..----..-19..-
14640 36 32 0d 0a 32 34 0d 0a 0d 0a 73 6b 69 70 69 66  62..24....skipif
14650 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
14660 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
14670 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
14680 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
14690 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
146a0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
146b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
146c0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
146d0 20 2a 20 43 41 53 54 20 28 20 2d 20 31 33 20 41   * CAST ( - 13 A
146e0 53 20 52 45 41 4c 20 29 20 2b 20 74 61 62 31 2e  S REAL ) + tab1.
146f0 63 6f 6c 31 20 2f 20 2d 20 74 61 62 31 2e 63 6f  col1 / - tab1.co
14700 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
14710 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a 31 36  1..----..130..16
14720 39 0d 0a 33 33 30 0d 0a 0d 0a 71 75 65 72 79 20  9..330....query 
14730 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14740 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  T + col2 * col1 
14750 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  + - col0 AS col1
14760 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
14770 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 36 0d 0a  r0..----..1456..
14780 35 36 37 0d 0a 38 33 30 0d 0a 0d 0a 73 6b 69 70  567..830....skip
14790 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
147a0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
147b0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
147c0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
147d0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
147e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
147f0 6f 6c 30 20 2b 20 36 39 20 63 6f 6c 32 20 46 52  ol0 + 69 col2 FR
14800 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
14810 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 35 38 0d  .----..104..158.
14820 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .93....query I r
14830 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
14840 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 72 30  LL - col2 + cor0
14850 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 41  .col0 + + col1 A
14860 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
14870 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35   cor0..----..-25
14880 0d 0a 2d 33 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72  ..-3..17....quer
14890 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
148a0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63  ECT ALL + cor0.c
148b0 6f 6c 32 20 2a 20 63 6f 6c 31 20 2d 20 2d 20 63  ol2 * col1 - - c
148c0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
148d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
148e0 2d 2d 2d 0d 0a 31 33 32 38 0d 0a 31 34 30 37 0d  ---..1328..1407.
148f0 0a 36 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .634....query I 
14900 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14910 2b 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a  + - ( + col0 ) *
14920 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   - cor0.col0 FRO
14930 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
14940 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35 37 36 0d  ----..1225..576.
14950 0a 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .7921....query I
14960 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14970 20 44 49 53 54 49 4e 43 54 20 37 38 20 41 53 20   DISTINCT 78 AS 
14980 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  col2 FROM tab0, 
14990 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
149a0 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32  b2 AS cor1, tab2
149b0 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
149c0 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  78....query I ro
149d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
149e0 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  - col0 * + col1 
149f0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
14a00 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
14a10 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39  .2064..3395..809
14a20 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
14a30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
14a40 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20 2d 20   - ( - col1 ) - 
14a50 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
14a60 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a  ----..-28..-47..
14a70 2d 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -83....skipif po
14a80 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
14a90 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
14aa0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
14ab0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
14ac0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14ad0 0a 53 45 4c 45 43 54 20 2b 20 36 20 2a 20 63 6f  .SELECT + 6 * co
14ae0 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
14af0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
14b00 0a 31 38 0d 0a 33 38 34 0d 0a 34 38 30 0d 0a 0d  .18..384..480...
14b10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14b20 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c  ..SELECT - ( col
14b30 30 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  0 ) * - cor0.col
14b40 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
14b50 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
14b60 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32  -..35..7298..792
14b70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
14b80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
14b90 2d 20 2b 20 39 20 2a 20 38 32 20 2b 20 63 6f 6c  - + 9 * 82 + col
14ba0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
14bb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 35 39 0d  or0..----..-659.
14bc0 0a 2d 36 36 30 0d 0a 2d 37 33 31 0d 0a 0d 0a 71  .-660..-731....q
14bd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14be0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
14bf0 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol0 * col1 + col
14c00 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
14c10 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
14c20 2d 0d 0a 32 30 39 37 0d 0a 33 33 39 36 0d 0a 38  -..2097..3396..8
14c30 31 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  181....query I r
14c40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
14c50 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63  ISTINCT col1 * c
14c60 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d  ol2 - + col2 * -
14c70 20 28 20 63 6f 6c 32 20 29 20 2a 20 2b 20 28 20   ( col2 ) * + ( 
14c80 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46  col1 ) AS col2 F
14c90 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
14ca0 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a 36 31 39  ..----..194..619
14cb0 33 34 36 0d 0a 39 36 34 39 32 0d 0a 0d 0a 71 75  346..96492....qu
14cc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14cd0 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20  ELECT cor0.col1 
14ce0 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  * - cor0.col2 + 
14cf0 31 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  15 FROM tab2 AS 
14d00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 31  cor0..----..-151
14d10 39 0d 0a 2d 36 33 31 0d 0a 2d 38 32 32 0d 0a 0d  9..-631..-822...
14d20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14d30 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63  ..SELECT + ( + c
14d40 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 31 20 2a  ol1 ) + + col1 *
14d50 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   - cor0.col2 FRO
14d60 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
14d70 2d 2d 2d 2d 0d 0a 2d 31 34 37 35 0d 0a 2d 36 32  ----..-1475..-62
14d80 39 0d 0a 2d 38 30 36 0d 0a 0d 0a 6f 6e 6c 79 69  9..-806....onlyi
14d90 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
14da0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
14db0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
14dc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14dd0 20 6c 61 62 65 6c 2d 35 35 31 0d 0a 53 45 4c 45   label-551..SELE
14de0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
14df0 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 36 33 20 2b   * col2 + + 63 +
14e00 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31   col2 DIV + col1
14e10 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
14e20 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
14e30 0d 0a 32 39 38 31 0d 0a 33 33 31 37 0d 0a 39 32  ..2981..3317..92
14e40 38 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  86....skipif mys
14e50 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
14e60 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
14e70 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 31 0d 0a  sort label-551..
14e80 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
14e90 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2b 20  col2 * col2 + + 
14ea0 36 33 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f  63 + col2 / + co
14eb0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
14ec0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
14ed0 2d 2d 0d 0a 32 39 38 31 0d 0a 33 33 31 37 0d 0a  --..2981..3317..
14ee0 39 32 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9286....query I 
14ef0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14f00 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 39 36 20  DISTINCT + + 96 
14f10 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
14f20 2d 2d 2d 2d 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  ----..96....quer
14f30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14f40 45 43 54 20 44 49 53 54 49 4e 43 54 20 33 39 20  ECT DISTINCT 39 
14f50 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 31 20 2a  * + col2 + - 1 *
14f60 20 2d 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31   - col2 - + col1
14f70 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
14f80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 33 34 0d 0a  r0..----..2134..
14f90 32 32 37 30 0d 0a 33 38 32 37 0d 0a 0d 0a 71 75  2270..3827....qu
14fa0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14fb0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
14fc0 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 34 20   + + col1 * + 4 
14fd0 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  + - col0 AS col2
14fe0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
14ff0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 34  r0..----..104..4
15000 30 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  0..52....query I
15010 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15020 20 2d 20 2d 20 37 38 20 2d 20 63 6f 6c 30 20 41   - - 78 - col0 A
15030 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
15040 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15050 2d 32 0d 0a 31 34 0d 0a 37 35 0d 0a 0d 0a 73 6b  -2..14..75....sk
15060 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
15070 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
15080 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
15090 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
150a0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
150b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
150c0 20 63 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 32   col0 ) * - col2
150d0 20 2a 20 74 61 62 31 2e 63 6f 6c 30 20 63 6f 6c   * tab1.col0 col
150e0 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
150f0 2d 0d 0a 2d 32 33 33 34 37 32 0d 0a 2d 34 38 36  -..-233472..-486
15100 0d 0a 2d 36 31 34 34 30 30 0d 0a 0d 0a 71 75 65  ..-614400....que
15110 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15120 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
15130 28 20 63 6f 6c 32 20 29 20 2a 20 74 61 62 31 2e  ( col2 ) * tab1.
15140 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
15150 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
15160 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37 30  248..-1404..-570
15170 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15180 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 38  ort..SELECT + 28
15190 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
151a0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
151b0 2d 0d 0a 2d 31 36 35 32 0d 0a 2d 34 37 36 0d 0a  -..-1652..-476..
151c0 2d 38 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -868....query I 
151d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
151e0 41 4c 4c 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a  ALL + ( col2 ) *
151f0 20 2d 20 35 37 20 41 53 20 63 6f 6c 30 20 46 52   - 57 AS col0 FR
15200 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
15210 2d 2d 0d 0a 2d 33 30 37 38 0d 0a 2d 33 32 34 39  --..-3078..-3249
15220 0d 0a 2d 35 34 37 32 0d 0a 0d 0a 6f 6e 6c 79 69  ..-5472....onlyi
15230 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
15240 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
15250 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
15260 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15270 20 6c 61 62 65 6c 2d 35 36 30 0d 0a 53 45 4c 45   label-560..SELE
15280 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
15290 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 72 30 2e  col2 DIV + cor0.
152a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
152b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
152c0 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .3....skipif mys
152d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
152e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
152f0 73 6f 72 74 20 6c 61 62 65 6c 2d 35 36 30 0d 0a  sort label-560..
15300 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
15310 2b 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 72  + + col2 / + cor
15320 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0.col0 FROM tab2
15330 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15340 30 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..3....query I 
15350 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15360 44 49 53 54 49 4e 43 54 20 2b 20 39 34 20 2a 20  DISTINCT + 94 * 
15370 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
15380 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
15390 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 38 0d 0a 32 39  ..----..1598..29
153a0 31 34 0d 0a 35 35 34 36 0d 0a 0d 0a 71 75 65 72  14..5546....quer
153b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
153c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 38 20 2b  ECT DISTINCT 8 +
153d0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41   col2 * + col1 A
153e0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
153f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15400 31 32 35 36 0d 0a 31 34 31 32 0d 0a 35 37 38 0d  1256..1412..578.
15410 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
15420 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
15430 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
15440 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
15450 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
15460 36 33 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c  63..SELECT ( col
15470 32 20 29 20 44 49 56 20 2b 20 63 6f 6c 32 20 46  2 ) DIV + col2 F
15480 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
15490 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
154a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
154b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
154c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
154d0 74 20 6c 61 62 65 6c 2d 35 36 33 0d 0a 53 45 4c  t label-563..SEL
154e0 45 43 54 20 28 20 63 6f 6c 32 20 29 20 2f 20 2b  ECT ( col2 ) / +
154f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
15500 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
15510 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20  ..1..1....query 
15520 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15530 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  T + cor0.col2 AS
15540 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
15550 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
15560 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
15570 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
15580 68 69 6e 67 20 74 6f 20 34 30 66 64 38 63 63 30  hing to 40fd8cc0
15590 64 65 39 32 65 61 36 38 64 37 33 36 33 34 63 32  de92ea68d73634c2
155a0 64 38 66 37 35 62 66 35 0d 0a 0d 0a 71 75 65 72  d8f75bf5....quer
155b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
155c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72  ECT DISTINCT cor
155d0 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
155e0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
155f0 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  S cor0, tab2 AS 
15600 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a  cor1..----..86..
15610 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  91..97....query 
15620 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15630 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 31 20  T ALL tab1.col1 
15640 2d 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63  - tab1.col1 AS c
15650 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
15660 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
15670 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15680 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a  .SELECT - col1 *
15690 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a   - col2 + col2 *
156a0 20 2b 20 33 36 20 41 53 20 63 6f 6c 31 20 46 52   + 36 AS col1 FR
156b0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
156c0 38 30 39 0d 0a 32 30 31 34 0d 0a 32 34 37 30 0d  809..2014..2470.
156d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
156e0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
156f0 4e 43 54 20 2d 20 36 37 20 2d 20 2b 20 63 6f 6c  NCT - 67 - + col
15700 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
15710 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 34 39 0d 0a 2d  -..-100..-149..-
15720 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  68....query I ro
15730 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
15740 4c 20 2b 20 37 20 2b 20 2d 20 63 6f 6c 32 20 2d  L + 7 + - col2 -
15750 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
15760 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
15770 31 36 34 0d 0a 2d 32 39 0d 0a 2d 35 30 0d 0a 0d  164..-29..-50...
15780 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15790 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
157a0 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  T + col0 * col0 
157b0 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
157c0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
157d0 0d 0a 31 31 39 30 0d 0a 35 35 32 0d 0a 37 38 33  ..1190..552..783
157e0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
157f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
15800 6f 6c 32 20 29 20 2a 20 2b 20 28 20 74 61 62 30  ol2 ) * + ( tab0
15810 2e 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 30  .col1 ) + - col0
15820 20 2a 20 39 20 2b 20 2d 20 74 61 62 30 2e 63 6f   * 9 + - tab0.co
15830 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 * col2 FROM t
15840 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 33 0d  ab0..----..-253.
15850 0a 2d 36 33 37 0d 0a 31 38 33 30 0d 0a 0d 0a 6f  .-637..1830....o
15860 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
15870 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
15880 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
15890 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
158a0 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 32 0d 0a  sort label-572..
158b0 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c  SELECT - ( + col
158c0 31 20 29 20 44 49 56 20 33 31 20 63 6f 6c 31 20  1 ) DIV 31 col1 
158d0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
158e0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .0..0..0....skip
158f0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
15900 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
15910 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
15920 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
15930 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
15940 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
15950 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
15960 6f 72 74 20 6c 61 62 65 6c 2d 35 37 32 0d 0a 53  ort label-572..S
15970 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c 31  ELECT - ( + col1
15980 20 29 20 2f 20 33 31 20 63 6f 6c 31 20 46 52 4f   ) / 31 col1 FRO
15990 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab1..----..0.
159a0 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
159b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
159c0 20 41 4c 4c 20 2d 20 2d 20 28 20 2b 20 38 30 20   ALL - - ( + 80 
159d0 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ) * col1 FROM ta
159e0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
159f0 0d 0a 31 30 34 30 0d 0a 32 30 38 30 0d 0a 38 30  ..1040..2080..80
15a00 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
15a10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
15a20 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 32 39 20 41   - col1 * + 29 A
15a30 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
15a40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15a50 2d 31 37 31 31 0d 0a 2d 34 39 33 0d 0a 2d 38 39  -1711..-493..-89
15a60 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
15a70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
15a80 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
15a90 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  2 + col0 FROM ta
15aa0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
15ab0 0d 0a 31 33 32 38 0d 0a 31 34 30 37 0d 0a 36 33  ..1328..1407..63
15ac0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
15ad0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15ae0 54 49 4e 43 54 20 2d 20 37 36 20 2b 20 63 6f 72  TINCT - 76 + cor
15af0 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52  0.col0 * col2 FR
15b00 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
15b10 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31 39 35 32  .----..113..1952
15b20 0d 0a 32 39 32 36 0d 0a 0d 0a 71 75 65 72 79 20  ..2926....query 
15b30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15b40 54 20 41 4c 4c 20 2b 20 2b 20 35 38 20 2a 20 63  T ALL + + 58 * c
15b50 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 + + cor0.col
15b60 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
15b70 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
15b80 2d 0d 0a 31 35 31 31 0d 0a 36 34 34 0d 0a 38 33  -..1511..644..83
15b90 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
15ba0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
15bb0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
15bc0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
15bd0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
15be0 2d 35 37 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -578..SELECT + c
15bf0 6f 6c 32 20 2b 20 63 6f 6c 31 20 44 49 56 20 63  ol2 + col1 DIV c
15c00 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
15c10 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
15c20 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d 0a 38 33 0d 0a  ---..2..34..83..
15c30 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
15c40 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
15c50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15c60 20 6c 61 62 65 6c 2d 35 37 38 0d 0a 53 45 4c 45   label-578..SELE
15c70 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  CT + col2 + col1
15c80 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   / col1 AS col1 
15c90 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
15ca0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d 0a  0..----..2..34..
15cb0 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  83....skipif pos
15cc0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
15cd0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
15ce0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
15cf0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
15d00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15d10 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
15d20 32 20 2b 20 2d 20 32 35 20 63 6f 6c 30 20 46 52  2 + - 25 col0 FR
15d30 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
15d40 0a 2d 2d 2d 2d 0d 0a 2d 31 30 37 0d 0a 2d 32 36  .----..-107..-26
15d50 0d 0a 2d 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-58....query I
15d60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15d70 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 31 20 29 20   ALL ( + col1 ) 
15d80 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
15d90 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
15da0 0d 0a 32 38 39 0d 0a 33 34 38 31 0d 0a 39 36 31  ..289..3481..961
15db0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15dc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 39  ort..SELECT + 59
15dd0 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   + + col2 * - co
15de0 6c 30 20 2a 20 2b 20 34 35 20 46 52 4f 4d 20 74  l0 * + 45 FROM t
15df0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
15e00 2d 0d 0a 2d 31 36 34 31 30 31 0d 0a 2d 33 34 35  -..-164101..-345
15e10 35 34 31 0d 0a 2d 37 32 33 31 0d 0a 0d 0a 71 75  541..-7231....qu
15e20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15e30 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
15e40 20 37 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f   70 + - col0 FRO
15e50 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
15e60 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 33 35 0d 0a 34  ----..-19..35..4
15e70 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
15e80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38  sort..SELECT - 8
15e90 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
15ea0 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  0 AS cor0, tab1 
15eb0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
15ec0 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
15ed0 20 74 6f 20 32 36 64 62 63 63 39 38 64 34 62 34   to 26dbcc98d4b4
15ee0 65 38 36 34 66 66 61 33 31 62 65 36 38 35 61 35  e864ffa31be685a5
15ef0 64 66 62 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20  dfbd....query I 
15f00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15f10 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
15f20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  + + col1 + col2 
15f30 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 46 52  * + tab1.col0 FR
15f40 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
15f50 38 35 0d 0a 33 35 39 34 0d 0a 37 36 31 33 0d 0a  85..3594..7613..
15f60 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
15f70 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
15f80 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
15f90 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
15fa0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38  rowsort label-58
15fb0 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  5..SELECT ALL + 
15fc0 63 6f 6c 31 20 2a 20 2d 20 28 20 2d 20 63 6f 6c  col1 * - ( - col
15fd0 30 20 29 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b  0 ) DIV - col0 +
15fe0 20 2d 20 63 6f 6c 30 20 2a 20 33 35 20 41 53 20   - col0 * 35 AS 
15ff0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
16000 2d 2d 2d 2d 0d 0a 2d 32 37 36 0d 0a 2d 32 37 38  ----..-276..-278
16010 32 0d 0a 2d 32 37 38 39 0d 0a 0d 0a 73 6b 69 70  2..-2789....skip
16020 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
16030 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
16040 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16050 2d 35 38 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -585..SELECT ALL
16060 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2d 20   + col1 * - ( - 
16070 63 6f 6c 30 20 29 20 2f 20 2d 20 63 6f 6c 30 20  col0 ) / - col0 
16080 2b 20 2d 20 63 6f 6c 30 20 2a 20 33 35 20 41 53  + - col0 * 35 AS
16090 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
160a0 0a 2d 2d 2d 2d 0d 0a 2d 32 37 36 0d 0a 2d 32 37  .----..-276..-27
160b0 38 32 0d 0a 2d 32 37 38 39 0d 0a 0d 0a 71 75 65  82..-2789....que
160c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
160d0 4c 45 43 54 20 32 39 20 41 53 20 63 6f 6c 32 20  LECT 29 AS col2 
160e0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
160f0 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
16100 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
16110 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
16120 6f 20 34 63 35 36 32 38 35 39 39 32 62 63 62 37  o 4c56285992bcb7
16130 36 65 31 61 61 63 32 32 65 36 64 32 33 64 31 33  6e1aac22e6d23d13
16140 31 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  18....onlyif mys
16150 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
16160 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
16170 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
16180 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
16190 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
161a0 38 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  87..SELECT ALL c
161b0 6f 6c 32 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c  ol2 * CAST( NULL
161c0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b   AS SIGNED ) * +
161d0 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b   col0 + - col0 +
161e0 20 2b 20 38 35 20 41 53 20 63 6f 6c 30 20 46 52   + 85 AS col0 FR
161f0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
16200 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
16210 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
16220 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
16230 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16240 74 20 6c 61 62 65 6c 2d 35 38 37 0d 0a 53 45 4c  t label-587..SEL
16250 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 43  ECT ALL col2 * C
16260 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
16270 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c 30  TEGER ) * + col0
16280 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 38 35   + - col0 + + 85
16290 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
162a0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b1..----..NULL..
162b0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
162c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
162d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
162e0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b  ol1 + - col1 * +
162f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
16300 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 37 0d 0a 2d 35  .----..-1027..-5
16310 32 0d 0a 2d 36 33 30 0d 0a 0d 0a 6f 6e 6c 79 69  2..-630....onlyi
16320 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
16330 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
16340 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
16350 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16360 20 6c 61 62 65 6c 2d 35 38 39 0d 0a 53 45 4c 45   label-589..SELE
16370 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
16380 6c 32 20 2a 20 2d 20 34 30 20 2b 20 32 35 20 44  l2 * - 40 + 25 D
16390 49 56 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  IV + col1 AS col
163a0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
163b0 2d 0d 0a 2d 31 33 32 30 0d 0a 2d 33 32 38 30 0d  -..-1320..-3280.
163c0 0a 2d 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-40....skipif m
163d0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
163e0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
163f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38 39  owsort label-589
16400 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
16410 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 34 30 20  T + col2 * - 40 
16420 2b 20 32 35 20 2f 20 2b 20 63 6f 6c 31 20 41 53  + 25 / + col1 AS
16430 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
16440 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 30 0d 0a 2d 33  .----..-1320..-3
16450 32 38 30 0d 0a 2d 34 30 0d 0a 0d 0a 71 75 65 72  280..-40....quer
16460 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16470 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 38 38 20  ECT col2 + + 88 
16480 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
16490 0a 31 31 34 0d 0a 31 31 35 0d 0a 31 32 36 0d 0a  .114..115..126..
164a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
164b0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
164c0 20 2d 20 33 38 20 46 52 4f 4d 20 74 61 62 31 0d   - 38 FROM tab1.
164d0 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 31 39 0d 0a 35  .----..16..19..5
164e0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
164f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
16500 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 32  TINCT + col2 * 2
16510 35 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  5 FROM tab0..---
16520 2d 0d 0a 32 30 35 30 0d 0a 32 35 0d 0a 38 32 35  -..2050..25..825
16530 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16540 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
16550 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   * - col1 * + co
16560 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
16570 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
16580 2d 2d 0d 0a 2d 33 36 34 38 30 0d 0a 2d 34 32 31  --..-36480..-421
16590 32 0d 0a 2d 39 39 38 34 30 0d 0a 0d 0a 71 75 65  2..-99840....que
165a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
165b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
165c0 36 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  60 * col1 AS col
165d0 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
165e0 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30 0d 0a 36 30  ..----..1560..60
165f0 30 0d 0a 37 38 30 0d 0a 0d 0a 71 75 65 72 79 20  0..780....query 
16600 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16610 54 20 41 4c 4c 20 37 33 20 2b 20 2d 20 37 38 20  T ALL 73 + - 78 
16620 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
16630 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 2d 35 0d  0..----..-5..-5.
16640 0a 2d 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .-5....query I r
16650 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33  owsort..SELECT 3
16660 34 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  4 FROM tab0, tab
16670 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
16680 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
16690 67 20 74 6f 20 31 31 34 36 64 31 35 39 66 30 62  g to 1146d159f0b
166a0 39 62 34 33 37 38 61 38 62 37 33 38 62 39 36 33  9b4378a8b738b963
166b0 66 37 30 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49  f7039....query I
166c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
166d0 20 44 49 53 54 49 4e 43 54 20 37 35 20 41 53 20   DISTINCT 75 AS 
166e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  col2 FROM tab0, 
166f0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
16700 2d 2d 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20  --..75....query 
16710 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16720 54 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2b 20  T tab0.col1 + + 
16730 31 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  10 FROM tab0..--
16740 2d 2d 0d 0a 31 30 31 0d 0a 31 30 37 0d 0a 39 36  --..101..107..96
16750 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
16760 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
16770 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
16780 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
16790 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
167a0 35 39 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  599..SELECT ALL 
167b0 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20 31 20 46  + col0 DIV - 1 F
167c0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
167d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35  ..----..-24..-35
167e0 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-89....skipif 
167f0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
16800 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
16810 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39  rowsort label-59
16820 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  9..SELECT ALL + 
16830 63 6f 6c 30 20 2f 20 2d 20 31 20 46 52 4f 4d 20  col0 / - 1 FROM 
16840 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
16850 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38  --..-24..-35..-8
16860 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
16870 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
16880 6f 6c 31 20 2a 20 2d 20 39 37 20 2a 20 2d 20 28  ol1 * - 97 * - (
16890 20 2d 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   - col2 ) AS col
168a0 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
168b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 30 35 36 0d  ..----..-121056.
168c0 0a 2d 31 33 36 31 38 38 0d 0a 2d 35 35 32 39 30  .-136188..-55290
168d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
168e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
168f0 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20  INCT - - col0 * 
16900 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e  - col0 + + cor0.
16910 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
16920 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 30  or0..----..-1190
16930 0d 0a 2d 35 35 32 0d 0a 2d 37 38 33 32 0d 0a 0d  ..-552..-7832...
16940 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16950 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
16960 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 32 31 20  T + col1 + + 21 
16970 2a 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  * ( col0 ) FROM 
16980 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
16990 2d 2d 0d 0a 31 33 35 34 0d 0a 31 36 39 33 0d 0a  --..1354..1693..
169a0 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  89....query I ro
169b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
169c0 2b 20 63 6f 6c 30 20 2b 20 31 38 20 2a 20 2d 20  + col0 + 18 * - 
169d0 39 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  94 AS col0 FROM 
169e0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
169f0 2d 2d 0d 0a 2d 31 36 30 33 0d 0a 2d 31 36 35 37  --..-1603..-1657
16a00 0d 0a 2d 31 36 36 38 0d 0a 0d 0a 71 75 65 72 79  ..-1668....query
16a10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16a20 43 54 20 2b 20 36 38 20 46 52 4f 4d 20 74 61 62  CT + 68 FROM tab
16a30 31 2c 20 74 61 62 32 20 63 6f 72 30 2c 20 74 61  1, tab2 cor0, ta
16a40 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
16a50 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
16a60 69 6e 67 20 74 6f 20 31 30 61 61 32 35 66 31 63  ing to 10aa25f1c
16a70 36 62 39 37 35 38 32 63 33 34 35 32 31 61 63 36  6b97582c34521ac6
16a80 34 35 32 65 30 62 34 0d 0a 0d 0a 71 75 65 72 79  452e0b4....query
16a90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16aa0 43 54 20 2d 20 63 6f 6c 32 20 2a 20 32 20 2b 20  CT - col2 * 2 + 
16ab0 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
16ac0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16ad0 2d 31 32 34 0d 0a 2d 31 33 34 0d 0a 2d 32 30 35  -124..-134..-205
16ae0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16af0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
16b00 49 4e 43 54 20 2b 20 33 36 20 2b 20 63 6f 6c 30  INCT + 36 + col0
16b10 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
16b20 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 31 36 0d  .----..100..116.
16b30 0a 33 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .39....skipif po
16b40 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
16b50 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
16b60 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
16b70 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
16b80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16b90 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
16ba0 20 2b 20 33 35 20 2a 20 2d 20 28 20 63 6f 6c 31   + 35 * - ( col1
16bb0 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   ) col2 FROM tab
16bc0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  1 cor0..----..-3
16bd0 35 30 0d 0a 2d 34 35 35 0d 0a 2d 39 31 30 0d 0a  50..-455..-910..
16be0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16bf0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 38 36  t..SELECT + - 86
16c00 20 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   - + col0 FROM t
16c10 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
16c20 2d 0d 0a 2d 31 36 34 0d 0a 2d 31 36 35 0d 0a 2d  -..-164..-165..-
16c30 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  93....onlyif mys
16c40 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
16c50 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
16c60 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
16c70 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
16c80 6c 2d 36 30 39 0d 0a 53 45 4c 45 43 54 20 41 4c  l-609..SELECT AL
16c90 4c 20 2d 20 2b 20 35 38 20 44 49 56 20 63 6f 6c  L - + 58 DIV col
16ca0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
16cb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d  or0..----..-2..-
16cc0 34 0d 0a 2d 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..-5....skipif 
16cd0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
16ce0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
16cf0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30  rowsort label-60
16d00 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  9..SELECT ALL - 
16d10 2b 20 35 38 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  + 58 / col1 FROM
16d20 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
16d30 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 34 0d 0a 2d 35 0d  ---..-2..-4..-5.
16d40 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
16d50 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
16d60 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
16d70 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
16d80 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
16d90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16da0 45 43 54 20 2d 20 34 32 20 2b 20 2b 20 63 6f 6c  ECT - 42 + + col
16db0 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  2 col2 FROM tab1
16dc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16dd0 31 32 0d 0a 31 35 0d 0a 35 34 0d 0a 0d 0a 71 75  12..15..54....qu
16de0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16df0 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20  ELECT cor0.col0 
16e00 2a 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 41 53  * col2 - col0 AS
16e10 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
16e20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
16e30 35 39 0d 0a 33 35 38 34 0d 0a 37 36 30 30 0d 0a  59..3584..7600..
16e40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16e50 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
16e60 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 38 34  CT - col0 * - 84
16e70 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46   + col0 * col1 F
16e80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
16e90 0d 0a 2d 2d 2d 2d 0d 0a 31 35 35 37 35 0d 0a 34  ..----..15575..4
16ea0 30 38 30 0d 0a 36 33 33 35 0d 0a 0d 0a 71 75 65  080..6335....que
16eb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16ec0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
16ed0 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  col0 + + col2 * 
16ee0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
16ef0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
16f00 36 35 0d 0a 35 39 38 0d 0a 37 32 32 0d 0a 0d 0a  65..598..722....
16f10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16f20 0a 53 45 4c 45 43 54 20 28 20 39 31 20 29 20 46  .SELECT ( 91 ) F
16f30 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
16f40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
16f50 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
16f60 6f 20 35 37 34 38 36 32 37 65 66 35 66 64 38 36  o 5748627ef5fd86
16f70 61 32 31 63 64 35 35 39 66 64 32 37 38 64 37 32  a21cd559fd278d72
16f80 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  77....query I ro
16f90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
16fa0 53 54 49 4e 43 54 20 39 31 20 46 52 4f 4d 20 74  STINCT 91 FROM t
16fb0 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
16fc0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
16fd0 0a 2d 2d 2d 2d 0d 0a 39 31 0d 0a 0d 0a 71 75 65  .----..91....que
16fe0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16ff0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LECT - col0 * co
17000 6c 30 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 35 31  l0 - - col1 * 51
17010 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
17020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 38 36 0d  r0..----..-3586.
17030 0a 2d 35 37 33 37 0d 0a 31 33 31 37 0d 0a 0d 0a  .-5737..1317....
17040 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17050 0a 53 45 4c 45 43 54 20 31 31 20 2a 20 2b 20 63  .SELECT 11 * + c
17060 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 35  ol1 + + col2 * 5
17070 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  3 AS col1 FROM t
17080 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
17090 2d 0d 0a 31 31 32 30 0d 0a 32 36 39 35 0d 0a 35  -..1120..2695..5
170a0 33 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  347....query I r
170b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
170c0 49 53 54 49 4e 43 54 20 2d 20 28 20 63 6f 6c 32  ISTINCT - ( col2
170d0 20 29 20 2a 20 2d 20 35 39 20 2a 20 36 33 20 46   ) * - 59 * 63 F
170e0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
170f0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 36 36 31 0d 0a  ..----..122661..
17100 33 30 34 37 39 34 0d 0a 33 37 31 37 0d 0a 0d 0a  304794..3717....
17110 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
17120 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
17130 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
17140 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
17150 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
17160 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17170 20 2b 20 36 38 20 2a 20 63 6f 6c 31 20 63 6f 6c   + 68 * col1 col
17180 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
17190 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 38 0d  or0..----..1768.
171a0 0a 36 38 30 0d 0a 38 38 34 0d 0a 0d 0a 71 75 65  .680..884....que
171b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
171c0 4c 45 43 54 20 2b 20 2b 20 28 20 63 6f 6c 31 20  LECT + + ( col1 
171d0 29 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 33  ) * - col2 + + 3
171e0 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  6 AS col0 FROM t
171f0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
17200 2d 0d 0a 2d 32 38 30 32 0d 0a 2d 36 31 0d 0a 2d  -..-2802..-61..-
17210 37 34 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7426....query I 
17220 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17230 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 74 61 62  ( + col0 ) * tab
17240 32 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  2.col0 + - col1 
17250 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
17260 0a 31 38 0d 0a 36 30 32 35 0d 0a 36 32 32 34 0d  .18..6025..6224.
17270 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
17280 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
17290 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
172a0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
172b0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
172c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 32 0d  wsort label-622.
172d0 0a 53 45 4c 45 43 54 20 2b 20 39 32 20 2a 20 2d  .SELECT + 92 * -
172e0 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 28 20   col0 + - CAST( 
172f0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
17300 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
17310 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  1 cor0..----..NU
17320 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
17330 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
17340 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
17350 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17360 20 6c 61 62 65 6c 2d 36 32 32 0d 0a 53 45 4c 45   label-622..SELE
17370 43 54 20 2b 20 39 32 20 2a 20 2d 20 63 6f 6c 30  CT + 92 * - col0
17380 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   + - CAST ( NULL
17390 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
173a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
173b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
173c0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
173d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
173e0 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e  SELECT - - cor0.
173f0 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col2 + + col2 AS
17400 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
17410 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
17420 36 34 0d 0a 32 0d 0a 36 36 0d 0a 0d 0a 71 75 65  64..2..66....que
17430 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17440 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20  LECT - + col0 + 
17450 63 6f 6c 32 20 2a 20 2d 20 28 20 2b 20 63 6f 6c  col2 * - ( + col
17460 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  2 ) FROM tab2 AS
17470 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
17480 32 33 0d 0a 2d 37 33 36 0d 0a 2d 37 35 34 0d 0a  23..-736..-754..
17490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
174a0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
174b0 20 2b 20 30 20 2a 20 2b 20 33 33 20 41 53 20 63   + 0 * + 33 AS c
174c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
174d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor0..----..-3.
174e0 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65  .-64..-80....que
174f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17500 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 72 30  LECT col1 + cor0
17510 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
17520 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
17530 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a 36 32 0d  --..118..34..62.
17540 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17550 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 20 41  rt..SELECT + 7 A
17560 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
17570 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
17580 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
17590 6f 72 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or1, tab2 AS cor
175a0 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 33 0d  2, tab2 AS cor3.
175b0 0a 2d 2d 2d 2d 0d 0a 32 34 33 20 76 61 6c 75 65  .----..243 value
175c0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 31 37  s hashing to d17
175d0 33 32 32 32 38 39 39 63 32 65 61 63 62 36 39 66  3222899c2eacb69f
175e0 37 62 31 64 31 30 38 34 61 31 32 33 30 0d 0a 0d  7b1d1084a1230...
175f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17600 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 38 20  ..SELECT ALL 38 
17610 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
17620 41 53 20 63 6f 72 30 2c 20 74 61 62 30 2c 20 74  AS cor0, tab0, t
17630 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
17640 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73  -..81 values has
17650 68 69 6e 67 20 74 6f 20 39 31 32 34 62 30 36 64  hing to 9124b06d
17660 33 33 39 39 35 64 38 32 30 36 32 30 32 36 39 36  33995d8206202696
17670 34 63 63 65 33 61 33 38 0d 0a 0d 0a 71 75 65 72  4cce3a38....quer
17680 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17690 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 28  ECT + + col2 * (
176a0 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 29   ( cor0.col1 ) )
176b0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
176c0 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36  .----..1534..646
176d0 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..837....query I
176e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
176f0 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 37 39   DISTINCT - + 79
17700 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
17710 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
17720 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 39 0d 0a 0d 0a 71  ..----..-79....q
17730 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17740 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e  SELECT - + cor0.
17750 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col2 * + col1 + 
17760 28 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  ( + col2 ) AS co
17770 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
17780 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35  cor0..----..-115
17790 32 0d 0a 2d 31 33 35 30 0d 0a 2d 35 31 33 0d 0a  2..-1350..-513..
177a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
177b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
177c0 39 36 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  96 FROM tab1, ta
177d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
177e0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
177f0 6e 67 20 74 6f 20 32 32 63 35 31 34 31 61 36 32  ng to 22c5141a62
17800 39 66 30 65 66 33 39 36 37 33 38 65 65 32 63 38  9f0ef396738ee2c8
17810 62 65 36 33 30 33 0d 0a 0d 0a 71 75 65 72 79 20  be6303....query 
17820 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17830 54 20 39 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53  T 91 * - col1 AS
17840 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
17850 0a 2d 2d 2d 2d 0d 0a 2d 31 35 34 37 0d 0a 2d 32  .----..-1547..-2
17860 38 32 31 0d 0a 2d 35 33 36 39 0d 0a 0d 0a 71 75  821..-5369....qu
17870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17880 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2b 20  ELECT ALL - ( + 
17890 35 35 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  55 ) AS col0 FRO
178a0 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
178b0 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
178c0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
178d0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62  ues hashing to b
178e0 39 30 65 37 34 62 65 63 65 35 35 32 31 62 35 31  90e74bece5521b51
178f0 34 30 39 36 63 35 62 36 65 31 30 35 66 64 65 0d  4096c5b6e105fde.
17900 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17910 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
17920 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 28   col2 + col1 * (
17930 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
17940 31 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  1 ) + col1 FROM 
17950 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
17960 2d 2d 0d 0a 36 33 36 31 37 35 0d 0a 37 35 33 37  --..636175..7537
17970 34 34 0d 0a 39 31 32 37 37 31 0d 0a 0d 0a 71 75  44..912771....qu
17980 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17990 45 4c 45 43 54 20 2d 20 32 30 20 2a 20 2d 20 63  ELECT - 20 * - c
179a0 6f 6c 30 20 2a 20 31 38 20 46 52 4f 4d 20 74 61  ol0 * 18 FROM ta
179b0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 30 0d 0a  b1..----..1080..
179c0 32 33 30 34 30 0d 0a 32 38 38 30 30 0d 0a 0d 0a  23040..28800....
179d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
179e0 0a 53 45 4c 45 43 54 20 2b 20 34 37 20 2b 20 63  .SELECT + 47 + c
179f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
17a00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33   cor0..----..133
17a10 0d 0a 31 33 38 0d 0a 31 34 34 0d 0a 0d 0a 71 75  ..138..144....qu
17a20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17a30 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c  ELECT col2 * col
17a40 30 20 2b 20 2d 20 35 32 20 46 52 4f 4d 20 74 61  0 + - 52 FROM ta
17a50 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
17a60 0d 0a 2d 31 37 0d 0a 37 32 34 36 0d 0a 37 34 30  ..-17..7246..740
17a70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17a80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
17a90 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20  ( - cor0.col0 ) 
17aa0 2d 20 35 20 46 52 4f 4d 20 74 61 62 31 20 41 53  - 5 FROM tab1 AS
17ab0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
17ac0 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
17ad0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
17ae0 73 68 69 6e 67 20 74 6f 20 39 66 39 32 61 65 64  shing to 9f92aed
17af0 38 61 35 65 66 63 30 37 39 32 38 62 34 33 61 64  8a5efc07928b43ad
17b00 61 64 39 36 31 65 64 37 31 0d 0a 0d 0a 71 75 65  ad961ed71....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 2d 20 34 33 20 2d 20 36 37 20 41  LECT - 43 - 67 A
17b30 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
17b40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17b50 2d 31 31 30 0d 0a 2d 31 31 30 0d 0a 2d 31 31 30  -110..-110..-110
17b60 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
17b70 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
17b80 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
17b90 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
17ba0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
17bb0 36 34 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  641..SELECT ALL 
17bc0 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20  - col2 * col1 * 
17bd0 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30  cor0.col0 + col0
17be0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56   + cor0.col1 DIV
17bf0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
17c00 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
17c10 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 31 36 0d 0a 2d  .----..-36416..-
17c20 34 32 30 39 0d 0a 2d 39 39 37 36 30 0d 0a 0d 0a  4209..-99760....
17c30 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
17c40 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
17c50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17c60 61 62 65 6c 2d 36 34 31 0d 0a 53 45 4c 45 43 54  abel-641..SELECT
17c70 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 63 6f   ALL - col2 * co
17c80 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  l1 * cor0.col0 +
17c90 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c   col0 + cor0.col
17ca0 31 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  1 / col2 AS col1
17cb0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
17cc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 31 36  r0..----..-36416
17cd0 0d 0a 2d 34 32 30 39 0d 0a 2d 39 39 37 36 30 0d  ..-4209..-99760.
17ce0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17cf0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
17d00 31 20 2b 20 39 30 20 41 53 20 63 6f 6c 30 20 46  1 + 90 AS col0 F
17d10 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
17d20 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 0d 0a 31 38 31  ..----..176..181
17d30 0d 0a 31 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..187....query I
17d40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17d50 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
17d60 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l1 FROM tab1, ta
17d70 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b1 AS cor0, tab1
17d80 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
17d90 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
17da0 67 20 74 6f 20 37 37 38 62 35 30 35 37 35 61 39  g to 778b50575a9
17db0 62 39 31 34 34 38 31 31 39 65 65 30 65 65 31 61  b91448119ee0ee1a
17dc0 39 63 34 34 66 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  9c44f....onlyif 
17dd0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
17de0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
17df0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
17e00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17e10 61 62 65 6c 2d 36 34 34 0d 0a 53 45 4c 45 43 54  abel-644..SELECT
17e20 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20 31 35   - col1 DIV - 15
17e30 20 2b 20 63 6f 6c 30 20 2a 20 28 20 2b 20 63 6f   + col0 * ( + co
17e40 6c 31 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  l1 ) * col2 FROM
17e50 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
17e60 2d 2d 2d 0d 0a 33 36 34 38 30 0d 0a 34 32 31 33  ---..36480..4213
17e70 0d 0a 39 39 38 34 30 0d 0a 0d 0a 73 6b 69 70 69  ..99840....skipi
17e80 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
17e90 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
17ea0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
17eb0 36 34 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  644..SELECT - co
17ec0 6c 31 20 2f 20 2d 20 31 35 20 2b 20 63 6f 6c 30  l1 / - 15 + col0
17ed0 20 2a 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20   * ( + col1 ) * 
17ee0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
17ef0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36  S cor0..----..36
17f00 34 38 30 0d 0a 34 32 31 33 0d 0a 39 39 38 34 30  480..4213..99840
17f10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17f20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
17f30 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 31   * col0 - - col1
17f40 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
17f50 0d 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31  ..2150..3492..81
17f60 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
17f70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
17f80 4c 20 33 34 20 2a 20 2d 20 39 38 20 46 52 4f 4d  L 34 * - 98 FROM
17f90 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
17fa0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
17fb0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36  ues hashing to 6
17fc0 63 63 36 64 61 65 62 35 35 62 61 64 35 66 33 38  cc6daeb55bad5f38
17fd0 33 63 31 64 38 39 39 31 63 36 37 31 37 66 35 0d  3c1d8991c6717f5.
17fe0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
17ff0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
18000 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18010 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
18020 43 54 20 2b 20 43 41 53 54 20 28 20 31 36 20 41  CT + CAST ( 16 A
18030 53 20 52 45 41 4c 20 29 20 2b 20 2d 20 63 6f 6c  S REAL ) + - col
18040 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
18050 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a  ab1..----..-10..
18060 33 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3..6....query I 
18070 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18080 41 4c 4c 20 2d 20 30 20 2b 20 63 6f 6c 32 20 2b  ALL - 0 + col2 +
18090 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
180a0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34  2..----..-33..-4
180b0 0d 0a 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..21....onlyif m
180c0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
180d0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
180e0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
180f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
18100 62 65 6c 2d 36 34 39 0d 0a 53 45 4c 45 43 54 20  bel-649..SELECT 
18110 35 32 20 44 49 56 20 2b 20 35 30 20 46 52 4f 4d  52 DIV + 50 FROM
18120 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
18130 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1..1....skipif m
18140 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
18150 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
18160 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 39  owsort label-649
18170 0d 0a 53 45 4c 45 43 54 20 35 32 20 2f 20 2b 20  ..SELECT 52 / + 
18180 35 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  50 FROM tab0..--
18190 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71  --..1..1..1....q
181a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
181b0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 31  SELECT ALL + ( 1
181c0 33 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  3 ) * - col2 FRO
181d0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
181e0 2d 2d 2d 2d 0d 0a 2d 33 33 38 0d 0a 2d 33 35 31  ----..-338..-351
181f0 0d 0a 2d 34 39 34 0d 0a 0d 0a 71 75 65 72 79 20  ..-494....query 
18200 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18210 54 20 41 4c 4c 20 63 6f 72 31 2e 63 6f 6c 32 20  T ALL cor1.col2 
18220 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
18230 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f  AS cor0, tab2 co
18240 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
18250 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
18260 30 66 64 38 63 63 30 64 65 39 32 65 61 36 38 64  0fd8cc0de92ea68d
18270 37 33 36 33 34 63 32 64 38 66 37 35 62 66 35 0d  73634c2d8f75bf5.
18280 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18290 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
182a0 4e 43 54 20 2d 20 2d 20 28 20 2d 20 36 35 20 29  NCT - - ( - 65 )
182b0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
182c0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
182d0 0d 0a 2d 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-65....query I
182e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
182f0 20 28 20 28 20 2d 20 63 6f 6c 32 20 29 20 29 20   ( ( - col2 ) ) 
18300 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  + + col0 AS col1
18310 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
18320 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34 31 0d 0a  .----..-20..41..
18330 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  52....query I ro
18340 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
18350 53 54 49 4e 43 54 20 31 30 20 41 53 20 63 6f 6c  STINCT 10 AS col
18360 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
18370 2d 0d 0a 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -..10....onlyif 
18380 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
18390 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
183a0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
183b0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
183c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
183d0 6c 2d 36 35 35 0d 0a 53 45 4c 45 43 54 20 44 49  l-655..SELECT DI
183e0 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30  STINCT cor0.col0
183f0 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
18400 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
18410 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
18420 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
18430 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
18440 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
18450 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
18460 6c 61 62 65 6c 2d 36 35 35 0d 0a 53 45 4c 45 43  label-655..SELEC
18470 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
18480 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 4e 55  col0 + CAST ( NU
18490 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
184a0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
184b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
184c0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
184d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
184e0 6f 6c 31 20 2d 20 2b 20 74 61 62 31 2e 63 6f 6c  ol1 - + tab1.col
184f0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
18500 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a  ab1..----..-54..
18510 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79  -67..23....query
18520 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18530 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a  CT col2 + col1 *
18540 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
18550 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
18560 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d 0a 33 33 39  .----..2097..339
18570 36 0d 0a 38 31 38 31 0d 0a 0d 0a 71 75 65 72 79  6..8181....query
18580 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18590 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20  CT ALL col0 + + 
185a0 28 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  ( + col1 ) AS co
185b0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
185c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d  cor0..----..110.
185d0 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 73 6b 69  .132..180....ski
185e0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
185f0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
18600 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
18610 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
18620 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
18630 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
18640 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2d 20  STINCT col2 + - 
18650 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d 20 63 6f  col0 * col0 - co
18660 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 31 20 29 20  l2 * + ( col1 ) 
18670 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
18680 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
18690 33 35 39 0d 0a 2d 34 36 30 39 0d 0a 2d 37 35 35  359..-4609..-755
186a0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
186b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
186c0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b   + col2 * col1 +
186d0 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
186e0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
186f0 2d 2d 0d 0a 31 39 34 0d 0a 32 39 32 34 0d 0a 37  --..194..2924..7
18700 35 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  553....query I r
18710 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
18720 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 74 61  LL - col1 * - ta
18730 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  b0.col0 AS col0 
18740 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
18750 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39  .2064..3395..809
18760 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
18770 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
18780 6f 6c 30 20 2a 20 2d 20 33 36 20 41 53 20 63 6f  ol0 * - 36 AS co
18790 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
187a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 30  cor0..----..1260
187b0 0d 0a 33 32 30 34 0d 0a 38 36 34 0d 0a 0d 0a 6f  ..3204..864....o
187c0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
187d0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
187e0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
187f0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
18800 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 33 0d 0a  sort label-663..
18810 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
18820 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20  + cor0.col0 * - 
18830 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  col2 * + col2 + 
18840 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30 20  col1 DIV + col0 
18850 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
18860 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
18870 31 34 30 37 36 0d 0a 2d 35 30 39 39 0d 0a 2d 35  14076..-5099..-5
18880 32 37 32 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  2728....skipif m
18890 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
188a0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
188b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 33  owsort label-663
188c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
188d0 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  T + cor0.col0 * 
188e0 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  - col2 * + col2 
188f0 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 30 20  + col1 / + col0 
18900 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
18910 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
18920 31 34 30 37 36 0d 0a 2d 35 30 39 39 0d 0a 2d 35  14076..-5099..-5
18930 32 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2728....query I 
18940 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18950 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
18960 32 20 2b 20 36 36 20 2a 20 2b 20 63 6f 6c 32 20  2 + 66 * + col2 
18970 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  * col2 AS col1 F
18980 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
18990 0d 0a 2d 2d 2d 2d 0d 0a 34 34 33 37 30 32 0d 0a  ..----..443702..
189a0 36 35 0d 0a 37 31 38 34 31 0d 0a 0d 0a 6f 6e 6c  65..71841....onl
189b0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
189c0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
189d0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
189e0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
189f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
18a00 6c 61 62 65 6c 2d 36 36 35 0d 0a 53 45 4c 45 43  label-665..SELEC
18a10 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
18a20 6f 6c 31 20 2b 20 43 41 53 54 28 20 2b 20 38 30  ol1 + CAST( + 80
18a30 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
18a40 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
18a50 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 31 37 0d 0a  ----..-11..-17..
18a60 2d 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  -6....skipif mys
18a70 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
18a80 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
18a90 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 35 0d 0a  sort label-665..
18aa0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
18ab0 2d 20 2b 20 63 6f 6c 31 20 2b 20 43 41 53 54 20  - + col1 + CAST 
18ac0 28 20 2b 20 38 30 20 41 53 20 49 4e 54 45 47 45  ( + 80 AS INTEGE
18ad0 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  R ) FROM tab0 AS
18ae0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
18af0 0d 0a 2d 31 37 0d 0a 2d 36 0d 0a 0d 0a 6f 6e 6c  ..-17..-6....onl
18b00 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
18b10 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
18b20 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
18b30 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
18b40 72 74 20 6c 61 62 65 6c 2d 36 36 36 0d 0a 53 45  rt label-666..SE
18b50 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  LECT + - cor0.co
18b60 6c 31 20 44 49 56 20 28 20 63 6f 6c 30 20 29 20  l1 DIV ( col0 ) 
18b70 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
18b80 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 30 0d 0a  0..----..-4..0..
18b90 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
18ba0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
18bb0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
18bc0 6f 72 74 20 6c 61 62 65 6c 2d 36 36 36 0d 0a 53  ort label-666..S
18bd0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  ELECT + - cor0.c
18be0 6f 6c 31 20 2f 20 28 20 63 6f 6c 30 20 29 20 46  ol1 / ( col0 ) F
18bf0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
18c00 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 30 0d 0a 30  ..----..-4..0..0
18c10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18c20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
18c30 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 33 38  INCT - col2 * 38
18c40 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41   + + cor0.col2 A
18c50 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
18c60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18c70 2d 31 34 30 36 0d 0a 2d 39 36 32 0d 0a 2d 39 39  -1406..-962..-99
18c80 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
18c90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
18ca0 20 38 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   81 AS col1 FROM
18cb0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
18cc0 2d 2d 2d 0d 0a 38 31 0d 0a 38 31 0d 0a 38 31 0d  ---..81..81..81.
18cd0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
18ce0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
18cf0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
18d00 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
18d10 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
18d20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18d30 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
18d40 6f 6c 30 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20  ol0 + col1 col1 
18d50 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
18d60 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a  0..----..2..62..
18d70 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
18d80 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
18d90 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
18da0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
18db0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
18dc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18dd0 43 54 20 41 4c 4c 20 2b 20 2b 20 32 20 2a 20 28  CT ALL + + 2 * (
18de0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 63   - cor0.col0 ) c
18df0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
18e00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
18e10 38 0d 0a 2d 31 36 30 0d 0a 2d 36 0d 0a 0d 0a 71  8..-160..-6....q
18e20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18e30 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
18e40 2d 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a  - + ( - col1 ) *
18e50 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
18e60 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
18e70 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36  0..----..1534..6
18e80 34 36 0d 0a 38 33 37 0d 0a 0d 0a 73 6b 69 70 69  46..837....skipi
18e90 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
18ea0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
18eb0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
18ec0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
18ed0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
18ee0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
18ef0 49 4e 43 54 20 2b 20 34 39 20 2a 20 63 6f 6c 30  INCT + 49 * col0
18f00 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
18f10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
18f20 31 37 36 0d 0a 31 37 31 35 0d 0a 34 33 36 31 0d  176..1715..4361.
18f30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18f40 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 38  rt..SELECT - + 8
18f50 39 20 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 2d  9 + ( col1 ) * -
18f60 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
18f70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
18f80 31 33 33 37 0d 0a 2d 31 34 39 33 0d 0a 2d 36 35  1337..-1493..-65
18f90 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
18fa0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
18fb0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
18fc0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
18fd0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
18fe0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37  rowsort label-67
18ff0 34 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  4..SELECT - CAST
19000 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ( + col2 AS SIGN
19010 45 44 20 29 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  ED ) * col0 + co
19020 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
19030 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 36  cor0..----..-706
19040 0d 0a 2d 37 32 30 37 0d 0a 36 32 0d 0a 0d 0a 73  ..-7207..62....s
19050 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
19060 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
19070 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
19080 62 65 6c 2d 36 37 34 0d 0a 53 45 4c 45 43 54 20  bel-674..SELECT 
19090 2d 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 32 20  - CAST ( + col2 
190a0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63  AS INTEGER ) * c
190b0 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 + col1 FROM 
190c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
190d0 2d 2d 0d 0a 2d 37 30 36 0d 0a 2d 37 32 30 37 0d  --..-706..-7207.
190e0 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .62....query I r
190f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
19100 4c 4c 20 32 36 20 2b 20 63 6f 6c 32 20 2a 20 63  LL 26 + col2 * c
19110 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
19120 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31   cor0..----..111
19130 35 0d 0a 32 37 0d 0a 36 37 35 30 0d 0a 0d 0a 6f  5..27..6750....o
19140 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
19150 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
19160 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
19170 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
19180 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 36 0d 0a  sort label-676..
19190 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
191a0 2d 20 33 39 20 44 49 56 20 37 35 20 2b 20 63 6f  - 39 DIV 75 + co
191b0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
191c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
191d0 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a  --..24..35..89..
191e0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
191f0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
19200 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19210 20 6c 61 62 65 6c 2d 36 37 36 0d 0a 53 45 4c 45   label-676..SELE
19220 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 33 39  CT DISTINCT - 39
19230 20 2f 20 37 35 20 2b 20 63 6f 6c 30 20 41 53 20   / 75 + col0 AS 
19240 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
19250 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  S cor0..----..24
19260 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 6f 6e 6c 79  ..35..89....only
19270 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
19280 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
19290 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
192a0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
192b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
192c0 61 62 65 6c 2d 36 37 37 0d 0a 53 45 4c 45 43 54  abel-677..SELECT
192d0 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f   DISTINCT ( + co
192e0 6c 31 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  l1 ) * cor0.col2
192f0 20 2a 20 2b 20 43 41 53 54 28 20 63 6f 72 30 2e   * + CAST( cor0.
19300 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29  col1 AS SIGNED )
19310 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   + + cor0.col0 *
19320 20 37 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   71 col2 FROM ta
19330 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
19340 0d 0a 31 36 35 39 31 0d 0a 32 36 34 34 34 0d 0a  ..16591..26444..
19350 39 36 30 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  96044....skipif 
19360 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
19370 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
19380 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
19390 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
193a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
193b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
193c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
193d0 20 6c 61 62 65 6c 2d 36 37 37 0d 0a 53 45 4c 45   label-677..SELE
193e0 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20  CT DISTINCT ( + 
193f0 63 6f 6c 31 20 29 20 2a 20 63 6f 72 30 2e 63 6f  col1 ) * cor0.co
19400 6c 32 20 2a 20 2b 20 43 41 53 54 20 28 20 63 6f  l2 * + CAST ( co
19410 72 30 2e 63 6f 6c 31 20 41 53 20 49 4e 54 45 47  r0.col1 AS INTEG
19420 45 52 20 29 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  ER ) + + cor0.co
19430 6c 30 20 2a 20 37 31 20 63 6f 6c 32 20 46 52 4f  l0 * 71 col2 FRO
19440 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
19450 2d 2d 2d 2d 0d 0a 31 36 35 39 31 0d 0a 32 36 34  ----..16591..264
19460 34 34 0d 0a 39 36 30 34 34 0d 0a 0d 0a 71 75 65  44..96044....que
19470 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19480 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
19490 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  - cor0.col0 * co
194a0 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
194b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
194c0 2d 2d 0d 0a 2d 31 30 32 37 0d 0a 2d 35 32 0d 0a  --..-1027..-52..
194d0 2d 36 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -630....onlyif m
194e0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
194f0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
19500 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
19510 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
19520 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
19530 2d 36 37 39 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -679..SELECT - +
19540 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20 41 53   CAST( + col0 AS
19550 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 63 6f   SIGNED ) + + co
19560 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l2 * col2 AS col
19570 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
19580 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a  or0..----..-34..
19590 31 30 36 35 0d 0a 36 36 33 35 0d 0a 0d 0a 73 6b  1065..6635....sk
195a0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
195b0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
195c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
195d0 65 6c 2d 36 37 39 0d 0a 53 45 4c 45 43 54 20 2d  el-679..SELECT -
195e0 20 2b 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 30   + CAST ( + col0
195f0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
19600 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53  + col2 * col2 AS
19610 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
19620 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
19630 33 34 0d 0a 31 30 36 35 0d 0a 36 36 33 35 0d 0a  34..1065..6635..
19640 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19650 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
19660 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   + cor0.col0 * c
19670 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 * col0 AS co
19680 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
19690 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 34 0d 0a 31  0..----..1354..1
196a0 35 38 32 34 33 0d 0a 32 33 37 31 37 35 0d 0a 0d  58243..237175...
196b0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
196c0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
196d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
196e0 0a 53 45 4c 45 43 54 20 2d 20 39 30 20 2b 20 2b  .SELECT - 90 + +
196f0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 43 41 53   cor0.col0 + CAS
19700 54 20 28 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  T ( col0 * col2 
19710 41 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c  AS REAL ) AS col
19720 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
19730 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 0d 0a 32 30 31  ..----..106..201
19740 36 0d 0a 32 39 39 31 0d 0a 0d 0a 71 75 65 72 79  6..2991....query
19750 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19760 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
19770 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  l1 + - col2 * + 
19780 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
19790 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
197a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 0d  or0..----..-158.
197b0 0a 2d 31 39 36 39 0d 0a 2d 32 39 38 35 0d 0a 0d  .-1969..-2985...
197c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
197d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
197e0 54 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 41 53  T - tab2.col2 AS
197f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c   col2 FROM tab1,
19800 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
19810 6f 72 30 2c 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  or0, tab2..----.
19820 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a  .-26..-27..-38..
19830 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
19840 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
19850 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
19860 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
19870 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
19880 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19890 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  CT - col2 + - co
198a0 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 31  l0 * - col1 col1
198b0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
198c0 0d 0a 32 30 33 31 0d 0a 33 33 39 34 0d 0a 38 30  ..2031..3394..80
198d0 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  17....query I ro
198e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
198f0 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  L cor0.col2 * co
19900 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
19910 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  0, tab2 AS cor0.
19920 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
19930 68 61 73 68 69 6e 67 20 74 6f 20 34 31 64 34 63  hashing to 41d4c
19940 31 32 36 62 66 64 34 62 66 61 62 35 39 62 61 35  126bfd4bfab59ba5
19950 65 38 33 34 32 37 63 39 38 65 30 0d 0a 0d 0a 71  e83427c98e0....q
19960 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19970 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
19980 2b 20 38 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  + 8 * + col2 AS 
19990 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
199a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 34 0d 0a  or0..----..264..
199b0 36 35 36 0d 0a 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  656..8....onlyif
199c0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
199d0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
199e0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
199f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
19a00 6c 61 62 65 6c 2d 36 38 37 0d 0a 53 45 4c 45 43  label-687..SELEC
19a10 54 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20  T cor0.col2 DIV 
19a20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 63 6f  col0 + - col2 co
19a30 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
19a40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d  cor0..----..-36.
19a50 0a 2d 35 37 0d 0a 2d 39 35 0d 0a 0d 0a 73 6b 69  .-57..-95....ski
19a60 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
19a70 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
19a80 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
19a90 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
19aa0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
19ab0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
19ac0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
19ad0 73 6f 72 74 20 6c 61 62 65 6c 2d 36 38 37 0d 0a  sort label-687..
19ae0 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32  SELECT cor0.col2
19af0 20 2f 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32   / col0 + - col2
19b00 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
19b10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
19b20 33 36 0d 0a 2d 35 37 0d 0a 2d 39 35 0d 0a 0d 0a  36..-57..-95....
19b30 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
19b40 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
19b50 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
19b60 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
19b70 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 38 38 0d  wsort label-688.
19b80 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
19b90 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32   + col1 + - col2
19ba0 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74   DIV col1 FROM t
19bb0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
19bc0 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b  86..91..97....sk
19bd0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
19be0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
19bf0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
19c00 65 6c 2d 36 38 38 0d 0a 53 45 4c 45 43 54 20 44  el-688..SELECT D
19c10 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b  ISTINCT + col1 +
19c20 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 46   - col2 / col1 F
19c30 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
19c40 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d  ---..86..91..97.
19c50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19c60 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
19c70 4e 43 54 20 32 38 20 46 52 4f 4d 20 74 61 62 31  NCT 28 FROM tab1
19c80 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
19c90 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31  OIN tab2 AS cor1
19ca0 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 0d 0a 71 75  ..----..28....qu
19cb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19cc0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a  ELECT ALL col1 *
19cd0 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31   + col1 + - col1
19ce0 20 2a 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20   * tab2.col0 AS 
19cf0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
19d00 2d 2d 2d 2d 0d 0a 2d 31 30 35 34 0d 0a 2d 31 31  ----..-1054..-11
19d10 32 31 0d 0a 37 34 34 0d 0a 0d 0a 71 75 65 72 79  21..744....query
19d20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19d30 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20  CT ALL - - col1 
19d40 2a 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c  * ( col2 ) * col
19d50 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
19d60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d  or0..----..3395.
19d70 0a 36 36 34 31 31 38 0d 0a 36 38 31 31 32 0d 0a  .664118..68112..
19d80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19d90 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
19da0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
19db0 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f  OM tab0, tab1 co
19dc0 72 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e  r0 WHERE NULL IN
19dd0 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( + cor0.col0 )
19de0 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
19df0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19e00 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33 30 20  T DISTINCT + 30 
19e10 2a 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  * ( cor0.col1 ) 
19e20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
19e30 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  2 AS cor0 CROSS 
19e40 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72  JOIN tab1 AS cor
19e50 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37 37 30 0d 0a 35  1..----..1770..5
19e60 31 30 0d 0a 39 33 30 0d 0a 0d 0a 6f 6e 6c 79 69  10..930....onlyi
19e70 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
19e80 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
19e90 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
19ea0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
19eb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
19ec0 62 65 6c 2d 36 39 34 0d 0a 53 45 4c 45 43 54 20  bel-694..SELECT 
19ed0 2b 20 2d 20 43 41 53 54 28 20 2b 20 37 36 20 41  + - CAST( + 76 A
19ee0 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
19ef0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
19f00 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
19f10 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  tab1 cor1..----.
19f20 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
19f30 67 20 74 6f 20 66 38 62 36 35 38 39 62 63 37 35  g to f8b6589bc75
19f40 30 33 66 63 37 32 30 63 61 35 34 33 30 65 33 35  03fc720ca5430e35
19f50 36 39 33 31 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  69317....skipif 
19f60 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
19f70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
19f80 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39  rowsort label-69
19f90 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 43 41  4..SELECT + - CA
19fa0 53 54 20 28 20 2b 20 37 36 20 41 53 20 49 4e 54  ST ( + 76 AS INT
19fb0 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46  EGER ) AS col0 F
19fc0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
19fd0 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
19fe0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
19ff0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1a000 20 66 38 62 36 35 38 39 62 63 37 35 30 33 66 63   f8b6589bc7503fc
1a010 37 32 30 63 61 35 34 33 30 65 33 35 36 39 33 31  720ca5430e356931
1a020 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1a030 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
1a040 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63  ol1 * - col0 + c
1a050 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
1a060 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1a070 2d 2d 2d 0d 0a 2d 31 33 32 36 0d 0a 2d 31 38 36  ---..-1326..-186
1a080 0d 0a 2d 34 35 34 33 0d 0a 0d 0a 71 75 65 72 79  ..-4543....query
1a090 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a0a0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38 36  CT DISTINCT - 86
1a0b0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
1a0c0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
1a0d0 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 0d 0a 71 75 65  ----..-86....que
1a0e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a0f0 4c 45 43 54 20 2b 20 35 37 20 2b 20 2b 20 63 6f  LECT + 57 + + co
1a100 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
1a110 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 35 0d  ab1..----..1305.
1a120 0a 31 34 36 31 0d 0a 36 32 37 0d 0a 0d 0a 71 75  .1461..627....qu
1a130 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a140 45 4c 45 43 54 20 39 38 20 41 53 20 63 6f 6c 31  ELECT 98 AS col1
1a150 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30   FROM tab0, tab0
1a160 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1a170 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
1a180 20 74 6f 20 66 39 64 65 65 38 63 32 31 31 31 36   to f9dee8c21116
1a190 66 31 61 65 64 36 34 61 63 35 31 36 30 65 31 39  f1aed64ac5160e19
1a1a0 30 38 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0809....query I 
1a1b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a1c0 31 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  10 + col0 FROM t
1a1d0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 37  ab1..----..13..7
1a1e0 34 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49  4..90....query I
1a1f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a200 20 41 4c 4c 20 37 35 20 2b 20 2d 20 63 6f 72 30   ALL 75 + - cor0
1a210 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
1a220 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
1a230 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
1a240 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1a250 20 35 62 34 61 34 38 38 31 34 34 36 39 65 63 32   5b4a48814469ec2
1a260 64 39 35 38 63 35 61 62 61 66 65 66 31 62 33 36  d958c5abafef1b36
1a270 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  a....query I row
1a280 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28  sort..SELECT + (
1a290 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62 30   + col0 * + tab0
1a2a0 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20  .col2 ) AS col0 
1a2b0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1a2c0 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a  .35..7298..792..
1a2d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a2e0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1a2f0 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b  CT cor0.col2 * +
1a300 20 33 38 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   38 FROM tab1, t
1a310 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab1 AS cor0, tab
1a320 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
1a330 0a 32 30 35 32 0d 0a 32 31 36 36 0d 0a 33 36 34  .2052..2166..364
1a340 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1a350 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1a360 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b  TINCT - + col2 +
1a370 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
1a380 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1a390 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a 2d  0..----..-171..-
1a3a0 33 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79  36..-57....query
1a3b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a3c0 43 54 20 41 4c 4c 20 2b 20 2d 20 37 35 20 46 52  CT ALL + - 75 FR
1a3d0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1a3e0 0a 2d 2d 2d 2d 0d 0a 2d 37 35 0d 0a 2d 37 35 0d  .----..-75..-75.
1a3f0 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-75....query I 
1a400 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a410 2b 20 2d 20 28 20 32 31 20 29 20 41 53 20 63 6f  + - ( 21 ) AS co
1a420 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
1a430 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d  cor0..----..-21.
1a440 0a 2d 32 31 0d 0a 2d 32 31 0d 0a 0d 0a 71 75 65  .-21..-21....que
1a450 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a460 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 74 61 62  LECT ALL - - tab
1a470 30 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 72 30 2e  0.col0 - - cor0.
1a480 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
1a490 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61  M tab0, tab1, ta
1a4a0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1a4b0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
1a4c0 69 6e 67 20 74 6f 20 64 62 66 35 33 63 38 64 33  ing to dbf53c8d3
1a4d0 39 35 66 65 36 32 34 66 37 30 62 63 66 66 37 31  95fe624f70bcff71
1a4e0 30 65 63 64 64 66 38 0d 0a 0d 0a 71 75 65 72 79  0ecddf8....query
1a4f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a500 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
1a510 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63  col1 + col1 AS c
1a520 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1a530 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
1a540 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a550 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
1a560 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col1 + col0 * - 
1a570 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
1a580 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
1a590 30 38 37 0d 0a 2d 32 32 30 0d 0a 2d 33 30 31 39  087..-220..-3019
1a5a0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1a5b0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1a5c0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1a5d0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1a5e0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1a5f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a600 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1a610 37 36 20 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 32  76 + + col1 col2
1a620 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1a630 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 31  r0..----..162..1
1a640 36 37 0d 0a 31 37 33 0d 0a 0d 0a 71 75 65 72 79  67..173....query
1a650 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a660 43 54 20 41 4c 4c 20 2b 20 2b 20 34 36 20 2a 20  CT ALL + + 46 * 
1a670 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS c
1a680 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1a690 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 37   cor0..----..167
1a6a0 38 30 38 0d 0a 33 35 33 32 38 30 0d 0a 37 34 35  808..353280..745
1a6b0 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
1a6c0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
1a6d0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
1a6e0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
1a6f0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
1a700 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 31  rowsort label-71
1a710 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
1a720 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  CT - col0 * + co
1a730 6c 31 20 2b 20 2d 20 43 41 53 54 28 20 33 38 20  l1 + - CAST( 38 
1a740 2a 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  * + col0 AS SIGN
1a750 45 44 20 29 20 2b 20 2d 20 33 38 20 46 52 4f 4d  ED ) + - 38 FROM
1a760 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1a770 2d 2d 2d 0d 0a 2d 32 33 30 0d 0a 2d 33 31 31 30  ---..-230..-3110
1a780 0d 0a 2d 34 31 31 38 0d 0a 0d 0a 73 6b 69 70 69  ..-4118....skipi
1a790 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1a7a0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1a7b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a7c0 37 31 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  711..SELECT DIST
1a7d0 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  INCT - col0 * + 
1a7e0 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 20 28 20  col1 + - CAST ( 
1a7f0 33 38 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 49  38 * + col0 AS I
1a800 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 33 38 20  NTEGER ) + - 38 
1a810 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1a820 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 30 0d 0a 2d  0..----..-230..-
1a830 33 31 31 30 0d 0a 2d 34 31 31 38 0d 0a 0d 0a 73  3110..-4118....s
1a840 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1a850 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1a860 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1a870 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1a880 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1a890 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a8a0 34 35 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c 30  45 + - col0 col0
1a8b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1a8c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d  r0..----..-19..-
1a8d0 33 35 0d 0a 34 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  35..42....onlyif
1a8e0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1a8f0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1a900 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1a910 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1a920 6c 61 62 65 6c 2d 37 31 33 0d 0a 53 45 4c 45 43  label-713..SELEC
1a930 54 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d  T - + col2 DIV -
1a940 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
1a950 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1a960 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
1a970 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1a980 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1a990 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1a9a0 62 65 6c 2d 37 31 33 0d 0a 53 45 4c 45 43 54 20  bel-713..SELECT 
1a9b0 2d 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c  - + col2 / - col
1a9c0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
1a9d0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
1a9e0 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
1a9f0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1aa00 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1aa10 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1aa20 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1aa30 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1aa40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1aa50 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f  + + cor0.col0 co
1aa60 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1aa70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37  cor0..----..7..7
1aa80 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  8..79....query I
1aa90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1aaa0 20 41 4c 4c 20 2b 20 38 31 20 2b 20 63 6f 6c 30   ALL + 81 + col0
1aab0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1aac0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1aad0 0d 0a 31 35 39 0d 0a 31 36 30 0d 0a 38 38 0d 0a  ..159..160..88..
1aae0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1aaf0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 33 34  t..SELECT + - 34
1ab00 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * + col2 AS col
1ab10 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1ab20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39 32  or0..----..-1292
1ab30 0d 0a 2d 38 38 34 0d 0a 2d 39 31 38 0d 0a 0d 0a  ..-884..-918....
1ab40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ab50 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
1ab60 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 28 20 63 6f   - col0 * + ( co
1ab70 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l1 ) FROM tab1 A
1ab80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1ab90 31 33 36 0d 0a 2d 31 33 32 0d 0a 2d 36 39 37 0d  136..-132..-697.
1aba0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1abb0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
1abc0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53  + col1 * col1 AS
1abd0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
1abe0 0a 2d 2d 2d 2d 0d 0a 33 35 35 39 0d 0a 33 36 38  .----..3559..368
1abf0 0d 0a 39 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..968....query I
1ac00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ac10 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 39 36 20 46   + col1 + + 96 F
1ac20 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1ac30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 38 37  ..----..182..187
1ac40 0d 0a 31 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..193....query I
1ac50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ac60 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 28 20 2d 20   + col2 + - ( - 
1ac70 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30  col2 ) FROM tab0
1ac80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ac90 31 36 34 0d 0a 32 0d 0a 36 36 0d 0a 0d 0a 73 6b  164..2..66....sk
1aca0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1acb0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1acc0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1acd0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1ace0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1acf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1ad00 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
1ad10 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a   + col2 + col1 *
1ad20 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f   + col2 col1 FRO
1ad30 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1ad40 2d 2d 2d 2d 0d 0a 31 30 32 36 0d 0a 33 35 36 32  ----..1026..3562
1ad50 0d 0a 33 36 34 38 0d 0a 0d 0a 71 75 65 72 79 20  ..3648....query 
1ad60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ad70 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20  T ALL cor0.col2 
1ad80 2b 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  + - ( - cor0.col
1ad90 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  0 ) FROM tab2 co
1ada0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31  r0..----..104..1
1adb0 31 37 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20  17..34....query 
1adc0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1add0 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2d 20 31  T ALL + col0 - 1
1ade0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1adf0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 32  or0..----..14..2
1ae00 35 0d 0a 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  5..79....onlyif 
1ae10 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1ae20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1ae30 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1ae40 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1ae50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1ae60 6c 2d 37 32 34 0d 0a 53 45 4c 45 43 54 20 2d 20  l-724..SELECT - 
1ae70 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 43 41 53 54  cor0.col2 * CAST
1ae80 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
1ae90 20 29 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   ) + col1 AS col
1aea0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1aeb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
1aec0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
1aed0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1aee0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1aef0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1af00 62 65 6c 2d 37 32 34 0d 0a 53 45 4c 45 43 54 20  bel-724..SELECT 
1af10 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 43 41  - cor0.col2 * CA
1af20 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
1af30 45 47 45 52 20 29 20 2b 20 63 6f 6c 31 20 41 53  EGER ) + col1 AS
1af40 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1af50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
1af60 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
1af70 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1af80 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1af90 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1afa0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1afb0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1afc0 32 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  25..SELECT DISTI
1afd0 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53  NCT col0 * - CAS
1afe0 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45  T( col2 AS SIGNE
1aff0 44 20 29 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56  D ) + - col0 DIV
1b000 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
1b010 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1b020 0a 2d 31 36 31 0d 0a 2d 33 36 34 37 0d 0a 2d 37  .-161..-3647..-7
1b030 36 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  679....skipif my
1b040 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1b050 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1b060 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 35 0d  wsort label-725.
1b070 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1b080 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54 20 28   col0 * - CAST (
1b090 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
1b0a0 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 2d 20   ) + - col0 / - 
1b0b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1b0c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1b0d0 36 31 0d 0a 2d 33 36 34 37 0d 0a 2d 37 36 37 39  61..-3647..-7679
1b0e0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1b0f0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1b100 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1b110 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1b120 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b130 37 32 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  726..SELECT DIST
1b140 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20  INCT - col1 + + 
1b150 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 32 20  col1 DIV + col2 
1b160 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1b170 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a 2d 39  0..----..-84..-9
1b180 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
1b190 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1b1a0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1b1b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 36  owsort label-726
1b1c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1b1d0 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  T - col1 + + col
1b1e0 31 20 2f 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  1 / + col2 FROM 
1b1f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1b200 2d 2d 0d 0a 2d 38 34 0d 0a 2d 39 30 0d 0a 30 0d  --..-84..-90..0.
1b210 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b220 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1b230 4e 43 54 20 63 6f 6c 31 20 2a 20 37 39 20 46 52  NCT col1 * 79 FR
1b240 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1b250 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 34 34  .----..1343..244
1b260 39 0d 0a 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79  9..4661....query
1b270 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b280 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  CT - + cor0.col1
1b290 20 2b 20 2b 20 28 20 32 39 20 29 20 46 52 4f 4d   + + ( 29 ) FROM
1b2a0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1b2b0 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 36 32 0d 0a 2d  ---..-57..-62..-
1b2c0 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  68....query I ro
1b2d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1b2e0 4c 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  L cor0.col0 * + 
1b2f0 33 39 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  39 + col0 AS col
1b300 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1b310 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 30 0d  or0..----..1400.
1b320 0a 33 35 36 30 0d 0a 39 36 30 0d 0a 0d 0a 71 75  .3560..960....qu
1b330 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b340 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d  ELECT + col1 * -
1b350 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d   col2 + col0 * -
1b360 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
1b370 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1b380 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 34 0d 0a 2d 31  .----..-1054..-1
1b390 39 38 39 0d 0a 2d 36 31 33 36 0d 0a 0d 0a 71 75  989..-6136....qu
1b3a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b3b0 45 4c 45 43 54 20 2b 20 28 20 36 32 20 29 20 46  ELECT + ( 62 ) F
1b3c0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1b3d0 0d 0a 2d 2d 2d 2d 0d 0a 36 32 0d 0a 36 32 0d 0a  ..----..62..62..
1b3e0 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  62....onlyif mys
1b3f0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1b400 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1b410 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1b420 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1b430 6c 2d 37 33 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-732..SELECT AL
1b440 4c 20 2d 20 36 34 20 2a 20 63 6f 6c 30 20 2d 20  L - 64 * col0 - 
1b450 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20  + col2 DIV col1 
1b460 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1b470 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1b480 35 33 36 0d 0a 2d 32 32 34 30 0d 0a 2d 35 36 39  536..-2240..-569
1b490 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
1b4a0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1b4b0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1b4c0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1b4d0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
1b4e0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1b4f0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1b500 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1b510 65 6c 2d 37 33 32 0d 0a 53 45 4c 45 43 54 20 41  el-732..SELECT A
1b520 4c 4c 20 2d 20 36 34 20 2a 20 63 6f 6c 30 20 2d  LL - 64 * col0 -
1b530 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 63   + col2 / col1 c
1b540 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
1b550 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
1b560 33 36 0d 0a 2d 32 32 34 30 0d 0a 2d 35 36 39 36  36..-2240..-5696
1b570 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b580 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1b590 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20 35 33  INCT col0 * - 53
1b5a0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1b5b0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 32 0d 0a 2d 31  .----..-1272..-1
1b5c0 38 35 35 0d 0a 2d 34 37 31 37 0d 0a 0d 0a 71 75  855..-4717....qu
1b5d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b5e0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 39 20 46  ELECT ALL + 99 F
1b5f0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
1b600 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
1b610 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1b620 6f 20 34 62 37 37 34 36 37 64 64 35 66 33 34 36  o 4b77467dd5f346
1b630 31 30 39 64 32 39 66 36 33 36 34 61 37 62 62 38  109d29f6364a7bb8
1b640 64 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  db....query I ro
1b650 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1b660 4c 20 2b 20 33 34 20 2b 20 2d 20 63 6f 6c 31 20  L + 34 + - col1 
1b670 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1b680 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1b690 0a 32 31 0d 0a 32 34 0d 0a 38 0d 0a 0d 0a 71 75  .21..24..8....qu
1b6a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b6b0 45 4c 45 43 54 20 41 4c 4c 20 36 20 2d 20 2d 20  ELECT ALL 6 - - 
1b6c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1b6d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30  S cor0..----..30
1b6e0 0d 0a 34 31 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72  ..41..95....quer
1b6f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1b700 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  ECT cor0.col1 + 
1b710 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 38 38 20  - ( col2 ) * 88 
1b720 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1b730 2d 2d 2d 2d 0d 0a 2d 32 38 31 38 0d 0a 2d 37 31  ----..-2818..-71
1b740 32 35 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49  25..9....query I
1b750 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b760 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 34 31   DISTINCT - + 41
1b770 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + + col2 AS col
1b780 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1b790 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 31  or0..----..13..1
1b7a0 36 0d 0a 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49  6..55....query I
1b7b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b7c0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   + cor0.col0 * c
1b7d0 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
1b7e0 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b2, tab1 AS cor0
1b7f0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
1b800 20 68 61 73 68 69 6e 67 20 74 6f 20 38 31 35 66   hashing to 815f
1b810 63 63 64 34 63 33 64 33 37 32 62 32 38 64 33 66  ccd4c3d372b28d3f
1b820 33 66 62 31 30 33 30 32 35 37 37 35 0d 0a 0d 0a  3fb103025775....
1b830 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b840 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
1b850 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30   + col1 * + cor0
1b860 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
1b870 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1b880 0a 2d 2d 2d 2d 0d 0a 37 34 38 32 0d 0a 38 33 37  .----..7482..837
1b890 32 0d 0a 39 35 30 36 0d 0a 0d 0a 71 75 65 72 79  2..9506....query
1b8a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b8b0 43 54 20 2b 20 28 20 30 20 29 20 2a 20 2b 20 63  CT + ( 0 ) * + c
1b8c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1b8d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
1b8e0 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
1b8f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1b900 2d 20 2d 20 36 39 20 2b 20 2b 20 34 32 20 46 52  - - 69 + + 42 FR
1b910 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
1b920 2d 2d 0d 0a 31 31 31 0d 0a 31 31 31 0d 0a 31 31  --..111..111..11
1b930 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1b940 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1b950 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  2 * - col0 + - c
1b960 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1b970 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
1b980 38 0d 0a 2d 33 36 35 38 0d 0a 2d 37 36 39 33 0d  8..-3658..-7693.
1b990 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b9a0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 36 32 20  rt..SELECT - 62 
1b9b0 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72  + + col1 * - cor
1b9c0 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  0.col2 AS col0 F
1b9d0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1b9e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 31 30 0d 0a 2d  ..----..-1310..-
1b9f0 31 34 36 36 0d 0a 2d 36 33 32 0d 0a 0d 0a 73 6b  1466..-632....sk
1ba00 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1ba10 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1ba20 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1ba30 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1ba40 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1ba50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1ba60 20 63 6f 6c 30 20 2a 20 33 20 63 6f 6c 31 20 46   col0 * 3 col1 F
1ba70 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1ba80 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 0d 0a 32 34 30  ..----..192..240
1ba90 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..9....query I r
1baa0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1bab0 20 36 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   65 AS col0 FROM
1bac0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1bad0 2d 2d 2d 0d 0a 2d 36 35 0d 0a 2d 36 35 0d 0a 2d  ---..-65..-65..-
1bae0 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  65....query I ro
1baf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
1bb00 2b 20 36 30 20 29 20 2a 20 2b 20 63 6f 6c 31 20  + 60 ) * + col1 
1bb10 2b 20 2d 20 28 20 2b 20 28 20 2b 20 63 6f 6c 32  + - ( + ( + col2
1bb20 20 29 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f   ) ) AS col1 FRO
1bb30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1bb40 2d 2d 2d 2d 0d 0a 35 31 32 37 0d 0a 35 33 37 38  ----..5127..5378
1bb50 0d 0a 35 38 31 39 0d 0a 0d 0a 71 75 65 72 79 20  ..5819....query 
1bb60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1bb70 54 20 28 20 2b 20 63 6f 6c 32 20 29 20 2b 20 63  T ( + col2 ) + c
1bb80 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 * - col1 FRO
1bb90 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
1bba0 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 36 30 38 0d 0a  -..-1508..-608..
1bbb0 2d 38 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -810....query I 
1bbc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1bbd0 2b 20 2d 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c  + - col1 - + col
1bbe0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
1bbf0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1bc00 2d 0d 0a 2d 32 30 0d 0a 2d 32 36 0d 0a 2d 35 32  -..-20..-26..-52
1bc10 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1bc20 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1bc30 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1bc40 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1bc50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1bc60 37 35 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  750..SELECT - + 
1bc70 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 44 49 56 20  col2 - col0 DIV 
1bc80 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
1bc90 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1bca0 2d 0d 0a 2d 32 0d 0a 2d 33 34 0d 0a 2d 38 33 0d  -..-2..-34..-83.
1bcb0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1bcc0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1bcd0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1bce0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1bcf0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
1bd00 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1bd10 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1bd20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1bd30 2d 37 35 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -750..SELECT - +
1bd40 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 2f 20 63   col2 - col0 / c
1bd50 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol0 col2 FROM ta
1bd60 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1bd70 0d 0a 2d 32 0d 0a 2d 33 34 0d 0a 2d 38 33 0d 0a  ..-2..-34..-83..
1bd80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bd90 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
1bda0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b   * + cor0.col1 +
1bdb0 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   - col1 * - col0
1bdc0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1bdd0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1bde0 0d 0a 2d 35 39 38 0d 0a 35 34 30 0d 0a 38 37 31  ..-598..540..871
1bdf0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1be00 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1be10 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1be20 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1be30 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1be40 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35 32  owsort label-752
1be50 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1be60 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T + CAST( NULL A
1be70 53 20 44 45 43 49 4d 41 4c 20 29 20 63 6f 6c 31  S DECIMAL ) col1
1be80 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1be90 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
1bea0 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
1beb0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
1bec0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1bed0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1bee0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1bef0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1bf00 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
1bf10 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1bf20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bf30 74 20 6c 61 62 65 6c 2d 37 35 32 0d 0a 53 45 4c  t label-752..SEL
1bf40 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43  ECT DISTINCT + C
1bf50 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45  AST ( NULL AS RE
1bf60 41 4c 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74  AL ) col1 FROM t
1bf70 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab0 AS cor0 CROS
1bf80 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63  S JOIN tab0 AS c
1bf90 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or1..----..NULL.
1bfa0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1bfb0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1bfc0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1bfd0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1bfe0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1bff0 35 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  53..SELECT ALL c
1c000 6f 6c 32 20 44 49 56 20 34 34 20 46 52 4f 4d 20  ol2 DIV 44 FROM 
1c010 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  tab1..----..1..1
1c020 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..2....skipif my
1c030 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1c040 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1c050 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35 33 0d  wsort label-753.
1c060 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
1c070 20 2f 20 34 34 20 46 52 4f 4d 20 74 61 62 31 0d   / 44 FROM tab1.
1c080 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 32 0d 0a  .----..1..1..2..
1c090 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c0a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1c0b0 2b 20 63 6f 6c 31 20 2a 20 28 20 2b 20 33 34 20  + col1 * ( + 34 
1c0c0 29 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 39  ) + + col0 * + 9
1c0d0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
1c0e0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
1c0f0 31 36 39 38 0d 0a 37 38 34 36 0d 0a 39 31 38 32  1698..7846..9182
1c100 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1c110 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1c120 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1c130 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1c140 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1c150 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c160 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20 29 20  LECT - ( col2 ) 
1c170 2a 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  * col1 col0 FROM
1c180 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1c190 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30  ---..-1248..-140
1c1a0 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79  4..-570....query
1c1b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c1c0 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20  CT ALL + + col0 
1c1d0 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  + + col2 * + col
1c1e0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1c1f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a  or0..----..165..
1c200 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75  3712..7760....qu
1c210 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c220 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1c230 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20   - ( + col0 ) + 
1c240 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  - col2 AS col0 F
1c250 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1c260 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a 2d 33  ..----..-171..-3
1c270 36 0d 0a 2d 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  6..-57....onlyif
1c280 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1c290 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1c2a0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1c2b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1c2c0 6c 61 62 65 6c 2d 37 35 38 0d 0a 53 45 4c 45 43  label-758..SELEC
1c2d0 54 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20  T col1 DIV col2 
1c2e0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
1c2f0 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a  ..----..54..57..
1c300 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  96....skipif mys
1c310 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1c320 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1c330 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35 38 0d 0a  sort label-758..
1c340 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20 63 6f  SELECT col1 / co
1c350 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 + col2 FROM t
1c360 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  ab1..----..54..5
1c370 37 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7..96....onlyif 
1c380 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1c390 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1c3a0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1c3b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1c3c0 61 62 65 6c 2d 37 35 39 0d 0a 53 45 4c 45 43 54  abel-759..SELECT
1c3d0 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 44   + - cor0.col0 D
1c3e0 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c  IV - col1 AS col
1c3f0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1c400 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 36 0d  or0..----..0..6.
1c410 0a 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .6....skipif mys
1c420 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1c430 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1c440 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35 39 0d 0a  sort label-759..
1c450 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e  SELECT + - cor0.
1c460 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 41 53  col0 / - col1 AS
1c470 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1c480 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1c490 0d 0a 36 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20  ..6..6....query 
1c4a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c4b0 54 20 2d 20 31 31 20 2a 20 2d 20 63 6f 6c 30 20  T - 11 * - col0 
1c4c0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1c4d0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 37 0d 0a 38 35 38  0..----..77..858
1c4e0 0d 0a 38 36 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..869....onlyif 
1c4f0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1c500 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1c510 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1c520 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1c530 61 62 65 6c 2d 37 36 31 0d 0a 53 45 4c 45 43 54  abel-761..SELECT
1c540 20 41 4c 4c 20 2d 20 34 33 20 44 49 56 20 63 6f   ALL - 43 DIV co
1c550 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
1c560 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  tab0..----..-1..
1c570 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -1..0....skipif 
1c580 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1c590 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1c5a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 36  rowsort label-76
1c5b0 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  1..SELECT ALL - 
1c5c0 34 33 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c  43 / col0 AS col
1c5d0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
1c5e0 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a  -..-1..-1..0....
1c5f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c600 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
1c610 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 28 20   * - col0 * - ( 
1c620 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46  col0 ) AS col0 F
1c630 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1c640 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 31 39  ..----..1225..19
1c650 30 30 38 0d 0a 36 34 39 35 32 32 0d 0a 0d 0a 6f  008..649522....o
1c660 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1c670 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1c680 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1c690 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1c6a0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 36 33 0d 0a  sort label-763..
1c6b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1c6c0 2b 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 63  + + col1 DIV - c
1c6d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
1c6e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
1c6f0 0a 2d 32 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70  .-2..-97....skip
1c700 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1c710 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1c720 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1c730 2d 37 36 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -763..SELECT DIS
1c740 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2f  TINCT + + col1 /
1c750 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
1c760 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1c770 0a 2d 31 0d 0a 2d 32 0d 0a 2d 39 37 0d 0a 0d 0a  .-1..-2..-97....
1c780 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c790 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
1c7a0 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  cor0.col0 * + co
1c7b0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
1c7c0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
1c7d0 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39  .2064..3395..809
1c7e0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
1c7f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1c800 20 39 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f   92 * col0 AS co
1c810 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
1c820 2d 2d 0d 0a 32 37 36 0d 0a 35 38 38 38 0d 0a 37  --..276..5888..7
1c830 33 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  360....query I r
1c840 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1c850 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  LL - cor0.col2 +
1c860 20 28 20 39 34 20 29 20 46 52 4f 4d 20 74 61 62   ( 94 ) FROM tab
1c870 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1c880 0a 2d 32 0d 0a 33 37 0d 0a 34 30 0d 0a 0d 0a 71  .-2..37..40....q
1c890 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c8a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1c8b0 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20  - col1 + + col1 
1c8c0 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
1c8d0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1c8e0 0d 0a 31 32 33 35 0d 0a 31 33 37 38 0d 0a 35 36  ..1235..1378..56
1c8f0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1c900 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1c910 54 49 4e 43 54 20 33 30 20 41 53 20 63 6f 6c 31  TINCT 30 AS col1
1c920 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
1c930 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c940 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
1c950 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
1c960 38 33 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  83 ) * + cor0.co
1c970 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  l1 * col2 + - co
1c980 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63  l0 + - col2 AS c
1c990 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
1c9a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 32 31 38  r0..----..127218
1c9b0 0d 0a 35 33 35 30 31 0d 0a 36 39 34 33 37 0d 0a  ..53501..69437..
1c9c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c9d0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
1c9e0 6f 6c 32 20 2a 20 28 20 63 6f 6c 30 20 29 20 2b  ol2 * ( col0 ) +
1c9f0 20 34 37 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f   47 + + col0 FRO
1ca00 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1ca10 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a 37 34 33 34 0d  ----..117..7434.
1ca20 0a 38 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .863....query I 
1ca30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ca40 44 49 53 54 49 4e 43 54 20 2d 20 74 61 62 31 2e  DISTINCT - tab1.
1ca50 63 6f 6c 30 20 2a 20 32 30 20 46 52 4f 4d 20 74  col0 * 20 FROM t
1ca60 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 30  ab1..----..-1280
1ca70 0d 0a 2d 31 36 30 30 0d 0a 2d 36 30 0d 0a 0d 0a  ..-1600..-60....
1ca80 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1ca90 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1caa0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1cab0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1cac0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 32 0d  wsort label-772.
1cad0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 39 32  .SELECT ALL - 92
1cae0 20 44 49 56 20 31 31 20 46 52 4f 4d 20 74 61 62   DIV 11 FROM tab
1caf0 31 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61  1, tab0 cor0, ta
1cb00 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  b2, tab1 AS cor1
1cb10 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
1cb20 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 64 63  s hashing to 7dc
1cb30 34 37 31 30 31 34 39 31 64 62 33 34 66 61 66 30  47101491db34faf0
1cb40 64 62 38 33 32 35 61 36 61 63 32 37 36 0d 0a 0d  db8325a6ac276...
1cb50 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1cb60 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1cb70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1cb80 6c 61 62 65 6c 2d 37 37 32 0d 0a 53 45 4c 45 43  label-772..SELEC
1cb90 54 20 41 4c 4c 20 2d 20 39 32 20 2f 20 31 31 20  T ALL - 92 / 11 
1cba0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
1cbb0 63 6f 72 30 2c 20 74 61 62 32 2c 20 74 61 62 31  cor0, tab2, tab1
1cbc0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
1cbd0 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  81 values hashin
1cbe0 67 20 74 6f 20 37 64 63 34 37 31 30 31 34 39 31  g to 7dc47101491
1cbf0 64 62 33 34 66 61 66 30 64 62 38 33 32 35 61 36  db34faf0db8325a6
1cc00 61 63 32 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ac276....query I
1cc10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1cc20 20 34 38 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20   48 * cor0.col2 
1cc30 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20  FROM tab2, tab0 
1cc40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
1cc50 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1cc60 74 6f 20 36 38 62 66 37 33 36 64 62 34 30 31 39  to 68bf736db4019
1cc70 35 35 64 35 38 31 38 37 39 63 62 30 66 36 31 34  55d581879cb0f614
1cc80 31 31 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  11b....query I r
1cc90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1cca0 20 35 35 20 2a 20 2d 20 63 6f 6c 32 20 2d 20 63   55 * - col2 - c
1ccb0 6f 6c 30 20 2a 20 2d 20 31 37 20 41 53 20 63 6f  ol0 * - 17 AS co
1ccc0 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
1ccd0 2d 2d 0d 0a 31 36 30 34 0d 0a 32 37 35 36 0d 0a  --..1604..2756..
1cce0 33 34 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3433....query I 
1ccf0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1cd00 2d 20 28 20 2b 20 38 20 29 20 2b 20 2d 20 63 6f  - ( + 8 ) + - co
1cd10 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
1cd20 2d 2d 0d 0a 2d 31 31 0d 0a 2d 37 32 0d 0a 2d 38  --..-11..-72..-8
1cd30 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  8....skipif post
1cd40 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1cd50 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1cd60 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1cd70 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1cd80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1cd90 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34  ELECT DISTINCT 4
1cda0 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2 col2 FROM tab2
1cdb0 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 0d 0a 71 75  ..----..42....qu
1cdc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1cdd0 45 4c 45 43 54 20 2b 20 37 33 20 2b 20 2b 20 74  ELECT + 73 + + t
1cde0 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30  ab2.col2 AS col0
1cdf0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
1ce00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ce10 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
1ce20 20 74 6f 20 37 37 31 31 66 62 38 33 64 32 30 34   to 7711fb83d204
1ce30 38 31 64 63 34 33 61 37 66 32 30 30 36 36 32 62  81dc43a7f200662b
1ce40 66 32 33 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20  f23a....query I 
1ce50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ce60 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2d 20 63  DISTINCT + ( - c
1ce70 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 29 20 46  ol1 * + col2 ) F
1ce80 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1ce90 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39  -2838..-7462..-9
1cea0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1ceb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1cec0 54 49 4e 43 54 20 2b 20 28 20 39 37 20 29 20 2a  TINCT + ( 97 ) *
1ced0 20 2d 20 63 6f 6c 32 20 2b 20 28 20 2d 20 34 34   - col2 + ( - 44
1cee0 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d   ) FROM tab1..--
1cef0 2d 2d 0d 0a 2d 35 32 38 32 0d 0a 2d 35 35 37 33  --..-5282..-5573
1cf00 0d 0a 2d 39 33 35 36 0d 0a 0d 0a 71 75 65 72 79  ..-9356....query
1cf10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cf20 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 36 32  CT + col2 + - 62
1cf30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1cf40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d  r0..----..-24..-
1cf50 33 35 0d 0a 2d 33 36 0d 0a 0d 0a 71 75 65 72 79  35..-36....query
1cf60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cf70 43 54 20 41 4c 4c 20 32 35 20 41 53 20 63 6f 6c  CT ALL 25 AS col
1cf80 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
1cf90 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1cfa0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
1cfb0 67 20 74 6f 20 35 32 35 61 35 35 64 35 65 64 32  g to 525a55d5ed2
1cfc0 32 34 61 36 32 64 61 36 35 64 66 33 36 37 33 31  24a62da65df36731
1cfd0 38 38 31 61 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  881a7....onlyif 
1cfe0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1cff0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1d000 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1d010 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1d020 61 62 65 6c 2d 37 38 32 0d 0a 53 45 4c 45 43 54  abel-782..SELECT
1d030 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 44 49 56 20   ALL - col1 DIV 
1d040 39 39 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  99 FROM tab0..--
1d050 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
1d060 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1d070 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1d080 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1d090 62 65 6c 2d 37 38 32 0d 0a 53 45 4c 45 43 54 20  bel-782..SELECT 
1d0a0 41 4c 4c 20 2d 20 63 6f 6c 31 20 2f 20 39 39 20  ALL - col1 / 99 
1d0b0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1d0c0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
1d0d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d0e0 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  ECT - col2 + col
1d0f0 32 20 2b 20 63 6f 6c 30 20 2a 20 32 36 20 41 53  2 + col0 * 26 AS
1d100 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1d110 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1d120 33 31 34 0d 0a 36 32 34 0d 0a 39 31 30 0d 0a 0d  314..624..910...
1d130 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d140 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35 37 20  ..SELECT ALL 57 
1d150 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  * col0 AS col0 F
1d160 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1d170 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 34  ..----..171..364
1d180 38 0d 0a 34 35 36 30 0d 0a 0d 0a 71 75 65 72 79  8..4560....query
1d190 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d1a0 43 54 20 41 4c 4c 20 32 20 41 53 20 63 6f 6c 30  CT ALL 2 AS col0
1d1b0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
1d1c0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
1d1d0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
1d1e0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1d1f0 74 6f 20 35 33 35 33 34 35 63 35 30 61 31 39 66  to 535345c50a19f
1d200 64 61 62 39 37 63 65 30 35 64 31 38 33 37 62 31  dab97ce05d1837b1
1d210 66 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  f09....onlyif my
1d220 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
1d230 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
1d240 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
1d250 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
1d260 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1d270 37 38 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  786..SELECT ALL 
1d280 2b 20 2b 20 31 31 20 2a 20 2d 20 63 6f 72 30 2e  + + 11 * - cor0.
1d290 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 28 20 2b  col1 + + CAST( +
1d2a0 20 28 20 63 6f 6c 30 20 29 20 41 53 20 53 49 47   ( col0 ) AS SIG
1d2b0 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20  NED ) FROM tab1 
1d2c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1d2d0 32 38 33 0d 0a 2d 34 36 0d 0a 2d 36 33 0d 0a 0d  283..-46..-63...
1d2e0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1d2f0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1d300 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1d310 6c 61 62 65 6c 2d 37 38 36 0d 0a 53 45 4c 45 43  label-786..SELEC
1d320 54 20 41 4c 4c 20 2b 20 2b 20 31 31 20 2a 20 2d  T ALL + + 11 * -
1d330 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 43   cor0.col1 + + C
1d340 41 53 54 20 28 20 2b 20 28 20 63 6f 6c 30 20 29  AST ( + ( col0 )
1d350 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
1d360 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1d370 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 0d 0a 2d 34 36  .----..-283..-46
1d380 0d 0a 2d 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-63....query I
1d390 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1d3a0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63   col0 * - cor0.c
1d3b0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
1d3c0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
1d3d0 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d  ..-189..-2028..-
1d3e0 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3002....query I 
1d3f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d400 41 4c 4c 20 2b 20 31 36 20 2a 20 2d 20 63 6f 6c  ALL + 16 * - col
1d410 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
1d420 2d 0d 0a 2d 31 31 32 0d 0a 2d 31 32 34 38 0d 0a  -..-112..-1248..
1d430 2d 31 32 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -1264....query I
1d440 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1d450 20 2d 20 34 20 2a 20 2d 20 63 6f 6c 31 20 2a 20   - 4 * - col1 * 
1d460 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30  cor0.col2 + col0
1d470 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1d480 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 36 33 0d 0a  r0..----..2663..
1d490 33 33 35 35 0d 0a 36 32 31 34 0d 0a 0d 0a 73 6b  3355..6214....sk
1d4a0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1d4b0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1d4c0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1d4d0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1d4e0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1d4f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1d500 49 53 54 49 4e 43 54 20 38 37 20 63 6f 6c 31 20  ISTINCT 87 col1 
1d510 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1d520 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 0d 0a 6f  0..----..87....o
1d530 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1d540 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1d550 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1d560 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1d570 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 31 0d 0a  sort label-791..
1d580 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e  SELECT + - cor0.
1d590 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 44 49 56 20  col0 + col1 DIV 
1d5a0 2b 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20  + CAST( col0 AS 
1d5b0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
1d5c0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1d5d0 0d 0a 2d 32 31 0d 0a 2d 33 33 0d 0a 2d 38 38 0d  ..-21..-33..-88.
1d5e0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1d5f0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1d600 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d610 74 20 6c 61 62 65 6c 2d 37 39 31 0d 0a 53 45 4c  t label-791..SEL
1d620 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT + - cor0.col
1d630 30 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 43 41 53  0 + col1 / + CAS
1d640 54 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45  T ( col0 AS INTE
1d650 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20  GER ) FROM tab0 
1d660 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1d670 32 31 0d 0a 2d 33 33 0d 0a 2d 38 38 0d 0a 0d 0a  21..-33..-88....
1d680 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d690 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1d6a0 20 2b 20 36 37 20 2a 20 38 35 20 46 52 4f 4d 20   + 67 * 85 FROM 
1d6b0 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
1d6c0 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
1d6d0 0d 0a 2d 2d 2d 2d 0d 0a 35 36 39 35 0d 0a 0d 0a  ..----..5695....
1d6e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d6f0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d  .SELECT col2 * -
1d700 20 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f 6c   col0 + tab1.col
1d710 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
1d720 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 0d  ab1..----..-136.
1d730 0a 2d 33 36 33 38 0d 0a 2d 37 36 36 37 0d 0a 0d  .-3638..-7667...
1d740 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1d750 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1d760 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1d770 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1d780 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1d790 6f 72 74 20 6c 61 62 65 6c 2d 37 39 34 0d 0a 53  ort label-794..S
1d7a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1d7b0 6f 6c 31 20 2b 20 43 41 53 54 28 20 31 36 20 41  ol1 + CAST( 16 A
1d7c0 53 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 32 20  S SIGNED ) col2 
1d7d0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1d7e0 0a 31 30 32 0d 0a 31 30 37 0d 0a 31 31 33 0d 0a  .102..107..113..
1d7f0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1d800 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1d810 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1d820 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1d830 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
1d840 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1d850 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1d860 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1d870 37 39 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  794..SELECT DIST
1d880 49 4e 43 54 20 63 6f 6c 31 20 2b 20 43 41 53 54  INCT col1 + CAST
1d890 20 28 20 31 36 20 41 53 20 49 4e 54 45 47 45 52   ( 16 AS INTEGER
1d8a0 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   ) col2 FROM tab
1d8b0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31 30  0..----..102..10
1d8c0 37 0d 0a 31 31 33 0d 0a 0d 0a 73 6b 69 70 69 66  7..113....skipif
1d8d0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1d8e0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1d8f0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1d900 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1d910 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
1d920 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62  rt..SELECT + tab
1d930 31 2e 63 6f 6c 32 20 2a 20 74 61 62 31 2e 63 6f  1.col2 * tab1.co
1d940 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
1d950 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31  1..----..1248..1
1d960 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 6f 6e 6c 79  404..570....only
1d970 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1d980 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1d990 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1d9a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d9b0 74 20 6c 61 62 65 6c 2d 37 39 36 0d 0a 53 45 4c  t label-796..SEL
1d9c0 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  ECT col1 + - col
1d9d0 31 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20  1 DIV col0 FROM 
1d9e0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a  tab1..----..10..
1d9f0 31 33 0d 0a 31 38 0d 0a 0d 0a 73 6b 69 70 69 66  13..18....skipif
1da00 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1da10 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1da20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1da30 39 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  96..SELECT col1 
1da40 2b 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20  + - col1 / col0 
1da50 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1da60 0a 31 30 0d 0a 31 33 0d 0a 31 38 0d 0a 0d 0a 71  .10..13..18....q
1da70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1da80 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1da90 32 20 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 63  2 + ( col1 ) * c
1daa0 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  or0.col2 * + col
1dab0 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  2 + col2 * + col
1dac0 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 * col2 FROM ta
1dad0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1dae0 0d 0a 32 34 30 33 36 39 0d 0a 38 34 35 31 30 0d  ..240369..84510.
1daf0 0a 38 35 36 39 39 32 0d 0a 0d 0a 71 75 65 72 79  .856992....query
1db00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1db10 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  CT + - col2 * co
1db20 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  l2 * - col1 + - 
1db30 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
1db40 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1db50 2d 0d 0a 31 31 39 37 32 38 0d 0a 33 32 34 32 36  -..119728..32426
1db60 0d 0a 37 35 38 31 33 0d 0a 0d 0a 6f 6e 6c 79 69  ..75813....onlyi
1db70 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1db80 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1db90 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1dba0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1dbb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1dbc0 62 65 6c 2d 37 39 39 0d 0a 53 45 4c 45 43 54 20  bel-799..SELECT 
1dbd0 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 43  ALL + col2 * + C
1dbe0 41 53 54 28 20 2d 20 33 31 20 41 53 20 53 49 47  AST( - 31 AS SIG
1dbf0 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52  NED ) AS col0 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 36 37 34 0d 0a 2d 31  .----..-1674..-1
1dc20 37 36 37 0d 0a 2d 32 39 37 36 0d 0a 0d 0a 73 6b  767..-2976....sk
1dc30 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1dc40 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1dc50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1dc60 65 6c 2d 37 39 39 0d 0a 53 45 4c 45 43 54 20 41  el-799..SELECT A
1dc70 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 43 41  LL + col2 * + CA
1dc80 53 54 20 28 20 2d 20 33 31 20 41 53 20 49 4e 54  ST ( - 31 AS INT
1dc90 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46  EGER ) AS col0 F
1dca0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1dcb0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 37 34 0d 0a 2d  ..----..-1674..-
1dcc0 31 37 36 37 0d 0a 2d 32 39 37 36 0d 0a 0d 0a 71  1767..-2976....q
1dcd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1dce0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
1dcf0 30 20 2a 20 2b 20 34 34 20 41 53 20 63 6f 6c 31  0 * + 44 AS col1
1dd00 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1dd10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 36 0d 0a  r0..----..1056..
1dd20 31 35 34 30 0d 0a 33 39 31 36 0d 0a 0d 0a 71 75  1540..3916....qu
1dd30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1dd40 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
1dd50 20 2a 20 2d 20 31 20 2a 20 2d 20 63 6f 6c 31 20   * - 1 * - col1 
1dd60 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1dd70 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a  0..----..-1248..
1dd80 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71  -1404..-570....q
1dd90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1dda0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1ddb0 2b 20 37 37 20 2b 20 2b 20 31 33 20 2b 20 63 6f  + 77 + + 13 + co
1ddc0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
1ddd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 34 0d  cor0..----..154.
1dde0 0a 31 37 30 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72  .170..93....quer
1ddf0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1de00 45 43 54 20 41 4c 4c 20 2b 20 32 34 20 2a 20 2b  ECT ALL + 24 * +
1de10 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 46   col2 + + col1 F
1de20 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1de30 0d 0a 2d 2d 2d 2d 0d 0a 36 37 39 0d 0a 36 38 33  ..----..679..683
1de40 0d 0a 39 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..929....onlyif 
1de50 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1de60 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1de70 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1de80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1de90 61 62 65 6c 2d 38 30 34 0d 0a 53 45 4c 45 43 54  abel-804..SELECT
1dea0 20 31 33 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c   13 + col2 * col
1deb0 30 20 44 49 56 20 2d 20 35 31 20 63 6f 6c 31 20  0 DIV - 51 col1 
1dec0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
1ded0 2d 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 35 38 0d  ----..-137..-58.
1dee0 0a 31 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .10....skipif po
1def0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1df00 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1df10 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1df20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1df30 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1df40 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1df50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1df60 61 62 65 6c 2d 38 30 34 0d 0a 53 45 4c 45 43 54  abel-804..SELECT
1df70 20 31 33 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c   13 + col2 * col
1df80 30 20 2f 20 2d 20 35 31 20 63 6f 6c 31 20 46 52  0 / - 51 col1 FR
1df90 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
1dfa0 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 35 38 0d 0a 31  --..-137..-58..1
1dfb0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1dfc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
1dfd0 20 28 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f   ( col2 ) * - co
1dfe0 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  l0 + + col2 * + 
1dff0 32 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  21 AS col2 FROM 
1e000 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1e010 2d 2d 0d 0a 31 32 39 36 0d 0a 34 38 34 35 0d 0a  --..1296..4845..
1e020 39 36 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9696....query I 
1e030 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e040 44 49 53 54 49 4e 43 54 20 39 39 20 2a 20 63 6f  DISTINCT 99 * co
1e050 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l0 + + cor0.col0
1e060 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1e070 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 30 0d 0a 37  r0..----..700..7
1e080 38 30 30 0d 0a 37 39 30 30 0d 0a 0d 0a 71 75 65  800..7900....que
1e090 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e0a0 4c 45 43 54 20 41 4c 4c 20 31 35 20 2b 20 2d 20  LECT ALL 15 + - 
1e0b0 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  col1 * - col0 * 
1e0c0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
1e0d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e0e0 31 31 39 36 36 37 0d 0a 35 31 30 34 39 0d 0a 35  119667..51049..5
1e0f0 38 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  874....query I r
1e100 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1e110 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30  LL + col0 + col0
1e120 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
1e130 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1e140 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 32 33 34  0..----..21..234
1e150 0d 0a 32 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..237....query I
1e160 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e170 20 41 4c 4c 20 2b 20 28 20 63 6f 72 30 2e 63 6f   ALL + ( cor0.co
1e180 6c 32 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l2 ) + col1 FROM
1e190 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1e1a0 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30  ---..109..67..80
1e1b0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1e1c0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1e1d0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1e1e0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1e1f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1e200 38 31 30 0d 0a 53 45 4c 45 43 54 20 32 32 20 2a  810..SELECT 22 *
1e210 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b   col2 * + col0 +
1e220 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56   + cor0.col2 DIV
1e230 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
1e240 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1e250 0a 34 31 36 31 0d 0a 34 34 36 31 36 0d 0a 36 36  .4161..44616..66
1e260 30 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  044....skipif my
1e270 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1e280 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1e290 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 30 0d  wsort label-810.
1e2a0 0a 53 45 4c 45 43 54 20 32 32 20 2a 20 63 6f 6c  .SELECT 22 * col
1e2b0 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  2 * + col0 + + c
1e2c0 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f 72 30 2e  or0.col2 / cor0.
1e2d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
1e2e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 36 31 0d  or0..----..4161.
1e2f0 0a 34 34 36 31 36 0d 0a 36 36 30 34 34 0d 0a 0d  .44616..66044...
1e300 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e310 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
1e320 20 36 32 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f   62 + + col1 FRO
1e330 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1e340 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 34 39 0d 0a  ----..-36..-49..
1e350 2d 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -52....query I r
1e360 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1e370 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31  ISTINCT - - col1
1e380 20 2b 20 2b 20 32 34 20 46 52 4f 4d 20 74 61 62   + + 24 FROM tab
1e390 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1e3a0 0a 33 34 0d 0a 33 37 0d 0a 35 30 0d 0a 0d 0a 6f  .34..37..50....o
1e3b0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1e3c0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1e3d0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1e3e0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1e3f0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 33 0d 0a  sort label-813..
1e400 53 45 4c 45 43 54 20 2d 20 33 20 2b 20 2d 20 33  SELECT - 3 + - 3
1e410 30 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20  0 DIV col0 FROM 
1e420 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1e430 2d 2d 0d 0a 2d 31 33 0d 0a 2d 33 0d 0a 2d 33 0d  --..-13..-3..-3.
1e440 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1e450 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1e460 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e470 74 20 6c 61 62 65 6c 2d 38 31 33 0d 0a 53 45 4c  t label-813..SEL
1e480 45 43 54 20 2d 20 33 20 2b 20 2d 20 33 30 20 2f  ECT - 3 + - 30 /
1e490 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1e4a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1e4b0 31 33 0d 0a 2d 33 0d 0a 2d 33 0d 0a 0d 0a 71 75  13..-3..-3....qu
1e4c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e4d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1e4e0 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20 2b 20   ( - col2 ) + + 
1e4f0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
1e500 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1e510 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35  ----..55..58..85
1e520 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e530 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1e540 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  col2 - col2 * co
1e550 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
1e560 2d 2d 0d 0a 2d 31 31 35 32 0d 0a 2d 31 33 35 30  --..-1152..-1350
1e570 0d 0a 2d 35 31 33 0d 0a 0d 0a 71 75 65 72 79 20  ..-513....query 
1e580 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e590 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36 38 20  T DISTINCT - 68 
1e5a0 2a 20 39 37 20 2a 20 2d 20 63 6f 6c 30 20 46 52  * 97 * - col0 FR
1e5b0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
1e5c0 2d 2d 0d 0a 34 36 31 37 32 0d 0a 35 31 34 34 38  --..46172..51448
1e5d0 38 0d 0a 35 32 31 30 38 34 0d 0a 0d 0a 71 75 65  8..521084....que
1e5e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e5f0 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
1e600 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  2 - - cor0.col1 
1e610 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1e620 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1e630 0a 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a  .109..67..80....
1e640 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e650 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
1e660 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b   + cor0.col1 + +
1e670 20 35 38 20 46 52 4f 4d 20 74 61 62 30 20 41 53   58 FROM tab0 AS
1e680 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 35   cor0..----..745
1e690 34 0d 0a 38 33 33 39 0d 0a 39 34 36 37 0d 0a 0d  4..8339..9467...
1e6a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e6b0 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
1e6c0 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 38  0 * - col0 + - 8
1e6d0 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  5 FROM tab2 AS c
1e6e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a  or0..----..-36..
1e6f0 35 39 39 39 0d 0a 36 31 35 36 0d 0a 0d 0a 71 75  5999..6156....qu
1e700 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e710 45 4c 45 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c  ELECT - cor1.col
1e720 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
1e730 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
1e740 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
1e750 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
1e760 20 68 61 73 68 69 6e 67 20 74 6f 20 36 61 34 33   hashing to 6a43
1e770 65 37 66 31 35 31 39 34 61 66 37 33 66 65 31 63  e7f15194af73fe1c
1e780 38 33 33 38 35 65 36 65 62 65 62 63 0d 0a 0d 0a  83385e6ebebc....
1e790 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e7a0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
1e7b0 20 2b 20 28 20 2b 20 31 35 20 29 20 46 52 4f 4d   + ( + 15 ) FROM
1e7c0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1e7d0 2d 2d 2d 0d 0a 31 32 39 30 0d 0a 31 33 36 35 0d  ---..1290..1365.
1e7e0 0a 31 34 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .1455....query I
1e7f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e800 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2d 20 63 6f   col2 * - ( - co
1e810 6c 32 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  l2 ) * col0 FROM
1e820 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1e830 2d 2d 2d 0d 0a 32 30 37 39 33 36 0d 0a 37 33 37  ---..207936..737
1e840 32 38 30 0d 0a 38 37 34 38 0d 0a 0d 0a 71 75 65  280..8748....que
1e850 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e860 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 33 37  LECT col2 * + 37
1e870 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1e880 0d 0a 31 34 30 36 0d 0a 39 36 32 0d 0a 39 39 39  ..1406..962..999
1e890 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1e8a0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1e8b0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1e8c0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1e8d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1e8e0 38 32 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  824..SELECT ALL 
1e8f0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f  + cor0.col2 + co
1e900 6c 30 20 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20  l0 DIV + col2 + 
1e910 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 63 6f  col0 * - col1 co
1e920 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
1e930 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 33 31 0d 0a  0..----..-2031..
1e940 2d 33 33 35 39 0d 0a 2d 38 30 31 36 0d 0a 0d 0a  -3359..-8016....
1e950 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1e960 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1e970 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1e980 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1e990 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
1e9a0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1e9b0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1e9c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32  rowsort label-82
1e9d0 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  4..SELECT ALL + 
1e9e0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30  cor0.col2 + col0
1e9f0 20 2f 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   / + col2 + col0
1ea00 20 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 32 20 46   * - col1 col2 F
1ea10 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
1ea20 2d 2d 2d 0d 0a 2d 32 30 33 31 0d 0a 2d 33 33 35  ---..-2031..-335
1ea30 39 0d 0a 2d 38 30 31 36 0d 0a 0d 0a 71 75 65 72  9..-8016....quer
1ea40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1ea50 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1ea60 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol1 * col1 + col
1ea70 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1ea80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a  or0..----..164..
1ea90 32 34 39 0d 0a 36 37 39 0d 0a 0d 0a 71 75 65 72  249..679....quer
1eaa0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1eab0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
1eac0 31 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c  1 * - col1 - col
1ead0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1eae0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d  or0..----..-164.
1eaf0 0a 2d 32 34 39 0d 0a 2d 36 37 39 0d 0a 0d 0a 71  .-249..-679....q
1eb00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1eb10 53 45 4c 45 43 54 20 2b 20 38 33 20 46 52 4f 4d  SELECT + 83 FROM
1eb20 20 74 61 62 32 2c 20 74 61 62 30 2c 20 74 61 62   tab2, tab0, tab
1eb30 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 0d  0 AS cor0, tab1.
1eb40 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73  .----..81 values
1eb50 20 68 61 73 68 69 6e 67 20 74 6f 20 35 63 65 64   hashing to 5ced
1eb60 33 37 32 30 64 35 61 65 66 66 30 64 64 37 37 64  3720d5aeff0dd77d
1eb70 35 30 35 39 61 33 38 30 30 31 62 36 0d 0a 0d 0a  5059a38001b6....
1eb80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1eb90 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1eba0 20 63 6f 6c 32 20 2a 20 28 20 39 36 20 29 20 41   col2 * ( 96 ) A
1ebb0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
1ebc0 0d 0a 2d 2d 2d 2d 0d 0a 32 34 39 36 0d 0a 32 35  ..----..2496..25
1ebd0 39 32 0d 0a 33 36 34 38 0d 0a 0d 0a 6f 6e 6c 79  92..3648....only
1ebe0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1ebf0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1ec00 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1ec10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ec20 74 20 6c 61 62 65 6c 2d 38 32 39 0d 0a 53 45 4c  t label-829..SEL
1ec30 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c 30 20 2b  ECT - ( - col0 +
1ec40 20 2b 20 63 6f 6c 32 20 29 20 44 49 56 20 2d 20   + col2 ) DIV - 
1ec50 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
1ec60 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
1ec70 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1ec80 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1ec90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1eca0 6c 61 62 65 6c 2d 38 32 39 0d 0a 53 45 4c 45 43  label-829..SELEC
1ecb0 54 20 2d 20 28 20 2d 20 63 6f 6c 30 20 2b 20 2b  T - ( - col0 + +
1ecc0 20 63 6f 6c 32 20 29 20 2f 20 2d 20 63 6f 6c 30   col2 ) / - col0
1ecd0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1ece0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
1ecf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ed00 4c 45 43 54 20 2d 20 37 35 20 2b 20 2b 20 63 6f  LECT - 75 + + co
1ed10 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l2 * - col2 FROM
1ed20 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1ed30 2d 2d 2d 0d 0a 2d 31 31 36 34 0d 0a 2d 36 37 39  ---..-1164..-679
1ed40 39 0d 0a 2d 37 36 0d 0a 0d 0a 71 75 65 72 79 20  9..-76....query 
1ed50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ed60 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  T - col0 * cor0.
1ed70 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  col1 + col0 * co
1ed80 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
1ed90 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1eda0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .0..0..0....only
1edb0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1edc0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1edd0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1ede0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1edf0 74 20 6c 61 62 65 6c 2d 38 33 32 0d 0a 53 45 4c  t label-832..SEL
1ee00 45 43 54 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c  ECT col2 DIV col
1ee10 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0 col0 FROM tab0
1ee20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ee30 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69  0..0..1....skipi
1ee40 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1ee50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1ee60 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1ee70 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1ee80 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
1ee90 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1eea0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1eeb0 72 74 20 6c 61 62 65 6c 2d 38 33 32 0d 0a 53 45  rt label-832..SE
1eec0 4c 45 43 54 20 63 6f 6c 32 20 2f 20 63 6f 6c 30  LECT col2 / col0
1eed0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1eee0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1eef0 0d 0a 30 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..0..1....onlyif
1ef00 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1ef10 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1ef20 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1ef30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1ef40 6c 61 62 65 6c 2d 38 33 33 0d 0a 53 45 4c 45 43  label-833..SELEC
1ef50 54 20 2d 20 2b 20 63 6f 6c 30 20 44 49 56 20 63  T - + col0 DIV c
1ef60 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
1ef70 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1ef80 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d  ---..-1..-1..-1.
1ef90 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1efa0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1efb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1efc0 74 20 6c 61 62 65 6c 2d 38 33 33 0d 0a 53 45 4c  t label-833..SEL
1efd0 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2f 20 63  ECT - + col0 / c
1efe0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
1eff0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1f000 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d  ---..-1..-1..-1.
1f010 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f020 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1f030 4e 43 54 20 28 20 63 6f 6c 32 20 29 20 2b 20 2d  NCT ( col2 ) + -
1f040 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
1f050 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
1f060 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 6f  53..-9..-96....o
1f070 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1f080 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1f090 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1f0a0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1f0b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f0c0 74 20 6c 61 62 65 6c 2d 38 33 35 0d 0a 53 45 4c  t label-835..SEL
1f0d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53  ECT DISTINCT CAS
1f0e0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
1f0f0 44 20 29 20 2b 20 39 20 41 53 20 63 6f 6c 31 20  D ) + 9 AS col1 
1f100 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1f110 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
1f120 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1f130 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1f140 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33  rowsort label-83
1f150 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
1f160 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  CT CAST ( NULL A
1f170 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 39 20  S INTEGER ) + 9 
1f180 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1f190 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
1f1a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f1b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1f1c0 54 20 2d 20 39 30 20 2b 20 38 37 20 46 52 4f 4d  T - 90 + 87 FROM
1f1d0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   tab1..----..-3.
1f1e0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1f1f0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1f200 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1f210 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1f220 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1f230 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  37..SELECT DISTI
1f240 4e 43 54 20 28 20 63 6f 6c 32 20 29 20 2a 20 63  NCT ( col2 ) * c
1f250 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20 2b 20 2d  ol0 DIV col1 + -
1f260 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a   col1 * - col0 *
1f270 20 28 20 2b 20 32 35 20 29 20 41 53 20 63 6f 6c   ( + 25 ) AS col
1f280 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
1f290 2d 0d 0a 31 31 35 30 38 34 0d 0a 33 33 37 35 31  -..115084..33751
1f2a0 0d 0a 35 34 33 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..5431....skipif
1f2b0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1f2c0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1f2d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1f2e0 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  37..SELECT DISTI
1f2f0 4e 43 54 20 28 20 63 6f 6c 32 20 29 20 2a 20 63  NCT ( col2 ) * c
1f300 6f 6c 30 20 2f 20 63 6f 6c 31 20 2b 20 2d 20 63  ol0 / col1 + - c
1f310 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 28  ol1 * - col0 * (
1f320 20 2b 20 32 35 20 29 20 41 53 20 63 6f 6c 32 20   + 25 ) AS col2 
1f330 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1f340 0a 31 31 35 30 38 34 0d 0a 33 33 37 35 31 0d 0a  .115084..33751..
1f350 35 34 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5431....query I 
1f360 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f370 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e  - col0 * - cor0.
1f380 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col1 * - col2 + 
1f390 2d 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  - ( col1 ) FROM 
1f3a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1f3b0 2d 2d 0d 0a 2d 31 31 39 37 31 31 0d 0a 2d 35 31  --..-119711..-51
1f3c0 30 35 31 0d 0a 2d 35 38 39 30 0d 0a 0d 0a 71 75  051..-5890....qu
1f3d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f3e0 45 4c 45 43 54 20 28 20 63 6f 6c 30 20 29 20 2b  ELECT ( col0 ) +
1f3f0 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f   col1 * col1 FRO
1f400 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1f410 2d 0d 0a 37 34 32 30 0d 0a 38 33 37 30 0d 0a 39  -..7420..8370..9
1f420 34 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  444....query I r
1f430 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1f440 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63   col0 + col2 * c
1f450 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
1f460 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1f470 2d 2d 2d 0d 0a 31 35 32 33 0d 0a 37 33 36 0d 0a  ---..1523..736..
1f480 37 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  754....onlyif my
1f490 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1f4a0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1f4b0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1f4c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1f4d0 65 6c 2d 38 34 31 0d 0a 53 45 4c 45 43 54 20 2d  el-841..SELECT -
1f4e0 20 28 20 2d 20 63 6f 6c 32 20 29 20 44 49 56 20   ( - col2 ) DIV 
1f4f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1f500 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
1f510 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..1....skipif 
1f520 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1f530 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1f540 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34  rowsort label-84
1f550 31 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20  1..SELECT - ( - 
1f560 63 6f 6c 32 20 29 20 2f 20 63 6f 6c 32 20 46 52  col2 ) / col2 FR
1f570 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1f580 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a  .----..1..1..1..
1f590 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f5a0 74 0d 0a 53 45 4c 45 43 54 20 32 36 20 2b 20 63  t..SELECT 26 + c
1f5b0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
1f5c0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1f5d0 2d 2d 2d 0d 0a 34 33 0d 0a 35 37 0d 0a 38 35 0d  ---..43..57..85.
1f5e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f5f0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
1f600 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63  ol2 * col2 + + c
1f610 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
1f620 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 35 0d 0a  r0..----..1175..
1f630 36 38 31 35 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72  6815..98....quer
1f640 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f650 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
1f660 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 28  ol2 + + col1 * (
1f670 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   - col1 ) AS col
1f680 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1f690 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34 32 39  or0..----..-7429
1f6a0 0d 0a 2d 38 33 36 33 0d 0a 2d 39 34 31 30 0d 0a  ..-8363..-9410..
1f6b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f6c0 74 0d 0a 53 45 4c 45 43 54 20 31 32 20 41 53 20  t..SELECT 12 AS 
1f6d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
1f6e0 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61  tab1 AS cor0, ta
1f6f0 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
1f700 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
1f710 69 6e 67 20 74 6f 20 37 30 32 34 37 38 63 35 33  ing to 702478c53
1f720 63 61 66 32 66 37 65 62 62 39 66 66 66 39 36 64  caf2f7ebb9fff96d
1f730 38 30 30 66 35 61 36 0d 0a 0d 0a 71 75 65 72 79  800f5a6....query
1f740 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f750 43 54 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20  CT + ( col2 ) * 
1f760 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  6 AS col2 FROM t
1f770 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 32 34 0d 0a  ab1..----..324..
1f780 33 34 32 0d 0a 35 37 36 0d 0a 0d 0a 6f 6e 6c 79  342..576....only
1f790 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1f7a0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1f7b0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1f7c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f7d0 74 20 6c 61 62 65 6c 2d 38 34 37 0d 0a 53 45 4c  t label-847..SEL
1f7e0 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  ECT - col0 + col
1f7f0 32 20 2d 20 2d 20 43 41 53 54 28 20 63 6f 6c 30  2 - - CAST( col0
1f800 20 41 53 20 53 49 47 4e 45 44 20 29 20 44 49 56   AS SIGNED ) DIV
1f810 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20   col0 col0 FROM 
1f820 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 0d  tab2..----..-40.
1f830 0a 2d 35 31 0d 0a 32 31 0d 0a 0d 0a 73 6b 69 70  .-51..21....skip
1f840 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1f850 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1f860 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1f870 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1f880 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
1f890 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1f8a0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1f8b0 6f 72 74 20 6c 61 62 65 6c 2d 38 34 37 0d 0a 53  ort label-847..S
1f8c0 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63  ELECT - col0 + c
1f8d0 6f 6c 32 20 2d 20 2d 20 43 41 53 54 20 28 20 63  ol2 - - CAST ( c
1f8e0 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
1f8f0 20 2f 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f   / col0 col0 FRO
1f900 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  M tab2..----..-4
1f910 30 0d 0a 2d 35 31 0d 0a 32 31 0d 0a 0d 0a 71 75  0..-51..21....qu
1f920 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f930 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 30 20  ELECT tab1.col0 
1f940 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 37 34 20  * + col2 + + 74 
1f950 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1f960 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 36 0d 0a 33 37  1..----..236..37
1f970 32 32 0d 0a 37 37 35 34 0d 0a 0d 0a 71 75 65 72  22..7754....quer
1f980 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f990 45 43 54 20 31 36 20 41 53 20 63 6f 6c 31 20 46  ECT 16 AS col1 F
1f9a0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 2c 20  ROM tab2, tab1, 
1f9b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1f9c0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
1f9d0 73 68 69 6e 67 20 74 6f 20 65 65 35 62 64 65 39  shing to ee5bde9
1f9e0 66 36 38 65 65 38 32 38 65 38 63 64 38 36 62 30  f68ee828e8cd86b0
1f9f0 64 35 39 30 30 39 30 62 63 0d 0a 0d 0a 71 75 65  d590090bc....que
1fa00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1fa10 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  LECT + - cor0.co
1fa20 6c 31 20 2b 20 36 31 20 2b 20 2d 20 35 38 20 46  l1 + 61 + - 58 F
1fa30 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1fa40 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 33 0d 0a 2d 38 38  ..----..-83..-88
1fa50 0d 0a 2d 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-94....query I
1fa60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fa70 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 28 20   - + col1 * - ( 
1fa80 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20 63 6f  cor0.col1 ) + co
1fa90 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
1faa0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1fab0 2d 2d 0d 0a 33 30 36 0d 0a 33 35 34 30 0d 0a 39  --..306..3540..9
1fac0 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  92....onlyif mys
1fad0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
1fae0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
1faf0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
1fb00 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
1fb10 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1fb20 35 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  52..SELECT col0 
1fb30 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  * CAST( NULL AS 
1fb40 44 45 43 49 4d 41 4c 20 29 20 46 52 4f 4d 20 74  DECIMAL ) FROM t
1fb50 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1fb60 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
1fb70 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
1fb80 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1fb90 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1fba0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35 32 0d  wsort label-852.
1fbb0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 43  .SELECT col0 * C
1fbc0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45  AST ( NULL AS RE
1fbd0 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  AL ) FROM tab0 A
1fbe0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
1fbf0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
1fc00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1fc10 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
1fc20 6f 6c 31 20 2a 20 35 33 20 41 53 20 63 6f 6c 31  ol1 * 53 AS col1
1fc30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
1fc40 0a 2d 2d 2d 2d 0d 0a 31 33 37 38 0d 0a 35 33 30  .----..1378..530
1fc50 0d 0a 36 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..689....query I
1fc60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fc70 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
1fc80 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + + col1 * + co
1fc90 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  l1 * col1 + - co
1fca0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
1fcb0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 33  tab2..----..2053
1fcc0 39 38 0d 0a 32 39 37 36 37 0d 0a 34 39 37 35 0d  98..29767..4975.
1fcd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1fce0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1fcf0 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63  ol2 + + col1 * c
1fd00 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 35 39 20  ol1 * col0 + 59 
1fd10 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  * col1 * - col2 
1fd20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1fd30 0a 31 30 30 39 35 0d 0a 32 39 36 38 33 33 0d 0a  .10095..296833..
1fd40 33 32 33 35 39 33 0d 0a 0d 0a 71 75 65 72 79 20  323593....query 
1fd50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1fd60 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  T + col1 * - col
1fd70 31 20 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  1 - - col1 AS co
1fd80 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
1fd90 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 0d 0a 2d  0..----..-156..-
1fda0 36 35 30 0d 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72  650..-90....quer
1fdb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1fdc0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
1fdd0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d  ol1 * - col1 + -
1fde0 20 39 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72   9 FROM tab2 cor
1fdf0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30 0d 0a 33 34  0..----..280..34
1fe00 37 32 0d 0a 39 35 32 0d 0a 0d 0a 6f 6e 6c 79 69  72..952....onlyi
1fe10 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1fe20 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1fe30 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1fe40 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1fe50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1fe60 62 65 6c 2d 38 35 38 0d 0a 53 45 4c 45 43 54 20  bel-858..SELECT 
1fe70 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2d 20 2d  ALL + + col0 - -
1fe80 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
1fe90 49 47 4e 45 44 20 29 20 63 6f 6c 31 20 46 52 4f  IGNED ) col1 FRO
1fea0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1feb0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
1fec0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
1fed0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1fee0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1fef0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1ff00 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1ff10 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
1ff20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1ff30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ff40 74 20 6c 61 62 65 6c 2d 38 35 38 0d 0a 53 45 4c  t label-858..SEL
1ff50 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30  ECT ALL + + col0
1ff60 20 2d 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   - - CAST ( NULL
1ff70 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 63 6f   AS INTEGER ) co
1ff80 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
1ff90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
1ffa0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
1ffb0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1ffc0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1ffd0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1ffe0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1fff0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
20000 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20010 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 38 37 20 63   + - col2 + 87 c
20020 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
20030 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d   cor0..----..49.
20040 0a 36 30 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72 79  .60..61....query
20050 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20060 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
20070 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63  col1 * col1 AS c
20080 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
20090 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30   cor0..----..100
200a0 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 6f 6e  ..169..676....on
200b0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
200c0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
200d0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
200e0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
200f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20100 20 6c 61 62 65 6c 2d 38 36 31 0d 0a 53 45 4c 45   label-861..SELE
20110 43 54 20 63 6f 6c 32 20 2f 20 43 41 53 54 28 20  CT col2 / CAST( 
20120 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
20130 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
20140 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  1 cor0..----..NU
20150 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
20160 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
20170 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
20180 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20190 20 6c 61 62 65 6c 2d 38 36 31 0d 0a 53 45 4c 45   label-861..SELE
201a0 43 54 20 63 6f 6c 32 20 2f 20 43 41 53 54 20 28  CT col2 / CAST (
201b0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
201c0 20 29 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) - col2 FROM t
201d0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
201e0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
201f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20200 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
20210 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 30 20 2a 20  col1 ) + col0 * 
20220 2d 20 28 20 35 30 20 29 20 46 52 4f 4d 20 74 61  - ( 50 ) FROM ta
20230 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
20240 0d 0a 2d 31 32 34 0d 0a 2d 33 31 39 30 0d 0a 2d  ..-124..-3190..-
20250 33 39 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3987....query I 
20260 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20270 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  ALL cor0.col1 * 
20280 2b 20 63 6f 72 31 2e 63 6f 6c 32 20 41 53 20 63  + cor1.col2 AS c
20290 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
202a0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
202b0 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
202c0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
202d0 73 68 69 6e 67 20 74 6f 20 65 38 63 63 63 66 62  shing to e8cccfb
202e0 61 66 35 31 34 63 64 65 33 36 30 32 32 64 32 32  af514cde36022d22
202f0 37 37 32 35 37 31 33 65 36 0d 0a 0d 0a 71 75 65  7725713e6....que
20300 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20310 4c 45 43 54 20 2b 20 33 20 2a 20 2d 20 63 6f 6c  LECT + 3 * - col
20320 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
20330 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 0d  or0..----..-114.
20340 0a 2d 37 38 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65  .-78..-81....que
20350 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20360 4c 45 43 54 20 2d 20 2d 20 28 20 2b 20 35 35 20  LECT - - ( + 55 
20370 29 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ) * + col0 AS co
20380 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
20390 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d  cor0..----..165.
203a0 0a 33 35 32 30 0d 0a 34 34 30 30 0d 0a 0d 0a 71  .3520..4400....q
203b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
203c0 53 45 4c 45 43 54 20 32 20 41 53 20 63 6f 6c 30  SELECT 2 AS col0
203d0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
203e0 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 32 0d 0a 32 0d 0a  .----..2..2..2..
203f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20400 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
20410 20 34 34 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f   44 * col2 AS co
20420 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
20430 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33 30  cor0..----..2430
20440 0d 0a 32 35 36 35 0d 0a 34 33 32 30 0d 0a 0d 0a  ..2565..4320....
20450 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20460 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 31 20 2a  .SELECT ALL 61 *
20470 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
20480 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
20490 0a 2d 33 32 39 34 0d 0a 2d 33 34 37 37 0d 0a 2d  .-3294..-3477..-
204a0 35 38 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5856....query I 
204b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
204c0 41 4c 4c 20 2d 20 32 39 20 2b 20 2b 20 63 6f 6c  ALL - 29 + + col
204d0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
204e0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
204f0 2d 32 32 0d 0a 34 39 0d 0a 35 30 0d 0a 0d 0a 71  -22..49..50....q
20500 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20510 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
20520 2b 20 32 39 20 2d 20 2d 20 63 6f 6c 30 20 46 52  + 29 - - col0 FR
20530 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
20540 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 35 33 0d 0a  .----..118..53..
20550 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
20560 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
20570 4c 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  L - col1 * col2 
20580 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  * - col1 + col0 
20590 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
205a0 0a 31 36 33 30 34 0d 0a 33 36 35 30 37 0d 0a 35  .16304..36507..5
205b0 37 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  764....query III
205c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
205d0 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45   * FROM tab1 WHE
205e0 52 45 20 2b 20 63 6f 6c 32 20 3e 20 4e 55 4c 4c  RE + col2 > NULL
205f0 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
20600 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
20610 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  ECT * FROM tab0 
20620 57 48 45 52 45 20 4e 4f 54 20 2d 20 63 6f 6c 31  WHERE NOT - col1
20630 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   * - col2 + + co
20640 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 3e 20 2d 20  l1 * - col1 > - 
20650 63 6f 6c 32 20 2a 20 63 6f 6c 30 0d 0a 2d 2d 2d  col2 * col0..---
20660 2d 0d 0a 32 34 0d 0a 38 36 0d 0a 33 33 0d 0a 33  -..24..86..33..3
20670 35 0d 0a 39 37 0d 0a 31 0d 0a 0d 0a 71 75 65 72  5..97..1....quer
20680 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20690 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74  ECT DISTINCT - t
206a0 61 62 32 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ab2.col2 * - col
206b0 32 20 2a 20 74 61 62 32 2e 63 6f 6c 30 20 41 53  2 * tab2.col0 AS
206c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
206d0 0a 2d 2d 2d 2d 0d 0a 31 31 34 30 37 36 0d 0a 35  .----..114076..5
206e0 31 30 33 0d 0a 35 32 37 32 38 0d 0a 0d 0a 71 75  103..52728....qu
206f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20700 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63  ELECT col2 * + c
20710 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63  ol2 + - col1 + c
20720 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
20730 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39 0d 0a 36 37  ---..1..1089..67
20740 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  24....query I ro
20750 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
20760 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20  STINCT col0 * - 
20770 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 57  col0 FROM tab0 W
20780 48 45 52 45 20 63 6f 6c 32 20 3c 3e 20 4e 55 4c  HERE col2 <> NUL
20790 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69  L..----....onlyi
207a0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
207b0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
207c0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
207d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
207e0 20 6c 61 62 65 6c 2d 38 37 37 0d 0a 53 45 4c 45   label-877..SELE
207f0 43 54 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32  CT col1 - - col2
20800 20 44 49 56 20 74 61 62 32 2e 63 6f 6c 30 20 46   DIV tab2.col0 F
20810 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
20820 31 37 0d 0a 33 34 0d 0a 35 39 0d 0a 0d 0a 73 6b  17..34..59....sk
20830 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
20840 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
20850 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
20860 65 6c 2d 38 37 37 0d 0a 53 45 4c 45 43 54 20 63  el-877..SELECT c
20870 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 2f 20 74  ol1 - - col2 / t
20880 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab2.col0 FROM ta
20890 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 34  b2..----..17..34
208a0 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..59....query I 
208b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
208c0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2d 20  + col1 * col0 - 
208d0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
208e0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  M tab0..----..20
208f0 33 31 0d 0a 33 33 39 34 0d 0a 38 30 31 37 0d 0a  31..3394..8017..
20900 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20910 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
20920 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 57  col2 FROM tab0 W
20930 48 45 52 45 20 4e 55 4c 4c 20 42 45 54 57 45 45  HERE NULL BETWEE
20940 4e 20 4e 55 4c 4c 20 41 4e 44 20 28 20 4e 55 4c  N NULL AND ( NUL
20950 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69  L )..----....ski
20960 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
20970 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
20980 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
20990 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
209a0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
209b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
209c0 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  l1 * col0 + col1
209d0 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20 46   * - col2 col2 F
209e0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
209f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 30 0d 0a 33 30  ..----..-620..30
20a00 36 38 0d 0a 36 39 37 0d 0a 0d 0a 71 75 65 72 79  68..697....query
20a10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20a20 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
20a30 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 34 32 20 41  l1 + col0 * 42 A
20a40 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
20a50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20a60 31 30 30 0d 0a 32 36 37 38 0d 0a 33 33 34 37 0d  100..2678..3347.
20a70 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
20a80 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
20a90 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
20aa0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
20ab0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
20ac0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20ad0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b  ECT ALL + col2 +
20ae0 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f   - col0 col1 FRO
20af0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
20b00 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d 0a 39  ----..-34..-7..9
20b10 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
20b20 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
20b30 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
20b40 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
20b50 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
20b60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20b70 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  LECT - cor0.col0
20b80 20 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46   + - col1 col1 F
20b90 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
20ba0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 31  ..----..-110..-1
20bb0 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 71 75 65 72  32..-180....quer
20bc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20bd0 45 43 54 20 41 4c 4c 20 2b 20 32 37 20 2b 20 63  ECT ALL + 27 + c
20be0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
20bf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37   cor0..----..107
20c00 0d 0a 33 30 0d 0a 39 31 0d 0a 0d 0a 71 75 65 72  ..30..91....quer
20c10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20c20 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33  ECT DISTINCT + 3
20c30 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  0 * cor0.col1 AS
20c40 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
20c50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
20c60 35 38 30 0d 0a 32 37 33 30 0d 0a 32 39 31 30 0d  580..2730..2910.
20c70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20c80 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
20c90 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63   col0 + col2 * c
20ca0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
20cb0 2d 2d 2d 0d 0a 32 38 31 34 0d 0a 36 32 0d 0a 37  ---..2814..62..7
20cc0 33 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  373....query I r
20cd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
20ce0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d  ol0 * + col2 + -
20cf0 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f   col1 * col2 FRO
20d00 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54  M tab0 WHERE NOT
20d10 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28 20 2d   NULL NOT IN ( -
20d20 20 63 6f 6c 31 20 2b 20 74 61 62 30 2e 63 6f 6c   col1 + tab0.col
20d30 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  1 )..----....que
20d40 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
20d50 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
20d60 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52  * FROM tab1 WHER
20d70 45 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  E + col0 * + col
20d80 31 20 2b 20 2d 20 63 6f 6c 31 20 4e 4f 54 20 49  1 + - col1 NOT I
20d90 4e 20 28 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  N ( col0 / - col
20da0 31 20 2d 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d  1 - col1 )..----
20db0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
20dc0 6e 67 20 74 6f 20 38 64 36 36 39 32 65 36 64 34  ng to 8d6692e6d4
20dd0 31 35 30 35 63 33 61 64 34 32 64 39 31 39 62 64  1505c3ad42d919bd
20de0 39 65 63 64 30 64 0d 0a 0d 0a 71 75 65 72 79 20  9ecd0d....query 
20df0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
20e00 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
20e10 31 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  1 - + col1 * col
20e20 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
20e30 2d 0d 0a 2d 31 32 33 35 0d 0a 2d 31 33 37 38 0d  -..-1235..-1378.
20e40 0a 2d 35 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-560....onlyif 
20e50 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
20e60 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
20e70 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
20e80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
20e90 61 62 65 6c 2d 38 39 30 0d 0a 53 45 4c 45 43 54  abel-890..SELECT
20ea0 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 44 49 56   - tab1.col0 DIV
20eb0 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2d   col0 + col0 * -
20ec0 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 41   col0 + + col0 A
20ed0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
20ee0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 33 33 0d 0a 2d  ..----..-4033..-
20ef0 36 33 32 31 0d 0a 2d 37 0d 0a 0d 0a 73 6b 69 70  6321..-7....skip
20f00 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
20f10 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
20f20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
20f30 2d 38 39 30 0d 0a 53 45 4c 45 43 54 20 2d 20 74  -890..SELECT - t
20f40 61 62 31 2e 63 6f 6c 30 20 2f 20 63 6f 6c 30 20  ab1.col0 / col0 
20f50 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  + col0 * - col0 
20f60 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  + + col0 AS col2
20f70 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
20f80 0d 0a 2d 34 30 33 33 0d 0a 2d 36 33 32 31 0d 0a  ..-4033..-6321..
20f90 2d 37 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  -7....query III 
20fa0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20fb0 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31 20  ALL * FROM tab1 
20fc0 57 48 45 52 45 20 4e 55 4c 4c 20 42 45 54 57 45  WHERE NULL BETWE
20fd0 45 4e 20 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  EN ( col2 * col2
20fe0 20 29 20 41 4e 44 20 28 20 4e 55 4c 4c 20 29 0d   ) AND ( NULL ).
20ff0 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
21000 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21010 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2a 20   ALL - - col1 * 
21020 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  - cor0.col0 AS c
21030 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
21040 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d  r0..----..-2064.
21050 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d  .-3395..-8099...
21060 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21070 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
21080 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53  - col0 * col0 AS
21090 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
210a0 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 36 30 35  .----..-22..-605
210b0 38 0d 0a 2d 36 32 30 33 0d 0a 0d 0a 71 75 65 72  8..-6203....quer
210c0 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
210d0 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
210e0 31 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20  1 AS cor0 WHERE 
210f0 28 20 4e 55 4c 4c 20 29 20 42 45 54 57 45 45 4e  ( NULL ) BETWEEN
21100 20 4e 55 4c 4c 20 41 4e 44 20 28 20 4e 55 4c 4c   NULL AND ( NULL
21110 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72   )..----....quer
21120 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21130 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ECT col2 * - col
21140 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  1 * col0 + col2 
21150 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
21160 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21170 2d 33 34 39 31 0d 0a 2d 36 36 34 31 32 37 0d 0a  -3491..-664127..
21180 2d 36 38 31 36 35 0d 0a 0d 0a 71 75 65 72 79 20  -68165....query 
21190 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
211a0 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  T - cor0.col2 + 
211b0 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30 20 46 52  col1 - + col0 FR
211c0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
211d0 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 33 0d 0a 2d 34  --..-100..-3..-4
211e0 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
211f0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
21200 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
21210 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
21220 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
21230 2d 38 39 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  -897..SELECT DIS
21240 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b  TINCT + col2 * +
21250 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 30   col0 DIV - col0
21260 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
21270 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
21280 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 73  1..-33..-82....s
21290 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
212a0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
212b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
212c0 62 65 6c 2d 38 39 37 0d 0a 53 45 4c 45 43 54 20  bel-897..SELECT 
212d0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
212e0 2a 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  * + col0 / - col
212f0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
21300 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
21310 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a  -1..-33..-82....
21320 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
21330 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
21340 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
21350 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
21360 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 38 0d  wsort label-898.
21370 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b  .SELECT col2 * +
21380 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 44   col1 + - col0 D
21390 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20  IV cor0.col1 AS 
213a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
213b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
213c0 34 32 0d 0a 31 34 30 34 0d 0a 35 36 34 0d 0a 0d  42..1404..564...
213d0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
213e0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
213f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
21400 6c 61 62 65 6c 2d 38 39 38 0d 0a 53 45 4c 45 43  label-898..SELEC
21410 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  T col2 * + col1 
21420 2b 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 72 30 2e  + - col0 / cor0.
21430 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
21440 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
21450 2d 2d 2d 2d 0d 0a 31 32 34 32 0d 0a 31 34 30 34  ----..1242..1404
21460 0d 0a 35 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..564....query I
21470 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
21480 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 41  CT * FROM tab1 A
21490 53 20 63 6f 72 30 20 57 48 45 52 45 20 4e 4f 54  S cor0 WHERE NOT
214a0 20 28 20 4e 55 4c 4c 20 29 20 3e 20 63 6f 6c 30   ( NULL ) > col0
214b0 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
214c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
214d0 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20 63  T ALL col2 * - c
214e0 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol0 * - col0 AS 
214f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
21500 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 31 39 30 30  ----..1225..1900
21510 38 0d 0a 36 34 39 35 32 32 0d 0a 0d 0a 71 75 65  8..649522....que
21520 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21530 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  LECT + col2 * co
21540 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l1 + - cor0.col2
21550 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
21560 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30 35 0d 0a  r0..----..2805..
21570 37 33 38 30 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70  7380..96....skip
21580 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
21590 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
215a0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
215b0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
215c0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
215d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
215e0 30 2e 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  0.col1 col0 FROM
215f0 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
21600 6f 72 30 20 57 48 45 52 45 20 28 20 4e 55 4c 4c  or0 WHERE ( NULL
21610 20 29 20 42 45 54 57 45 45 4e 20 63 6f 72 30 2e   ) BETWEEN cor0.
21620 63 6f 6c 32 20 41 4e 44 20 28 20 4e 55 4c 4c 20  col2 AND ( NULL 
21630 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
21640 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
21650 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f  CT ALL + cor0.co
21660 6c 30 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l0 + col1 + + co
21670 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
21680 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
21690 2d 2d 0d 0a 31 33 31 0d 0a 31 38 39 0d 0a 38 33  --..131..189..83
216a0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
216b0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
216c0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
216d0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
216e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
216f0 39 30 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  904..SELECT - co
21700 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  l2 * + col0 + - 
21710 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 41 53  col1 DIV col2 AS
21720 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
21730 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 37 32  .----..-132..-72
21740 39 39 0d 0a 2d 37 39 34 0d 0a 0d 0a 73 6b 69 70  99..-794....skip
21750 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
21760 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
21770 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
21780 2d 39 30 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -904..SELECT - c
21790 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d  ol2 * + col0 + -
217a0 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 41 53 20   col1 / col2 AS 
217b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
217c0 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 37 32 39  ----..-132..-729
217d0 39 0d 0a 2d 37 39 34 0d 0a 0d 0a 71 75 65 72 79  9..-794....query
217e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
217f0 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  CT + col1 * col0
21800 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   + + col0 * + co
21810 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
21820 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 30  tab1..----..1280
21830 0d 0a 31 35 36 0d 0a 32 30 38 30 0d 0a 0d 0a 71  ..156..2080....q
21840 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
21850 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
21860 74 61 62 30 20 57 48 45 52 45 20 28 20 4e 55 4c  tab0 WHERE ( NUL
21870 4c 20 29 20 4e 4f 54 20 49 4e 20 28 20 74 61 62  L ) NOT IN ( tab
21880 30 2e 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a  0.col2 )..----..
21890 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
218a0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
218b0 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31   - col0 + + col1
218c0 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2d   * col1 * col0 -
218d0 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
218e0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
218f0 0a 31 39 38 31 32 0d 0a 32 36 39 34 33 31 0d 0a  .19812..269431..
21900 36 35 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6507....query I 
21910 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21920 41 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  ALL col2 * col2 
21930 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
21940 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
21950 31 31 34 30 37 36 0d 0a 35 31 30 33 0d 0a 35 32  114076..5103..52
21960 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  728....query I r
21970 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
21980 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
21990 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
219a0 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f  OM tab2 WHERE NO
219b0 54 20 4e 55 4c 4c 20 42 45 54 57 45 45 4e 20 4e  T NULL BETWEEN N
219c0 55 4c 4c 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d  ULL AND NULL..--
219d0 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
219e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
219f0 4c 20 63 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f  L col0 * tab0.co
21a00 6c 30 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  l0 + col0 + - co
21a10 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 * col1 FROM t
21a20 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 31 0d  ab0..----..-271.
21a30 0a 2d 36 37 39 36 0d 0a 2d 38 31 34 39 0d 0a 0d  .-6796..-8149...
21a40 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
21a50 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a  rt..SELECT ALL *
21a60 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45   FROM tab0 WHERE
21a70 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28 20 63   NULL NOT IN ( c
21a80 6f 6c 31 20 2f 20 63 6f 6c 31 20 29 0d 0a 2d 2d  ol1 / col1 )..--
21a90 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
21aa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
21ab0 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 41 53 20 63  col2 / col2 AS c
21ac0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 57 48  ol0 FROM tab2 WH
21ad0 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 49 4e 20  ERE NOT NULL IN 
21ae0 28 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62  ( + col0 * + tab
21af0 32 2e 63 6f 6c 32 20 2b 20 74 61 62 32 2e 63 6f  2.col2 + tab2.co
21b00 6c 32 20 2f 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d  l2 / col1 )..---
21b10 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  -....onlyif mysq
21b20 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
21b30 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
21b40 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
21b50 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
21b60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31  rowsort label-91
21b70 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41  3..SELECT ALL CA
21b80 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
21b90 45 44 20 29 20 2a 20 63 6f 6c 30 20 2b 20 2d 20  ED ) * col0 + - 
21ba0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col2 * - col1 FR
21bb0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
21bc0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
21bd0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
21be0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
21bf0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
21c00 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
21c10 39 31 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  913..SELECT ALL 
21c20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
21c30 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30 20  NTEGER ) * col0 
21c40 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + - col2 * - col
21c50 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
21c60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
21c70 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
21c80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21c90 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 28  SELECT ALL - - (
21ca0 20 2b 20 30 20 29 20 2b 20 2b 20 63 6f 6c 30 20   + 0 ) + + col0 
21cb0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
21cc0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a  0..----..7..78..
21cd0 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
21ce0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
21cf0 63 6f 6c 31 20 2a 20 2b 20 28 20 2b 20 63 6f 72  col1 * + ( + cor
21d00 30 2e 63 6f 6c 32 20 29 20 2a 20 28 20 63 6f 6c  0.col2 ) * ( col
21d10 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  0 ) FROM tab2 AS
21d20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
21d30 39 36 35 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35  9652..-51034..-5
21d40 38 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  859....query I r
21d50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
21d60 49 53 54 49 4e 43 54 20 2d 20 2d 20 38 30 20 41  ISTINCT - - 80 A
21d70 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
21d80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21d90 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
21da0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
21db0 2b 20 31 34 20 2b 20 2b 20 35 36 20 46 52 4f 4d  + 14 + + 56 FROM
21dc0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
21dd0 2d 2d 2d 0d 0a 34 32 0d 0a 34 32 0d 0a 34 32 0d  ---..42..42..42.
21de0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21df0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63  rt..SELECT - ( c
21e00 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c 30 20 46  ol0 ) + + col0 F
21e10 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
21e20 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
21e30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21e40 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b  rt..SELECT + ( +
21e50 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20 2a   col2 ) * col2 *
21e60 20 2b 20 28 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   + ( col2 * + co
21e70 6c 30 20 29 20 2b 20 2b 20 63 6f 6c 32 20 41 53  l0 ) + + col2 AS
21e80 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
21e90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 30  cor0..----..1370
21ea0 39 35 34 0d 0a 31 33 37 38 30 38 0d 0a 34 33 33  954..137808..433
21eb0 34 39 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4926....query I 
21ec0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21ed0 44 49 53 54 49 4e 43 54 20 2b 20 36 37 20 2b 20  DISTINCT + 67 + 
21ee0 2b 20 36 37 20 2a 20 2d 20 63 6f 6c 30 20 46 52  + 67 * - col0 FR
21ef0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
21f00 0a 2d 2d 2d 2d 0d 0a 2d 31 35 34 31 0d 0a 2d 32  .----..-1541..-2
21f10 32 37 38 0d 0a 2d 35 38 39 36 0d 0a 0d 0a 71 75  278..-5896....qu
21f20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21f30 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
21f40 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2d   col1 * + col2 -
21f50 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46   col0 * + col2 F
21f60 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
21f70 2d 31 33 32 0d 0a 2d 31 34 37 36 30 0d 0a 2d 33  -132..-14760..-3
21f80 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  630....query I r
21f90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
21fa0 20 63 6f 6c 31 20 2b 20 2b 20 39 20 41 53 20 63   col1 + + 9 AS c
21fb0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
21fc0 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 30 36 0d 0a 39  ---..100..106..9
21fd0 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
21fe0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
21ff0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
22000 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
22010 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
22020 2d 39 32 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -923..SELECT DIS
22030 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63  TINCT col1 + - c
22040 6f 6c 32 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c  ol2 + - tab1.col
22050 32 20 44 49 56 20 28 20 63 6f 6c 30 20 29 20 46  2 DIV ( col0 ) F
22060 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
22070 2d 34 36 0d 0a 2d 34 37 0d 0a 2d 38 34 0d 0a 0d  -46..-47..-84...
22080 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
22090 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
220a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
220b0 6c 61 62 65 6c 2d 39 32 33 0d 0a 53 45 4c 45 43  label-923..SELEC
220c0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
220d0 2b 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 74 61 62  + - col2 + - tab
220e0 31 2e 63 6f 6c 32 20 2f 20 28 20 63 6f 6c 30 20  1.col2 / ( col0 
220f0 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
22100 2d 0d 0a 2d 34 36 0d 0a 2d 34 37 0d 0a 2d 38 34  -..-46..-47..-84
22110 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22120 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 34 20 2d  ort..SELECT 24 -
22130 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
22140 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 36  0..----..-11..-6
22150 35 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5..0....query I 
22160 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22170 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
22180 2a 20 35 32 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  * 52 + + col2 + 
22190 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
221a0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
221b0 31 36 30 38 0d 0a 33 30 33 35 0d 0a 39 30 35 0d  1608..3035..905.
221c0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
221d0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
221e0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
221f0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
22200 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
22210 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22220 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b  ECT ALL - col2 +
22230 20 34 34 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d   44 + - col2 * -
22240 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 63   col2 * - col2 c
22250 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
22260 2d 2d 2d 0d 0a 2d 31 35 37 34 37 34 0d 0a 2d 31  ---..-157474..-1
22270 38 35 32 30 36 0d 0a 2d 38 38 34 37 38 38 0d 0a  85206..-884788..
22280 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22290 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 39 20 2b  t..SELECT + 19 +
222a0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
222b0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
222c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 34  0..----..-12..-4
222d0 30 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..2....query I 
222e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
222f0 34 39 20 2b 20 33 37 20 46 52 4f 4d 20 74 61 62  49 + 37 FROM tab
22300 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
22310 0a 38 36 0d 0a 38 36 0d 0a 38 36 0d 0a 0d 0a 71  .86..86..86....q
22320 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22330 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 34  SELECT ALL + + 4
22340 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  0 * + col2 AS co
22350 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
22360 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 30  cor0..----..2160
22370 0d 0a 32 32 38 30 0d 0a 33 38 34 30 0d 0a 0d 0a  ..2280..3840....
22380 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22390 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32 35  .SELECT ALL - 25
223a0 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   * + col2 * + co
223b0 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
223c0 2d 2d 0d 0a 2d 34 37 32 35 0d 0a 2d 35 30 37 30  --..-4725..-5070
223d0 30 0d 0a 2d 37 35 30 35 30 0d 0a 0d 0a 6f 6e 6c  0..-75050....onl
223e0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
223f0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
22400 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
22410 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
22420 72 74 20 6c 61 62 65 6c 2d 39 33 31 0d 0a 53 45  rt label-931..SE
22430 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
22440 63 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f  col2 DIV cor0.co
22450 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l0 + - cor0.col1
22460 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   * col2 AS col1 
22470 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
22480 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a  0..----..-1534..
22490 2d 36 34 36 0d 0a 2d 38 33 34 0d 0a 0d 0a 73 6b  -646..-834....sk
224a0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
224b0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
224c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
224d0 65 6c 2d 39 33 31 0d 0a 53 45 4c 45 43 54 20 44  el-931..SELECT D
224e0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2f  ISTINCT + col2 /
224f0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
22500 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  or0.col1 * col2 
22510 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
22520 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
22530 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38  .-1534..-646..-8
22540 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
22550 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
22560 4c 20 2d 20 28 20 2b 20 63 6f 6c 31 20 2b 20 2d  L - ( + col1 + -
22570 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20   col0 ) AS col1 
22580 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
22590 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a 0d 0a  .-24..19..62....
225a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
225b0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
225c0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
225d0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
225e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33 33 0d  wsort label-933.
225f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
22600 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 44   col2 + + col0 D
22610 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  IV col0 AS col0 
22620 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
22630 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d  0..----..55..58.
22640 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .97....skipif my
22650 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
22660 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
22670 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33 33 0d  wsort label-933.
22680 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
22690 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2f   col2 + + col0 /
226a0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
226b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
226c0 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39  .----..55..58..9
226d0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
226e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
226f0 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 32 37 20  ol2 + col1 * 27 
22700 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
22710 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  2 cor0..----..16
22720 31 39 0d 0a 34 39 37 0d 0a 38 36 34 0d 0a 0d 0a  19..497..864....
22730 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
22740 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
22750 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
22760 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
22770 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
22780 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22790 20 41 4c 4c 20 34 39 20 63 6f 6c 30 20 46 52 4f   ALL 49 col0 FRO
227a0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39  M tab0..----..49
227b0 0d 0a 34 39 0d 0a 34 39 0d 0a 0d 0a 71 75 65 72  ..49..49....quer
227c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
227d0 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ECT col2 * - col
227e0 30 20 2b 20 2d 20 36 39 20 41 53 20 63 6f 6c 32  0 + - 69 AS col2
227f0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
22800 0d 0a 2d 32 33 31 0d 0a 2d 33 37 31 37 0d 0a 2d  ..-231..-3717..-
22810 37 37 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7749....query I 
22820 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22830 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
22840 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
22850 74 61 62 32 2c 20 74 61 62 30 2c 20 74 61 62 30  tab2, tab0, tab0
22860 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22870 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75  24..35..89....qu
22880 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22890 45 4c 45 43 54 20 31 36 20 2a 20 2b 20 63 6f 6c  ELECT 16 * + col
228a0 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 + col0 FROM ta
228b0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 32 34 0d 0a 32  b1..----..224..2
228c0 38 38 0d 0a 34 31 39 0d 0a 0d 0a 71 75 65 72 79  88..419....query
228d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
228e0 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20  CT ALL - + col2 
228f0 2b 20 2d 20 35 32 20 46 52 4f 4d 20 74 61 62 32  + - 52 FROM tab2
22900 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22910 2d 37 38 0d 0a 2d 37 39 0d 0a 2d 39 30 0d 0a 0d  -78..-79..-90...
22920 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
22930 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
22940 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
22950 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
22960 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
22970 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22980 54 20 63 6f 6c 30 20 2a 20 2b 20 28 20 2b 20 28  T col0 * + ( + (
22990 20 2b 20 63 6f 6c 31 20 29 20 29 20 2b 20 2d 20   + col1 ) ) + - 
229a0 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46  cor0.col2 col1 F
229b0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
229c0 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 35 38 33 0d  ..----..24..583.
229d0 0a 39 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .944....onlyif m
229e0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
229f0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
22a00 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
22a10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22a20 62 65 6c 2d 39 34 31 0d 0a 53 45 4c 45 43 54 20  bel-941..SELECT 
22a30 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
22a40 30 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  0 * - col2 * col
22a50 31 20 2b 20 63 6f 6c 31 20 2b 20 43 41 53 54 28  1 + col1 + CAST(
22a60 20 2d 20 32 35 20 2b 20 2d 20 63 6f 6c 30 20 41   - 25 + - col0 A
22a70 53 20 53 49 47 4e 45 44 20 29 20 44 49 56 20 2b  S SIGNED ) DIV +
22a80 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
22a90 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
22aa0 0a 2d 2d 2d 2d 0d 0a 31 31 39 37 31 30 0d 0a 35  .----..119710..5
22ab0 31 30 35 30 0d 0a 35 38 38 36 0d 0a 0d 0a 73 6b  1050..5886....sk
22ac0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
22ad0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
22ae0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
22af0 65 6c 2d 39 34 31 0d 0a 53 45 4c 45 43 54 20 44  el-941..SELECT D
22b00 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30  ISTINCT + - col0
22b10 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   * - col2 * col1
22b20 20 2b 20 63 6f 6c 31 20 2b 20 43 41 53 54 20 28   + col1 + CAST (
22b30 20 2d 20 32 35 20 2b 20 2d 20 63 6f 6c 30 20 41   - 25 + - col0 A
22b40 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2b 20  S INTEGER ) / + 
22b50 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
22b60 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
22b70 2d 2d 2d 2d 0d 0a 31 31 39 37 31 30 0d 0a 35 31  ----..119710..51
22b80 30 35 30 0d 0a 35 38 38 36 0d 0a 0d 0a 6f 6e 6c  050..5886....onl
22b90 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
22ba0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
22bb0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
22bc0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
22bd0 72 74 20 6c 61 62 65 6c 2d 39 34 32 0d 0a 53 45  rt label-942..SE
22be0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
22bf0 2a 20 63 6f 6c 31 20 44 49 56 20 31 34 20 2b 20  * col1 DIV 14 + 
22c00 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31 20 41 53  col2 - - col1 AS
22c10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
22c20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
22c30 32 0d 0a 33 35 0d 0a 37 35 0d 0a 0d 0a 73 6b 69  2..35..75....ski
22c40 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
22c50 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
22c60 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
22c70 6c 2d 39 34 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-942..SELECT AL
22c80 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  L - col0 * col1 
22c90 2f 20 31 34 20 2b 20 63 6f 6c 32 20 2d 20 2d 20  / 14 + col2 - - 
22ca0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
22cb0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
22cc0 2d 2d 2d 2d 0d 0a 32 32 0d 0a 33 35 0d 0a 37 35  ----..22..35..75
22cd0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
22ce0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
22cf0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
22d00 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
22d10 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
22d20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22d30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
22d40 6c 31 20 2a 20 2d 20 35 36 20 63 6f 6c 30 20 46  l1 * - 56 col0 F
22d50 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
22d60 2d 2d 2d 0d 0a 2d 31 34 35 36 0d 0a 2d 35 36 30  ---..-1456..-560
22d70 0d 0a 2d 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20  ..-728....query 
22d80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22d90 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
22da0 30 20 2a 20 2d 20 36 33 20 41 53 20 63 6f 6c 31  0 * - 63 AS col1
22db0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
22dc0 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 34 30  .----..-189..-40
22dd0 33 32 0d 0a 2d 35 30 34 30 0d 0a 0d 0a 71 75 65  32..-5040....que
22de0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22df0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
22e00 63 6f 6c 31 20 2a 20 2b 20 34 20 41 53 20 63 6f  col1 * + 4 AS co
22e10 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
22e20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 0d  cor0..----..124.
22e30 0a 32 33 36 0d 0a 36 38 0d 0a 0d 0a 71 75 65 72  .236..68....quer
22e40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22e50 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d  ECT ALL col2 + -
22e60 20 35 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f   50 * col2 AS co
22e70 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
22e80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37  cor0..----..-127
22e90 34 0d 0a 2d 31 33 32 33 0d 0a 2d 31 38 36 32 0d  4..-1323..-1862.
22ea0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22eb0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
22ec0 30 20 2b 20 2b 20 39 32 20 2a 20 37 36 20 46 52  0 + + 92 * 76 FR
22ed0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
22ee0 0a 2d 2d 2d 2d 0d 0a 36 39 39 35 0d 0a 37 30 35  .----..6995..705
22ef0 36 0d 0a 37 30 37 32 0d 0a 0d 0a 6f 6e 6c 79 69  6..7072....onlyi
22f00 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
22f10 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
22f20 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
22f30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22f40 20 6c 61 62 65 6c 2d 39 34 38 0d 0a 53 45 4c 45   label-948..SELE
22f50 43 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20  CT - col0 DIV + 
22f60 31 34 20 2d 20 2b 20 63 6f 6c 30 20 44 49 56 20  14 - + col0 DIV 
22f70 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
22f80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
22f90 0d 0a 2d 33 0d 0a 2d 37 0d 0a 0d 0a 73 6b 69 70  ..-3..-7....skip
22fa0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
22fb0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
22fc0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
22fd0 2d 39 34 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -948..SELECT - c
22fe0 6f 6c 30 20 2f 20 2b 20 31 34 20 2d 20 2b 20 63  ol0 / + 14 - + c
22ff0 6f 6c 30 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 / col0 FROM 
23000 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
23010 2d 2d 0d 0a 2d 32 0d 0a 2d 33 0d 0a 2d 37 0d 0a  --..-2..-3..-7..
23020 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
23030 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
23040 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
23050 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
23060 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34  rowsort label-94
23070 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
23080 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 28 20  CT - col1 + - ( 
23090 2b 20 28 20 63 6f 6c 30 20 29 20 29 20 44 49 56  + ( col0 ) ) DIV
230a0 20 2d 20 31 20 46 52 4f 4d 20 74 61 62 31 20 41   - 1 FROM tab1 A
230b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
230c0 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 73 6b 69  3..54..67....ski
230d0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
230e0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
230f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
23100 6c 2d 39 34 39 0d 0a 53 45 4c 45 43 54 20 44 49  l-949..SELECT DI
23110 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
23120 2d 20 28 20 2b 20 28 20 63 6f 6c 30 20 29 20 29  - ( + ( col0 ) )
23130 20 2f 20 2d 20 31 20 46 52 4f 4d 20 74 61 62 31   / - 1 FROM tab1
23140 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23150 2d 32 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 71  -23..54..67....q
23160 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23170 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
23180 63 6f 6c 32 20 2b 20 2b 20 37 37 20 46 52 4f 4d  col2 + + 77 FROM
23190 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
231a0 0d 0a 31 30 33 0d 0a 31 30 34 0d 0a 31 31 35 0d  ..103..104..115.
231b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
231c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
231d0 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b  NCT + + col0 * +
231e0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63   cor0.col0 + + c
231f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
23200 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d   cor0..----..35.
23210 0a 34 31 30 36 0d 0a 36 34 31 33 0d 0a 0d 0a 71  .4106..6413....q
23220 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23230 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
23240 6f 6c 32 20 2a 20 35 34 20 2b 20 63 6f 6c 30 20  ol2 * 54 + col0 
23250 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
23260 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
23270 0a 2d 31 33 32 36 0d 0a 2d 31 34 35 31 0d 0a 2d  .-1326..-1451..-
23280 31 39 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1973....query I 
23290 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
232a0 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 38 38 20  ALL + col1 * 88 
232b0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
232c0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
232d0 0a 37 35 36 38 0d 0a 38 30 30 38 0d 0a 38 35 33  .7568..8008..853
232e0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
232f0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
23300 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
23310 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
23320 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
23330 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23340 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
23350 20 35 20 2a 20 63 6f 6c 32 20 63 6f 6c 32 20 46   5 * col2 col2 F
23360 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
23370 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a 31 33 35  ..----..130..135
23380 0d 0a 31 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..190....query I
23390 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
233a0 20 63 6f 6c 31 20 2b 20 39 20 46 52 4f 4d 20 74   col1 + 9 FROM t
233b0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
233c0 31 39 0d 0a 32 32 0d 0a 33 35 0d 0a 0d 0a 6f 6e  19..22..35....on
233d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
233e0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
233f0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
23400 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
23410 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23420 20 6c 61 62 65 6c 2d 39 35 36 0d 0a 53 45 4c 45   label-956..SELE
23430 43 54 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c  CT + CAST( - col
23440 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  1 AS SIGNED ) + 
23450 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col1 col0 FROM t
23460 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
23470 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
23480 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
23490 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
234a0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
234b0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
234c0 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
234d0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
234e0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
234f0 72 74 20 6c 61 62 65 6c 2d 39 35 36 0d 0a 53 45  rt label-956..SE
23500 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 2d 20  LECT + CAST ( - 
23510 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
23520 29 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  ) + col1 col0 FR
23530 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
23540 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
23550 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
23560 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
23570 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
23580 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
23590 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
235a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
235b0 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  + col0 * + col0 
235c0 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  + + col0 + + col
235d0 31 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  1 * + col0 * col
235e0 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  2 col0 FROM tab0
235f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23600 34 36 35 35 0d 0a 36 37 32 31 32 38 0d 0a 36 38  4655..672128..68
23610 37 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  712....query I r
23620 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
23630 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d   + cor0.col0 + -
23640 20 28 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32   ( + col0 * col2
23650 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
23660 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
23670 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d 33 35 38 34 0d  --..-159..-3584.
23680 0a 2d 37 36 30 30 0d 0a 0d 0a 71 75 65 72 79 20  .-7600....query 
23690 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
236a0 54 20 2b 20 2d 20 31 33 20 2a 20 2b 20 63 6f 6c  T + - 13 * + col
236b0 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  2 + cor0.col1 * 
236c0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
236d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
236e0 0d 0a 2d 2d 2d 2d 0d 0a 32 34 30 39 0d 0a 36 33  ..----..2409..63
236f0 39 36 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72 79 20  96..84....query 
23700 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23710 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  T + cor0.col1 + 
23720 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  - col0 * + col2 
23730 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
23740 2d 2d 2d 2d 0d 0a 2d 31 33 36 0d 0a 2d 33 36 33  ----..-136..-363
23750 38 0d 0a 2d 37 36 36 37 0d 0a 0d 0a 73 6b 69 70  8..-7667....skip
23760 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
23770 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
23780 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
23790 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
237a0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
237b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
237c0 20 31 36 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   16 col2 FROM ta
237d0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
237e0 31 36 0d 0a 2d 31 36 0d 0a 2d 31 36 0d 0a 0d 0a  16..-16..-16....
237f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23800 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c  .SELECT tab1.col
23810 32 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  2 * + col1 * - c
23820 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
23830 2d 2d 2d 0d 0a 2d 31 36 32 32 34 0d 0a 2d 33 36  ---..-16224..-36
23840 35 30 34 0d 0a 2d 35 37 30 30 0d 0a 0d 0a 71 75  504..-5700....qu
23850 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23860 45 4c 45 43 54 20 39 30 20 2a 20 63 6f 6c 32 20  ELECT 90 * col2 
23870 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  * + col2 + col2 
23880 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
23890 0a 32 36 32 34 39 34 0d 0a 32 39 32 34 36 37 0d  .262494..292467.
238a0 0a 38 32 39 35 33 36 0d 0a 0d 0a 71 75 65 72 79  .829536....query
238b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
238c0 43 54 20 28 20 35 37 20 2b 20 2b 20 63 6f 6c 31  CT ( 57 + + col1
238d0 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
238e0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 33 0d  tab0..----..143.
238f0 0a 31 34 38 0d 0a 31 35 34 0d 0a 0d 0a 71 75 65  .148..154....que
23900 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23910 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
23920 63 6f 6c 30 20 2b 20 2d 20 39 39 20 46 52 4f 4d  col0 + - 99 FROM
23930 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   tab0..----..-12
23940 33 0d 0a 2d 31 33 34 0d 0a 2d 31 38 38 0d 0a 0d  3..-134..-188...
23950 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
23960 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
23970 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
23980 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
23990 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
239a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
239b0 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20 35  T ALL col0 * - 5
239c0 33 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  3 col2 FROM tab1
239d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d 33  ..----..-159..-3
239e0 33 39 32 0d 0a 2d 34 32 34 30 0d 0a 0d 0a 6f 6e  392..-4240....on
239f0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
23a00 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
23a10 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
23a20 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
23a30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23a40 20 6c 61 62 65 6c 2d 39 36 37 0d 0a 53 45 4c 45   label-967..SELE
23a50 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 43 41  CT - col1 + - CA
23a60 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
23a70 4d 41 4c 20 29 20 2f 20 63 6f 6c 30 20 41 53 20  MAL ) / col0 AS 
23a80 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
23a90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
23aa0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
23ab0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
23ac0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
23ad0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23ae0 20 6c 61 62 65 6c 2d 39 36 37 0d 0a 53 45 4c 45   label-967..SELE
23af0 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 43 41  CT - col1 + - CA
23b00 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
23b10 4c 20 29 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f  L ) / col0 AS co
23b20 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
23b30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
23b40 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
23b50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23b60 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32  .SELECT - + col2
23b70 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20   + ( - col2 ) * 
23b80 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
23b90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23ba0 2d 32 38 37 31 0d 0a 2d 37 35 34 34 0d 0a 2d 39  -2871..-7544..-9
23bb0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
23bc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
23bd0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d   - cor0.col1 + -
23be0 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
23bf0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
23c00 0a 2d 31 31 30 0d 0a 2d 31 33 32 0d 0a 2d 31 38  .-110..-132..-18
23c10 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....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 63 6f 72 30 2e 63 6f 6c 32 20 41 53  0 + cor0.col2 AS
23c40 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
23c50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
23c60 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 71 75  71..36..57....qu
23c70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23c80 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
23c90 6c 31 20 2a 20 35 33 20 46 52 4f 4d 20 74 61 62  l1 * 53 FROM tab
23ca0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
23cb0 0a 31 36 34 33 0d 0a 33 31 32 37 0d 0a 39 30 31  .1643..3127..901
23cc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23cd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
23ce0 49 4e 43 54 20 2b 20 28 20 63 6f 6c 32 20 2a 20  INCT + ( col2 * 
23cf0 2b 20 74 61 62 32 2e 63 6f 6c 31 20 29 20 41 53  + tab2.col1 ) AS
23d00 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
23d10 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36  .----..1534..646
23d20 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..837....query I
23d30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23d40 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   - + col0 * + co
23d50 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
23d60 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
23d70 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37  .-162..-3648..-7
23d80 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  680....query I r
23d90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
23da0 20 63 6f 72 32 2e 63 6f 6c 31 20 41 53 20 63 6f   cor2.col1 AS co
23db0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
23dc0 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
23dd0 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
23de0 72 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 32  r1, tab1 AS cor2
23df0 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
23e00 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 37 64  s hashing to d7d
23e10 33 66 61 62 63 61 66 62 65 64 31 34 66 30 64 36  3fabcafbed14f0d6
23e20 66 66 64 33 37 31 39 35 63 39 37 31 63 0d 0a 0d  ffd37195c971c...
23e30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23e40 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
23e50 63 6f 6c 31 20 2a 20 2b 20 28 20 2b 20 63 6f 6c  col1 * + ( + col
23e60 32 20 29 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d  2 ) + + col2 * -
23e70 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 41   col2 * - col1 A
23e80 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
23e90 0d 0a 2d 2d 2d 2d 0d 0a 31 39 35 0d 0a 36 31 39  ..----..195..619
23ea0 34 32 38 0d 0a 39 36 35 32 35 0d 0a 0d 0a 71 75  428..96525....qu
23eb0 65 72 79 20 49 49 49 49 49 49 49 49 49 20 72 6f  ery IIIIIIIII ro
23ec0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
23ed0 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61  STINCT * FROM ta
23ee0 62 30 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  b0 cor0 CROSS JO
23ef0 49 4e 20 74 61 62 32 2c 20 74 61 62 30 20 63 6f  IN tab2, tab0 co
23f00 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33 20 76 61  r1..----..243 va
23f10 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
23f20 35 63 33 33 65 39 36 62 38 35 61 66 65 31 65 61  5c33e96b85afe1ea
23f30 35 31 62 62 36 64 34 65 39 66 61 36 66 39 39 33  51bb6d4e9fa6f993
23f40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23f50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
23f60 2d 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  - + col1 + cor0.
23f70 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f  col1 * col2 + co
23f80 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
23f90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 31  cor0..----..1501
23fa0 0d 0a 36 36 37 0d 0a 38 33 33 0d 0a 0d 0a 71 75  ..667..833....qu
23fb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23fc0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
23fd0 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a  r0.col1 * col1 *
23fe0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
23ff0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  AS cor0..----..6
24000 33 36 30 35 36 0d 0a 37 35 33 35 37 31 0d 0a 39  36056..753571..9
24010 31 32 36 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49  12673....query I
24020 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24030 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
24040 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30   * + col2 * col0
24050 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
24060 0d 0a 32 36 31 33 36 0d 0a 33 35 0d 0a 35 39 38  ..26136..35..598
24070 34 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  436....query III
24080 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24090 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 32   ALL * FROM tab2
240a0 20 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 32 20   WHERE NOT col2 
240b0 4e 4f 54 20 42 45 54 57 45 45 4e 20 28 20 4e 55  NOT BETWEEN ( NU
240c0 4c 4c 20 29 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d  LL ) AND NULL..-
240d0 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ---....skipif po
240e0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
240f0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
24100 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
24110 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
24120 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24130 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c  .SELECT tab1.col
24140 31 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  1 - col1 col0 FR
24150 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab1..----..0
24160 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
24170 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24180 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
24190 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53  - col2 * col1 AS
241a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
241b0 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 35 0d 0a 2d 37  .----..-2805..-7
241c0 33 38 30 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72  380..-96....quer
241d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
241e0 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  ECT cor0.col2 FR
241f0 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 63 6f  OM tab1, tab1 co
24200 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
24210 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  b2..----..27 val
24220 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
24230 66 34 61 39 62 66 32 34 64 36 34 38 33 33 37 30  f4a9bf24d6483370
24240 36 64 66 62 64 64 30 62 61 66 34 39 64 37 39 0d  6dfbdd0baf49d79.
24250 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24260 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
24270 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 2a 20 2d   col2 - col2 * -
24280 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
24290 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
242a0 35 36 30 0d 0a 36 38 34 0d 0a 38 36 34 0d 0a 0d  560..684..864...
242b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
242c0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
242d0 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  * cor0.col0 * + 
242e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
242f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
24300 39 36 35 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35  9652..51034..585
24310 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
24320 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
24330 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  0 + - col1 * + c
24340 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
24350 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   cor0..----..-21
24360 30 0d 0a 2d 33 34 30 33 0d 0a 2d 39 35 34 0d 0a  0..-3403..-954..
24370 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24380 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
24390 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30  CT + col1 + cor0
243a0 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f  .col0 * col0 FRO
243b0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
243c0 2d 2d 2d 2d 0d 0a 33 35 0d 0a 34 31 30 36 0d 0a  ----..35..4106..
243d0 36 34 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6413....query I 
243e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
243f0 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 63 6f  + tab0.col1 + co
24400 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
24410 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a  ab0..----..194..
24420 32 39 32 34 0d 0a 37 35 35 33 0d 0a 0d 0a 71 75  2924..7553....qu
24430 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24440 45 4c 45 43 54 20 2b 20 33 34 20 2a 20 74 61 62  ELECT + 34 * tab
24450 31 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20  1.col1 + + col1 
24460 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
24470 0a 33 35 30 0d 0a 34 35 35 0d 0a 39 31 30 0d 0a  .350..455..910..
24480 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24490 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
244a0 2b 20 63 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 6c  + col0 + + ( col
244b0 30 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20  0 ) * - col1 AS 
244c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
244d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
244e0 30 34 30 0d 0a 2d 33 33 36 30 0d 0a 2d 38 30 31  040..-3360..-801
244f0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
24500 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
24510 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 31 20 29   col0 * ( col1 )
24520 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
24530 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
24540 0a 2d 31 31 33 36 0d 0a 2d 31 33 32 0d 0a 2d 36  .-1136..-132..-6
24550 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
24560 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
24570 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b 20  STINCT col1 * + 
24580 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63  col1 + col2 AS c
24590 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
245a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 32   cor0..----..742
245b0 39 0d 0a 38 33 36 33 0d 0a 39 34 31 30 0d 0a 0d  9..8363..9410...
245c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
245d0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
245e0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
245f0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
24600 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 33  owsort label-993
24610 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
24620 44 49 56 20 2b 20 28 20 2b 20 28 20 2b 20 63 6f  DIV + ( + ( + co
24630 72 30 2e 63 6f 6c 30 20 29 20 29 20 2b 20 35 20  r0.col0 ) ) + 5 
24640 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
24650 30 0d 0a 2d 2d 2d 2d 0d 0a 36 0d 0a 36 0d 0a 36  0..----..6..6..6
24660 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
24670 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
24680 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
24690 72 74 20 6c 61 62 65 6c 2d 39 39 33 0d 0a 53 45  rt label-993..SE
246a0 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2b 20  LECT + col0 / + 
246b0 28 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  ( + ( + cor0.col
246c0 30 20 29 20 29 20 2b 20 35 20 46 52 4f 4d 20 74  0 ) ) + 5 FROM t
246d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
246e0 2d 0d 0a 36 0d 0a 36 0d 0a 36 0d 0a 0d 0a 71 75  -..6..6..6....qu
246f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24700 45 4c 45 43 54 20 39 36 20 2b 20 2b 20 63 6f 6c  ELECT 96 + + col
24710 31 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  1 * + col0 * col
24720 32 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  2 + - col0 AS co
24730 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
24740 2d 2d 0d 0a 33 34 35 36 0d 0a 36 36 34 31 32 35  --..3456..664125
24750 0d 0a 36 38 31 38 34 0d 0a 0d 0a 6f 6e 6c 79 69  ..68184....onlyi
24760 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
24770 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
24780 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
24790 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
247a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
247b0 62 65 6c 2d 39 39 35 0d 0a 53 45 4c 45 43 54 20  bel-995..SELECT 
247c0 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 43  ALL + col2 * - C
247d0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
247e0 4e 45 44 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f  NED ) * col2 FRO
247f0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab0..----..NU
24800 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
24810 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
24820 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
24830 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24840 20 6c 61 62 65 6c 2d 39 39 35 0d 0a 53 45 4c 45   label-995..SELE
24850 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20  CT ALL + col2 * 
24860 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
24870 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c   INTEGER ) * col
24880 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
24890 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
248a0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
248b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
248c0 20 63 6f 6c 31 20 2a 20 2d 20 34 39 20 2b 20 2b   col1 * - 49 + +
248d0 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
248e0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
248f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 33 38  cor0..----..4238
24900 0d 0a 34 35 34 38 0d 0a 34 37 38 38 0d 0a 0d 0a  ..4548..4788....
24910 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24920 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
24930 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 28 20   + + col1 + + ( 
24940 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53 20 63  cor0.col2 ) AS c
24950 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
24960 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d   cor0..----..55.
24970 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79  .58..85....query
24980 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24990 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
249a0 6c 30 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 30 20  l0 + + ( + col0 
249b0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
249c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a  or0..----..128..
249d0 31 36 30 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20  160..6....query 
249e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
249f0 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20  T col1 * col1 + 
24a00 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
24a10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 36   cor0..----..736
24a20 33 0d 0a 38 31 39 39 0d 0a 39 34 30 38 0d 0a 0d  3..8199..9408...
24a30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24a40 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
24a50 2b 20 2d 20 28 20 2d 20 37 32 20 29 20 46 52 4f  + - ( - 72 ) FRO
24a60 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
24a70 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 36 39 0d 0a 38 0d  ----..-8..69..8.
24a80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24a90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
24aa0 20 63 6f 6c 32 20 2a 20 28 20 37 39 20 29 20 46   col2 * ( 79 ) F
24ab0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
24ac0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 30 37 0d 0a 2d  ..----..-2607..-
24ad0 36 34 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65  6478..-79....que
24ae0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24af0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
24b00 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  + cor0.col2 + + 
24b10 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
24b20 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
24b30 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  ----..0....query
24b40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24b50 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20  CT ALL + - col1 
24b60 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  * col0 AS col1 F
24b70 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
24b80 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30  ---..-1040..-640
24b90 0d 0a 2d 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-78....onlyif 
24ba0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
24bb0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
24bc0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
24bd0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
24be0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
24bf0 6c 2d 31 30 30 34 0d 0a 53 45 4c 45 43 54 20 2b  l-1004..SELECT +
24c00 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 28 20   col1 + + CAST( 
24c10 2b 20 38 36 20 41 53 20 53 49 47 4e 45 44 20 29  + 86 AS SIGNED )
24c20 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   * col2 AS col1 
24c30 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
24c40 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 39 35 0d 0a 32  0..----..2295..2
24c50 33 35 33 0d 0a 33 32 38 35 0d 0a 0d 0a 73 6b 69  353..3285....ski
24c60 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
24c70 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
24c80 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
24c90 6c 2d 31 30 30 34 0d 0a 53 45 4c 45 43 54 20 2b  l-1004..SELECT +
24ca0 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 20 28   col1 + + CAST (
24cb0 20 2b 20 38 36 20 41 53 20 49 4e 54 45 47 45 52   + 86 AS INTEGER
24cc0 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c   ) * col2 AS col
24cd0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
24ce0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 39 35 0d  or0..----..2295.
24cf0 0a 32 33 35 33 0d 0a 33 32 38 35 0d 0a 0d 0a 6f  .2353..3285....o
24d00 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
24d10 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
24d20 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
24d30 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
24d40 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 35 0d  sort label-1005.
24d50 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 32  .SELECT col2 * 2
24d60 39 20 2b 20 39 34 20 2a 20 63 6f 6c 32 20 44 49  9 + 94 * col2 DI
24d70 56 20 36 34 20 46 52 4f 4d 20 74 61 62 31 20 41  V 64 FROM tab1 A
24d80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
24d90 34 35 0d 0a 31 37 33 36 0d 0a 32 39 32 35 0d 0a  45..1736..2925..
24da0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
24db0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
24dc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24dd0 20 6c 61 62 65 6c 2d 31 30 30 35 0d 0a 53 45 4c   label-1005..SEL
24de0 45 43 54 20 63 6f 6c 32 20 2a 20 32 39 20 2b 20  ECT col2 * 29 + 
24df0 39 34 20 2a 20 63 6f 6c 32 20 2f 20 36 34 20 46  94 * col2 / 64 F
24e00 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
24e10 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 35 0d 0a 31 37  ..----..1645..17
24e20 33 36 0d 0a 32 39 32 35 0d 0a 0d 0a 71 75 65 72  36..2925....quer
24e30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24e40 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c  ECT ALL cor0.col
24e50 31 20 2a 20 39 33 20 41 53 20 63 6f 6c 31 20 46  1 * 93 AS col1 F
24e60 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
24e70 2d 2d 2d 0d 0a 31 32 30 39 0d 0a 32 34 31 38 0d  ---..1209..2418.
24e80 0a 39 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .930....query I 
24e90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24ea0 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  ALL + col2 + - c
24eb0 6f 6c 32 20 2b 20 2b 20 30 20 46 52 4f 4d 20 74  ol2 + + 0 FROM t
24ec0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
24ed0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
24ee0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24ef0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
24f00 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a   col0 * + col0 *
24f10 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
24f20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
24f30 2d 2d 0d 0a 31 31 38 38 32 35 0d 0a 34 39 35 33  --..118825..4953
24f40 36 0d 0a 37 32 30 38 31 31 0d 0a 0d 0a 6f 6e 6c  6..720811....onl
24f50 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
24f60 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
24f70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
24f80 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
24f90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
24fa0 6c 61 62 65 6c 2d 31 30 30 39 0d 0a 53 45 4c 45  label-1009..SELE
24fb0 43 54 20 63 6f 6c 30 20 2b 20 43 41 53 54 28 20  CT col0 + CAST( 
24fc0 38 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  82 AS SIGNED ) F
24fd0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
24fe0 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36 0d 0a 31 36 32  ..----..146..162
24ff0 0d 0a 38 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..85....skipif m
25000 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
25010 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
25020 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30  owsort label-100
25030 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  9..SELECT col0 +
25040 20 43 41 53 54 20 28 20 38 32 20 41 53 20 49 4e   CAST ( 82 AS IN
25050 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
25060 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
25070 0a 31 34 36 0d 0a 31 36 32 0d 0a 38 35 0d 0a 0d  .146..162..85...
25080 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
25090 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
250a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
250b0 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28  .SELECT + CAST (
250c0 20 32 37 20 41 53 20 52 45 41 4c 20 29 20 2a 20   27 AS REAL ) * 
250d0 2b 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20  + col1 - - col2 
250e0 2a 20 32 31 20 2a 20 2b 20 74 61 62 32 2e 63 6f  * 21 * + tab2.co
250f0 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
25100 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 32  tab2..----..1402
25110 35 0d 0a 31 38 34 31 34 0d 0a 33 33 38 30 37 0d  5..18414..33807.
25120 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25130 72 74 0d 0a 53 45 4c 45 43 54 20 36 38 20 2b 20  rt..SELECT 68 + 
25140 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
25150 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
25160 31 30 33 0d 0a 31 35 37 0d 0a 39 32 0d 0a 0d 0a  103..157..92....
25170 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
25180 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
25190 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
251a0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
251b0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
251c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
251d0 20 2b 20 2b 20 36 38 20 63 6f 6c 32 20 46 52 4f   + + 68 col2 FRO
251e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
251f0 2d 2d 2d 2d 0d 0a 36 38 0d 0a 36 38 0d 0a 36 38  ----..68..68..68
25200 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25210 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
25220 2d 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 32 20  - col1 * ( col2 
25230 29 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ) + + cor0.col2 
25240 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
25250 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 35 0d 0a  0..----..-2805..
25260 2d 37 33 38 30 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e  -7380..-96....on
25270 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
25280 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
25290 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
252a0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
252b0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31 34 0d 0a  ort label-1014..
252c0 53 45 4c 45 43 54 20 2d 20 34 34 20 44 49 56 20  SELECT - 44 DIV 
252d0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  - col0 FROM tab2
252e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
252f0 30 0d 0a 30 0d 0a 36 0d 0a 0d 0a 73 6b 69 70 69  0..0..6....skipi
25300 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25310 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
25320 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25330 31 30 31 34 0d 0a 53 45 4c 45 43 54 20 2d 20 34  1014..SELECT - 4
25340 34 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  4 / - col0 FROM 
25350 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
25360 2d 2d 0d 0a 30 0d 0a 30 0d 0a 36 0d 0a 0d 0a 71  --..0..0..6....q
25370 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25380 53 45 4c 45 43 54 20 35 33 20 2a 20 2b 20 63 6f  SELECT 53 * + co
25390 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 38 30 20 46  l1 * col0 + 80 F
253a0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
253b0 2d 2d 2d 0d 0a 31 30 39 34 37 32 0d 0a 31 38 30  ---..109472..180
253c0 30 31 35 0d 0a 34 32 39 33 32 37 0d 0a 0d 0a 6f  015..429327....o
253d0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
253e0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
253f0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
25400 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
25410 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31 36 0d  sort label-1016.
25420 0a 53 45 4c 45 43 54 20 2d 20 36 30 20 44 49 56  .SELECT - 60 DIV
25430 20 63 6f 6c 31 20 2b 20 31 39 20 2a 20 2d 20 32   col1 + 19 * - 2
25440 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
25450 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 38 0d  ab0..----..-418.
25460 0a 2d 34 31 38 0d 0a 2d 34 31 38 0d 0a 0d 0a 73  .-418..-418....s
25470 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
25480 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
25490 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
254a0 62 65 6c 2d 31 30 31 36 0d 0a 53 45 4c 45 43 54  bel-1016..SELECT
254b0 20 2d 20 36 30 20 2f 20 63 6f 6c 31 20 2b 20 31   - 60 / col1 + 1
254c0 39 20 2a 20 2d 20 32 32 20 41 53 20 63 6f 6c 32  9 * - 22 AS col2
254d0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
254e0 0d 0a 2d 34 31 38 0d 0a 2d 34 31 38 0d 0a 2d 34  ..-418..-418..-4
254f0 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  18....query I ro
25500 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
25510 53 54 49 4e 43 54 20 2b 20 28 20 2b 20 34 33 20  STINCT + ( + 43 
25520 29 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  ) FROM tab0, tab
25530 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  1 AS cor0, tab1 
25540 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor1..----..4
25550 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
25560 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
25570 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 - + col2 AS 
25580 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
25590 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
255a0 30 34 0d 0a 2d 31 31 37 0d 0a 2d 33 34 0d 0a 0d  04..-117..-34...
255b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
255c0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 33  ..SELECT ALL - 3
255d0 36 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  6 * - col0 * col
255e0 30 20 2b 20 2b 20 36 33 20 2a 20 63 6f 6c 31 20  0 + + 63 * col1 
255f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
25600 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
25610 0a 32 32 32 37 34 31 0d 0a 32 32 35 37 34 37 0d  .222741..225747.
25620 0a 33 37 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .3717....query I
25630 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25640 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 63 6f   DISTINCT + ( co
25650 6c 31 20 29 20 2b 20 37 32 20 41 53 20 63 6f 6c  l1 ) + 72 AS col
25660 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
25670 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d 0a  or0..----..158..
25680 31 36 33 0d 0a 31 36 39 0d 0a 0d 0a 71 75 65 72  163..169....quer
25690 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
256a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 31 36 20  ECT DISTINCT 16 
256b0 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  * - col0 + cor0.
256c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
256d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
256e0 32 30 30 0d 0a 2d 34 35 0d 0a 2d 39 36 30 0d 0a  200..-45..-960..
256f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
25700 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
25710 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
25720 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
25730 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
25740 32 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  22..SELECT DISTI
25750 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  NCT + col0 * - c
25760 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 + - cor0.col
25770 32 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20  2 DIV col2 FROM 
25780 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
25790 2d 2d 0d 0a 2d 33 36 0d 0a 2d 37 32 39 39 0d 0a  --..-36..-7299..
257a0 2d 37 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  -793....skipif m
257b0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
257c0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
257d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32  owsort label-102
257e0 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
257f0 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  CT + col0 * - co
25800 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l2 + - cor0.col2
25810 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   / col2 FROM tab
25820 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
25830 0a 2d 33 36 0d 0a 2d 37 32 39 39 0d 0a 2d 37 39  .-36..-7299..-79
25840 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
25850 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
25860 20 2b 20 39 39 20 2d 20 63 6f 6c 31 20 2a 20 63   + 99 - col1 * c
25870 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
25880 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
25890 2d 2d 2d 0d 0a 2d 31 31 38 0d 0a 2d 31 32 34 34  ---..-118..-1244
258a0 0d 0a 2d 34 35 30 33 0d 0a 0d 0a 6f 6e 6c 79 69  ..-4503....onlyi
258b0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
258c0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
258d0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
258e0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
258f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25900 62 65 6c 2d 31 30 32 34 0d 0a 53 45 4c 45 43 54  bel-1024..SELECT
25910 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
25920 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 30 20 46   SIGNED ) col0 F
25930 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
25940 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
25950 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
25960 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
25970 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31   cd7a7901e47c151
25980 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30  55404aff0d216fe0
25990 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  b....skipif post
259a0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
259b0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
259c0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
259d0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
259e0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
259f0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
25a00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25a10 65 6c 2d 31 30 32 34 0d 0a 53 45 4c 45 43 54 20  el-1024..SELECT 
25a20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
25a30 20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 30 20   INTEGER ) col0 
25a40 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
25a50 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
25a60 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  1 cor1..----..9 
25a70 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
25a80 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35  o cd7a7901e47c15
25a90 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65  155404aff0d216fe
25aa0 30 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  0b....query I ro
25ab0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
25ac0 39 33 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  93 + col1 FROM t
25ad0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
25ae0 2d 0d 0a 2d 32 0d 0a 2d 37 0d 0a 34 0d 0a 0d 0a  -..-2..-7..4....
25af0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25b00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
25b10 20 2b 20 33 20 2a 20 2d 20 63 6f 6c 30 20 46 52   + 3 * - col0 FR
25b20 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
25b30 0a 2d 2d 2d 2d 0d 0a 2d 31 39 32 0d 0a 2d 32 34  .----..-192..-24
25b40 30 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49  0..-9....query I
25b50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25b60 20 2b 20 2b 20 35 35 20 2a 20 2b 20 63 6f 6c 30   + + 55 * + col0
25b70 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
25b80 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
25b90 0d 0a 31 36 35 0d 0a 33 35 32 30 0d 0a 34 34 30  ..165..3520..440
25ba0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
25bb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34  sort..SELECT - 4
25bc0 39 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  9 FROM tab1 cor0
25bd0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 34 39  ..----..-49..-49
25be0 0d 0a 2d 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-49....query I
25bf0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25c00 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 63 6f   ALL - col2 * co
25c10 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41  l0 + cor0.col2 A
25c20 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
25c30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25c40 2d 31 30 38 0d 0a 2d 33 35 39 31 0d 0a 2d 37 35  -108..-3591..-75
25c50 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  84....query I ro
25c60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
25c70 63 6f 6c 30 20 2d 20 2b 20 28 20 2b 20 63 6f 6c  col0 - + ( + col
25c80 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  1 ) FROM tab1 co
25c90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35  r0..----..-23..5
25ca0 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49  4..67....query I
25cb0 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
25cc0 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
25cd0 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  0, tab2 AS cor0 
25ce0 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c  WHERE NOT NULL <
25cf0 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  = NULL..----....
25d00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25d10 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d  .SELECT + col2 -
25d20 20 2d 20 28 20 2d 20 35 38 20 2b 20 63 6f 6c 30   - ( - 58 + col0
25d30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
25d40 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
25d50 2d 2d 0d 0a 2d 32 34 0d 0a 34 36 0d 0a 35 39 0d  --..-24..46..59.
25d60 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
25d70 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
25d80 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
25d90 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
25da0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
25db0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25dc0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a  ECT ALL + col2 *
25dd0 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( - cor0.col0 )
25de0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
25df0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
25e00 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38  162..-3648..-768
25e10 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
25e20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
25e30 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b   col0 * - col1 +
25e40 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   ( col0 ) FROM t
25e50 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
25e60 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a 34 36  -..1422..224..46
25e70 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
25e80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
25e90 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 37 33 20 2b  l2 * col0 * 73 +
25ea0 20 2b 20 36 32 20 46 52 4f 4d 20 74 61 62 31 0d   + 62 FROM tab1.
25eb0 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 38 0d 0a 32 36  .----..11888..26
25ec0 36 33 36 36 0d 0a 35 36 30 37 30 32 0d 0a 0d 0a  6366..560702....
25ed0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25ee0 0a 53 45 4c 45 43 54 20 63 6f 72 31 2e 63 6f 6c  .SELECT cor1.col
25ef0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
25f00 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab0 AS cor0 CROS
25f10 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63  S JOIN tab2 AS c
25f20 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
25f30 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
25f40 36 31 64 32 37 61 30 30 32 32 65 36 64 30 32 32  61d27a0022e6d022
25f50 33 37 31 64 63 35 38 38 31 39 61 62 32 37 32 0d  371dc58819ab272.
25f60 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
25f70 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
25f80 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
25f90 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
25fa0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
25fb0 30 33 37 0d 0a 53 45 4c 45 43 54 20 2b 20 39 30  037..SELECT + 90
25fc0 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20 63   DIV - col0 AS c
25fd0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
25fe0 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 32  ---..-1..-1..-12
25ff0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
26000 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
26010 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
26020 72 74 20 6c 61 62 65 6c 2d 31 30 33 37 0d 0a 53  rt label-1037..S
26030 45 4c 45 43 54 20 2b 20 39 30 20 2f 20 2d 20 63  ELECT + 90 / - c
26040 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
26050 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   tab2..----..-1.
26060 0a 2d 31 0d 0a 2d 31 32 0d 0a 0d 0a 71 75 65 72  .-1..-12....quer
26070 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26080 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
26090 2a 20 39 38 20 46 52 4f 4d 20 74 61 62 30 2c 20  * 98 FROM tab0, 
260a0 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
260b0 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor1..----..2
260c0 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
260d0 20 74 6f 20 30 38 65 31 31 64 63 37 33 35 63 39   to 08e11dc735c9
260e0 31 63 35 30 35 62 36 62 32 62 30 32 34 30 38 35  1c505b6b2b024085
260f0 35 66 64 61 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  5fda....onlyif m
26100 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
26110 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
26120 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
26130 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
26140 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
26150 2d 31 30 33 39 0d 0a 53 45 4c 45 43 54 20 44 49  -1039..SELECT DI
26160 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 38  STINCT - CAST( 8
26170 39 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  9 AS SIGNED ) AS
26180 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
26190 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
261a0 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  89....skipif mys
261b0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
261c0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
261d0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 39 0d  sort label-1039.
261e0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
261f0 20 2d 20 43 41 53 54 20 28 20 38 39 20 41 53 20   - CAST ( 89 AS 
26200 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
26210 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
26220 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 39 0d 0a  or0..----..-89..
26230 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26240 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
26250 43 54 20 2b 20 2b 20 33 20 2a 20 63 6f 6c 30 20  CT + + 3 * col0 
26260 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
26270 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
26280 0d 0a 2d 31 32 32 38 38 0d 0a 2d 31 39 32 30 30  ..-12288..-19200
26290 0d 0a 2d 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-27....query I
262a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
262b0 20 44 49 53 54 49 4e 43 54 20 2d 20 35 36 20 2d   DISTINCT - 56 -
262c0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
262d0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
262e0 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32 0d 0a 2d 31 34  .----..-142..-14
262f0 37 0d 0a 2d 31 35 33 0d 0a 0d 0a 71 75 65 72 79  7..-153....query
26300 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26310 43 54 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20  CT + ( col2 ) * 
26320 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
26330 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
26340 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d  or0..----..1248.
26350 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75  .1404..570....qu
26360 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26370 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63  ELECT col1 + + c
26380 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 * + col2 AS 
26390 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
263a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
263b0 32 0d 0a 37 33 38 39 0d 0a 38 37 38 0d 0a 0d 0a  2..7389..878....
263c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
263d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
263e0 35 35 20 2b 20 2b 20 38 30 20 46 52 4f 4d 20 74  55 + + 80 FROM t
263f0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
26400 2d 0d 0a 31 33 35 0d 0a 31 33 35 0d 0a 31 33 35  -..135..135..135
26410 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26420 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
26430 72 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r1.col2 FROM tab
26440 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  2 AS cor0 CROSS 
26450 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 32 20  JOIN tab2, tab2 
26460 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
26470 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
26480 20 74 6f 20 66 39 64 34 62 62 38 36 37 37 64 62   to f9d4bb8677db
26490 37 62 39 38 63 37 65 64 38 39 64 30 36 65 36 65  7b98c7ed89d06e6e
264a0 38 63 64 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8cd6....query I 
264b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
264c0 44 49 53 54 49 4e 43 54 20 31 34 20 41 53 20 63  DISTINCT 14 AS c
264d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
264e0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
264f0 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  14....query I ro
26500 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
26510 2b 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d  + tab1.col0 FROM
26520 20 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61 62   tab1, tab0, tab
26530 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  1 cor0..----..27
26540 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
26550 74 6f 20 37 37 38 62 35 30 35 37 35 61 39 62 39  to 778b50575a9b9
26560 31 34 34 38 31 31 39 65 65 30 65 65 31 61 39 63  1448119ee0ee1a9c
26570 34 34 66 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  44f....skipif my
26580 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
26590 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
265a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
265b0 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 2b 20  STINCT CAST ( + 
265c0 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29 20 41  col2 AS REAL ) A
265d0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
265e0 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a  ..----..54..57..
265f0 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  96....skipif pos
26600 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
26610 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
26620 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
26630 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
26640 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26650 53 45 4c 45 43 54 20 2b 20 37 35 20 63 6f 6c 32  SELECT + 75 col2
26660 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
26670 0d 0a 37 35 0d 0a 37 35 0d 0a 37 35 0d 0a 0d 0a  ..75..75..75....
26680 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26690 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
266a0 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53   + ( + col1 ) AS
266b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
266c0 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35  .----..17..31..5
266d0 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
266e0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
266f0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
26700 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
26710 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
26720 2d 31 30 35 31 0d 0a 53 45 4c 45 43 54 20 44 49  -1051..SELECT DI
26730 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 44 49  STINCT - col1 DI
26740 56 20 2b 20 36 37 20 41 53 20 63 6f 6c 32 20 46  V + 67 AS col2 F
26750 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
26760 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
26770 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
26780 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
26790 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 31 0d 0a  ort label-1051..
267a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
267b0 2d 20 63 6f 6c 31 20 2f 20 2b 20 36 37 20 41 53  - col1 / + 67 AS
267c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
267d0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .----..0....quer
267e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
267f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
26800 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2d   col2 + col2 * -
26810 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
26820 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
26830 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 36 0d 0a 2d 36  .----..-1406..-6
26840 35 30 0d 0a 2d 37 30 32 0d 0a 0d 0a 71 75 65 72  50..-702....quer
26850 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26860 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30  ECT ALL + - col0
26870 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b   * cor0.col1 + +
26880 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2a   col1 + + col1 *
26890 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
268a0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
268b0 2d 0d 0a 2d 33 30 30 39 0d 0a 2d 36 38 30 0d 0a  -..-3009..-680..
268c0 36 35 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  651....onlyif my
268d0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
268e0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
268f0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
26900 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
26910 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
26920 31 30 35 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  1054..SELECT DIS
26930 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c 31 20 29  TINCT ( + col1 )
26940 20 2f 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 43 41   / + col1 - + CA
26950 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
26960 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 31 0d  MAL ) FROM tab1.
26970 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
26980 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
26990 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
269a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
269b0 62 65 6c 2d 31 30 35 34 0d 0a 53 45 4c 45 43 54  bel-1054..SELECT
269c0 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f   DISTINCT ( + co
269d0 6c 31 20 29 20 2f 20 2b 20 63 6f 6c 31 20 2d 20  l1 ) / + col1 - 
269e0 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
269f0 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62   REAL ) FROM tab
26a00 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  1..----..NULL...
26a10 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
26a20 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
26a30 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
26a40 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
26a50 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
26a60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26a70 54 20 2d 20 37 39 20 63 6f 6c 30 20 46 52 4f 4d  T - 79 col0 FROM
26a80 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
26a90 2d 2d 2d 0d 0a 2d 37 39 0d 0a 2d 37 39 0d 0a 2d  ---..-79..-79..-
26aa0 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
26ab0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
26ac0 63 6f 6c 31 20 2a 20 2b 20 28 20 2b 20 63 6f 6c  col1 * + ( + col
26ad0 32 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  2 ) FROM tab0..-
26ae0 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36  ---..-2838..-746
26af0 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20  2..-97....query 
26b00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26b10 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 39 35 20  T - col1 * - 95 
26b20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  + + col0 AS col2
26b30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
26b40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 34 0d 0a  r0..----..1014..
26b50 31 33 31 35 0d 0a 32 34 37 33 0d 0a 0d 0a 71 75  1315..2473....qu
26b60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26b70 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b  ELECT + + col2 +
26b80 20 2b 20 39 38 20 46 52 4f 4d 20 74 61 62 31 20   + 98 FROM tab1 
26b90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
26ba0 35 32 0d 0a 31 35 35 0d 0a 31 39 34 0d 0a 0d 0a  52..155..194....
26bb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26bc0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
26bd0 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c  ol2 * col0 + col
26be0 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  1 * col1 AS col2
26bf0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
26c00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 36 30 34 0d 0a  r0..----..6604..
26c10 39 33 37 34 0d 0a 39 38 33 0d 0a 0d 0a 71 75 65  9374..983....que
26c20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26c30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
26c40 2d 20 63 6f 6c 31 20 2d 20 63 6f 72 30 2e 63 6f  - col1 - cor0.co
26c50 6c 32 20 2a 20 36 32 20 41 53 20 63 6f 6c 30 20  l2 * 62 AS col0 
26c60 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
26c70 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 35 33 0d 0a  0..----..-1553..
26c80 2d 31 36 34 33 0d 0a 2d 32 33 33 39 0d 0a 0d 0a  -1643..-2339....
26c90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26ca0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
26cb0 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 34 31 20 41   + - col1 * 41 A
26cc0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
26cd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26ce0 2d 31 30 31 32 0d 0a 2d 33 35 33 0d 0a 2d 34 33  -1012..-353..-43
26cf0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
26d00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34  sort..SELECT + 4
26d10 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  8 AS col1 FROM t
26d20 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
26d30 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
26d40 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 62 30  s hashing to 8b0
26d50 39 63 63 32 63 39 39 63 32 31 30 32 30 33 36 31  9cc2c99c21020361
26d60 36 32 64 30 36 33 65 30 65 35 61 34 62 0d 0a 0d  62d063e0e5a4b...
26d70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26d80 0d 0a 53 45 4c 45 43 54 20 35 31 20 41 53 20 63  ..SELECT 51 AS c
26d90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
26da0 61 62 30 20 63 6f 72 30 2c 20 74 61 62 30 20 41  ab0 cor0, tab0 A
26db0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
26dc0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
26dd0 74 6f 20 30 32 61 37 64 65 39 34 33 36 35 62 38  to 02a7de94365b8
26de0 63 62 35 62 35 63 62 39 32 63 34 62 31 64 31 65  cb5b5cb92c4b1d1e
26df0 37 63 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  7c5....query I r
26e00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
26e10 4c 4c 20 2d 20 39 30 20 2a 20 37 20 41 53 20 63  LL - 90 * 7 AS c
26e20 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
26e30 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
26e40 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
26e50 69 6e 67 20 74 6f 20 38 61 65 66 66 35 36 63 33  ing to 8aeff56c3
26e60 64 38 31 36 66 36 30 66 63 39 64 64 64 61 31 39  d816f60fc9ddda19
26e70 66 38 64 66 31 36 39 0d 0a 0d 0a 71 75 65 72 79  f8df169....query
26e80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26e90 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
26ea0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   - cor0.col1 AS 
26eb0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
26ec0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
26ed0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26ee0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 20 2b  rt..SELECT + 3 +
26ef0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
26f00 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
26f10 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 38 31 0d 0a 38  .----..10..81..8
26f20 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
26f30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
26f40 54 49 4e 43 54 20 34 39 20 2b 20 63 6f 6c 30 20  TINCT 49 + col0 
26f50 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
26f60 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 0d 0a 31 32  0..----..127..12
26f70 38 0d 0a 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  8..56....query I
26f80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26f90 20 41 4c 4c 20 63 6f 72 31 2e 63 6f 6c 32 20 46   ALL cor1.col2 F
26fa0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 63  ROM tab2, tab0 c
26fb0 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
26fc0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
26fd0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 66  es hashing to 7f
26fe0 34 61 39 62 66 32 34 64 36 34 38 33 33 37 30 36  4a9bf24d64833706
26ff0 64 66 62 64 64 30 62 61 66 34 39 64 37 39 0d 0a  dfbdd0baf49d79..
27000 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27010 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
27020 6c 31 20 2a 20 33 30 20 2b 20 2b 20 63 6f 6c 31  l1 * 30 + + col1
27030 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
27040 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
27050 0a 31 30 31 39 32 0d 0a 33 30 30 37 0d 0a 35 34  .10192..3007..54
27060 31 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  18....onlyif mys
27070 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
27080 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
27090 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
270a0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
270b0 6c 2d 31 30 37 30 0d 0a 53 45 4c 45 43 54 20 2d  l-1070..SELECT -
270c0 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 44 49 56   col0 + col2 DIV
270d0 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f   - col0 col1 FRO
270e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
270f0 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 37 38 0d 0a  ----..-10..-78..
27100 2d 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -79....skipif po
27110 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
27120 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
27130 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
27140 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
27150 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
27160 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
27170 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
27180 61 62 65 6c 2d 31 30 37 30 0d 0a 53 45 4c 45 43  abel-1070..SELEC
27190 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  T - col0 + col2 
271a0 2f 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52  / - col0 col1 FR
271b0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
271c0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 37 38 0d  .----..-10..-78.
271d0 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-79....query I 
271e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
271f0 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  + - col0 + cor0.
27200 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2a 20  col0 * + col1 * 
27210 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
27220 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27230 2d 31 31 38 38 36 30 0d 0a 2d 34 39 35 36 30 0d  -118860..-49560.
27240 0a 2d 37 32 30 39 30 30 0d 0a 0d 0a 71 75 65 72  .-720900....quer
27250 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27260 45 43 54 20 2d 20 34 30 20 41 53 20 63 6f 6c 32  ECT - 40 AS col2
27270 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
27280 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab1 cor0..---
27290 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
272a0 68 69 6e 67 20 74 6f 20 30 31 61 61 64 34 35 33  hing to 01aad453
272b0 39 31 39 38 61 36 35 30 39 32 34 38 65 30 38 36  9198a6509248e086
272c0 38 36 39 66 39 30 61 36 0d 0a 0d 0a 71 75 65 72  869f90a6....quer
272d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
272e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
272f0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
27300 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
27310 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab2 cor0..---
27320 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39  -..-17..-31..-59
27330 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27340 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
27350 35 39 20 2a 20 63 6f 72 31 2e 63 6f 6c 31 20 46  59 * cor1.col1 F
27360 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
27370 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  S cor0, tab1 AS 
27380 63 6f 72 31 2c 20 74 61 62 30 2c 20 74 61 62 31  cor1, tab0, tab1
27390 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33   cor2..----..243
273a0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
273b0 74 6f 20 37 63 38 36 32 32 32 63 63 32 32 35 33  to 7c86222cc2253
273c0 31 66 30 65 32 63 62 61 39 39 37 37 37 32 34 31  1f0e2cba99777241
273d0 33 39 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  39c....query I r
273e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
273f0 20 2d 20 63 6f 6c 30 20 2b 20 34 35 20 46 52 4f   - col0 + 45 FRO
27400 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
27410 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 33 35 0d 0a  ----..-19..-35..
27420 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  42....query I ro
27430 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
27440 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 38 31  l2 * col0 + - 81
27450 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
27460 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31  r0..----..108..1
27470 39 34 37 0d 0a 32 39 32 31 0d 0a 0d 0a 71 75 65  947..2921....que
27480 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27490 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
274a0 38 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  81 * + cor0.col0
274b0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
274c0 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b2, tab1 AS cor0
274d0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
274e0 2d 2d 2d 2d 0d 0a 2d 32 34 33 0d 0a 2d 35 31 38  ----..-243..-518
274f0 34 0d 0a 2d 36 34 38 30 0d 0a 0d 0a 71 75 65 72  4..-6480....quer
27500 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27510 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  ECT col1 + col0 
27520 2a 20 2d 20 33 35 20 46 52 4f 4d 20 74 61 62 32  * - 35 FROM tab2
27530 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27540 2d 32 31 34 0d 0a 2d 32 36 37 31 0d 0a 2d 32 37  -214..-2671..-27
27550 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  48....query I ro
27560 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
27570 4c 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  L col1 + - col1 
27580 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
27590 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  1 cor0..----..0.
275a0 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .0..0....onlyif 
275b0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
275c0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
275d0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
275e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
275f0 61 62 65 6c 2d 31 30 38 30 0d 0a 53 45 4c 45 43  abel-1080..SELEC
27600 54 20 41 4c 4c 20 28 20 63 6f 6c 31 20 29 20 2b  T ALL ( col1 ) +
27610 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30   col1 DIV + col0
27620 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
27630 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 39 0d 0a 39 32  r0..----..89..92
27640 0d 0a 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..99....skipif m
27650 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
27660 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
27670 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38  owsort label-108
27680 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  0..SELECT ALL ( 
27690 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 31 20 2f 20  col1 ) + col1 / 
276a0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
276b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
276c0 38 39 0d 0a 39 32 0d 0a 39 39 0d 0a 0d 0a 6f 6e  89..92..99....on
276d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
276e0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
276f0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
27700 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
27710 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 31 0d 0a  ort label-1081..
27720 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2b 20 63  SELECT ALL ( + c
27730 6f 6c 31 20 29 20 44 49 56 20 63 6f 6c 30 20 46  ol1 ) DIV col0 F
27740 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
27750 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a  ---..0..0..4....
27760 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
27770 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
27780 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
27790 61 62 65 6c 2d 31 30 38 31 0d 0a 53 45 4c 45 43  abel-1081..SELEC
277a0 54 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 31 20 29  T ALL ( + col1 )
277b0 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
277c0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  2 cor0..----..0.
277d0 0a 30 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..4....query I
277e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
277f0 20 41 4c 4c 20 2d 20 2b 20 32 36 20 2b 20 31 35   ALL - + 26 + 15
27800 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + - col1 * + co
27810 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
27820 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
27830 2d 2d 0d 0a 2d 32 30 37 35 0d 0a 2d 33 34 30 36  --..-2075..-3406
27840 0d 0a 2d 38 31 31 30 0d 0a 0d 0a 71 75 65 72 79  ..-8110....query
27850 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27860 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20  CT ALL + col2 + 
27870 2b 20 32 38 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 28 AS col0 FRO
27880 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
27890 2d 2d 2d 2d 0d 0a 31 32 34 0d 0a 38 32 0d 0a 38  ----..124..82..8
278a0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
278b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
278c0 54 49 4e 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c  TINCT + tab0.col
278d0 31 20 2a 20 2d 20 28 20 74 61 62 30 2e 63 6f 6c  1 * - ( tab0.col
278e0 31 20 2b 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f  1 + - col1 ) FRO
278f0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
27900 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27910 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
27920 4e 43 54 20 2b 20 36 31 20 46 52 4f 4d 20 74 61  NCT + 61 FROM ta
27930 62 31 2c 20 74 61 62 31 20 63 6f 72 30 2c 20 74  b1, tab1 cor0, t
27940 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
27950 2d 0d 0a 36 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..61....skipif 
27960 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
27970 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
27980 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
27990 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
279a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
279b0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
279c0 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63   * col1 * cor0.c
279d0 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
279e0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
279f0 0d 0a 2d 32 32 38 33 31 0d 0a 2d 32 37 31 35 31  ..-22831..-27151
27a00 38 0d 0a 2d 36 37 32 37 0d 0a 0d 0a 71 75 65 72  8..-6727....quer
27a10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27a20 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
27a30 20 33 34 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f   34 * - col0 FRO
27a40 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
27a50 2d 2d 2d 2d 0d 0a 2d 31 30 32 0d 0a 2d 32 31 37  ----..-102..-217
27a60 36 0d 0a 2d 32 37 32 30 0d 0a 0d 0a 71 75 65 72  6..-2720....quer
27a70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27a80 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2b  ECT - - col1 * +
27a90 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 72 30 2e 63   col2 - - cor0.c
27aa0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
27ab0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32   cor0..----..132
27ac0 0d 0a 32 38 36 32 0d 0a 37 35 35 31 0d 0a 0d 0a  ..2862..7551....
27ad0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27ae0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 39 38 20 2a  .SELECT - - 98 *
27af0 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
27b00 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
27b10 0a 2d 31 36 36 36 0d 0a 2d 33 30 33 38 0d 0a 2d  .-1666..-3038..-
27b20 35 37 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5782....query I 
27b30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27b40 2d 20 2d 20 39 37 20 2b 20 2b 20 63 6f 6c 32 20  - - 97 + + col2 
27b50 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  * col2 FROM tab1
27b60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 31   cor0..----..301
27b70 33 0d 0a 33 33 34 36 0d 0a 39 33 31 33 0d 0a 0d  3..3346..9313...
27b80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27b90 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63  ..SELECT + ( + c
27ba0 6f 6c 31 20 29 20 2a 20 34 33 20 46 52 4f 4d 20  ol1 ) * 43 FROM 
27bb0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
27bc0 2d 2d 0d 0a 31 33 33 33 0d 0a 32 35 33 37 0d 0a  --..1333..2537..
27bd0 37 33 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  731....onlyif my
27be0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
27bf0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
27c00 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
27c10 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
27c20 65 6c 2d 31 30 39 32 0d 0a 53 45 4c 45 43 54 20  el-1092..SELECT 
27c30 2d 20 28 20 63 6f 6c 32 20 29 20 44 49 56 20 74  - ( col2 ) DIV t
27c40 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab0.col2 FROM ta
27c50 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  b0..----..-1..-1
27c60 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..-1....skipif m
27c70 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
27c80 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
27c90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39  owsort label-109
27ca0 32 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f  2..SELECT - ( co
27cb0 6c 32 20 29 20 2f 20 74 61 62 30 2e 63 6f 6c 32  l2 ) / tab0.col2
27cc0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
27cd0 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a  ..-1..-1..-1....
27ce0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27cf0 0a 53 45 4c 45 43 54 20 31 31 20 2b 20 38 20 46  .SELECT 11 + 8 F
27d00 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
27d10 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30   CROSS JOIN tab0
27d20 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
27d30 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
27d40 20 33 64 61 63 33 30 64 63 38 32 63 39 65 35 61   3dac30dc82c9e5a
27d50 63 62 62 64 33 61 35 63 35 64 31 61 65 65 65 31  cbbd3a5c5d1aeee1
27d60 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
27d70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
27d80 54 49 4e 43 54 20 2d 20 34 20 46 52 4f 4d 20 74  TINCT - 4 FROM t
27d90 61 62 30 20 63 6f 72 30 20 43 52 4f 53 53 20 4a  ab0 cor0 CROSS J
27da0 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31  OIN tab1 AS cor1
27db0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 0d 0a 71 75  ..----..-4....qu
27dc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27dd0 45 4c 45 43 54 20 41 4c 4c 20 38 31 20 2a 20 2d  ELECT ALL 81 * -
27de0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
27df0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 33 0d 0a 2d 32  .----..-1053..-2
27e00 31 30 36 0d 0a 2d 38 31 30 0d 0a 0d 0a 71 75 65  106..-810....que
27e10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27e20 4c 45 43 54 20 34 30 20 2a 20 2b 20 63 6f 6c 32  LECT 40 * + col2
27e30 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53   * ( - col2 ) AS
27e40 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
27e50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
27e60 32 37 30 34 30 0d 0a 2d 32 39 31 36 30 0d 0a 2d  27040..-29160..-
27e70 35 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  57760....query I
27e80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27e90 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   ALL col2 + - co
27ea0 6c 32 20 2b 20 37 34 20 46 52 4f 4d 20 74 61 62  l2 + 74 FROM tab
27eb0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 0d 0a 37 34 0d  0..----..74..74.
27ec0 0a 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .74....query I r
27ed0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
27ee0 49 53 54 49 4e 43 54 20 28 20 63 6f 72 30 2e 63  ISTINCT ( cor0.c
27ef0 6f 6c 31 20 29 20 2b 20 63 6f 6c 31 20 2a 20 2d  ol1 ) + col1 * -
27f00 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
27f10 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
27f20 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 37 0d 0a 2d 35  .----..-1027..-5
27f30 32 0d 0a 2d 36 33 30 0d 0a 0d 0a 71 75 65 72 79  2..-630....query
27f40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27f50 43 54 20 2d 20 37 33 20 2a 20 2d 20 63 6f 6c 31  CT - 73 * - col1
27f60 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 28 20 2b 20   + col2 - - ( + 
27f70 63 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d  cor0.col1 ) FROM
27f80 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
27f90 2d 2d 2d 0d 0a 31 30 35 38 0d 0a 31 39 37 38 0d  ---..1058..1978.
27fa0 0a 37 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .797....query I 
27fb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27fc0 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63  DISTINCT - ( + c
27fd0 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 31 20 46  ol1 ) * - col1 F
27fe0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
27ff0 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32  ..----..7396..82
28000 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a 71 75 65 72  81..9409....quer
28010 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28020 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
28030 20 34 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20   40 * + col2 AS 
28040 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
28050 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  S cor0..----..21
28060 36 30 0d 0a 32 32 38 30 0d 0a 33 38 34 30 0d 0a  60..2280..3840..
28070 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28080 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
28090 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e  - col2 * + cor0.
280a0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
280b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39  S cor0..----..29
280c0 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d 0a  16..3249..9216..
280d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
280e0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
280f0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  + cor0.col2 AS c
28100 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
28110 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d  r0..----..1..33.
28120 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .82....query I r
28130 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33  owsort..SELECT 3
28140 36 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29  6 + - ( - col1 )
28150 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
28160 0a 2d 2d 2d 2d 0d 0a 34 36 0d 0a 34 39 0d 0a 36  .----..46..49..6
28170 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
28180 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
28190 54 49 4e 43 54 20 28 20 63 6f 72 30 2e 63 6f 6c  TINCT ( cor0.col
281a0 30 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  0 ) + cor0.col1 
281b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
281c0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33  0..----..110..13
281d0 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20  2..180....query 
281e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
281f0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 36  T DISTINCT + - 6
28200 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
28210 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
28220 2d 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -61....query I r
28230 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
28240 49 53 54 49 4e 43 54 20 2b 20 2b 20 28 20 63 6f  ISTINCT + + ( co
28250 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  l0 ) + - col1 * 
28260 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  ( - col1 ) FROM 
28270 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
28280 0a 37 34 32 30 0d 0a 38 33 37 30 0d 0a 39 34 34  .7420..8370..944
28290 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
282a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
282b0 20 32 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f   22 * - col2 FRO
282c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
282d0 2d 2d 2d 2d 0d 0a 2d 31 38 30 34 0d 0a 2d 32 32  ----..-1804..-22
282e0 0d 0a 2d 37 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-726....onlyif
282f0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
28300 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
28310 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
28320 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
28330 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
28340 65 6c 2d 31 31 30 39 0d 0a 53 45 4c 45 43 54 20  el-1109..SELECT 
28350 2d 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  - - CAST( NULL A
28360 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 63  S SIGNED ) + + c
28370 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2f 20 37  ol1 * + col1 / 7
28380 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
28390 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
283a0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
283b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
283c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
283d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
283e0 2d 31 31 30 39 0d 0a 53 45 4c 45 43 54 20 2d 20  -1109..SELECT - 
283f0 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
28400 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 63   INTEGER ) + + c
28410 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2f 20 37  ol1 * + col1 / 7
28420 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
28430 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
28440 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
28450 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28460 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63  ECT + col2 + + c
28470 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 39  ol0 - - col0 * 9
28480 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
28490 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
284a0 2d 0d 0a 33 32 37 0d 0a 35 38 38 31 0d 0a 37 33  -..327..5881..73
284b0 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  76....onlyif mys
284c0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
284d0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
284e0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
284f0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
28500 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
28510 31 31 31 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41  111..SELECT + CA
28520 53 54 28 20 33 35 20 41 53 20 53 49 47 4e 45 44  ST( 35 AS SIGNED
28530 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
28540 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
28550 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
28560 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 39  es hashing to d9
28570 62 31 30 33 66 37 39 63 34 65 38 66 30 64 65 34  b103f79c4e8f0de4
28580 62 37 63 31 63 38 32 31 37 38 33 61 32 39 0d 0a  b7c1c821783a29..
28590 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
285a0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
285b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
285c0 20 6c 61 62 65 6c 2d 31 31 31 31 0d 0a 53 45 4c   label-1111..SEL
285d0 45 43 54 20 2b 20 43 41 53 54 20 28 20 33 35 20  ECT + CAST ( 35 
285e0 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
285f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20  col1 FROM tab0, 
28600 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
28610 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
28620 68 69 6e 67 20 74 6f 20 64 39 62 31 30 33 66 37  hing to d9b103f7
28630 39 63 34 65 38 66 30 64 65 34 62 37 63 31 63 38  9c4e8f0de4b7c1c8
28640 32 31 37 38 33 61 32 39 0d 0a 0d 0a 6f 6e 6c 79  21783a29....only
28650 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
28660 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
28670 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
28680 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28690 74 20 6c 61 62 65 6c 2d 31 31 31 32 0d 0a 53 45  t label-1112..SE
286a0 4c 45 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 30  LECT - tab2.col0
286b0 20 44 49 56 20 2d 20 37 34 20 46 52 4f 4d 20 74   DIV - 74 FROM t
286c0 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
286d0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
286e0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 33 61  s hashing to 43a
286f0 33 38 37 65 66 34 62 61 38 35 39 32 37 64 63 33  387ef4ba85927dc3
28700 64 39 64 35 37 33 61 66 63 31 32 63 39 0d 0a 0d  d9d573afc12c9...
28710 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
28720 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
28730 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
28740 6c 61 62 65 6c 2d 31 31 31 32 0d 0a 53 45 4c 45  label-1112..SELE
28750 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2f  CT - tab2.col0 /
28760 20 2d 20 37 34 20 46 52 4f 4d 20 74 61 62 32 2c   - 74 FROM tab2,
28770 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
28780 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
28790 73 68 69 6e 67 20 74 6f 20 34 33 61 33 38 37 65  shing to 43a387e
287a0 66 34 62 61 38 35 39 32 37 64 63 33 64 39 64 35  f4ba85927dc3d9d5
287b0 37 33 61 66 63 31 32 63 39 0d 0a 0d 0a 71 75 65  73afc12c9....que
287c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
287d0 4c 45 43 54 20 41 4c 4c 20 2d 20 32 37 20 2b 20  LECT ALL - 27 + 
287e0 37 33 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 28 20  73 * col2 * + ( 
287f0 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  - col0 + + col2 
28800 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
28810 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 30 39  ab0..----..-2509
28820 0d 0a 2d 34 31 39 32 39 0d 0a 32 31 36 35 34 0d  ..-41929..21654.
28830 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28840 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
28850 20 32 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   24 AS col1 FROM
28860 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
28870 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
28880 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
28890 39 37 64 30 66 37 63 31 34 35 66 38 61 63 36 32  97d0f7c145f8ac62
288a0 33 39 32 34 34 34 38 63 37 31 34 62 62 63 63 0d  3924448c714bbcc.
288b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
288c0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
288d0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
288e0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
288f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
28900 31 31 35 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  115..SELECT - ( 
28910 2b 20 63 6f 6c 30 20 29 20 44 49 56 20 63 6f 6c  + col0 ) DIV col
28920 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
28930 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
28940 2d 31 0d 0a 2d 33 35 0d 0a 30 0d 0a 0d 0a 73 6b  -1..-35..0....sk
28950 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
28960 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
28970 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
28980 65 6c 2d 31 31 31 35 0d 0a 53 45 4c 45 43 54 20  el-1115..SELECT 
28990 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 2f 20 63  - ( + col0 ) / c
289a0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
289b0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
289c0 0d 0a 2d 31 0d 0a 2d 33 35 0d 0a 30 0d 0a 0d 0a  ..-1..-35..0....
289d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
289e0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 36 20 2b  .SELECT ALL 26 +
289f0 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41   - col1 * col0 A
28a00 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
28a10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28a20 2d 31 33 31 37 0d 0a 2d 31 39 31 0d 0a 2d 34 35  -1317..-191..-45
28a30 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
28a40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
28a50 53 54 49 4e 43 54 20 2b 20 32 35 20 2a 20 2d 20  STINCT + 25 * - 
28a60 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63  col1 * col0 AS c
28a70 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
28a80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
28a90 30 30 30 0d 0a 2d 31 39 35 30 0d 0a 2d 32 36 30  000..-1950..-260
28aa0 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  00....skipif pos
28ab0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
28ac0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
28ad0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
28ae0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
28af0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28b00 53 45 4c 45 43 54 20 2d 20 37 36 20 2b 20 2b 20  SELECT - 76 + + 
28b10 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col1 col0 FROM t
28b20 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
28b30 2d 0d 0a 31 30 0d 0a 31 35 0d 0a 32 31 0d 0a 0d  -..10..15..21...
28b40 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
28b50 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
28b60 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
28b70 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
28b80 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
28b90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28ba0 54 20 2d 20 2b 20 63 6f 6c 30 20 2d 20 33 34 20  T - + col0 - 34 
28bb0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
28bc0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
28bd0 32 33 0d 0a 2d 35 38 0d 0a 2d 36 39 0d 0a 0d 0a  23..-58..-69....
28be0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28bf0 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63  .SELECT + tab0.c
28c00 6f 6c 31 20 2a 20 2b 20 37 33 20 46 52 4f 4d 20  ol1 * + 73 FROM 
28c10 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
28c20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
28c30 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 30  es hashing to 80
28c40 66 31 62 33 62 32 32 64 38 31 38 36 64 64 63 39  f1b3b22d8186ddc9
28c50 33 63 66 35 32 34 35 63 62 64 36 62 33 38 0d 0a  3cf5245cbd6b38..
28c60 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
28c70 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
28c80 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
28c90 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
28ca0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
28cb0 32 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  21..SELECT + col
28cc0 32 20 44 49 56 20 2d 20 33 37 20 41 53 20 63 6f  2 DIV - 37 AS co
28cd0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
28ce0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  cor0..----..-2..
28cf0 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
28d00 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
28d10 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
28d20 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32  owsort label-112
28d30 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  1..SELECT + col2
28d40 20 2f 20 2d 20 33 37 20 41 53 20 63 6f 6c 32 20   / - 37 AS col2 
28d50 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
28d60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d 0a  0..----..-2..0..
28d70 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
28d80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
28d90 20 2b 20 36 34 20 2a 20 2d 20 74 61 62 32 2e 63   + 64 * - tab2.c
28da0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
28db0 2d 2d 2d 0d 0a 2d 31 30 38 38 0d 0a 2d 31 39 38  ---..-1088..-198
28dc0 34 0d 0a 2d 33 37 37 36 0d 0a 0d 0a 6f 6e 6c 79  4..-3776....only
28dd0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
28de0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
28df0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
28e00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28e10 74 20 6c 61 62 65 6c 2d 31 31 32 33 0d 0a 53 45  t label-1123..SE
28e20 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
28e30 44 49 56 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  DIV + col1 AS co
28e40 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
28e50 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73  --..1..1..1....s
28e60 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
28e70 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
28e80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
28e90 62 65 6c 2d 31 31 32 33 0d 0a 53 45 4c 45 43 54  bel-1123..SELECT
28ea0 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2f 20 2b 20   ALL + col1 / + 
28eb0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
28ec0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab0..----..1.
28ed0 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .1..1....query I
28ee0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28ef0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
28f00 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   - col2 * + col2
28f10 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
28f20 0d 0a 2d 31 35 37 34 36 34 0d 0a 2d 31 38 35 31  ..-157464..-1851
28f30 39 33 0d 0a 2d 38 38 34 37 33 36 0d 0a 0d 0a 71  93..-884736....q
28f40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28f50 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28f60 2b 20 63 6f 6c 31 20 2b 20 35 36 20 46 52 4f 4d  + col1 + 56 FROM
28f70 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
28f80 2d 2d 2d 0d 0a 31 34 32 0d 0a 31 34 37 0d 0a 31  ---..142..147..1
28f90 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  53....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 2b 20 2d 20 63 6f 72 30 2e  STINCT + - cor0.
28fc0 63 6f 6c 30 20 2a 20 2d 20 36 32 20 46 52 4f 4d  col0 * - 62 FROM
28fd0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
28fe0 2d 2d 2d 0d 0a 31 34 38 38 0d 0a 32 31 37 30 0d  ---..1488..2170.
28ff0 0a 35 35 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .5518....query I
29000 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29010 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
29020 6c 31 20 2a 20 2d 20 32 39 20 41 53 20 63 6f 6c  l1 * - 29 AS col
29030 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
29040 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 39 34  or0..----..-2494
29050 0d 0a 2d 32 36 33 39 0d 0a 2d 32 38 31 33 0d 0a  ..-2639..-2813..
29060 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
29070 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
29080 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
29090 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
290a0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
290b0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 38 0d  sort label-1128.
290c0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d  .SELECT col1 + -
290d0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
290e0 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20  IGNED ) AS col0 
290f0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
29100 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
29110 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
29120 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
29130 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
29140 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 38 0d 0a  ort label-1128..
29150 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20  SELECT col1 + - 
29160 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
29170 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30  NTEGER ) AS col0
29180 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
29190 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
291a0 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
291b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37 32  wsort..SELECT 72
291c0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
291d0 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b1 AS cor0 CROSS
291e0 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f   JOIN tab2 AS co
291f0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
29200 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 30  es hashing to 90
29210 36 62 36 33 63 39 61 64 62 37 64 39 61 63 37 33  6b63c9adb7d9ac73
29220 35 35 63 61 62 37 31 61 32 35 66 63 34 39 0d 0a  55cab71a25fc49..
29230 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29240 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
29250 20 2a 20 2b 20 39 32 20 41 53 20 63 6f 6c 30 20   * + 92 AS col0 
29260 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
29270 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 39 32 0d 0a 32  0..----..2392..2
29280 34 38 34 0d 0a 33 34 39 36 0d 0a 0d 0a 71 75 65  484..3496....que
29290 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
292a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
292b0 63 6f 6c 31 20 2b 20 2d 20 35 34 20 46 52 4f 4d  col1 + - 54 FROM
292c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
292d0 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 36 37 0d 0a 2d  ---..-64..-67..-
292e0 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
292f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
29300 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f  STINCT - cor0.co
29310 6c 32 20 2b 20 39 37 20 2b 20 34 33 20 2a 20 63  l2 + 97 + 43 * c
29320 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
29330 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30   cor0..----..140
29340 33 0d 0a 32 36 30 38 0d 0a 37 39 30 0d 0a 0d 0a  3..2608..790....
29350 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29360 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 33 39  .SELECT ALL - 39
29370 20 2b 20 2b 20 36 39 20 41 53 20 63 6f 6c 31 20   + + 69 AS col1 
29380 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
29390 2d 2d 2d 2d 0d 0a 33 30 0d 0a 33 30 0d 0a 33 30  ----..30..30..30
293a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
293b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
293c0 6c 31 20 2a 20 2b 20 28 20 2b 20 63 6f 72 30 2e  l1 * + ( + cor0.
293d0 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c 32 20  col0 ) + + col2 
293e0 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
293f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
29400 0d 0a 31 30 35 34 0d 0a 31 39 38 39 0d 0a 36 31  ..1054..1989..61
29410 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  36....skipif pos
29420 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
29430 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
29440 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
29450 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
29460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29470 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
29480 39 39 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20 46  99 * col1 col2 F
29490 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
294a0 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 33 0d 0a 33 30  ..----..1683..30
294b0 36 39 0d 0a 35 38 34 31 0d 0a 0d 0a 71 75 65 72  69..5841....quer
294c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
294d0 45 43 54 20 28 20 36 33 20 29 20 46 52 4f 4d 20  ECT ( 63 ) FROM 
294e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
294f0 2d 2d 0d 0a 36 33 0d 0a 36 33 0d 0a 36 33 0d 0a  --..63..63..63..
29500 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
29510 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
29520 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
29530 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
29540 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
29550 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  37..SELECT DISTI
29560 4e 43 54 20 2b 20 2b 20 34 36 20 44 49 56 20 2b  NCT + + 46 DIV +
29570 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 72 30 2e 63   col2 - + cor0.c
29580 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
29590 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d  r0..----..-23..-
295a0 38 39 0d 0a 31 31 0d 0a 0d 0a 73 6b 69 70 69 66  89..11....skipif
295b0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
295c0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
295d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
295e0 31 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  137..SELECT DIST
295f0 49 4e 43 54 20 2b 20 2b 20 34 36 20 2f 20 2b 20  INCT + + 46 / + 
29600 63 6f 6c 32 20 2d 20 2b 20 63 6f 72 30 2e 63 6f  col2 - + cor0.co
29610 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
29620 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 38  0..----..-23..-8
29630 39 0d 0a 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49  9..11....query I
29640 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29650 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 28 20   DISTINCT - + ( 
29660 2d 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 31 20  - col0 ) + col1 
29670 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
29680 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33  0..----..110..13
29690 32 0d 0a 31 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  2..180....onlyif
296a0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
296b0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
296c0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
296d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
296e0 6c 61 62 65 6c 2d 31 31 33 39 0d 0a 53 45 4c 45  label-1139..SELE
296f0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
29700 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2d 20  cor0.col2 DIV - 
29710 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
29720 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d  or0..----..-1...
29730 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
29740 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
29750 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
29760 6c 61 62 65 6c 2d 31 31 33 39 0d 0a 53 45 4c 45  label-1139..SELE
29770 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
29780 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2d 20 63 6f  cor0.col2 / - co
29790 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
297a0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 71  0..----..-1....q
297b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
297c0 53 45 4c 45 43 54 20 34 20 2a 20 39 38 20 46 52  SELECT 4 * 98 FR
297d0 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
297e0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
297f0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   tab2..----..27 
29800 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
29810 6f 20 65 62 66 31 36 37 34 62 66 32 63 31 38 33  o ebf1674bf2c183
29820 31 38 64 37 39 32 32 31 63 66 30 30 39 63 34 35  18d79221cf009c45
29830 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  12....query I ro
29840 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
29850 53 54 49 4e 43 54 20 2b 20 2b 20 36 36 20 46 52  STINCT + + 66 FR
29860 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
29870 0a 2d 2d 2d 2d 0d 0a 36 36 0d 0a 0d 0a 71 75 65  .----..66....que
29880 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29890 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20  LECT - - col0 * 
298a0 32 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  23 AS col2 FROM 
298b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
298c0 2d 2d 0d 0a 32 30 34 37 0d 0a 35 35 32 0d 0a 38  --..2047..552..8
298d0 30 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  05....onlyif mys
298e0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
298f0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
29900 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
29910 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
29920 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
29930 31 34 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  143..SELECT - co
29940 6c 32 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c  l2 * + CAST( NUL
29950 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  L AS SIGNED ) + 
29960 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63  ( - col2 ) * + c
29970 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
29980 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
29990 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
299a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
299b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
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 34 33 0d 0a 53 45 4c 45  label-1143..SELE
299e0 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 43 41  CT - col2 * + CA
299f0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
29a00 45 47 45 52 20 29 20 2b 20 28 20 2d 20 63 6f 6c  EGER ) + ( - col
29a10 32 20 29 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  2 ) * + col0 FRO
29a20 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
29a30 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
29a40 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
29a50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29a60 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63  T ALL - - cor0.c
29a70 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 + col2 AS co
29a80 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
29a90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d  cor0..----..109.
29aa0 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  .67..80....query
29ab0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29ac0 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2d 20 28 20  CT ALL col1 - ( 
29ad0 35 33 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  53 ) AS col1 FRO
29ae0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
29af0 2d 2d 2d 2d 0d 0a 33 33 0d 0a 33 38 0d 0a 34 34  ----..33..38..44
29b00 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29b10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
29b20 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2b 20 34 36  INCT col0 * + 46
29b30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
29b40 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
29b50 0d 0a 33 32 32 0d 0a 33 35 38 38 0d 0a 33 36 33  ..322..3588..363
29b60 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
29b70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
29b80 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31   - + col0 + col1
29b90 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
29ba0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
29bb0 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a  ..-54..-67..23..
29bc0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
29bd0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
29be0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
29bf0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
29c00 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
29c10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29c20 43 54 20 2d 20 32 37 20 2b 20 63 6f 6c 30 20 2a  CT - 27 + col0 *
29c30 20 2d 20 31 39 20 2a 20 63 6f 6c 32 20 63 6f 6c   - 19 * col2 col
29c40 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
29c50 2d 0d 0a 2d 31 33 38 36 38 39 0d 0a 2d 31 35 30  -..-138689..-150
29c60 37 35 0d 0a 2d 36 39 32 0d 0a 0d 0a 71 75 65 72  75..-692....quer
29c70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29c80 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 74  ECT - col0 + + t
29c90 61 62 31 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  ab1.col0 * - col
29ca0 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  2 * + col2 FROM 
29cb0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38  tab1..----..-208
29cc0 30 30 30 0d 0a 2d 37 33 37 33 36 30 0d 0a 2d 38  000..-737360..-8
29cd0 37 35 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  751....onlyif my
29ce0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
29cf0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
29d00 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
29d10 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
29d20 65 6c 2d 31 31 35 30 0d 0a 53 45 4c 45 43 54 20  el-1150..SELECT 
29d30 44 49 53 54 49 4e 43 54 20 2b 20 28 20 63 6f 6c  DISTINCT + ( col
29d40 31 20 29 20 2b 20 2d 20 36 20 44 49 56 20 28 20  1 ) + - 6 DIV ( 
29d50 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31  col0 ) FROM tab1
29d60 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a  ..----..10..13..
29d70 32 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  24....skipif mys
29d80 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
29d90 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
29da0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 30 0d  sort label-1150.
29db0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
29dc0 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20   + ( col1 ) + - 
29dd0 36 20 2f 20 28 20 63 6f 6c 30 20 29 20 46 52 4f  6 / ( col0 ) FRO
29de0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
29df0 0d 0a 31 33 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72  ..13..24....quer
29e00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29e10 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  ECT cor0.col2 AS
29e20 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c   col0 FROM tab1,
29e30 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
29e40 6f 72 30 2c 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  or0, tab2..----.
29e50 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69  .81 values hashi
29e60 6e 67 20 74 6f 20 39 64 33 35 35 66 31 66 32 65  ng to 9d355f1f2e
29e70 64 63 33 34 37 61 33 35 39 64 61 64 30 30 64 32  dc347a359dad00d2
29e80 64 33 66 38 38 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  d3f886....onlyif
29e90 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
29ea0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
29eb0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
29ec0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
29ed0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
29ee0 65 6c 2d 31 31 35 32 0d 0a 53 45 4c 45 43 54 20  el-1152..SELECT 
29ef0 44 49 53 54 49 4e 43 54 20 28 20 63 6f 6c 30 20  DISTINCT ( col0 
29f00 29 20 2b 20 43 41 53 54 28 20 2d 20 33 20 41 53  ) + CAST( - 3 AS
29f10 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 74 61   SIGNED ) + + ta
29f20 62 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46  b2.col1 * col2 F
29f30 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
29f40 31 36 30 39 0d 0a 37 32 32 0d 0a 38 34 31 0d 0a  1609..722..841..
29f50 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
29f60 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
29f70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29f80 20 6c 61 62 65 6c 2d 31 31 35 32 0d 0a 53 45 4c   label-1152..SEL
29f90 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 63  ECT DISTINCT ( c
29fa0 6f 6c 30 20 29 20 2b 20 43 41 53 54 20 28 20 2d  ol0 ) + CAST ( -
29fb0 20 33 20 41 53 20 49 4e 54 45 47 45 52 20 29 20   3 AS INTEGER ) 
29fc0 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20  + + tab2.col1 * 
29fd0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
29fe0 2d 2d 2d 2d 0d 0a 31 36 30 39 0d 0a 37 32 32 0d  ----..1609..722.
29ff0 0a 38 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .841....query I 
2a000 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a010 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  ALL col2 * + col
2a020 30 20 2a 20 36 36 20 46 52 4f 4d 20 74 61 62 30  0 * 66 FROM tab0
2a030 0d 0a 2d 2d 2d 2d 0d 0a 32 33 31 30 0d 0a 34 38  ..----..2310..48
2a040 31 36 36 38 0d 0a 35 32 32 37 32 0d 0a 0d 0a 6f  1668..52272....o
2a050 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2a060 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2a070 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2a080 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2a090 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a0a0 74 20 6c 61 62 65 6c 2d 31 31 35 34 0d 0a 53 45  t label-1154..SE
2a0b0 4c 45 43 54 20 28 20 74 61 62 30 2e 63 6f 6c 31  LECT ( tab0.col1
2a0c0 20 2b 20 2d 20 43 41 53 54 28 20 2d 20 63 6f 6c   + - CAST( - col
2a0d0 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 29 20  0 AS SIGNED ) ) 
2a0e0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2a0f0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33  0..----..110..13
2a100 32 0d 0a 31 38 30 0d 0a 0d 0a 73 6b 69 70 69 66  2..180....skipif
2a110 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2a120 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2a130 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2a140 31 35 34 0d 0a 53 45 4c 45 43 54 20 28 20 74 61  154..SELECT ( ta
2a150 62 30 2e 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54  b0.col1 + - CAST
2a160 20 28 20 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54   ( - col0 AS INT
2a170 45 47 45 52 20 29 20 29 20 41 53 20 63 6f 6c 32  EGER ) ) AS col2
2a180 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2a190 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d  ..110..132..180.
2a1a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a1b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2a1c0 4e 43 54 20 34 36 20 2a 20 2b 20 63 6f 6c 32 20  NCT 46 * + col2 
2a1d0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2a1e0 0a 31 31 39 36 0d 0a 31 32 34 32 0d 0a 31 37 34  .1196..1242..174
2a1f0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2a200 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2a210 20 28 20 39 37 20 29 20 41 53 20 63 6f 6c 30 20   ( 97 ) AS col0 
2a220 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20  FROM tab1, tab2 
2a230 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63 6f  AS cor0, tab1 co
2a240 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
2a250 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
2a260 37 33 66 61 36 39 37 38 64 66 38 35 32 35 63 39  73fa6978df8525c9
2a270 39 64 36 62 63 37 39 32 62 62 32 37 31 32 33 0d  9d6bc792bb27123.
2a280 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a290 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
2a2a0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col2 * - col1 FR
2a2b0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
2a2c0 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 32  --..-2838..-7462
2a2d0 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-97....query I
2a2e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a2f0 20 2d 20 38 34 20 41 53 20 63 6f 6c 31 20 46 52   - 84 AS col1 FR
2a300 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
2a310 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
2a320 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2a330 20 39 37 35 65 32 65 66 32 61 33 62 66 31 65 65   975e2ef2a3bf1ee
2a340 32 36 32 32 33 36 32 66 34 65 34 33 35 37 35 32  2622362f4e435752
2a350 66 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  f....query I row
2a360 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2a370 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 32 20  TINCT tab1.col2 
2a380 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  * + col0 * - col
2a390 32 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20  2 + - tab1.col2 
2a3a0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2a3b0 0a 2d 32 30 37 39 39 33 0d 0a 2d 37 33 37 33 37  .-207993..-73737
2a3c0 36 0d 0a 2d 38 38 30 32 0d 0a 0d 0a 71 75 65 72  6..-8802....quer
2a3d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a3e0 45 43 54 20 63 6f 6c 31 20 2a 20 74 61 62 32 2e  ECT col1 * tab2.
2a3f0 63 6f 6c 31 20 2b 20 28 20 2d 20 63 6f 6c 31 20  col1 + ( - col1 
2a400 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
2a410 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32 0d 0a  ab2..----..272..
2a420 33 34 32 32 0d 0a 39 33 30 0d 0a 0d 0a 71 75 65  3422..930....que
2a430 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a440 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2a450 63 6f 6c 31 20 2a 20 32 39 20 2b 20 2b 20 32 33  col1 * 29 + + 23
2a460 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2a470 0d 0a 2d 32 36 37 0d 0a 2d 33 35 34 0d 0a 2d 37  ..-267..-354..-7
2a480 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
2a490 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2a4a0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20  STINCT - col0 + 
2a4b0 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 2d 20 63  ( - col0 ) * - c
2a4c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2a4d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32   cor0..----..182
2a4e0 0d 0a 31 39 35 30 0d 0a 32 39 32 33 0d 0a 0d 0a  ..1950..2923....
2a4f0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
2a500 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
2a510 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
2a520 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
2a530 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
2a540 72 74 20 6c 61 62 65 6c 2d 31 31 36 33 0d 0a 53  rt label-1163..S
2a550 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
2a560 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  l2 * col2 + - co
2a570 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30  r0.col2 * + cor0
2a580 2e 63 6f 6c 30 20 2b 20 43 41 53 54 28 20 4e 55  .col0 + CAST( NU
2a590 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20  LL AS DECIMAL ) 
2a5a0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2a5b0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
2a5c0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
2a5d0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2a5e0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2a5f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2a600 6c 2d 31 31 36 33 0d 0a 53 45 4c 45 43 54 20 41  l-1163..SELECT A
2a610 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  LL + - col2 * co
2a620 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l2 + - cor0.col2
2a630 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   * + cor0.col0 +
2a640 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
2a650 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30  REAL ) FROM tab0
2a660 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a670 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
2a680 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2a690 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2a6a0 49 4e 43 54 20 2b 20 28 20 2d 20 63 6f 72 30 2e  INCT + ( - cor0.
2a6b0 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c 30 20  col0 ) + + col0 
2a6c0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2a6d0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  0..----..0....qu
2a6e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a6f0 45 4c 45 43 54 20 28 20 28 20 2d 20 63 6f 6c 32  ELECT ( ( - col2
2a700 20 29 20 29 20 2b 20 63 6f 6c 30 20 2a 20 2d 20   ) ) + col0 * - 
2a710 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53  col1 * + col2 AS
2a720 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
2a730 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2a740 31 31 39 36 37 38 0d 0a 2d 35 31 30 37 32 0d 0a  119678..-51072..
2a750 2d 35 38 38 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -5886....onlyif 
2a760 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2a770 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2a780 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2a790 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2a7a0 61 62 65 6c 2d 31 31 36 36 0d 0a 53 45 4c 45 43  abel-1166..SELEC
2a7b0 54 20 41 4c 4c 20 36 30 20 2a 20 2d 20 74 61 62  T ALL 60 * - tab
2a7c0 31 2e 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c  1.col2 DIV + col
2a7d0 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
2a7e0 2d 0d 0a 2d 36 30 0d 0a 2d 36 30 0d 0a 2d 36 30  -..-60..-60..-60
2a7f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2a800 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2a810 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2a820 72 74 20 6c 61 62 65 6c 2d 31 31 36 36 0d 0a 53  rt label-1166..S
2a830 45 4c 45 43 54 20 41 4c 4c 20 36 30 20 2a 20 2d  ELECT ALL 60 * -
2a840 20 74 61 62 31 2e 63 6f 6c 32 20 2f 20 2b 20 63   tab1.col2 / + c
2a850 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
2a860 2d 2d 2d 0d 0a 2d 36 30 0d 0a 2d 36 30 0d 0a 2d  ---..-60..-60..-
2a870 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
2a880 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2a890 4c 20 2d 20 28 20 33 32 20 29 20 46 52 4f 4d 20  L - ( 32 ) FROM 
2a8a0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2a8b0 2d 2d 0d 0a 2d 33 32 0d 0a 2d 33 32 0d 0a 2d 33  --..-32..-32..-3
2a8c0 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
2a8d0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2a8e0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2a8f0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2a900 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2a910 2d 31 31 36 38 0d 0a 53 45 4c 45 43 54 20 2d 20  -1168..SELECT - 
2a920 33 35 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53  35 DIV - col0 AS
2a930 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2a940 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2a950 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..1..1....skipif
2a960 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2a970 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2a980 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2a990 31 36 38 0d 0a 53 45 4c 45 43 54 20 2d 20 33 35  168..SELECT - 35
2a9a0 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   / - col0 AS col
2a9b0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2a9c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  or0..----..0..1.
2a9d0 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
2a9e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2a9f0 53 54 49 4e 43 54 20 30 20 2a 20 34 30 20 46 52  STINCT 0 * 40 FR
2aa00 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2aa10 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .----..0....quer
2aa20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2aa30 45 43 54 20 63 6f 6c 32 20 2a 20 35 32 20 41 53  ECT col2 * 52 AS
2aa40 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2aa50 0a 2d 2d 2d 2d 0d 0a 32 38 30 38 0d 0a 32 39 36  .----..2808..296
2aa60 34 0d 0a 34 39 39 32 0d 0a 0d 0a 71 75 65 72 79  4..4992....query
2aa70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2aa80 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
2aa90 6c 32 20 2b 20 28 20 2d 20 38 20 29 20 2a 20 63  l2 + ( - 8 ) * c
2aaa0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
2aab0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37   tab1..----..-37
2aac0 38 0d 0a 2d 33 39 39 0d 0a 2d 36 37 32 0d 0a 0d  8..-399..-672...
2aad0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2aae0 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28 20 2d  ..SELECT - + ( -
2aaf0 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
2ab00 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2ab10 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d  ----..1..33..82.
2ab20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2ab30 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 38  rt..SELECT ( + 8
2ab40 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c   ) * col0 AS col
2ab50 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
2ab60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a 36  or0..----..56..6
2ab70 32 34 0d 0a 36 33 32 0d 0a 0d 0a 71 75 65 72 79  24..632....query
2ab80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ab90 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 37  CT cor0.col1 + 7
2aba0 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
2abb0 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  2 AS cor0, tab0 
2abc0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
2abd0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2abe0 20 30 36 34 30 39 61 62 31 39 34 61 62 30 63 34   06409ab194ab0c4
2abf0 34 66 36 38 38 33 31 38 34 62 62 61 34 30 34 38  4f6883184bba4048
2ac00 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
2ac10 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2ac20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2ac30 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2ac40 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2ac50 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2ac60 37 35 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  75..SELECT - CAS
2ac70 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45  T( col2 AS SIGNE
2ac80 44 20 29 20 2a 20 63 6f 6c 32 20 2d 20 2b 20 28  D ) * col2 - + (
2ac90 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a   - col0 + col2 *
2aca0 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20   col0 ) AS col1 
2acb0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2acc0 0a 2d 31 36 38 31 36 0d 0a 2d 33 30 37 35 0d 0a  .-16816..-3075..
2acd0 2d 36 38 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  -6833....skipif 
2ace0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2acf0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2ad00 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2ad10 37 35 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  75..SELECT - CAS
2ad20 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45  T ( col2 AS INTE
2ad30 47 45 52 20 29 20 2a 20 63 6f 6c 32 20 2d 20 2b  GER ) * col2 - +
2ad40 20 28 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   ( - col0 + col2
2ad50 20 2a 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   * col0 ) AS col
2ad60 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
2ad70 2d 0d 0a 2d 31 36 38 31 36 0d 0a 2d 33 30 37 35  -..-16816..-3075
2ad80 0d 0a 2d 36 38 33 33 0d 0a 0d 0a 71 75 65 72 79  ..-6833....query
2ad90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ada0 43 54 20 2b 20 63 6f 6c 31 20 2b 20 34 33 20 41  CT + col1 + 43 A
2adb0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
2adc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2add0 35 33 0d 0a 35 36 0d 0a 36 39 0d 0a 0d 0a 71 75  53..56..69....qu
2ade0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2adf0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
2ae00 20 2b 20 31 20 29 20 41 53 20 63 6f 6c 32 20 46   + 1 ) AS col2 F
2ae10 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2ae20 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
2ae30 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2ae40 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2ae50 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2ae60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2ae70 2d 31 31 37 38 0d 0a 53 45 4c 45 43 54 20 74 61  -1178..SELECT ta
2ae80 62 32 2e 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63  b2.col0 + tab2.c
2ae90 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 46 52 4f  ol0 DIV col0 FRO
2aea0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 39  M tab2..----..79
2aeb0 0d 0a 38 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69  ..8..80....skipi
2aec0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2aed0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2aee0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2aef0 31 31 37 38 0d 0a 53 45 4c 45 43 54 20 74 61 62  1178..SELECT tab
2af00 32 2e 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63 6f  2.col0 + tab2.co
2af10 6c 30 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 / col0 FROM t
2af20 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 39 0d 0a 38  ab2..----..79..8
2af30 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..80....query I 
2af40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2af50 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  + col1 + - col2 
2af60 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  * + col1 AS col1
2af70 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2af80 0d 0a 2d 31 32 33 35 0d 0a 2d 31 33 37 38 0d 0a  ..-1235..-1378..
2af90 2d 35 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -560....query I 
2afa0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2afb0 2d 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  - - col1 * + col
2afc0 30 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 28 20 63  0 + col0 + - ( c
2afd0 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20 41 53 20  ol2 ) * col2 AS 
2afe0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
2aff0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36 34 0d  or0..----..1464.
2b000 0a 33 34 32 39 0d 0a 39 39 39 0d 0a 0d 0a 6f 6e  .3429..999....on
2b010 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2b020 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2b030 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2b040 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2b050 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 31 0d 0a  ort label-1181..
2b060 53 45 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20  SELECT col1 DIV 
2b070 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  col0 + col1 * co
2b080 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
2b090 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2b0a0 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 31 32 0d 0a  --..1248..1412..
2b0b0 35 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  570....skipif my
2b0c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2b0d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2b0e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 31  wsort label-1181
2b0f0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20  ..SELECT col1 / 
2b100 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  col0 + col1 * co
2b110 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
2b120 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2b130 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 31 32 0d 0a  --..1248..1412..
2b140 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  570....query I r
2b150 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2b160 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32   - col1 + - col2
2b170 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   * cor0.col1 AS 
2b180 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
2b190 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2b1a0 34 37 35 0d 0a 2d 36 32 39 0d 0a 2d 38 30 36 0d  475..-629..-806.
2b1b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2b1c0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2b1d0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2b1e0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2b1f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2b200 31 38 33 0d 0a 53 45 4c 45 43 54 20 37 39 20 2b  183..SELECT 79 +
2b210 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56   + cor0.col0 DIV
2b220 20 2b 20 35 34 20 41 53 20 63 6f 6c 31 20 46 52   + 54 AS col1 FR
2b230 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
2b240 2d 2d 0d 0a 37 39 0d 0a 38 30 0d 0a 38 30 0d 0a  --..79..80..80..
2b250 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2b260 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2b270 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b280 20 6c 61 62 65 6c 2d 31 31 38 33 0d 0a 53 45 4c   label-1183..SEL
2b290 45 43 54 20 37 39 20 2b 20 2b 20 63 6f 72 30 2e  ECT 79 + + cor0.
2b2a0 63 6f 6c 30 20 2f 20 2b 20 35 34 20 41 53 20 63  col0 / + 54 AS c
2b2b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
2b2c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 39 0d 0a 38 30  r0..----..79..80
2b2d0 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..80....query I 
2b2e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b2f0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
2b300 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  * + cor0.col2 + 
2b310 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53  - col2 * col1 AS
2b320 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
2b330 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2b340 31 30 38 0d 0a 2d 38 35 38 0d 0a 37 39 38 0d 0a  108..-858..798..
2b350 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b360 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2b370 43 54 20 2b 20 32 36 20 2b 20 2b 20 63 6f 6c 32  CT + 26 + + col2
2b380 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2b390 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 32  r0..----..108..2
2b3a0 37 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49  7..59....query I
2b3b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b3c0 20 2d 20 2b 20 37 37 20 2b 20 2b 20 63 6f 6c 32   - + 77 + + col2
2b3d0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2b3e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 0d 0a 2d  r0..----..-39..-
2b3f0 35 30 0d 0a 2d 35 31 0d 0a 0d 0a 71 75 65 72 79  50..-51....query
2b400 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b410 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
2b420 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63  r0.col1 * cor0.c
2b430 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f  ol0 + + col1 FRO
2b440 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2b450 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 30 35 33 0d  ----..104..1053.
2b460 0a 36 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .650....query I 
2b470 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b480 2b 20 32 35 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  + 25 * cor0.col0
2b490 20 2b 20 2b 20 31 34 20 46 52 4f 4d 20 74 61 62   + + 14 FROM tab
2b4a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2b4b0 0a 31 38 39 0d 0a 31 39 36 34 0d 0a 31 39 38 39  .189..1964..1989
2b4c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b4d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2b4e0 28 20 37 34 20 29 20 46 52 4f 4d 20 74 61 62 31  ( 74 ) FROM tab1
2b4f0 0d 0a 2d 2d 2d 2d 0d 0a 37 34 0d 0a 37 34 0d 0a  ..----..74..74..
2b500 37 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  74....skipif pos
2b510 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2b520 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2b530 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2b540 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2b550 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b560 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
2b570 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c  ol2 * + col2 col
2b580 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
2b590 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37  ..----..1444..67
2b5a0 36 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20  6..729....query 
2b5b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b5c0 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63  T ALL - + cor0.c
2b5d0 6f 6c 31 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 - col1 AS co
2b5e0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
2b5f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38  cor0..----..-118
2b600 0d 0a 2d 33 34 0d 0a 2d 36 32 0d 0a 0d 0a 71 75  ..-34..-62....qu
2b610 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b620 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
2b630 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b  ol1 * - col0 + +
2b640 20 34 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   41 AS col2 FROM
2b650 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2b660 2d 2d 2d 0d 0a 2d 32 30 32 33 0d 0a 2d 33 33 35  ---..-2023..-335
2b670 34 0d 0a 2d 38 30 35 38 0d 0a 0d 0a 71 75 65 72  4..-8058....quer
2b680 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b690 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 28  ECT - col2 * - (
2b6a0 20 35 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20   50 ) FROM tab1 
2b6b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
2b6c0 37 30 30 0d 0a 32 38 35 30 0d 0a 34 38 30 30 0d  700..2850..4800.
2b6d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b6e0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
2b6f0 30 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  0 - col1 * - col
2b700 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
2b710 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 32 0d  or0..----..1422.
2b720 0a 32 32 34 0d 0a 34 36 38 30 0d 0a 0d 0a 6f 6e  .224..4680....on
2b730 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2b740 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2b750 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2b760 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2b770 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 35 0d 0a  ort label-1195..
2b780 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2b790 2b 20 31 35 20 44 49 56 20 2b 20 63 6f 6c 31 20  + 15 DIV + col1 
2b7a0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2b7b0 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
2b7c0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2b7d0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2b7e0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 35 0d  sort label-1195.
2b7f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2b800 20 2b 20 31 35 20 2f 20 2b 20 63 6f 6c 31 20 46   + 15 / + col1 F
2b810 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2b820 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
2b830 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2b840 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2b850 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2b860 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2b870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b880 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 31  ELECT col2 * - 1
2b890 31 20 2a 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52  1 * col0 col1 FR
2b8a0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2b8b0 0a 2d 2d 2d 2d 0d 0a 2d 33 38 35 0d 0a 2d 38 30  .----..-385..-80
2b8c0 32 37 38 0d 0a 2d 38 37 31 32 0d 0a 0d 0a 6f 6e  278..-8712....on
2b8d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2b8e0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2b8f0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2b900 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2b910 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b920 20 6c 61 62 65 6c 2d 31 31 39 37 0d 0a 53 45 4c   label-1197..SEL
2b930 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 43  ECT + col0 * + C
2b940 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
2b950 49 4d 41 4c 20 29 20 63 6f 6c 30 20 46 52 4f 4d  IMAL ) col0 FROM
2b960 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2b970 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
2b980 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
2b990 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2b9a0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2b9b0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2b9c0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2b9d0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2b9e0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2b9f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ba00 20 6c 61 62 65 6c 2d 31 31 39 37 0d 0a 53 45 4c   label-1197..SEL
2ba10 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 43  ECT + col0 * + C
2ba20 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45  AST ( NULL AS RE
2ba30 41 4c 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74  AL ) col0 FROM t
2ba40 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2ba50 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2ba60 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
2ba70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2ba80 4c 4c 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b  LL tab1.col0 * +
2ba90 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62 31 2e 63   col1 * - tab1.c
2baa0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
2bab0 2d 2d 2d 0d 0a 2d 31 33 35 32 30 0d 0a 2d 32 30  ---..-13520..-20
2bac0 32 38 0d 0a 2d 36 34 30 30 0d 0a 0d 0a 6f 6e 6c  28..-6400....onl
2bad0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2bae0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2baf0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2bb00 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2bb10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2bb20 6c 61 62 65 6c 2d 31 31 39 39 0d 0a 53 45 4c 45  label-1199..SELE
2bb30 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
2bb40 53 54 28 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  ST( cor0.col0 AS
2bb50 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
2bb60 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
2bb70 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a  0..----..3..64..
2bb80 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  80....skipif mys
2bb90 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2bba0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2bbb0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 39 0d  sort label-1199.
2bbc0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2bbd0 20 2b 20 43 41 53 54 20 28 20 63 6f 72 30 2e 63   + CAST ( cor0.c
2bbe0 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
2bbf0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
2bc00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2bc10 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c  3..64..80....onl
2bc20 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2bc30 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2bc40 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2bc50 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2bc60 72 74 20 6c 61 62 65 6c 2d 31 32 30 30 0d 0a 53  rt label-1200..S
2bc70 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 38  ELECT DISTINCT 8
2bc80 38 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72  8 * col2 * - cor
2bc90 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2d 20  0.col1 + col1 - 
2bca0 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c  - col2 DIV - col
2bcb0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2bcc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 38  or0..----..-1098
2bcd0 31 32 0d 0a 2d 31 32 33 35 34 34 0d 0a 2d 35 30  12..-123544..-50
2bce0 31 35 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  150....skipif my
2bcf0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2bd00 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2bd10 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 30 30  wsort label-1200
2bd20 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2bd30 54 20 38 38 20 2a 20 63 6f 6c 32 20 2a 20 2d 20  T 88 * col2 * - 
2bd40 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31  cor0.col1 + col1
2bd50 20 2d 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 63 6f   - - col2 / - co
2bd60 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
2bd70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39  cor0..----..-109
2bd80 38 31 32 0d 0a 2d 31 32 33 35 34 34 0d 0a 2d 35  812..-123544..-5
2bd90 30 31 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0150....query I 
2bda0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2bdb0 41 4c 4c 20 37 31 20 2b 20 2b 20 28 20 2b 20 63  ALL 71 + + ( + c
2bdc0 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20  or0.col1 ) FROM 
2bdd0 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
2bde0 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61  SS JOIN tab2, ta
2bdf0 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31  b1 AS cor1, tab1
2be00 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
2be10 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  81 values hashin
2be20 67 20 74 6f 20 34 34 33 34 63 34 66 64 39 61 34  g to 4434c4fd9a4
2be30 64 61 39 35 31 30 39 31 30 39 36 63 38 62 39 66  da951091096c8b9f
2be40 61 32 37 63 33 0d 0a 0d 0a 71 75 65 72 79 20 49  a27c3....query I
2be50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2be60 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20 74 61   ALL col0 + + ta
2be70 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  b0.col0 AS col0 
2be80 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2be90 0a 31 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a  .178..48..70....
2bea0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2beb0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20 2d  .SELECT col1 / -
2bec0 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab0.col1 FROM 
2bed0 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20 4e  tab0 WHERE NOT N
2bee0 55 4c 4c 20 3d 20 63 6f 6c 30 20 2a 20 63 6f 6c  ULL = col0 * col
2bef0 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  1..----....query
2bf00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2bf10 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  CT - col0 + + co
2bf20 6c 30 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30  l0 * + tab1.col0
2bf30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2bf40 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 30 33 32 0d 0a  b1..----..4032..
2bf50 36 0d 0a 36 33 32 30 0d 0a 0d 0a 71 75 65 72 79  6..6320....query
2bf60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2bf70 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
2bf80 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30   + col1 + - cor0
2bf90 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41  .col0 * + col0 A
2bfa0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2bfb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2bfc0 2d 31 30 39 33 0d 0a 2d 34 36 36 0d 0a 2d 37 37  -1093..-466..-77
2bfd0 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  41....query III 
2bfe0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2bff0 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20  DISTINCT * FROM 
2c000 74 61 62 30 20 57 48 45 52 45 20 63 6f 6c 32 20  tab0 WHERE col2 
2c010 49 4e 20 28 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d  IN ( col1 )..---
2c020 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
2c030 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2c040 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2d 20 2b  TINCT - col0 - +
2c050 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41   col1 * + col1 A
2c060 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2c070 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 35 39 0d 0a 2d  ..----..-3559..-
2c080 33 36 38 0d 0a 2d 39 36 38 0d 0a 0d 0a 71 75 65  368..-968....que
2c090 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
2c0a0 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f  SELECT ALL * FRO
2c0b0 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54  M tab0 WHERE NOT
2c0c0 20 4e 55 4c 4c 20 3d 20 63 6f 6c 32 0d 0a 2d 2d   NULL = col2..--
2c0d0 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
2c0e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2c0f0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 46 52  STINCT + col0 FR
2c100 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 63 6f  OM tab2 WHERE co
2c110 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2f 20 2d 20  l2 * - col1 / - 
2c120 63 6f 6c 31 20 3c 3d 20 4e 55 4c 4c 0d 0a 2d 2d  col1 <= NULL..--
2c130 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  --....query III 
2c140 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c150 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20  DISTINCT * FROM 
2c160 74 61 62 31 20 57 48 45 52 45 20 4e 55 4c 4c 20  tab1 WHERE NULL 
2c170 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f 6c 30 20  NOT IN ( + col0 
2c180 2a 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a  * col1 )..----..
2c190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c1a0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
2c1b0 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 41 53 20   col2 - col2 AS 
2c1c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
2c1d0 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36  ----..10..13..26
2c1e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c1f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2c200 6c 32 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l2 - col0 * - co
2c210 6c 30 20 2a 20 74 61 62 32 2e 63 6f 6c 30 20 46  l0 * tab2.col0 F
2c220 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
2c230 33 31 36 0d 0a 34 37 34 35 32 36 0d 0a 34 39 33  316..474526..493
2c240 30 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  001....query I r
2c250 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2c260 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d  ISTINCT col1 * -
2c270 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 46   col1 + + col1 F
2c280 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2c290 2d 37 33 31 30 0d 0a 2d 38 31 39 30 0d 0a 2d 39  -7310..-8190..-9
2c2a0 33 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  312....query III
2c2b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c2c0 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d   DISTINCT * FROM
2c2d0 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20   tab2 WHERE NOT 
2c2e0 2d 20 63 6f 6c 30 20 4e 4f 54 20 49 4e 20 28 20  - col0 NOT IN ( 
2c2f0 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  + col2 * + col1 
2c300 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69  )..----....onlyi
2c310 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2c320 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2c330 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2c340 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c350 20 6c 61 62 65 6c 2d 31 32 31 35 0d 0a 53 45 4c   label-1215..SEL
2c360 45 43 54 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d  ECT + col2 DIV -
2c370 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab0.col0 FROM 
2c380 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  tab0..----..-1..
2c390 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
2c3a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2c3b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2c3c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31  owsort label-121
2c3d0 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  5..SELECT + col2
2c3e0 20 2f 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 46   / - tab0.col0 F
2c3f0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2c400 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  -1..0..0....quer
2c410 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c420 45 43 54 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20  ECT tab1.col1 * 
2c430 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2d 20  col1 + - col1 - 
2c440 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
2c450 2d 2d 2d 2d 0d 0a 32 36 0d 0a 36 34 37 0d 0a 37  ----..26..647..7
2c460 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2c470 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2c480 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   - + col2 * - co
2c490 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  l0 + + col2 + + 
2c4a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
2c4b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  S cor0..----..21
2c4c0 31 33 0d 0a 32 34 37 0d 0a 33 30 35 37 0d 0a 0d  13..247..3057...
2c4d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c4e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2c4f0 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e  T col1 * + cor0.
2c500 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  col2 + cor0.col2
2c510 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
2c520 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2c530 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 39 38 0d  or0..----..-798.
2c540 0a 31 30 38 0d 0a 38 35 38 0d 0a 0d 0a 71 75 65  .108..858....que
2c550 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c560 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
2c570 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2b 20  * cor0.col0 - + 
2c580 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  col1 * - col0 * 
2c590 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
2c5a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 37 33  or0..----..12573
2c5b0 36 0d 0a 35 37 32 37 35 0d 0a 35 39 30 38 0d 0a  6..57275..5908..
2c5c0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2c5d0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2c5e0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2c5f0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2c600 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2c610 32 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  20..SELECT DISTI
2c620 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  NCT - col0 * col
2c630 31 20 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20 2d  1 DIV + col2 + -
2c640 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c   cor0.col0 * col
2c650 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2c660 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2c670 2d 0d 0a 2d 31 36 33 0d 0a 2d 33 36 35 39 0d 0a  -..-163..-3659..
2c680 2d 37 36 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -7690....skipif 
2c690 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2c6a0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2c6b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2c6c0 32 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  20..SELECT DISTI
2c6d0 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  NCT - col0 * col
2c6e0 31 20 2f 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  1 / + col2 + - c
2c6f0 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  or0.col0 * col2 
2c700 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2c710 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2c720 0a 2d 31 36 33 0d 0a 2d 33 36 35 39 0d 0a 2d 37  .-163..-3659..-7
2c730 36 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  690....query I r
2c740 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2c750 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31  LL col2 * + col1
2c760 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
2c770 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
2c780 2d 0d 0a 31 36 32 32 34 0d 0a 33 36 35 30 34 0d  -..16224..36504.
2c790 0a 35 37 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .5700....query I
2c7a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c7b0 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   - - col0 + + co
2c7c0 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
2c7d0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2c7e0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36  0..----..128..16
2c7f0 30 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..6....query I 
2c800 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c810 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  ALL + col0 * - c
2c820 6f 6c 30 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20  ol0 + tab2.col2 
2c830 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2c840 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 36  2..----..-22..-6
2c850 30 35 38 0d 0a 2d 36 32 30 33 0d 0a 0d 0a 71 75  058..-6203....qu
2c860 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c870 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
2c880 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30   - col2 + + col0
2c890 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2c8a0 0d 0a 2d 31 30 36 35 0d 0a 2d 36 36 33 35 0d 0a  ..-1065..-6635..
2c8b0 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
2c8c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2c8d0 53 54 49 4e 43 54 20 2b 20 74 61 62 32 2e 63 6f  STINCT + tab2.co
2c8e0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
2c8f0 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
2c900 53 53 20 4a 4f 49 4e 20 74 61 62 32 0d 0a 2d 2d  SS JOIN tab2..--
2c910 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a  --..26..27..38..
2c920 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c930 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
2c940 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 74 61   + - col0 * - ta
2c950 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b2.col2 FROM tab
2c960 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34 0d 0a 32  2..----..2054..2
2c970 31 36 0d 0a 33 30 34 30 0d 0a 0d 0a 71 75 65 72  16..3040....quer
2c980 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c990 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a  ECT ALL - col1 *
2c9a0 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41   col0 + + col2 A
2c9b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2c9c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 33 31 0d 0a 2d  ..----..-2031..-
2c9d0 33 33 39 34 0d 0a 2d 38 30 31 37 0d 0a 0d 0a 6f  3394..-8017....o
2c9e0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2c9f0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2ca00 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2ca10 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2ca20 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 38 0d  sort label-1228.
2ca30 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31  .SELECT - - col1
2ca40 20 2b 20 2b 20 28 20 2b 20 37 38 20 29 20 2b 20   + + ( + 78 ) + 
2ca50 63 6f 6c 30 20 44 49 56 20 34 35 20 41 53 20 63  col0 DIV 45 AS c
2ca60 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2ca70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
2ca80 0d 0a 38 39 0d 0a 39 32 0d 0a 0d 0a 73 6b 69 70  ..89..92....skip
2ca90 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2caa0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2cab0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2cac0 2d 31 32 32 38 0d 0a 53 45 4c 45 43 54 20 2d 20  -1228..SELECT - 
2cad0 2d 20 63 6f 6c 31 20 2b 20 2b 20 28 20 2b 20 37  - col1 + + ( + 7
2cae0 38 20 29 20 2b 20 63 6f 6c 30 20 2f 20 34 35 20  8 ) + col0 / 45 
2caf0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2cb00 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2cb10 0a 31 30 34 0d 0a 38 39 0d 0a 39 32 0d 0a 0d 0a  .104..89..92....
2cb20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2cb30 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
2cb40 20 31 38 20 2a 20 2b 20 31 34 20 41 53 20 63 6f   18 * + 14 AS co
2cb50 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
2cb60 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 36 34 0d 0a  0..----..20664..
2cb70 32 35 32 0d 0a 38 33 31 36 0d 0a 0d 0a 71 75 65  252..8316....que
2cb80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2cb90 4c 45 43 54 20 2d 20 35 33 20 2b 20 2b 20 63 6f  LECT - 53 + + co
2cba0 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63  l1 * - col1 AS c
2cbb0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
2cbc0 2d 2d 2d 0d 0a 2d 31 30 31 34 0d 0a 2d 33 34 32  ---..-1014..-342
2cbd0 0d 0a 2d 33 35 33 34 0d 0a 0d 0a 6f 6e 6c 79 69  ..-3534....onlyi
2cbe0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2cbf0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2cc00 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2cc10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2cc20 20 6c 61 62 65 6c 2d 31 32 33 31 0d 0a 53 45 4c   label-1231..SEL
2cc30 45 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 35  ECT + col0 DIV 5
2cc40 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  5 AS col1 FROM t
2cc50 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2cc60 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b  -..0..1..1....sk
2cc70 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2cc80 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2cc90 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2cca0 65 6c 2d 31 32 33 31 0d 0a 53 45 4c 45 43 54 20  el-1231..SELECT 
2ccb0 2b 20 63 6f 6c 30 20 2f 20 35 35 20 41 53 20 63  + col0 / 55 AS c
2ccc0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2ccd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2cce0 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..1....query I 
2ccf0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2cd00 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30  cor0.col0 + cor0
2cd10 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 41  .col2 + + col2 A
2cd20 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2cd30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2cd40 31 33 30 0d 0a 31 35 35 0d 0a 36 31 0d 0a 0d 0a  130..155..61....
2cd50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2cd60 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b  .SELECT col2 * +
2cd70 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   ( col0 ) FROM t
2cd80 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
2cd90 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a 0d  35..7298..792...
2cda0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2cdb0 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
2cdc0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
2cdd0 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61 62 30  tab1, tab0, tab0
2cde0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 0d 0a   AS cor0, tab2..
2cdf0 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20  ----..81 values 
2ce00 68 61 73 68 69 6e 67 20 74 6f 20 65 39 33 38 37  hashing to e9387
2ce10 37 37 65 62 66 66 63 32 65 33 65 39 63 30 63 64  77ebffc2e3e9c0cd
2ce20 66 61 61 34 66 37 33 32 63 30 35 0d 0a 0d 0a 6f  faa4f732c05....o
2ce30 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2ce40 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2ce50 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2ce60 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2ce70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ce80 74 20 6c 61 62 65 6c 2d 31 32 33 35 0d 0a 53 45  t label-1235..SE
2ce90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
2cea0 63 6f 6c 31 20 29 20 2a 20 28 20 63 6f 6c 32 20  col1 ) * ( col2 
2ceb0 29 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 43 41 53  ) + + col0 * CAS
2cec0 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d  T( NULL AS DECIM
2ced0 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  AL ) FROM tab2..
2cee0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
2cef0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2cf00 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2cf10 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2cf20 65 6c 2d 31 32 33 35 0d 0a 53 45 4c 45 43 54 20  el-1235..SELECT 
2cf30 44 49 53 54 49 4e 43 54 20 28 20 63 6f 6c 31 20  DISTINCT ( col1 
2cf40 29 20 2a 20 28 20 63 6f 6c 32 20 29 20 2b 20 2b  ) * ( col2 ) + +
2cf50 20 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 4e   col0 * CAST ( N
2cf60 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 46 52  ULL AS REAL ) FR
2cf70 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab2..----..N
2cf80 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
2cf90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2cfa0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
2cfb0 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20   col0 + col1 AS 
2cfc0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
2cfd0 2d 2d 2d 2d 0d 0a 2d 31 31 32 38 0d 0a 2d 34 39  ----..-1128..-49
2cfe0 30 0d 0a 2d 37 38 33 30 0d 0a 0d 0a 73 6b 69 70  0..-7830....skip
2cff0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2d000 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2d010 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2d020 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2d030 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2d040 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2d050 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63  TINCT + col1 * c
2d060 6f 6c 31 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol1 + col2 + col
2d070 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  1 col1 FROM tab0
2d080 0d 0a 2d 2d 2d 2d 0d 0a 37 35 31 35 0d 0a 38 34  ..----..7515..84
2d090 35 34 0d 0a 39 35 30 37 0d 0a 0d 0a 71 75 65 72  54..9507....quer
2d0a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d0b0 45 43 54 20 2d 20 32 39 20 2a 20 63 6f 6c 30 20  ECT - 29 * col0 
2d0c0 2b 20 2d 20 39 39 20 41 53 20 63 6f 6c 32 20 46  + - 99 AS col2 F
2d0d0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2d0e0 2d 31 31 31 34 0d 0a 2d 32 36 38 30 0d 0a 2d 37  -1114..-2680..-7
2d0f0 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  95....query I ro
2d100 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2d110 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
2d120 2d 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 2d 20  - tab1.col2 * - 
2d130 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
2d140 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab1..----..-2
2d150 33 33 34 37 32 0d 0a 2d 34 38 36 0d 0a 2d 36 31  33472..-486..-61
2d160 34 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4400....query I 
2d170 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d180 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 31 30 20 41  cor0.col2 * 10 A
2d190 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
2d1a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2d1b0 32 36 30 0d 0a 32 37 30 0d 0a 33 38 30 0d 0a 0d  260..270..380...
2d1c0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2d1d0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2d1e0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2d1f0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2d200 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2d210 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d220 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 28 20 63  T + col1 * - ( c
2d230 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 29 20 63  ol0 * + col2 ) c
2d240 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2d250 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
2d260 39 36 35 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35  9652..-51034..-5
2d270 38 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  859....query I r
2d280 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2d290 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31  ISTINCT - - col1
2d2a0 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   + - cor0.col2 *
2d2b0 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
2d2c0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2d2d0 0a 2d 31 33 36 0d 0a 2d 33 36 33 38 0d 0a 2d 37  .-136..-3638..-7
2d2e0 36 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  667....query I r
2d2f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2d300 4c 4c 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 2a  LL - cor1.col1 *
2d310 20 63 6f 72 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor1.col0 FROM 
2d320 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
2d330 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20  SS JOIN tab1 AS 
2d340 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
2d350 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2d360 30 63 65 61 31 62 65 35 35 31 66 62 34 62 64 38  0cea1be551fb4bd8
2d370 38 66 34 64 61 30 62 37 64 36 37 36 65 65 32 66  8f4da0b7d676ee2f
2d380 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d390 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
2d3a0 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col0 * + cor0.co
2d3b0 6c 32 20 2a 20 36 32 20 2b 20 63 6f 6c 32 20 2b  l2 * 62 + col2 +
2d3c0 20 38 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   89 AS col1 FROM
2d3d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2d3e0 2d 2d 2d 0d 0a 31 30 31 38 37 0d 0a 32 32 36 33  ---..10187..2263
2d3f0 32 32 0d 0a 34 37 36 33 34 35 0d 0a 0d 0a 71 75  22..476345....qu
2d400 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d410 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d  ELECT + col0 * -
2d420 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 41   col2 * + col2 A
2d430 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
2d440 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39 33 36 0d  ..----..-207936.
2d450 0a 2d 37 33 37 32 38 30 0d 0a 2d 38 37 34 38 0d  .-737280..-8748.
2d460 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
2d470 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2d480 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  TINCT * FROM tab
2d490 31 20 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20  1 WHERE NULL IN 
2d4a0 28 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 74 61 62  ( + col2 + - tab
2d4b0 31 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  1.col2 * + col1 
2d4c0 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69  )..----....skipi
2d4d0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2d4e0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2d4f0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2d500 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2d510 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2d520 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2d530 49 4e 43 54 20 63 6f 6c 30 20 63 6f 6c 31 20 46  INCT col0 col1 F
2d540 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 2b  ROM tab2 WHERE +
2d550 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b   col2 * - col1 +
2d560 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 3e   + col0 + col0 >
2d570 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  = NULL..----....
2d580 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d590 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
2d5a0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41   - col1 + col2 A
2d5b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2d5c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 35 0d 0a 2d  ..----..-2805..-
2d5d0 37 33 38 30 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e 6c  7380..-96....onl
2d5e0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2d5f0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2d600 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2d610 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2d620 72 74 20 6c 61 62 65 6c 2d 31 32 34 39 0d 0a 53  rt label-1249..S
2d630 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2d640 20 74 61 62 30 2e 63 6f 6c 30 20 44 49 56 20 2b   tab0.col0 DIV +
2d650 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
2d660 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab0..----..0
2d670 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2d680 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2d690 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2d6a0 72 74 20 6c 61 62 65 6c 2d 31 32 34 39 0d 0a 53  rt label-1249..S
2d6b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2d6c0 20 74 61 62 30 2e 63 6f 6c 30 20 2f 20 2b 20 63   tab0.col0 / + c
2d6d0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
2d6e0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab0..----..0..
2d6f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2d700 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2d710 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2d720 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2d730 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2d740 35 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  50..SELECT + col
2d750 30 20 2a 20 2b 20 63 6f 6c 30 20 44 49 56 20 63  0 * + col0 DIV c
2d760 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
2d770 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a  ---..7..78..79..
2d780 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2d790 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2d7a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d7b0 20 6c 61 62 65 6c 2d 31 32 35 30 0d 0a 53 45 4c   label-1250..SEL
2d7c0 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  ECT + col0 * + c
2d7d0 6f 6c 30 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 / col0 FROM 
2d7e0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37  tab2..----..7..7
2d7f0 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  8..79....query I
2d800 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d810 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 32   ALL + tab1.col2
2d820 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 74 61 62 31   + col1 - - tab1
2d830 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d  .col1 FROM tab1.
2d840 0a 2d 2d 2d 2d 0d 0a 31 30 36 0d 0a 31 32 32 0d  .----..106..122.
2d850 0a 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .77....query I r
2d860 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2d870 4c 4c 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  LL col0 AS col0 
2d880 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20  FROM tab1 WHERE 
2d890 4e 55 4c 4c 20 49 4e 20 28 20 2b 20 63 6f 6c 30  NULL IN ( + col0
2d8a0 20 2a 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 29   * col1 / col0 )
2d8b0 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
2d8c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d8d0 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20 74  T ALL col0 * - t
2d8e0 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  ab2.col2 AS col2
2d8f0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2d900 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d  ..-189..-2028..-
2d910 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3002....query I 
2d920 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d930 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col1 * + col1 + 
2d940 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
2d950 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32 34 39 0d 0a  ----..164..249..
2d960 36 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  679....query I r
2d970 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2d980 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63  ISTINCT col1 * c
2d990 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20  ol0 - - col2 AS 
2d9a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
2d9b0 2d 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34 34 0d  ----..1381..244.
2d9c0 0a 34 36 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .4628....onlyif 
2d9d0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2d9e0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2d9f0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2da00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2da10 61 62 65 6c 2d 31 32 35 36 0d 0a 53 45 4c 45 43  abel-1256..SELEC
2da20 54 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 44 49  T + tab1.col2 DI
2da30 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  V col1 + col0 * 
2da40 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 63 6f 6c 32  col1 * col2 col2
2da50 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2da60 0d 0a 33 36 34 38 35 0d 0a 34 32 31 34 0d 0a 39  ..36485..4214..9
2da70 39 38 34 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  9847....skipif p
2da80 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2da90 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2daa0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2dab0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2dac0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2dad0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2dae0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2daf0 6c 61 62 65 6c 2d 31 32 35 36 0d 0a 53 45 4c 45  label-1256..SELE
2db00 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2f  CT + tab1.col2 /
2db10 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 63   col1 + col0 * c
2db20 6f 6c 31 20 2a 20 63 6f 6c 32 20 63 6f 6c 32 20  ol1 * col2 col2 
2db30 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2db40 0a 33 36 34 38 35 0d 0a 34 32 31 34 0d 0a 39 39  .36485..4214..99
2db50 38 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  847....query I r
2db60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2db70 4c 4c 20 35 38 20 2a 20 2d 20 63 6f 6c 30 20 41  LL 58 * - col0 A
2db80 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2db90 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 32 0d 0a 2d  ..----..-1392..-
2dba0 32 30 33 30 0d 0a 2d 35 31 36 32 0d 0a 0d 0a 71  2030..-5162....q
2dbb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2dbc0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2dbd0 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  - cor0.col0 * co
2dbe0 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  r0.col2 AS col2 
2dbf0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
2dc00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2dc10 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38  162..-3648..-768
2dc20 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
2dc30 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2dc40 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2dc50 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2dc60 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2dc70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2dc80 35 39 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  59..SELECT cor0.
2dc90 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col2 * - col2 + 
2dca0 2b 20 43 41 53 54 28 20 2d 20 28 20 2d 20 63 6f  + CAST( - ( - co
2dcb0 6c 30 20 29 20 41 53 20 53 49 47 4e 45 44 20 29  l0 ) AS SIGNED )
2dcc0 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
2dcd0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2dce0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 32  or0..----..-1402
2dcf0 32 0d 0a 2d 31 38 38 31 0d 0a 2d 33 36 0d 0a 0d  2..-1881..-36...
2dd00 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2dd10 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2dd20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2dd30 6c 61 62 65 6c 2d 31 32 35 39 0d 0a 53 45 4c 45  label-1259..SELE
2dd40 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d  CT cor0.col2 * -
2dd50 20 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54 20 28   col2 + + CAST (
2dd60 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20 41 53   - ( - col0 ) AS
2dd70 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63   INTEGER ) * - c
2dd80 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
2dd90 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2dda0 2d 2d 2d 0d 0a 2d 31 34 30 32 32 0d 0a 2d 31 38  ---..-14022..-18
2ddb0 38 31 0d 0a 2d 33 36 0d 0a 0d 0a 73 6b 69 70 69  81..-36....skipi
2ddc0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2ddd0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2dde0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2ddf0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2de00 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2de10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2de20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 63 6f 6c  + ( + col1 ) col
2de30 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
2de40 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a  ..----..10..13..
2de50 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  26....query I ro
2de60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2de70 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
2de80 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col1 * cor0.col1
2de90 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
2dea0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2deb0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 37 34 31 38 0d  0..----..177418.
2dec0 0a 33 32 39 32 31 38 0d 0a 37 33 36 39 31 38 0d  .329218..736918.
2ded0 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
2dee0 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
2def0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2df00 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  T * FROM tab0, t
2df10 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
2df20 30 20 63 6f 72 31 2c 20 74 61 62 31 2c 20 74 61  0 cor1, tab1, ta
2df30 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d  b2 AS cor2..----
2df40 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61  ..3645 values ha
2df50 73 68 69 6e 67 20 74 6f 20 64 66 30 30 64 31 39  shing to df00d19
2df60 66 31 37 38 61 37 30 38 66 36 33 36 62 30 33 36  f178a708f636b036
2df70 64 63 62 36 63 36 66 38 37 0d 0a 0d 0a 6f 6e 6c  dcb6c6f87....onl
2df80 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2df90 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2dfa0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2dfb0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2dfc0 72 74 20 6c 61 62 65 6c 2d 31 32 36 33 0d 0a 53  rt label-1263..S
2dfd0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 44  ELECT + - col2 D
2dfe0 49 56 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 32 37  IV + col2 + + 27
2dff0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2e000 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2e010 0d 0a 32 36 0d 0a 32 36 0d 0a 32 36 0d 0a 0d 0a  ..26..26..26....
2e020 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2e030 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2e040 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2e050 61 62 65 6c 2d 31 32 36 33 0d 0a 53 45 4c 45 43  abel-1263..SELEC
2e060 54 20 2b 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63  T + - col2 / + c
2e070 6f 6c 32 20 2b 20 2b 20 32 37 20 41 53 20 63 6f  ol2 + + 27 AS co
2e080 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
2e090 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a  cor0..----..26..
2e0a0 32 36 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20  26..26....query 
2e0b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e0c0 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  T - col0 * + col
2e0d0 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  0 + col1 AS col1
2e0e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2e0f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d  r0..----..-18..-
2e100 36 30 32 35 0d 0a 2d 36 32 32 34 0d 0a 0d 0a 6f  6025..-6224....o
2e110 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2e120 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2e130 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2e140 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2e150 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 36 35 0d  sort label-1265.
2e160 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30  .SELECT - + col0
2e170 20 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20 2b 20   DIV + col1 + + 
2e180 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
2e190 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2e1a0 2d 2d 2d 2d 0d 0a 31 33 0d 0a 33 31 0d 0a 35 38  ----..13..31..58
2e1b0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2e1c0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2e1d0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2e1e0 72 74 20 6c 61 62 65 6c 2d 31 32 36 35 0d 0a 53  rt label-1265..S
2e1f0 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2f  ELECT - + col0 /
2e200 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   + col1 + + col1
2e210 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2e220 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2e230 0d 0a 31 33 0d 0a 33 31 0d 0a 35 38 0d 0a 0d 0a  ..13..31..58....
2e240 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2e250 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2e260 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2e270 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2e280 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2e290 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e2a0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63   col1 * + cor0.c
2e2b0 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
2e2c0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2e2d0 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37  ..2838..7462..97
2e2e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2e2f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2e300 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 28 20  INCT + col1 * ( 
2e310 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20  - cor0.col2 ) * 
2e320 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
2e330 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2e340 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 32 34 0d 0a  ..----..-16224..
2e350 2d 33 36 35 30 34 0d 0a 2d 35 37 30 30 0d 0a 0d  -36504..-5700...
2e360 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e370 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
2e380 63 6f 6c 32 20 2a 20 2b 20 28 20 2b 20 63 6f 6c  col2 * + ( + col
2e390 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
2e3a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2e3b0 2d 2d 2d 0d 0a 31 35 36 30 0d 0a 36 38 34 0d 0a  ---..1560..684..
2e3c0 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  864....query I r
2e3d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2e3e0 49 53 54 49 4e 43 54 20 2b 20 28 20 2d 20 33 37  ISTINCT + ( - 37
2e3f0 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) * col2 FROM t
2e400 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2e410 2d 0d 0a 2d 31 32 32 31 0d 0a 2d 33 30 33 34 0d  -..-1221..-3034.
2e420 0a 2d 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-37....query I 
2e430 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e440 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  - col1 + col0 * 
2e450 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
2e460 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
2e470 2d 2d 2d 0d 0a 31 35 38 0d 0a 31 39 36 39 0d 0a  ---..158..1969..
2e480 32 39 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2985....query I 
2e490 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e4a0 2d 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 41  - + ( - col1 ) A
2e4b0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2e4c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d   cor0..----..86.
2e4d0 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69  .91..97....onlyi
2e4e0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2e4f0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2e500 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2e510 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e520 20 6c 61 62 65 6c 2d 31 32 37 32 0d 0a 53 45 4c   label-1272..SEL
2e530 45 43 54 20 2d 20 34 34 20 44 49 56 20 2b 20 37  ECT - 44 DIV + 7
2e540 36 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  6 FROM tab0, tab
2e550 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2e560 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
2e570 67 20 74 6f 20 38 62 37 35 31 33 36 62 32 62 35  g to 8b75136b2b5
2e580 31 63 37 37 33 34 35 63 30 33 38 30 34 65 63 31  1c77345c03804ec1
2e590 63 64 61 35 63 0d 0a 0d 0a 73 6b 69 70 69 66 20  cda5c....skipif 
2e5a0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2e5b0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2e5c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2e5d0 37 32 0d 0a 53 45 4c 45 43 54 20 2d 20 34 34 20  72..SELECT - 44 
2e5e0 2f 20 2b 20 37 36 20 46 52 4f 4d 20 74 61 62 30  / + 76 FROM tab0
2e5f0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
2e600 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
2e610 61 73 68 69 6e 67 20 74 6f 20 38 62 37 35 31 33  ashing to 8b7513
2e620 36 62 32 62 35 31 63 37 37 33 34 35 63 30 33 38  6b2b51c77345c038
2e630 30 34 65 63 31 63 64 61 35 63 0d 0a 0d 0a 71 75  04ec1cda5c....qu
2e640 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e650 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 2d 20 63  ELECT col2 - - c
2e660 6f 72 30 2e 63 6f 6c 30 20 2a 20 28 20 2b 20 63  or0.col0 * ( + c
2e670 6f 6c 31 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f  ol1 + col0 ) FRO
2e680 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2e690 2d 2d 2d 2d 0d 0a 31 30 37 31 32 0d 0a 32 39 33  ----..10712..293
2e6a0 0d 0a 37 36 32 32 0d 0a 0d 0a 71 75 65 72 79 20  ..7622....query 
2e6b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e6c0 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  T - - col2 * col
2e6d0 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  1 + + cor0.col0 
2e6e0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
2e6f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2e700 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34  ..----..1248..14
2e710 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79  04..570....query
2e720 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e730 43 54 20 33 32 20 2b 20 2b 20 63 6f 6c 30 20 2b  CT 32 + + col0 +
2e740 20 35 35 20 46 52 4f 4d 20 74 61 62 31 20 41 53   55 FROM tab1 AS
2e750 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31   cor0..----..151
2e760 0d 0a 31 36 37 0d 0a 39 30 0d 0a 0d 0a 6f 6e 6c  ..167..90....onl
2e770 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2e780 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2e790 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2e7a0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2e7b0 72 74 20 6c 61 62 65 6c 2d 31 32 37 36 0d 0a 53  rt label-1276..S
2e7c0 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63  ELECT + col1 + c
2e7d0 6f 6c 31 20 44 49 56 20 28 20 2b 20 36 20 29 20  ol1 DIV ( + 6 ) 
2e7e0 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  + + col1 col0 FR
2e7f0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2e800 2d 2d 0d 0a 31 32 37 0d 0a 33 36 0d 0a 36 37 0d  --..127..36..67.
2e810 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2e820 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2e830 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2e840 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2e850 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
2e860 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2e870 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2e880 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2e890 2d 31 32 37 36 0d 0a 53 45 4c 45 43 54 20 2b 20  -1276..SELECT + 
2e8a0 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2f 20 28 20  col1 + col1 / ( 
2e8b0 2b 20 36 20 29 20 2b 20 2b 20 63 6f 6c 31 20 63  + 6 ) + + col1 c
2e8c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
2e8d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 0d 0a 33  r0..----..127..3
2e8e0 36 0d 0a 36 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  6..67....onlyif 
2e8f0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2e900 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2e910 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2e920 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2e930 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2e940 6c 2d 31 32 37 37 0d 0a 53 45 4c 45 43 54 20 2b  l-1277..SELECT +
2e950 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2a   col2 * + col0 *
2e960 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
2e970 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
2e980 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2e990 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2e9a0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
2e9b0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2e9c0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2e9d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 37  wsort label-1277
2e9e0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
2e9f0 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53  * + col0 * - CAS
2ea00 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
2ea10 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52  GER ) AS col0 FR
2ea20 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab0..----..N
2ea30 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
2ea40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2ea50 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 30 20  rt..SELECT + 20 
2ea60 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2ea70 32 2c 20 74 61 62 30 2c 20 74 61 62 32 20 41 53  2, tab0, tab2 AS
2ea80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
2ea90 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2eaa0 6f 20 30 61 33 35 66 65 39 38 66 33 65 37 64 35  o 0a35fe98f3e7d5
2eab0 66 63 38 66 66 32 61 65 38 31 35 62 64 32 30 65  fc8ff2ae815bd20e
2eac0 66 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  f4....onlyif mys
2ead0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2eae0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2eaf0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2eb00 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2eb10 6c 2d 31 32 37 39 0d 0a 53 45 4c 45 43 54 20 39  l-1279..SELECT 9
2eb20 34 20 44 49 56 20 2b 20 63 6f 6c 32 20 46 52 4f  4 DIV + col2 FRO
2eb30 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab1..----..0.
2eb40 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..1....skipif 
2eb50 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2eb60 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2eb70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2eb80 37 39 0d 0a 53 45 4c 45 43 54 20 39 34 20 2f 20  79..SELECT 94 / 
2eb90 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
2eba0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d  ..----..0..1..1.
2ebb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2ebc0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2ebd0 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  NCT - col1 * col
2ebe0 31 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  1 + col1 * - col
2ebf0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2ec00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 32  or0..----..-1352
2ec10 0d 0a 2d 32 30 30 0d 0a 2d 33 33 38 0d 0a 0d 0a  ..-200..-338....
2ec20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ec30 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30  .SELECT - + col0
2ec40 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   - col1 * + col2
2ec50 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2ec60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a  r0..----..-132..
2ec70 2d 32 38 36 32 0d 0a 2d 37 35 35 31 0d 0a 0d 0a  -2862..-7551....
2ec80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ec90 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63  .SELECT + tab0.c
2eca0 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b  ol2 + + col2 * +
2ecb0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
2ecc0 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37 33 38 30 0d  .----..36..7380.
2ecd0 0a 38 32 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .825....skipif p
2ece0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2ecf0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2ed00 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2ed10 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2ed20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ed30 0d 0a 53 45 4c 45 43 54 20 31 39 20 2b 20 2b 20  ..SELECT 19 + + 
2ed40 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col1 col1 FROM t
2ed50 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a  ab0..----..105..
2ed60 31 31 30 0d 0a 31 31 36 0d 0a 0d 0a 71 75 65 72  110..116....quer
2ed70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ed80 45 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20  ECT + tab0.col0 
2ed90 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2eda0 30 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  0, tab1 cor0..--
2edb0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2edc0 68 69 6e 67 20 74 6f 20 38 62 34 39 37 39 39 39  hing to 8b497999
2edd0 34 32 61 39 65 33 35 33 61 33 64 32 37 39 63 66  42a9e353a3d279cf
2ede0 36 34 65 66 33 66 36 33 0d 0a 0d 0a 73 6b 69 70  64ef3f63....skip
2edf0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2ee00 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2ee10 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2ee20 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2ee30 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2ee40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2ee50 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 74  ol2 + - col1 * t
2ee60 61 62 31 2e 63 6f 6c 31 20 63 6f 6c 30 20 46 52  ab1.col1 col0 FR
2ee70 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
2ee80 31 35 37 0d 0a 2d 32 36 35 0d 0a 2d 37 33 30 0d  157..-265..-730.
2ee90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2eea0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2eeb0 4e 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  NCT col2 * col2 
2eec0 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
2eed0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 35 0d 0a  b0..----..1175..
2eee0 36 38 31 35 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72  6815..98....quer
2eef0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ef00 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2ef10 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d  ol2 + + col2 * -
2ef20 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41   col0 * - col2 A
2ef30 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2ef40 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 39 39 33 0d 0a  ..----..207993..
2ef50 37 33 37 33 37 36 0d 0a 38 38 30 32 0d 0a 0d 0a  737376..8802....
2ef60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ef70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2ef80 20 63 6f 6c 31 20 2a 20 74 61 62 32 2e 63 6f 6c   col1 * tab2.col
2ef90 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  0 + - col2 AS co
2efa0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
2efb0 2d 2d 0d 0a 31 33 30 35 0d 0a 31 39 30 0d 0a 34  --..1305..190..4
2efc0 35 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  576....skipif po
2efd0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2efe0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2eff0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2f000 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2f010 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f020 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2f030 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 63   - col1 + col0 c
2f040 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
2f050 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32  ---..-24..19..62
2f060 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2f070 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2f080 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2f090 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2f0a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2f0b0 31 32 39 30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1290..SELECT col
2f0c0 30 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d  0 + - col0 DIV -
2f0d0 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20   col1 col1 FROM 
2f0e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2f0f0 2d 2d 0d 0a 33 0d 0a 37 30 0d 0a 38 36 0d 0a 0d  --..3..70..86...
2f100 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2f110 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2f120 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2f130 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2f140 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
2f150 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2f160 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2f170 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2f180 32 39 30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  290..SELECT col0
2f190 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 2d 20 63 6f   + - col0 / - co
2f1a0 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
2f1b0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2f1c0 0a 33 0d 0a 37 30 0d 0a 38 36 0d 0a 0d 0a 73 6b  .3..70..86....sk
2f1d0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2f1e0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2f1f0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2f200 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2f210 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2f220 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2f230 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  LL + col2 + col0
2f240 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63   * col2 * cor0.c
2f250 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
2f260 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2f270 0d 0a 31 31 34 31 31 34 0d 0a 35 31 33 30 0d 0a  ..114114..5130..
2f280 35 32 37 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49  52754....query I
2f290 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f2a0 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30   - col2 + - cor0
2f2b0 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2d  .col0 * col1 * -
2f2c0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
2f2d0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2f2e0 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 32 36 0d 0a 35  .----..119626..5
2f2f0 30 39 39 36 0d 0a 35 38 33 32 0d 0a 0d 0a 71 75  0996..5832....qu
2f300 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f310 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63  ELECT - col1 * c
2f320 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ol0 + col1 * - c
2f330 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2f340 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
2f350 35 34 0d 0a 2d 31 39 38 39 0d 0a 2d 36 31 33 36  54..-1989..-6136
2f360 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2f370 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2f380 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2f390 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2f3a0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2f3b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f3c0 4c 45 43 54 20 2d 20 28 20 63 6f 6c 30 20 29 20  LECT - ( col0 ) 
2f3d0 2d 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  - + col1 col0 FR
2f3e0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
2f3f0 31 33 37 0d 0a 2d 33 38 0d 0a 2d 39 36 0d 0a 0d  137..-38..-96...
2f400 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f410 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2f420 54 20 37 38 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  T 78 * + col2 * 
2f430 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
2f440 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab2..----..11
2f450 32 36 33 32 0d 0a 35 32 37 32 38 0d 0a 35 36 38  2632..52728..568
2f460 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
2f470 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2f480 34 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  41 AS col2 FROM 
2f490 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d  tab0..----..-41.
2f4a0 0a 2d 34 31 0d 0a 2d 34 31 0d 0a 0d 0a 71 75 65  .-41..-41....que
2f4b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f4c0 4c 45 43 54 20 38 39 20 2b 20 63 6f 72 30 2e 63  LECT 89 + cor0.c
2f4d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol0 FROM tab1, t
2f4e0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2f4f0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
2f500 69 6e 67 20 74 6f 20 36 38 33 62 34 34 35 31 62  ing to 683b4451b
2f510 33 63 37 35 62 64 30 33 62 32 37 38 33 30 38 66  3c75bd03b278308f
2f520 33 38 62 65 61 65 34 0d 0a 0d 0a 6f 6e 6c 79 69  38beae4....onlyi
2f530 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2f540 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2f550 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2f560 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f570 20 6c 61 62 65 6c 2d 31 32 39 38 0d 0a 53 45 4c   label-1298..SEL
2f580 45 43 54 20 2b 20 2d 20 36 38 20 44 49 56 20 2b  ECT + - 68 DIV +
2f590 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
2f5a0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2f5b0 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d  .----..-1..-2..-
2f5c0 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
2f5d0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2f5e0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2f5f0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 38 0d 0a  ort label-1298..
2f600 53 45 4c 45 43 54 20 2b 20 2d 20 36 38 20 2f 20  SELECT + - 68 / 
2f610 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
2f620 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2f630 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a  ..----..-1..-2..
2f640 2d 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -4....query I ro
2f650 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2f660 2d 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  - ( col2 ) FROM 
2f670 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
2f680 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a  .-26..-27..-38..
2f690 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f6a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2f6b0 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  - col1 + - col0 
2f6c0 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * - col1 FROM ta
2f6d0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2f6e0 0d 0a 31 33 32 36 0d 0a 31 38 36 0d 0a 34 35 34  ..1326..186..454
2f6f0 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  3....skipif post
2f700 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2f710 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2f720 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2f730 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2f740 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f750 45 4c 45 43 54 20 28 20 63 6f 6c 31 20 29 20 63  ELECT ( col1 ) c
2f760 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
2f770 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d  ---..17..31..59.
2f780 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f790 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2f7a0 4e 43 54 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  NCT col0 * cor0.
2f7b0 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63  col2 + col1 AS c
2f7c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
2f7d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 0d 0a 33  r0..----..188..3
2f7e0 36 35 38 0d 0a 37 36 39 33 0d 0a 0d 0a 6f 6e 6c  658..7693....onl
2f7f0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2f800 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2f810 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2f820 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2f830 72 74 20 6c 61 62 65 6c 2d 31 33 30 33 0d 0a 53  rt label-1303..S
2f840 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 34 31  ELECT ALL - - 41
2f850 20 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f   + col0 DIV + co
2f860 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32  r0.col0 + + col2
2f870 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2f880 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 0d 0a 34  r0..----..124..4
2f890 33 0d 0a 37 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..75....skipif 
2f8a0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2f8b0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2f8c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2f8d0 30 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  03..SELECT ALL -
2f8e0 20 2d 20 34 31 20 2b 20 63 6f 6c 30 20 2f 20 2b   - 41 + col0 / +
2f8f0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63   cor0.col0 + + c
2f900 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2f910 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   cor0..----..124
2f920 0d 0a 34 33 0d 0a 37 35 0d 0a 0d 0a 6f 6e 6c 79  ..43..75....only
2f930 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2f940 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2f950 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2f960 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f970 74 20 6c 61 62 65 6c 2d 31 33 30 34 0d 0a 53 45  t label-1304..SE
2f980 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
2f990 44 49 56 20 2b 20 38 36 20 2b 20 74 61 62 30 2e  DIV + 86 + tab0.
2f9a0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
2f9b0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d  M tab0..----..2.
2f9c0 0a 33 34 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69  .34..83....skipi
2f9d0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2f9e0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2f9f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2fa00 31 33 30 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1304..SELECT ALL
2fa10 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 38 36 20 2b   + col1 / + 86 +
2fa20 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f   tab0.col2 AS co
2fa30 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
2fa40 2d 2d 0d 0a 32 0d 0a 33 34 0d 0a 38 33 0d 0a 0d  --..2..34..83...
2fa50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fa60 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2fa70 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  T + col1 + - col
2fa80 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  0 * + col1 FROM 
2fa90 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32  tab1..----..-102
2faa0 37 0d 0a 2d 35 32 0d 0a 2d 36 33 30 0d 0a 0d 0a  7..-52..-630....
2fab0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2fac0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2fad0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2fae0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2faf0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2fb00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2fb10 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
2fb20 20 2b 20 28 20 63 6f 6c 30 20 29 20 63 6f 6c 31   + ( col0 ) col1
2fb30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2fb40 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a  ..104..117..34..
2fb50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fb60 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2fb70 43 54 20 39 37 20 2a 20 38 36 20 46 52 4f 4d 20  CT 97 * 86 FROM 
2fb80 74 61 62 32 2c 20 74 61 62 30 2c 20 74 61 62 31  tab2, tab0, tab1
2fb90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2fba0 38 33 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8342....query I 
2fbb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2fbc0 41 4c 4c 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c  ALL col2 - + col
2fbd0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
2fbe0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2fbf0 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d  -..-7..16..51...
2fc00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fc10 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2fc20 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  T - col1 * col0 
2fc30 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  - + col1 AS col1
2fc40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2fc50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 35 30 0d  r0..----..-2150.
2fc60 0a 2d 33 34 39 32 0d 0a 2d 38 31 39 30 0d 0a 0d  .-3492..-8190...
2fc70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fc80 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
2fc90 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32  cor0.col1 + col2
2fca0 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
2fcb0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2fcc0 2d 0d 0a 2d 32 37 31 33 0d 0a 31 34 35 33 0d 0a  -..-2713..1453..
2fcd0 37 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  772....query I r
2fce0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2fcf0 49 53 54 49 4e 43 54 20 2b 20 2b 20 36 34 20 2b  ISTINCT + + 64 +
2fd00 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
2fd10 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2fd20 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 0d 0a 35 31 0d  0..----..38..51.
2fd30 0a 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .54....query I r
2fd40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2fd50 4c 4c 20 28 20 35 30 20 29 20 2b 20 2b 20 63 6f  LL ( 50 ) + + co
2fd60 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 30 20 29 20  l2 * + ( col0 ) 
2fd70 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  * - col1 AS col0
2fd80 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2fd90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 33 30  r0..----..-36430
2fda0 0d 0a 2d 34 31 36 32 0d 0a 2d 39 39 37 39 30 0d  ..-4162..-99790.
2fdb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2fdc0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
2fdd0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col2 * - col2 + 
2fde0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
2fdf0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2fe00 2d 32 38 39 30 0d 0a 2d 33 32 33 39 0d 0a 2d 39  -2890..-3239..-9
2fe10 32 30 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  203....skipif po
2fe20 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2fe30 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2fe40 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2fe50 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2fe60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2fe70 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
2fe80 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c   + cor0.col1 col
2fe90 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
2fea0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33  or0..----..-1343
2feb0 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d  ..-217..-4602...
2fec0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fed0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28  ..SELECT ALL + (
2fee0 20 2b 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 31   + col0 ) + col1
2fef0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2ff00 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor0..----..2
2ff10 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75 65  9..74..93....que
2ff20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ff30 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
2ff40 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 28 20  l0 * col2 + + ( 
2ff50 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  + col0 ) FROM ta
2ff60 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
2ff70 36 35 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a  65..3712..7760..
2ff80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ff90 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2ffa0 43 54 20 2b 20 33 39 20 2b 20 63 6f 6c 30 20 41  CT + 39 + col0 A
2ffb0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2ffc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2ffd0 31 31 37 0d 0a 31 31 38 0d 0a 34 36 0d 0a 0d 0a  117..118..46....
2ffe0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2fff0 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32  .SELECT - + col2
30000 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 41   * col0 - col1 A
30010 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
30020 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30030 2d 32 30 38 37 0d 0a 2d 32 32 30 0d 0a 2d 33 30  -2087..-220..-30
30040 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  19....query I ro
30050 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
30060 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e  - col1 * - cor0.
30070 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col2 + - cor0.co
30080 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
30090 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
300a0 2d 2d 0d 0a 2d 31 36 31 32 0d 0a 2d 37 32 35 0d  --..-1612..-725.
300b0 0a 2d 38 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .-844....query I
300c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
300d0 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2b   col0 * col0 + +
300e0 20 32 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f   20 FROM tab0 co
300f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 35 0d 0a  r0..----..1245..
30100 35 39 36 0d 0a 37 39 34 31 0d 0a 0d 0a 6f 6e 6c  596..7941....onl
30110 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
30120 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
30130 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
30140 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
30150 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
30160 6c 61 62 65 6c 2d 31 33 32 31 0d 0a 53 45 4c 45  label-1321..SELE
30170 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
30180 20 2a 20 2b 20 43 41 53 54 28 20 63 6f 6c 31 20   * + CAST( col1 
30190 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20  AS SIGNED ) + - 
301a0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
301b0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
301c0 2d 2d 2d 2d 0d 0a 32 38 30 35 0d 0a 37 33 38 30  ----..2805..7380
301d0 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..96....skipif m
301e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
301f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
30200 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32  owsort label-132
30210 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
30220 43 54 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54  CT col2 * + CAST
30230 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   ( col1 AS INTEG
30240 45 52 20 29 20 2b 20 2d 20 63 6f 6c 32 20 41 53  ER ) + - col2 AS
30250 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
30260 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
30270 38 30 35 0d 0a 37 33 38 30 0d 0a 39 36 0d 0a 0d  805..7380..96...
30280 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30290 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
302a0 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53  T col2 * col1 AS
302b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
302c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38  cor0..----..1248
302d0 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71  ..1404..570....q
302e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
302f0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20  SELECT - col1 - 
30300 2d 20 34 33 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  - 43 * cor0.col1
30310 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
30320 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 32 0d 0a  r0..----..1092..
30330 34 32 30 0d 0a 35 34 36 0d 0a 0d 0a 71 75 65 72  420..546....quer
30340 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30350 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
30360 20 63 6f 6c 32 20 2b 20 28 20 28 20 63 6f 6c 30   col2 + ( ( col0
30370 20 29 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2d 20   ) ) * + col2 - 
30380 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
30390 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
303a0 0d 0a 2d 2d 2d 2d 0d 0a 31 39 30 0d 0a 33 36 39  ..----..190..369
303b0 35 0d 0a 37 37 36 33 0d 0a 0d 0a 71 75 65 72 79  5..7763....query
303c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
303d0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 28 20  CT ALL col2 + ( 
303e0 2b 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c  + col2 ) * - col
303f0 30 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  0 - + cor0.col2 
30400 2a 20 2b 20 35 37 20 41 53 20 63 6f 6c 32 20 46  * + 57 AS col2 F
30410 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
30420 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 30 31 0d 0a 2d  ..----..-1701..-
30430 33 34 38 34 0d 0a 2d 35 31 33 30 0d 0a 0d 0a 71  3484..-5130....q
30440 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30450 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
30460 6f 6c 31 20 2b 20 2d 20 38 31 20 41 53 20 63 6f  ol1 + - 81 AS co
30470 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
30480 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 35  0..----..-22..-5
30490 30 0d 0a 2d 36 34 0d 0a 0d 0a 71 75 65 72 79 20  0..-64....query 
304a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
304b0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
304c0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col1 + + col1 * 
304d0 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  + col1 + - col2 
304e0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
304f0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
30500 0a 32 36 38 0d 0a 33 35 31 34 0d 0a 39 36 35 0d  .268..3514..965.
30510 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
30520 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 33 20  rt..SELECT + 23 
30530 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
30540 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32   cor0..----..112
30550 0d 0a 34 37 0d 0a 35 38 0d 0a 0d 0a 71 75 65 72  ..47..58....quer
30560 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30570 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
30580 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 41   col2 - + col2 A
30590 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
305a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
305b0 2d 32 30 35 34 0d 0a 2d 32 31 36 0d 0a 2d 33 30  -2054..-216..-30
305c0 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  40....query I ro
305d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
305e0 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 33  L - + col1 + + 3
305f0 34 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  4 + + cor0.col0 
30600 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
30610 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 35 33 0d  0..----..10..53.
30620 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .96....onlyif my
30630 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
30640 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
30650 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
30660 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
30670 65 6c 2d 31 33 33 31 0d 0a 53 45 4c 45 43 54 20  el-1331..SELECT 
30680 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
30690 6c 31 20 44 49 56 20 28 20 63 6f 6c 31 20 29 20  l1 DIV ( col1 ) 
306a0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
306b0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
306c0 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
306d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
306e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
306f0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 31 0d  sort label-1331.
30700 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
30710 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 28 20 63   cor0.col1 / ( c
30720 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol1 ) AS col2 FR
30730 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
30740 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .----..1....quer
30750 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30760 45 43 54 20 2b 20 2d 20 34 31 20 2b 20 63 6f 6c  ECT + - 41 + col
30770 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
30780 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
30790 0d 0a 32 34 38 0d 0a 33 34 34 30 0d 0a 39 32 30  ..248..3440..920
307a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
307b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 20 41 53  ort..SELECT 8 AS
307c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c   col1 FROM tab0,
307d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
307e0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
307f0 73 68 69 6e 67 20 74 6f 20 66 66 63 35 62 34 63  shing to ffc5b4c
30800 39 38 62 35 37 61 65 35 34 36 35 32 31 31 37 35  98b57ae546521175
30810 39 39 35 63 34 39 63 35 37 0d 0a 0d 0a 6f 6e 6c  995c49c57....onl
30820 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
30830 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
30840 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
30850 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
30860 72 74 20 6c 61 62 65 6c 2d 31 33 33 34 0d 0a 53  rt label-1334..S
30870 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
30880 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 2d   col1 DIV col0 -
30890 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
308a0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
308b0 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 31 38 0d 0a  .-10..-13..-18..
308c0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
308d0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
308e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
308f0 20 6c 61 62 65 6c 2d 31 33 33 34 0d 0a 53 45 4c   label-1334..SEL
30900 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
30910 6f 6c 31 20 2f 20 63 6f 6c 30 20 2d 20 2b 20 63  ol1 / col0 - + c
30920 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
30930 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
30940 0d 0a 2d 31 33 0d 0a 2d 31 38 0d 0a 0d 0a 71 75  ..-13..-18....qu
30950 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30960 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
30970 31 20 2b 20 2d 20 28 20 63 6f 6c 31 20 29 20 2a  1 + - ( col1 ) *
30980 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
30990 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
309a0 31 30 34 0d 0a 2d 31 30 35 33 0d 0a 2d 36 35 30  104..-1053..-650
309b0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
309c0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
309d0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
309e0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
309f0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
30a00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33  owsort label-133
30a10 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  6..SELECT ALL + 
30a20 43 41 53 54 28 20 2d 20 33 30 20 41 53 20 53 49  CAST( - 30 AS SI
30a30 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20 41 53  GNED ) * col0 AS
30a40 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
30a50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30  cor0..----..-210
30a60 0d 0a 2d 32 33 34 30 0d 0a 2d 32 33 37 30 0d 0a  ..-2340..-2370..
30a70 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
30a80 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
30a90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30aa0 20 6c 61 62 65 6c 2d 31 33 33 36 0d 0a 53 45 4c   label-1336..SEL
30ab0 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28  ECT ALL + CAST (
30ac0 20 2d 20 33 30 20 41 53 20 49 4e 54 45 47 45 52   - 30 AS INTEGER
30ad0 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c   ) * col0 AS col
30ae0 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
30af0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a 2d 32  ..----..-210..-2
30b00 33 34 30 0d 0a 2d 32 33 37 30 0d 0a 0d 0a 71 75  340..-2370....qu
30b10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30b20 45 4c 45 43 54 20 2d 20 36 30 20 2d 20 2d 20 28  ELECT - 60 - - (
30b30 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 41 53 20   cor0.col1 ) AS 
30b40 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
30b50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 33  or0..----..26..3
30b60 31 0d 0a 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  1..37....query I
30b70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30b80 20 41 4c 4c 20 36 33 20 41 53 20 63 6f 6c 31 20   ALL 63 AS col1 
30b90 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
30ba0 2d 2d 2d 2d 0d 0a 36 33 0d 0a 36 33 0d 0a 36 33  ----..63..63..63
30bb0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
30bc0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
30bd0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
30be0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
30bf0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
30c00 31 33 33 39 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  1339..SELECT - +
30c10 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 63   cor0.col1 DIV c
30c20 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 43  ol1 + + col2 - C
30c30 41 53 54 28 20 2d 20 63 6f 6c 30 20 41 53 20 53  AST( - col0 AS S
30c40 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20  IGNED ) AS col2 
30c50 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
30c60 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 31 31  0..----..103..11
30c70 36 0d 0a 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  6..33....skipif 
30c80 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
30c90 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
30ca0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
30cb0 33 39 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  39..SELECT - + c
30cc0 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 31 20  or0.col1 / col1 
30cd0 2b 20 2b 20 63 6f 6c 32 20 2d 20 43 41 53 54 20  + + col2 - CAST 
30ce0 28 20 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54 45  ( - col0 AS INTE
30cf0 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52  GER ) AS col2 FR
30d00 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
30d10 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 31 31 36 0d  .----..103..116.
30d20 0a 33 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .33....onlyif my
30d30 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
30d40 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
30d50 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
30d60 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
30d70 65 6c 2d 31 33 34 30 0d 0a 53 45 4c 45 43 54 20  el-1340..SELECT 
30d80 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20  - cor0.col0 DIV 
30d90 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col1 + + col2 AS
30da0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
30db0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
30dc0 31 0d 0a 35 34 0d 0a 39 30 0d 0a 0d 0a 73 6b 69  1..54..90....ski
30dd0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
30de0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
30df0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
30e00 6c 2d 31 33 34 30 0d 0a 53 45 4c 45 43 54 20 2d  l-1340..SELECT -
30e10 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 63 6f 6c   cor0.col0 / col
30e20 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 + + col2 AS co
30e30 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
30e40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 31 0d 0a  cor0..----..51..
30e50 35 34 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20  54..90....query 
30e60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30e70 54 20 41 4c 4c 20 2d 20 2b 20 37 35 20 2a 20 63  T ALL - + 75 * c
30e80 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 + - col1 FRO
30e90 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
30ea0 2d 2d 2d 2d 0d 0a 2d 34 30 37 36 0d 0a 2d 34 32  ----..-4076..-42
30eb0 38 35 0d 0a 2d 37 32 31 33 0d 0a 0d 0a 71 75 65  85..-7213....que
30ec0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30ed0 4c 45 43 54 20 2d 20 28 20 39 38 20 29 20 2a 20  LECT - ( 98 ) * 
30ee0 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
30ef0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
30f00 2d 32 39 34 0d 0a 2d 36 32 37 32 0d 0a 2d 37 38  -294..-6272..-78
30f10 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  40....onlyif mys
30f20 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
30f30 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
30f40 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
30f50 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
30f60 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
30f70 33 34 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  343..SELECT DIST
30f80 49 4e 43 54 20 2d 20 28 20 37 37 20 29 20 2a 20  INCT - ( 77 ) * 
30f90 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 28  + col1 + + CAST(
30fa0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
30fb0 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c  SIGNED ) * - col
30fc0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
30fd0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
30fe0 2d 0d 0a 2d 32 30 31 31 0d 0a 2d 34 38 36 36 0d  -..-2011..-4866.
30ff0 0a 2d 37 34 30 31 0d 0a 0d 0a 73 6b 69 70 69 66  .-7401....skipif
31000 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
31010 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
31020 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
31030 33 34 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  343..SELECT DIST
31040 49 4e 43 54 20 2d 20 28 20 37 37 20 29 20 2a 20  INCT - ( 77 ) * 
31050 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 20  + col1 + + CAST 
31060 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  ( + cor0.col0 AS
31070 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63   INTEGER ) * - c
31080 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
31090 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
310a0 2d 2d 2d 0d 0a 2d 32 30 31 31 0d 0a 2d 34 38 36  ---..-2011..-486
310b0 36 0d 0a 2d 37 34 30 31 0d 0a 0d 0a 71 75 65 72  6..-7401....quer
310c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
310d0 45 43 54 20 41 4c 4c 20 35 34 20 2d 20 2b 20 63  ECT ALL 54 - + c
310e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
310f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   cor0..----..-24
31100 0d 0a 2d 32 35 0d 0a 34 37 0d 0a 0d 0a 71 75 65  ..-25..47....que
31110 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31120 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  LECT + col1 * + 
31130 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 31 20 41 53  col0 - - col1 AS
31140 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
31150 0a 2d 2d 2d 2d 0d 0a 32 31 35 30 0d 0a 33 34 39  .----..2150..349
31160 32 0d 0a 38 31 39 30 0d 0a 0d 0a 71 75 65 72 79  2..8190....query
31170 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31180 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  CT + col0 * col1
31190 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   + cor0.col2 AS 
311a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
311b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
311c0 33 36 0d 0a 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a  36..132..697....
311d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
311e0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d  .SELECT - col1 -
311f0 20 31 39 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20   19 * cor0.col1 
31200 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
31210 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
31220 0a 2d 32 30 30 0d 0a 2d 32 36 30 0d 0a 2d 35 32  .-200..-260..-52
31230 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
31240 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
31250 54 49 4e 43 54 20 2b 20 36 31 20 46 52 4f 4d 20  TINCT + 61 FROM 
31260 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
31270 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 0d 0a  r0..----..61....
31280 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31290 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
312a0 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  l2 * + col1 + + 
312b0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
312c0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
312d0 35 30 38 0d 0a 2d 36 30 38 0d 0a 2d 38 31 30 0d  508..-608..-810.
312e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
312f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32  rt..SELECT ALL 2
31300 35 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  5 + - col2 * col
31310 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
31320 2d 0d 0a 2d 32 38 39 31 0d 0a 2d 33 32 32 34 0d  -..-2891..-3224.
31330 0a 2d 39 31 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-9191....onlyif
31340 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
31350 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
31360 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
31370 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
31380 6c 61 62 65 6c 2d 31 33 35 31 0d 0a 53 45 4c 45  label-1351..SELE
31390 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
313a0 6c 31 20 2a 20 34 32 20 44 49 56 20 63 6f 72 30  l1 * 42 DIV cor0
313b0 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20  .col1 FROM tab1 
313c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
313d0 34 32 0d 0a 2d 34 32 0d 0a 2d 34 32 0d 0a 0d 0a  42..-42..-42....
313e0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
313f0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
31400 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
31410 61 62 65 6c 2d 31 33 35 31 0d 0a 53 45 4c 45 43  abel-1351..SELEC
31420 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
31430 31 20 2a 20 34 32 20 2f 20 63 6f 72 30 2e 63 6f  1 * 42 / cor0.co
31440 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
31450 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d  cor0..----..-42.
31460 0a 2d 34 32 0d 0a 2d 34 32 0d 0a 0d 0a 71 75 65  .-42..-42....que
31470 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31480 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  LECT + col0 + - 
31490 34 31 20 2a 20 33 30 20 46 52 4f 4d 20 74 61 62  41 * 30 FROM tab
314a0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
314b0 0a 2d 31 31 35 30 0d 0a 2d 31 31 36 36 0d 0a 2d  .-1150..-1166..-
314c0 31 32 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1227....query I 
314d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
314e0 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
314f0 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  ( + cor0.col2 ) 
31500 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
31510 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39  0..----..35..729
31520 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20  8..792....query 
31530 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31540 54 20 2d 20 37 39 20 46 52 4f 4d 20 74 61 62 31  T - 79 FROM tab1
31550 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
31560 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31  OIN tab0 AS cor1
31570 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
31580 20 68 61 73 68 69 6e 67 20 74 6f 20 31 62 37 62   hashing to 1b7b
31590 30 62 33 34 66 65 33 34 33 31 66 62 34 30 39 37  0b34fe3431fb4097
315a0 31 39 36 32 34 64 31 32 37 39 31 66 0d 0a 0d 0a  19624d12791f....
315b0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
315c0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
315d0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
315e0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
315f0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
31600 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31610 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20 63   - tab0.col0 + c
31620 6f 6c 31 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c  ol1 * - tab0.col
31630 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  2 col2 FROM tab0
31640 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 32  ..----..-132..-2
31650 38 36 32 0d 0a 2d 37 35 35 31 0d 0a 0d 0a 71 75  862..-7551....qu
31660 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31670 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 28  ELECT - col2 * (
31680 20 74 61 62 31 2e 63 6f 6c 30 20 29 20 46 52 4f   tab1.col0 ) FRO
31690 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
316a0 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30  62..-3648..-7680
316b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
316c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
316d0 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2b 20  + tab1.col1 + + 
316e0 28 20 74 61 62 31 2e 63 6f 6c 32 20 29 20 41 53  ( tab1.col2 ) AS
316f0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
31700 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a  .----..109..67..
31710 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  80....onlyif mys
31720 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
31730 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
31740 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
31750 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
31760 6c 2d 31 33 35 38 0d 0a 53 45 4c 45 43 54 20 63  l-1358..SELECT c
31770 6f 6c 30 20 44 49 56 20 36 39 20 41 53 20 63 6f  ol0 DIV 69 AS co
31780 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
31790 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73  --..0..1..1....s
317a0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
317b0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
317c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
317d0 62 65 6c 2d 31 33 35 38 0d 0a 53 45 4c 45 43 54  bel-1358..SELECT
317e0 20 63 6f 6c 30 20 2f 20 36 39 20 41 53 20 63 6f   col0 / 69 AS co
317f0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
31800 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71  --..0..1..1....q
31810 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31820 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31830 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f  - cor0.col1 * co
31840 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
31850 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
31860 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d 33 34 38 31 0d  --..-289..-3481.
31870 0a 2d 39 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .-961....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 6c 30 20 2b 20 2d 20 63 6f   - + col0 + - co
318a0 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 * col1 AS col
318b0 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
318c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 32  ..----..-132..-2
318d0 38 36 32 0d 0a 2d 37 35 35 31 0d 0a 0d 0a 71 75  862..-7551....qu
318e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
318f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
31900 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f   + col2 * + ( co
31910 6c 30 20 29 20 2a 20 63 6f 6c 31 20 41 53 20 63  l0 ) * col1 AS c
31920 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
31930 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
31940 36 35 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35 39  652..51034..5859
31950 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
31960 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
31970 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
31980 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
31990 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
319a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36  owsort label-136
319b0 32 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  2..SELECT + col0
319c0 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   + + CAST( NULL 
319d0 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
319e0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
319f0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
31a00 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
31a10 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
31a20 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
31a30 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36 32 0d  sort label-1362.
31a40 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
31a50 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
31a60 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
31a70 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
31a80 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
31a90 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
31aa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
31ab0 6c 30 20 2b 20 2d 20 35 33 20 2a 20 31 32 20 41  l0 + - 53 * 12 A
31ac0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
31ad0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31ae0 2d 35 35 36 0d 0a 2d 35 37 32 0d 0a 2d 36 33 33  -556..-572..-633
31af0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31b00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
31b10 49 4e 43 54 20 2d 20 39 20 46 52 4f 4d 20 74 61  INCT - 9 FROM ta
31b20 62 30 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  b0 cor0 CROSS JO
31b30 49 4e 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d  IN tab0 cor1..--
31b40 2d 2d 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20  --..-9....query 
31b50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31b60 54 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  T ( + cor0.col2 
31b70 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
31b80 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
31b90 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  0, tab2 AS cor1.
31ba0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
31bb0 20 68 61 73 68 69 6e 67 20 74 6f 20 34 30 66 64   hashing to 40fd
31bc0 38 63 63 30 64 65 39 32 65 61 36 38 64 37 33 36  8cc0de92ea68d736
31bd0 33 34 63 32 64 38 66 37 35 62 66 35 0d 0a 0d 0a  34c2d8f75bf5....
31be0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31bf0 0a 53 45 4c 45 43 54 20 36 39 20 2b 20 63 6f 6c  .SELECT 69 + col
31c00 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
31c10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 35 0d 0a  or0..----..155..
31c20 31 36 30 0d 0a 31 36 36 0d 0a 0d 0a 71 75 65 72  160..166....quer
31c30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31c40 45 43 54 20 2d 20 39 31 20 2a 20 63 6f 72 30 2e  ECT - 91 * cor0.
31c50 63 6f 6c 30 20 2d 20 2b 20 63 6f 72 30 2e 63 6f  col0 - + cor0.co
31c60 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l1 * col0 * - co
31c70 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
31c80 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
31c90 2d 2d 0d 0a 31 37 35 35 0d 0a 35 37 36 0d 0a 36  --..1755..576..6
31ca0 32 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  240....query I r
31cb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
31cc0 20 2d 20 36 39 20 2a 20 2d 20 63 6f 6c 31 20 2d   - 69 * - col1 -
31cd0 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 2b   col1 * col0 * +
31ce0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
31cf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35  cor0..----..-115
31d00 35 38 31 0d 0a 2d 33 37 32 30 0d 0a 2d 34 39 38  581..-3720..-498
31d10 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
31d20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
31d30 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
31d40 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab2 AS cor0 CROS
31d50 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63  S JOIN tab2 AS c
31d60 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
31d70 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
31d80 63 61 61 35 64 64 33 33 38 38 64 39 65 65 30 66  caa5dd3388d9ee0f
31d90 65 61 36 37 36 66 61 33 35 32 39 39 66 65 35 0d  ea676fa35299fe5.
31da0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31db0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
31dc0 30 2e 63 6f 6c 30 20 2d 20 2b 20 63 6f 72 30 2e  0.col0 - + cor0.
31dd0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52  col0 * + col1 FR
31de0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
31df0 2d 2d 0d 0a 2d 31 32 36 34 0d 0a 2d 32 31 30 0d  --..-1264..-210.
31e00 0a 2d 34 35 32 34 0d 0a 0d 0a 71 75 65 72 79 20  .-4524....query 
31e10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31e20 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2b  T + col2 * + ( +
31e30 20 34 35 20 29 20 2a 20 63 6f 6c 30 20 2b 20 63   45 ) * col0 + c
31e40 6f 6c 31 20 2b 20 2b 20 28 20 63 6f 6c 32 20 29  ol1 + + ( col2 )
31e50 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
31e60 0a 2d 2d 2d 2d 0d 0a 31 36 37 33 0d 0a 33 32 38  .----..1673..328
31e70 35 38 33 0d 0a 33 35 37 35 39 0d 0a 0d 0a 71 75  583..35759....qu
31e80 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
31e90 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
31ea0 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c  ECT * FROM tab1,
31eb0 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
31ec0 61 62 32 20 63 6f 72 31 2c 20 74 61 62 30 2c 20  ab2 cor1, tab0, 
31ed0 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab2 AS cor2..--
31ee0 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20  --..3645 values 
31ef0 68 61 73 68 69 6e 67 20 74 6f 20 35 39 63 61 37  hashing to 59ca7
31f00 63 39 36 66 33 39 35 35 65 30 31 34 62 65 62 64  c96f3955e014bebd
31f10 30 38 62 35 34 34 32 65 64 66 66 0d 0a 0d 0a 71  08b5442edff....q
31f20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31f30 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
31f40 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  l2 * + col0 + + 
31f50 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  ( - cor0.col1 + 
31f60 2d 20 32 34 20 29 20 41 53 20 63 6f 6c 30 20 46  - 24 ) AS col0 F
31f70 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
31f80 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 31 31 0d 0a 2d  ..----..-2111..-
31f90 32 34 34 0d 0a 2d 33 30 34 33 0d 0a 0d 0a 71 75  244..-3043....qu
31fa0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31fb0 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a  ELECT - - col0 *
31fc0 20 36 34 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63   64 + + col1 * c
31fd0 6f 6c 30 20 2b 20 39 31 20 46 52 4f 4d 20 74 61  ol0 + 91 FROM ta
31fe0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
31ff0 33 38 38 36 0d 0a 33 36 39 31 0d 0a 35 37 32 36  3886..3691..5726
32000 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32010 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
32020 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  col1 + - col0 + 
32030 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
32040 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
32050 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d  -..-7..-78..-79.
32060 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32070 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
32080 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 72  or0.col1 + - cor
32090 30 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  0.col0 * cor0.co
320a0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
320b0 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72 30 0d  tab2, tab1 cor0.
320c0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
320d0 68 61 73 68 69 6e 67 20 74 6f 20 63 66 35 35 32  hashing to cf552
320e0 63 64 36 38 62 34 31 63 62 36 64 32 32 32 37 63  cd68b41cb6d2227c
320f0 36 63 65 36 38 64 39 39 39 64 39 0d 0a 0d 0a 71  6ce68d999d9....q
32100 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32110 53 45 4c 45 43 54 20 33 20 2a 20 2b 20 63 6f 72  SELECT 3 * + cor
32120 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
32130 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20  , tab2 AS cor0, 
32140 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
32150 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
32160 73 68 69 6e 67 20 74 6f 20 66 36 38 31 61 32 36  shing to f681a26
32170 66 65 31 65 30 38 66 62 61 63 35 33 34 36 38 61  fe1e08fbac53468a
32180 36 39 32 35 62 34 39 39 65 0d 0a 0d 0a 71 75 65  6925b499e....que
32190 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
321a0 4c 45 43 54 20 2d 20 32 39 20 41 53 20 63 6f 6c  LECT - 29 AS col
321b0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
321c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a  or0..----..-29..
321d0 2d 32 39 0d 0a 2d 32 39 0d 0a 0d 0a 71 75 65 72  -29..-29....quer
321e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
321f0 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c  ECT ALL cor0.col
32200 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
32210 61 62 30 2c 20 74 61 62 32 20 63 6f 72 30 2c 20  ab0, tab2 cor0, 
32220 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  tab0 cor1..----.
32230 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
32240 6e 67 20 74 6f 20 34 30 66 64 38 63 63 30 64 65  ng to 40fd8cc0de
32250 39 32 65 61 36 38 64 37 33 36 33 34 63 32 64 38  92ea68d73634c2d8
32260 66 37 35 62 66 35 0d 0a 0d 0a 71 75 65 72 79 20  f75bf5....query 
32270 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32280 54 20 2b 20 63 6f 6c 30 20 2b 20 38 33 20 46 52  T + col0 + 83 FR
32290 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
322a0 34 37 0d 0a 31 36 33 0d 0a 38 36 0d 0a 0d 0a 71  47..163..86....q
322b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
322c0 53 45 4c 45 43 54 20 34 39 20 2a 20 63 6f 6c 32  SELECT 49 * col2
322d0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
322e0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
322f0 32 37 34 0d 0a 31 33 32 33 0d 0a 31 38 36 32 0d  274..1323..1862.
32300 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32310 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 63  rt..SELECT ( - c
32320 6f 6c 31 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f  ol1 ) + col1 FRO
32330 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
32340 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
32350 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32360 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
32370 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  - - col1 AS col1
32380 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
32390 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d  r0..----..2..62.
323a0 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .62....query I r
323b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
323c0 49 53 54 49 4e 43 54 20 2d 20 74 61 62 31 2e 63  ISTINCT - tab1.c
323d0 6f 6c 32 20 2a 20 35 36 20 46 52 4f 4d 20 74 61  ol2 * 56 FROM ta
323e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 32 34 0d  b1..----..-3024.
323f0 0a 2d 33 31 39 32 0d 0a 2d 35 33 37 36 0d 0a 0d  .-3192..-5376...
32400 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32410 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 63 6f 6c  ..SELECT ( - col
32420 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  1 * + col1 + col
32430 32 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  2 ) FROM tab1..-
32440 2d 2d 2d 0d 0a 2d 34 33 0d 0a 2d 36 32 32 0d 0a  ---..-43..-622..
32450 2d 37 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -73....onlyif my
32460 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
32470 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
32480 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
32490 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
324a0 65 6c 2d 31 33 38 36 0d 0a 53 45 4c 45 43 54 20  el-1386..SELECT 
324b0 2d 20 2d 20 34 34 20 44 49 56 20 63 6f 72 30 2e  - - 44 DIV cor0.
324c0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
324d0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
324e0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
324f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
32500 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
32510 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32520 6c 61 62 65 6c 2d 31 33 38 36 0d 0a 53 45 4c 45  label-1386..SELE
32530 43 54 20 2d 20 2d 20 34 34 20 2f 20 63 6f 72 30  CT - - 44 / cor0
32540 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
32550 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
32560 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
32570 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32580 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 31 37  t..SELECT - + 17
32590 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
325a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d  r0..----..-17..-
325b0 31 37 0d 0a 2d 31 37 0d 0a 0d 0a 71 75 65 72 79  17..-17....query
325c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
325d0 43 54 20 44 49 53 54 49 4e 43 54 20 39 35 20 2a  CT DISTINCT 95 *
325e0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   + cor0.col1 AS 
325f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
32600 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
32610 33 35 0d 0a 32 34 37 30 0d 0a 39 35 30 0d 0a 0d  35..2470..950...
32620 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
32630 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
32640 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
32650 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
32660 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
32670 6f 72 74 20 6c 61 62 65 6c 2d 31 33 38 39 0d 0a  ort label-1389..
32680 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 32 20  SELECT + ( col2 
32690 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  * + CAST( NULL A
326a0 53 20 53 49 47 4e 45 44 20 29 20 29 20 41 53 20  S SIGNED ) ) AS 
326b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
326c0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
326d0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
326e0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
326f0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
32700 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
32710 33 38 39 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  389..SELECT + ( 
32720 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 20 28 20  col2 * + CAST ( 
32730 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
32740 29 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ) ) AS col0 FROM
32750 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab0..----..NUL
32760 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
32770 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32780 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 20 46  ..SELECT ALL 8 F
32790 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20  ROM tab0, tab2, 
327a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
327b0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
327c0 73 68 69 6e 67 20 74 6f 20 33 33 30 36 39 61 64  shing to 33069ad
327d0 63 33 63 31 31 34 32 64 33 31 35 31 31 65 63 38  c3c1142d31511ec8
327e0 38 66 63 66 61 34 30 61 66 0d 0a 0d 0a 71 75 65  8fcfa40af....que
327f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32800 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
32810 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 32 20 29 20  col2 * ( col2 ) 
32820 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
32830 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  1 cor0..----..-2
32840 39 31 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39 32 31  916..-3249..-921
32850 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
32860 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
32870 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a  TINCT - - col2 *
32880 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31   - col0 + - col1
32890 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
328a0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
328b0 31 33 32 0d 0a 2d 37 33 38 39 0d 0a 2d 38 37 38  132..-7389..-878
328c0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
328d0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
328e0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
328f0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
32900 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
32910 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39  owsort label-139
32920 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  3..SELECT + - co
32930 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 28 20 2b 20  r0.col1 + + ( + 
32940 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 30 20 2b 20  col0 ) * col0 + 
32950 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
32960 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 72  SIGNED ) * - cor
32970 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  0.col0 * + col1 
32980 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
32990 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
329a0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
329b0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
329c0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
329d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
329e0 33 39 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  393..SELECT + - 
329f0 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 28 20  cor0.col1 + + ( 
32a00 2b 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 30 20  + col0 ) * col0 
32a10 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + - CAST ( NULL 
32a20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d  AS INTEGER ) * -
32a30 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63   cor0.col0 * + c
32a40 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
32a50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
32a60 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
32a70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32a80 45 4c 45 43 54 20 34 37 20 46 52 4f 4d 20 74 61  ELECT 47 FROM ta
32a90 62 31 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74  b1, tab0 cor0, t
32aa0 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor1..----..
32ab0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
32ac0 67 20 74 6f 20 33 66 39 39 31 36 33 32 65 39 63  g to 3f991632e9c
32ad0 37 63 35 31 34 32 65 31 64 38 30 38 35 37 63 64  7c5142e1d80857cd
32ae0 31 30 61 32 64 0d 0a 0d 0a 71 75 65 72 79 20 49  10a2d....query I
32af0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32b00 20 2d 20 2b 20 32 31 20 41 53 20 63 6f 6c 32 20   - + 21 AS col2 
32b10 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 2c  FROM tab2, tab1,
32b20 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
32b30 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
32b40 61 73 68 69 6e 67 20 74 6f 20 63 64 63 62 34 30  ashing to cdcb40
32b50 63 39 65 31 62 62 39 61 33 33 63 65 39 31 36 37  c9e1bb9a33ce9167
32b60 61 30 64 32 62 61 63 30 62 31 0d 0a 0d 0a 71 75  a0d2bac0b1....qu
32b70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32b80 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 2d 20 74  ELECT col0 - - t
32b90 61 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  ab1.col0 AS col0
32ba0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
32bb0 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a 0d  ..128..160..6...
32bc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32bd0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
32be0 54 20 32 36 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  T 26 + - cor0.co
32bf0 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l0 FROM tab1, ta
32c00 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
32c10 0d 0a 2d 33 38 0d 0a 2d 35 34 0d 0a 32 33 0d 0a  ..-38..-54..23..
32c20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32c30 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
32c40 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  CT - - col1 * co
32c50 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31  r0.col0 * + col1
32c60 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
32c70 0a 2d 2d 2d 2d 0d 0a 31 37 37 35 30 34 0d 0a 33  .----..177504..3
32c80 32 39 33 31 35 0d 0a 37 33 37 30 30 39 0d 0a 0d  29315..737009...
32c90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32ca0 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28 20 63  ..SELECT + - ( c
32cb0 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2b  ol0 ) * - col2 +
32cc0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   - cor0.col2 AS 
32cd0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
32ce0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
32cf0 38 0d 0a 33 35 39 31 0d 0a 37 35 38 34 0d 0a 0d  8..3591..7584...
32d00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32d10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 32  ..SELECT ALL + 2
32d20 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
32d30 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
32d40 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
32d50 67 20 74 6f 20 63 35 32 37 32 66 61 63 64 61 61  g to c5272facdaa
32d60 61 31 31 66 38 38 34 63 38 63 63 30 64 39 64 34  a11f884c8cc0d9d4
32d70 66 34 31 63 37 0d 0a 0d 0a 71 75 65 72 79 20 49  f41c7....query I
32d80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32d90 20 2b 20 63 6f 6c 31 20 2a 20 34 32 20 2a 20 2d   + col1 * 42 * -
32da0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
32db0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
32dc0 31 34 32 35 39 30 0d 0a 2d 33 34 30 31 35 38 0d  142590..-340158.
32dd0 0a 2d 38 36 36 38 38 0d 0a 0d 0a 6f 6e 6c 79 69  .-86688....onlyi
32de0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
32df0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
32e00 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
32e10 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
32e20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
32e30 62 65 6c 2d 31 34 30 32 0d 0a 53 45 4c 45 43 54  bel-1402..SELECT
32e40 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 32 20 2b   ALL tab0.col2 +
32e50 20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   - CAST( col1 AS
32e60 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
32e70 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
32e80 2d 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d  -..-53..-9..-96.
32e90 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
32ea0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
32eb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32ec0 74 20 6c 61 62 65 6c 2d 31 34 30 32 0d 0a 53 45  t label-1402..SE
32ed0 4c 45 43 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f  LECT ALL tab0.co
32ee0 6c 32 20 2b 20 2d 20 43 41 53 54 20 28 20 63 6f  l2 + - CAST ( co
32ef0 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
32f00 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
32f10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 39  0..----..-53..-9
32f20 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-96....query I
32f30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32f40 20 63 6f 6c 30 20 2a 20 2b 20 34 35 20 2d 20 2d   col0 * + 45 - -
32f50 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a   col1 * - col1 *
32f60 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f   tab1.col1 AS co
32f70 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
32f80 2d 2d 0d 0a 2d 31 37 34 34 31 0d 0a 31 34 30 33  --..-17441..1403
32f90 0d 0a 31 38 38 30 0d 0a 0d 0a 71 75 65 72 79 20  ..1880....query 
32fa0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32fb0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
32fc0 2b 20 28 20 35 33 20 29 20 2a 20 63 6f 6c 32 20  + ( 53 ) * col2 
32fd0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
32fe0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33  1..----..2916..3
32ff0 30 37 38 0d 0a 35 31 38 34 0d 0a 0d 0a 71 75 65  078..5184....que
33000 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33010 4c 45 43 54 20 63 6f 6c 31 20 2a 20 38 37 20 2a  LECT col1 * 87 *
33020 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
33030 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 36 39 30 36 0d  0..----..246906.
33040 0a 36 34 39 31 39 34 0d 0a 38 34 33 39 0d 0a 0d  .649194..8439...
33050 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33060 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32  ..SELECT ALL - 2
33070 34 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  4 FROM tab0, tab
33080 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  2 AS cor0, tab2 
33090 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
330a0 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
330b0 20 74 6f 20 66 32 65 34 30 66 36 65 35 63 64 62   to f2e40f6e5cdb
330c0 63 32 38 37 37 38 34 33 31 39 31 63 62 32 36 31  c2877843191cb261
330d0 39 37 35 66 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  975f....onlyif m
330e0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
330f0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
33100 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
33110 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
33120 62 65 6c 2d 31 34 30 37 0d 0a 53 45 4c 45 43 54  bel-1407..SELECT
33130 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 44 49 56   col0 * col1 DIV
33140 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   + col1 + - col0
33150 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
33160 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
33170 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
33180 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
33190 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
331a0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
331b0 6c 2d 31 34 30 37 0d 0a 53 45 4c 45 43 54 20 63  l-1407..SELECT c
331c0 6f 6c 30 20 2a 20 63 6f 6c 31 20 2f 20 2b 20 63  ol0 * col1 / + c
331d0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 + - col0 AS 
331e0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
331f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
33200 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
33210 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33220 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20 2d   cor0.col1 + ( -
33230 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20 41   col0 ) * col1 A
33240 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
33250 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33260 2d 31 39 37 38 0d 0a 2d 33 32 39 38 0d 0a 2d 38  -1978..-3298..-8
33270 30 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  008....query I r
33280 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
33290 20 2b 20 38 36 20 41 53 20 63 6f 6c 31 20 46 52   + 86 AS col1 FR
332a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
332b0 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 38 36 0d 0a 38  .----..86..86..8
332c0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
332d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
332e0 54 49 4e 43 54 20 2d 20 28 20 2d 20 32 32 20 29  TINCT - ( - 22 )
332f0 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41   + - cor0.col2 A
33300 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
33310 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33320 2d 31 31 0d 0a 2d 36 30 0d 0a 32 31 0d 0a 0d 0a  -11..-60..21....
33330 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
33340 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
33350 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
33360 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
33370 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
33380 72 74 20 6c 61 62 65 6c 2d 31 34 31 31 0d 0a 53  rt label-1411..S
33390 45 4c 45 43 54 20 2b 20 2b 20 43 41 53 54 28 20  ELECT + + CAST( 
333a0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
333b0 20 2a 20 2b 20 36 35 20 2f 20 63 6f 72 30 2e 63   * + 65 / cor0.c
333c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
333d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
333e0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
333f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
33400 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
33410 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
33420 6c 61 62 65 6c 2d 31 34 31 31 0d 0a 53 45 4c 45  label-1411..SELE
33430 43 54 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55  CT + + CAST ( NU
33440 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
33450 2a 20 2b 20 36 35 20 2f 20 63 6f 72 30 2e 63 6f  * + 65 / cor0.co
33460 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
33470 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
33480 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
33490 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
334a0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b  .SELECT col0 * +
334b0 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a   col1 + + col0 *
334c0 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32   - col1 + - col2
334d0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
334e0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
334f0 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d  ..-54..-57..-96.
33500 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33510 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 33 34 20  rt..SELECT ( 34 
33520 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
33530 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
33540 2d 0d 0a 33 34 0d 0a 33 34 0d 0a 33 34 0d 0a 0d  -..34..34..34...
33550 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
33560 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
33570 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
33580 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
33590 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31  owsort label-141
335a0 34 0d 0a 53 45 4c 45 43 54 20 36 20 44 49 56 20  4..SELECT 6 DIV 
335b0 2d 20 35 38 20 63 6f 6c 31 20 46 52 4f 4d 20 74  - 58 col1 FROM t
335c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
335d0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
335e0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
335f0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
33600 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
33610 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
33620 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
33630 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
33640 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
33650 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 34  wsort label-1414
33660 0d 0a 53 45 4c 45 43 54 20 36 20 2f 20 2d 20 35  ..SELECT 6 / - 5
33670 38 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  8 col1 FROM tab0
33680 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33690 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
336a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
336b0 43 54 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 31  CT + ( cor0.col1
336c0 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61   ) FROM tab2, ta
336d0 62 32 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  b2 cor0, tab0 AS
336e0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
336f0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
33700 6f 20 37 35 39 39 62 34 38 30 31 32 35 64 65 35  o 7599b480125de5
33710 32 31 65 66 65 64 37 31 62 35 62 32 34 31 33 63  21efed71b5b2413c
33720 37 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  7d....query I ro
33730 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
33740 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31  cor0.col2 * col1
33750 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
33760 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
33770 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38 0d 0a 36  0..----..1508..6
33780 30 38 0d 0a 38 31 30 0d 0a 0d 0a 71 75 65 72 79  08..810....query
33790 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
337a0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
337b0 6c 32 20 2d 20 2b 20 31 39 20 41 53 20 63 6f 6c  l2 - + 19 AS col
337c0 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
337d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 0d 0a 2d 37  ..----..-115..-7
337e0 33 0d 0a 2d 37 36 0d 0a 0d 0a 71 75 65 72 79 20  3..-76....query 
337f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33800 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 35  T + - col0 * + 5
33810 35 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  5 FROM tab0 AS c
33820 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 30  or0..----..-1320
33830 0d 0a 2d 31 39 32 35 0d 0a 2d 34 38 39 35 0d 0a  ..-1925..-4895..
33840 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33850 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
33860 20 2a 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20   * ( + col0 ) + 
33870 63 6f 6c 32 20 2a 20 2b 20 31 30 20 41 53 20 63  col2 * + 10 AS c
33880 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
33890 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 36 38 0d  r0..----..-1768.
338a0 0a 2d 32 36 32 32 0d 0a 38 31 0d 0a 0d 0a 6f 6e  .-2622..81....on
338b0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
338c0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
338d0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
338e0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
338f0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32 30 0d 0a  ort label-1420..
33900 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20  SELECT - + col1 
33910 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 72  + col0 DIV + cor
33920 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  0.col0 AS col1 F
33930 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
33940 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 33 30  ..----..-16..-30
33950 0d 0a 2d 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-58....skipif 
33960 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
33970 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
33980 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
33990 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  20..SELECT - + c
339a0 6f 6c 31 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63  ol1 + col0 / + c
339b0 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or0.col0 AS col1
339c0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
339d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d  r0..----..-16..-
339e0 33 30 0d 0a 2d 35 38 0d 0a 0d 0a 71 75 65 72 79  30..-58....query
339f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33a00 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d 20 63 6f  CT ALL col0 - co
33a10 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
33a20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
33a30 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32 0d  --..-24..19..62.
33a40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33a50 72 74 0d 0a 53 45 4c 45 43 54 20 36 34 20 2b 20  rt..SELECT 64 + 
33a60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
33a70 2d 2d 2d 2d 0d 0a 31 35 33 0d 0a 38 38 0d 0a 39  ----..153..88..9
33a80 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
33a90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
33aa0 30 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20  0 + tab2.col0 * 
33ab0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
33ac0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34  M tab2..----..14
33ad0 32 32 0d 0a 32 32 34 0d 0a 34 36 38 30 0d 0a 0d  22..224..4680...
33ae0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33af0 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e  ..SELECT + tab0.
33b00 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c 30  col2 + tab0.col0
33b10 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
33b20 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 36 0d 0a 36  0..----..1226..6
33b30 30 39 0d 0a 38 30 30 33 0d 0a 0d 0a 71 75 65 72  09..8003....quer
33b40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33b50 45 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20  ECT + tab2.col1 
33b60 2b 20 34 37 20 46 52 4f 4d 20 74 61 62 32 0d 0a  + 47 FROM tab2..
33b70 2d 2d 2d 2d 0d 0a 31 30 36 0d 0a 36 34 0d 0a 37  ----..106..64..7
33b80 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
33b90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
33ba0 20 63 6f 6c 30 20 2b 20 33 35 20 41 53 20 63 6f   col0 + 35 AS co
33bb0 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
33bc0 2d 2d 0d 0a 31 31 35 0d 0a 33 38 0d 0a 39 39 0d  --..115..38..99.
33bd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33be0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
33bf0 31 20 2d 20 2b 20 28 20 63 6f 6c 30 20 29 20 41  1 - + ( col0 ) A
33c00 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
33c10 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 31  ..----..-110..-1
33c20 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 71 75 65 72  32..-180....quer
33c30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33c40 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
33c50 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 37  ol2 * col0 + + 7
33c60 35 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  5 FROM tab2..---
33c70 2d 0d 0a 2d 31 31 34 0d 0a 2d 31 39 35 33 0d 0a  -..-114..-1953..
33c80 2d 32 39 32 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -2927....onlyif 
33c90 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
33ca0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
33cb0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
33cc0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
33cd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
33ce0 6c 2d 31 34 32 39 0d 0a 53 45 4c 45 43 54 20 2d  l-1429..SELECT -
33cf0 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20   col1 * + CAST( 
33d00 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
33d10 20 2b 20 2d 20 36 20 46 52 4f 4d 20 74 61 62 30   + - 6 FROM tab0
33d20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33d30 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
33d40 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
33d50 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
33d60 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
33d70 72 74 20 6c 61 62 65 6c 2d 31 34 32 39 0d 0a 53  rt label-1429..S
33d80 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b  ELECT - col1 * +
33d90 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
33da0 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 36 20  INTEGER ) + - 6 
33db0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
33dc0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
33dd0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
33de0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33df0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 37  LECT DISTINCT 97
33e00 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
33e10 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
33e20 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37  S cor1..----..97
33e30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33e40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
33e50 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 30 20  col2 * + ( col0 
33e60 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
33e70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a  or0..----..189..
33e80 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75  2028..3002....qu
33e90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33ea0 45 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f 6c 32  ELECT ALL ( col2
33eb0 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 29 20 46   + tab2.col2 ) F
33ec0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
33ed0 35 32 0d 0a 35 34 0d 0a 37 36 0d 0a 0d 0a 6f 6e  52..54..76....on
33ee0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
33ef0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
33f00 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
33f10 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
33f20 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 33 0d 0a  ort label-1433..
33f30 53 45 4c 45 43 54 20 35 38 20 2b 20 2b 20 39 38  SELECT 58 + + 98
33f40 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63   DIV - col1 AS c
33f50 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
33f60 2d 2d 2d 0d 0a 35 37 0d 0a 35 37 0d 0a 35 37 0d  ---..57..57..57.
33f70 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
33f80 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
33f90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33fa0 74 20 6c 61 62 65 6c 2d 31 34 33 33 0d 0a 53 45  t label-1433..SE
33fb0 4c 45 43 54 20 35 38 20 2b 20 2b 20 39 38 20 2f  LECT 58 + + 98 /
33fc0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
33fd0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
33fe0 0a 35 37 0d 0a 35 37 0d 0a 35 37 0d 0a 0d 0a 71  .57..57..57....q
33ff0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34000 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
34010 2d 20 2d 20 63 6f 6c 32 20 2b 20 32 37 20 41 53  - - col2 + 27 AS
34020 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
34030 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
34040 32 33 0d 0a 38 31 0d 0a 38 34 0d 0a 0d 0a 6f 6e  23..81..84....on
34050 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
34060 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
34070 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
34080 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
34090 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 35 0d 0a  ort label-1435..
340a0 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28  SELECT ALL CAST(
340b0 20 2d 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45   - col0 AS SIGNE
340c0 44 20 29 20 44 49 56 20 2d 20 63 6f 6c 32 20 41  D ) DIV - col2 A
340d0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
340e0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d  ..----..0..0..1.
340f0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
34100 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
34110 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34120 74 20 6c 61 62 65 6c 2d 31 34 33 35 0d 0a 53 45  t label-1435..SE
34130 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20  LECT ALL CAST ( 
34140 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  - col0 AS INTEGE
34150 52 20 29 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20  R ) / - col2 AS 
34160 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
34170 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d  ----..0..0..1...
34180 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34190 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 39 20  ..SELECT ALL 79 
341a0 2b 20 74 61 62 32 2e 63 6f 6c 32 20 41 53 20 63  + tab2.col2 AS c
341b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
341c0 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 30 36 0d 0a 31  ---..105..106..1
341d0 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  17....query I ro
341e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
341f0 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20  STINCT + - col1 
34200 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
34210 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
34220 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d  ..----..-1248..-
34230 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75  1404..-570....qu
34240 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34250 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
34260 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a   col1 + - col2 *
34270 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
34280 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
34290 2d 2d 0d 0a 2d 32 30 38 37 0d 0a 2d 32 32 30 0d  --..-2087..-220.
342a0 0a 2d 33 30 31 39 0d 0a 0d 0a 71 75 65 72 79 20  .-3019....query 
342b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
342c0 54 20 37 30 20 2b 20 63 6f 6c 32 20 2d 20 38 33  T 70 + col2 - 83
342d0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
342e0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
342f0 33 0d 0a 31 34 0d 0a 32 35 0d 0a 0d 0a 71 75 65  3..14..25....que
34300 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34310 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
34320 2d 20 38 34 20 46 52 4f 4d 20 74 61 62 31 20 41  - 84 FROM tab1 A
34330 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 34  S cor0..----..84
34340 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34350 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
34360 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  l0 + - col2 * - 
34370 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
34380 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab0..----..13
34390 32 0d 0a 32 38 36 32 0d 0a 37 35 35 31 0d 0a 0d  2..2862..7551...
343a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
343b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
343c0 54 20 38 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  T 81 AS col1 FRO
343d0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
343e0 2d 2d 2d 2d 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72  ----..81....quer
343f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34400 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b  ECT ALL - col1 +
34410 20 63 6f 6c 30 20 2b 20 2b 20 28 20 31 31 20 29   col0 + + ( 11 )
34420 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
34430 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a 33  r0..----..-13..3
34440 30 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49  0..73....query I
34450 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34460 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 32 20 29 20   ALL + ( col2 ) 
34470 2b 20 37 33 20 2a 20 63 6f 6c 31 20 41 53 20 63  + 73 * col1 AS c
34480 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
34490 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
344a0 35 0d 0a 31 39 35 32 0d 0a 37 38 37 0d 0a 0d 0a  5..1952..787....
344b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
344c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
344d0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63   + col0 * cor0.c
344e0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 + + col2 AS 
344f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
34500 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31  S cor0..----..41
34510 35 33 0d 0a 36 33 0d 0a 36 34 39 36 0d 0a 0d 0a  53..63..6496....
34520 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34530 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 32 34  .SELECT ALL + 24
34540 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
34550 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
34560 2d 0d 0a 2d 31 34 31 36 0d 0a 2d 34 30 38 0d 0a  -..-1416..-408..
34570 2d 37 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -744....skipif p
34580 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
34590 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
345a0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
345b0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
345c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
345d0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
345e0 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2d 20 35 36  col1 + col2 - 56
345f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
34600 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
34610 31 0d 0a 32 0d 0a 32 39 0d 0a 0d 0a 71 75 65 72  1..2..29....quer
34620 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34630 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
34640 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  0 * col2 AS col1
34650 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
34660 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38  .----..162..3648
34670 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20  ..7680....query 
34680 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34690 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
346a0 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ol0 + cor0.col1 
346b0 2a 20 63 6f 6c 32 20 2a 20 37 34 20 41 53 20 63  * col2 * 74 AS c
346c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
346d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33   cor0..----..103
346e0 38 39 33 0d 0a 34 32 31 31 36 0d 0a 39 32 32 37  893..42116..9227
346f0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
34700 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
34710 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 38 33 20  2 * + col1 + 83 
34720 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
34730 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
34740 0d 0a 2d 34 37 34 32 0d 0a 2d 35 33 39 32 0d 0a  ..-4742..-5392..
34750 31 31 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1155....query I 
34760 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34770 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e 63 6f  DISTINCT tab0.co
34780 6c 30 20 2a 20 37 35 20 46 52 4f 4d 20 74 61 62  l0 * 75 FROM tab
34790 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
347a0 0a 2d 2d 2d 2d 0d 0a 31 38 30 30 0d 0a 32 36 32  .----..1800..262
347b0 35 0d 0a 36 36 37 35 0d 0a 0d 0a 71 75 65 72 79  5..6675....query
347c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
347d0 43 54 20 2b 20 38 37 20 2b 20 63 6f 6c 31 20 41  CT + 87 + col1 A
347e0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
347f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34800 31 30 30 0d 0a 31 31 33 0d 0a 39 37 0d 0a 0d 0a  100..113..97....
34810 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34820 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
34830 28 20 2d 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c  ( - col0 ) + col
34840 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  0 * - col2 FROM 
34850 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
34860 0a 2d 37 32 30 39 0d 0a 2d 37 36 38 0d 0a 30 0d  .-7209..-768..0.
34870 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34880 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
34890 20 2d 20 37 37 20 2a 20 63 6f 6c 30 20 41 53 20   - 77 * col0 AS 
348a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
348b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
348c0 34 38 0d 0a 32 36 39 35 0d 0a 36 38 35 33 0d 0a  48..2695..6853..
348d0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
348e0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
348f0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
34900 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
34910 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
34920 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34930 43 54 20 63 6f 6c 32 20 2b 20 28 20 2d 20 63 6f  CT col2 + ( - co
34940 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2a 20  l0 ) * + col0 * 
34950 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32  - cor0.col0 col2
34960 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
34970 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 32 32 30 31  r0..----..262201
34980 0d 0a 35 31 32 30 39 36 0d 0a 38 31 0d 0a 0d 0a  ..512096..81....
34990 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
349a0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30  .SELECT + - col0
349b0 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   * - col0 + + co
349c0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
349d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a  cor0..----..12..
349e0 34 31 36 30 0d 0a 36 34 38 30 0d 0a 0d 0a 6f 6e  4160..6480....on
349f0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
34a00 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
34a10 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
34a20 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
34a30 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 37 0d 0a  ort label-1457..
34a40 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 44 49  SELECT + col1 DI
34a50 56 20 2d 20 32 32 20 41 53 20 63 6f 6c 31 20 46  V - 22 AS col1 F
34a60 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
34a70 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a  ..----..-1..-2..
34a80 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
34a90 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
34aa0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
34ab0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 37 0d 0a  ort label-1457..
34ac0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2f 20  SELECT + col1 / 
34ad0 2d 20 32 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 22 AS col1 FRO
34ae0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
34af0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d  ----..-1..-2..0.
34b00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34b10 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
34b20 2a 20 2b 20 32 20 46 52 4f 4d 20 74 61 62 31 20  * + 2 FROM tab1 
34b30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
34b40 30 0d 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 71 75 65  0..26..52....que
34b50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34b60 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20  LECT - - col0 * 
34b70 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  - cor0.col0 FROM
34b80 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
34b90 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37 36 0d 0a 2d  ..-1225..-576..-
34ba0 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7921....query I 
34bb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34bc0 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72  ALL + col0 * cor
34bd0 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  0.col0 + cor0.co
34be0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
34bf0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
34c00 0a 35 36 0d 0a 36 31 36 32 0d 0a 36 33 32 30 0d  .56..6162..6320.
34c10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34c20 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
34c30 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   + col1 + - col0
34c40 20 2a 20 2b 20 31 34 20 41 53 20 63 6f 6c 30 20   * + 14 AS col0 
34c50 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
34c60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 35 0d 0a  0..----..-1155..
34c70 2d 32 35 30 0d 0a 2d 33 39 33 0d 0a 0d 0a 71 75  -250..-393....qu
34c80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34c90 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 28  ELECT - col2 + (
34ca0 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
34cb0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  2 cor0..----..-2
34cc0 31 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72  1..33..4....quer
34cd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34ce0 45 43 54 20 41 4c 4c 20 37 33 20 2b 20 63 6f 6c  ECT ALL 73 + col
34cf0 31 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20  1 * + tab0.col2 
34d00 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
34d10 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
34d20 33 34 36 38 0d 0a 36 36 34 31 39 31 0d 0a 36 38  3468..664191..68
34d30 31 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  185....query I r
34d40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
34d50 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   + col1 * + col1
34d60 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 63 6f   + + col2 - + co
34d70 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
34d80 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
34d90 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d  .-7396..-8281..-
34da0 39 34 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  9409....onlyif m
34db0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
34dc0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
34dd0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
34de0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
34df0 62 65 6c 2d 31 34 36 35 0d 0a 53 45 4c 45 43 54  bel-1465..SELECT
34e00 20 2b 20 63 6f 6c 30 20 44 49 56 20 31 32 20 46   + col0 DIV 12 F
34e10 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
34e20 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 36 0d 0a 36 0d  ..----..0..6..6.
34e30 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
34e40 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
34e50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34e60 74 20 6c 61 62 65 6c 2d 31 34 36 35 0d 0a 53 45  t label-1465..SE
34e70 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 31 32  LECT + col0 / 12
34e80 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
34e90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 36 0d 0a  r0..----..0..6..
34ea0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
34eb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
34ec0 20 63 6f 6c 30 20 2b 20 28 20 38 33 20 29 20 2a   col0 + ( 83 ) *
34ed0 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
34ee0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
34ef0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 36 0d  cor0..----..246.
34f00 0a 35 32 34 38 0d 0a 36 35 36 30 0d 0a 0d 0a 73  .5248..6560....s
34f10 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
34f20 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
34f30 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
34f40 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
34f50 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
34f60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34f70 44 49 53 54 49 4e 43 54 20 2b 20 28 20 63 6f 6c  DISTINCT + ( col
34f80 30 20 29 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20  0 ) * col1 col2 
34f90 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
34fa0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36  0..----..1040..6
34fb0 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20  40..78....query 
34fc0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34fd0 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 63  T ALL - col0 * c
34fe0 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  ol1 + col0 + + c
34ff0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
35000 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
35010 34 37 0d 0a 2d 31 37 39 0d 0a 2d 34 34 36 35 0d  47..-179..-4465.
35020 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35030 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
35040 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20   + ( + col1 ) * 
35050 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col2 + col0 * - 
35060 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
35070 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
35080 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32 30 34 36 0d  ----..164..2046.
35090 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .62....query I r
350a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
350b0 49 53 54 49 4e 43 54 20 2d 20 2d 20 39 38 20 41  ISTINCT - - 98 A
350c0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
350d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
350e0 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
350f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
35100 34 33 20 2b 20 38 35 20 41 53 20 63 6f 6c 30 20  43 + 85 AS col0 
35110 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
35120 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 32  0..----..128..12
35130 38 0d 0a 31 32 38 0d 0a 0d 0a 71 75 65 72 79 20  8..128....query 
35140 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35150 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63  T ALL + - cor0.c
35160 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 + - col0 AS 
35170 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
35180 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
35190 33 37 0d 0a 2d 33 38 0d 0a 2d 39 36 0d 0a 0d 0a  37..-38..-96....
351a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
351b0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
351c0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
351d0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
351e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 33  wsort label-1473
351f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
35200 54 20 2d 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63  T - + ( + cor0.c
35210 6f 6c 32 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 ) + cor0.col
35220 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20  0 DIV - col1 AS 
35230 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
35240 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
35250 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 73 6b  ..-33..-82....sk
35260 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
35270 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
35280 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
35290 65 6c 2d 31 34 37 33 0d 0a 53 45 4c 45 43 54 20  el-1473..SELECT 
352a0 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 28 20 2b  DISTINCT - + ( +
352b0 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 63   cor0.col2 ) + c
352c0 6f 72 30 2e 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  or0.col0 / - col
352d0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
352e0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
352f0 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d  -..-1..-33..-82.
35300 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
35310 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
35320 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
35330 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
35340 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
35350 34 37 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  474..SELECT ALL 
35360 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  + cor0.col1 + co
35370 6c 32 20 44 49 56 20 2d 20 63 6f 6c 31 20 46 52  l2 DIV - col1 FR
35380 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
35390 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39  .----..86..91..9
353a0 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  7....skipif mysq
353b0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
353c0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
353d0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 34 0d 0a  ort label-1474..
353e0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
353f0 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2f 20  0.col1 + col2 / 
35400 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
35410 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35420 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75  86..91..97....qu
35430 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35440 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
35450 20 2b 20 31 35 20 2a 20 63 6f 6c 30 20 2b 20 2b   + 15 * col0 + +
35460 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
35470 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
35480 2d 2d 0d 0a 31 34 31 37 0d 0a 33 39 33 0d 0a 35  --..1417..393..5
35490 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  26....skipif pos
354a0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
354b0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
354c0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
354d0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
354e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
354f0 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
35500 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  l2 + + col2 * - 
35510 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
35520 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
35530 2d 0d 0a 2d 32 38 36 32 0d 0a 2d 33 31 39 32 0d  -..-2862..-3192.
35540 0a 2d 39 31 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-9120....onlyif
35550 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
35560 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
35570 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
35580 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
35590 6c 61 62 65 6c 2d 31 34 37 37 0d 0a 53 45 4c 45  label-1477..SELE
355a0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
355b0 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 63 6f  l2 * + col1 - co
355c0 6c 30 20 2a 20 28 20 2b 20 63 6f 6c 32 20 29 20  l0 * ( + col2 ) 
355d0 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  DIV + col1 FROM 
355e0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
355f0 2d 2d 0d 0a 2d 32 38 34 37 0d 0a 2d 37 35 34 32  --..-2847..-7542
35600 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-97....skipif 
35610 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
35620 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
35630 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
35640 37 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  77..SELECT DISTI
35650 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  NCT - col2 * + c
35660 6f 6c 31 20 2d 20 63 6f 6c 30 20 2a 20 28 20 2b  ol1 - col0 * ( +
35670 20 63 6f 6c 32 20 29 20 2f 20 2b 20 63 6f 6c 31   col2 ) / + col1
35680 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
35690 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 34 37 0d  r0..----..-2847.
356a0 0a 2d 37 35 34 32 0d 0a 2d 39 37 0d 0a 0d 0a 71  .-7542..-97....q
356b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
356c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
356d0 2d 20 2b 20 33 35 20 2d 20 2d 20 63 6f 6c 32 20  - + 35 - - col2 
356e0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
356f0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
35700 0a 2d 38 0d 0a 2d 39 0d 0a 33 0d 0a 0d 0a 71 75  .-8..-9..3....qu
35710 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35720 45 4c 45 43 54 20 41 4c 4c 20 37 39 20 2b 20 63  ELECT ALL 79 + c
35730 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 * cor0.col0 
35740 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
35750 2d 2d 2d 2d 0d 0a 31 33 30 34 0d 0a 36 35 35 0d  ----..1304..655.
35760 0a 38 30 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .8000....onlyif 
35770 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
35780 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
35790 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
357a0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
357b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
357c0 6c 2d 31 34 38 30 0d 0a 53 45 4c 45 43 54 20 43  l-1480..SELECT C
357d0 41 53 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53  AST( + col2 AS S
357e0 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 32 20 46  IGNED ) + col2 F
357f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
35800 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35 34 0d 0a  ..----..52..54..
35810 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  76....skipif mys
35820 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
35830 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
35840 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 30 0d  sort label-1480.
35850 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 2b  .SELECT CAST ( +
35860 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
35870 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) + col2 FROM t
35880 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
35890 2d 0d 0a 35 32 0d 0a 35 34 0d 0a 37 36 0d 0a 0d  -..52..54..76...
358a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
358b0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
358c0 31 20 2b 20 2b 20 31 31 20 2a 20 2d 20 63 6f 6c  1 + + 11 * - col
358d0 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
358e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 37 0d 0a 2d 32  ..----..-227..-2
358f0 36 36 0d 0a 2d 34 30 31 0d 0a 0d 0a 6f 6e 6c 79  66..-401....only
35900 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
35910 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
35920 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
35930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35940 74 20 6c 61 62 65 6c 2d 31 34 38 32 0d 0a 53 45  t label-1482..SE
35950 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
35960 30 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63 6f  0 DIV col2 AS co
35970 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
35980 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33  0..----..0..1..3
35990 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
359a0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
359b0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
359c0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 32 0d 0a  ort label-1482..
359d0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
359e0 6f 6c 30 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 / col2 AS co
359f0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
35a00 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33  0..----..0..1..3
35a10 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
35a20 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
35a30 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
35a40 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
35a50 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
35a60 2d 31 34 38 33 0d 0a 53 45 4c 45 43 54 20 2b 20  -1483..SELECT + 
35a70 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 44 49  col0 + + col1 DI
35a80 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V - col0 FROM ta
35a90 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
35aa0 0d 0a 32 31 0d 0a 33 33 0d 0a 38 38 0d 0a 0d 0a  ..21..33..88....
35ab0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
35ac0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
35ad0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
35ae0 61 62 65 6c 2d 31 34 38 33 0d 0a 53 45 4c 45 43  abel-1483..SELEC
35af0 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  T + col0 + + col
35b00 31 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  1 / - col0 FROM 
35b10 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
35b20 2d 2d 0d 0a 32 31 0d 0a 33 33 0d 0a 38 38 0d 0a  --..21..33..88..
35b30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35b40 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
35b50 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32  CT col0 * + col2
35b60 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
35b70 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30  ab1..----..36480
35b80 0d 0a 34 32 31 32 0d 0a 39 39 38 34 30 0d 0a 0d  ..4212..99840...
35b90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35ba0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74  ..SELECT ALL + t
35bb0 61 62 30 2e 63 6f 6c 31 20 2a 20 2b 20 28 20 63  ab0.col1 * + ( c
35bc0 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol0 ) AS col2 FR
35bd0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
35be0 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
35bf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35c00 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
35c10 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 28 20 63  NCT + col0 * ( c
35c20 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 0d  ol0 ) FROM tab0.
35c30 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35 37 36  .----..1225..576
35c40 0d 0a 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20  ..7921....query 
35c50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35c60 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
35c70 30 20 2d 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  0 - - tab1.col0 
35c80 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  * - col1 AS col2
35c90 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
35ca0 0d 0a 2d 31 31 32 30 0d 0a 2d 37 30 34 0d 0a 2d  ..-1120..-704..-
35cb0 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  81....onlyif mys
35cc0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
35cd0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
35ce0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
35cf0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
35d00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
35d10 34 38 38 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  488..SELECT CAST
35d20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  ( - cor0.col0 AS
35d30 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
35d40 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
35d50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d  or0..----..-3..-
35d60 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69  64..-80....skipi
35d70 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
35d80 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
35d90 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
35da0 31 34 38 38 0d 0a 53 45 4c 45 43 54 20 43 41 53  1488..SELECT CAS
35db0 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  T ( - cor0.col0 
35dc0 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
35dd0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
35de0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
35df0 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 6f 6e  ..-64..-80....on
35e00 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
35e10 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
35e20 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
35e30 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
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 38 39 0d 0a 53 45 4c   label-1489..SEL
35e60 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  ECT + CAST( NULL
35e70 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2a 20   AS DECIMAL ) * 
35e80 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col0 + + cor0.co
35e90 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
35ea0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
35eb0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
35ec0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
35ed0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
35ee0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
35ef0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38  owsort label-148
35f00 39 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54  9..SELECT + CAST
35f10 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20   ( NULL AS REAL 
35f20 29 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72  ) * col0 + + cor
35f30 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  0.col0 AS col0 F
35f40 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
35f50 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
35f60 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  LL..NULL....only
35f70 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
35f80 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
35f90 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
35fa0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35fb0 74 20 6c 61 62 65 6c 2d 31 34 39 30 0d 0a 53 45  t label-1490..SE
35fc0 4c 45 43 54 20 2b 20 2b 20 28 20 63 6f 6c 31 20  LECT + + ( col1 
35fd0 29 20 2a 20 37 32 20 44 49 56 20 63 6f 72 30 2e  ) * 72 DIV cor0.
35fe0 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col2 + col0 * - 
35ff0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
36000 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
36010 30 33 31 0d 0a 2d 34 34 0d 0a 2d 36 32 38 0d 0a  031..-44..-628..
36020 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
36030 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
36040 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36050 20 6c 61 62 65 6c 2d 31 34 39 30 0d 0a 53 45 4c   label-1490..SEL
36060 45 43 54 20 2b 20 2b 20 28 20 63 6f 6c 31 20 29  ECT + + ( col1 )
36070 20 2a 20 37 32 20 2f 20 63 6f 72 30 2e 63 6f 6c   * 72 / cor0.col
36080 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  2 + col0 * - col
36090 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
360a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 31  or0..----..-1031
360b0 0d 0a 2d 34 34 0d 0a 2d 36 32 38 0d 0a 0d 0a 71  ..-44..-628....q
360c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
360d0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72  SELECT ALL - cor
360e0 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  0.col2 AS col1 F
360f0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 63  ROM tab2, tab0 c
36100 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
36110 31 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  1, tab1, tab0 AS
36120 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33   cor2..----..243
36130 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
36140 74 6f 20 33 65 32 62 38 31 63 61 31 30 34 38 34  to 3e2b81ca10484
36150 63 62 66 63 36 36 66 31 38 36 39 35 35 65 30 65  cbfc66f186955e0e
36160 39 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  920....query I r
36170 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
36180 4c 4c 20 63 6f 72 32 2e 63 6f 6c 30 20 46 52 4f  LL cor2.col0 FRO
36190 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
361a0 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
361b0 72 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 32  r1, tab1 AS cor2
361c0 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
361d0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 32 38  s hashing to e28
361e0 62 66 37 66 39 32 32 36 35 30 63 61 34 32 33 61  bf7f922650ca423a
361f0 64 65 33 36 34 32 63 65 30 32 38 35 62 0d 0a 0d  de3642ce0285b...
36200 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
36210 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
36220 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
36230 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
36240 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39  owsort label-149
36250 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  3..SELECT + col0
36260 20 44 49 56 20 2b 20 28 20 2b 20 38 36 20 29 20   DIV + ( + 86 ) 
36270 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
36280 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
36290 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
362a0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
362b0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
362c0 72 74 20 6c 61 62 65 6c 2d 31 34 39 33 0d 0a 53  rt label-1493..S
362d0 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2b  ELECT + col0 / +
362e0 20 28 20 2b 20 38 36 20 29 20 46 52 4f 4d 20 74   ( + 86 ) FROM t
362f0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
36300 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
36310 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36320 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
36330 20 63 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 30   col0 * ( - col0
36340 20 2a 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d   * + col1 ) FROM
36350 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
36360 2d 2d 2d 0d 0a 31 31 38 38 32 35 0d 0a 34 39 35  ---..118825..495
36370 33 36 0d 0a 37 32 30 38 31 31 0d 0a 0d 0a 73 6b  36..720811....sk
36380 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
36390 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
363a0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
363b0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
363c0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
363d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
363e0 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  LL + cor0.col0 +
363f0 20 2d 20 28 20 2d 20 63 6f 6c 30 20 2a 20 63 6f   - ( - col0 * co
36400 6c 31 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 ) col2 FROM t
36410 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
36420 32 30 38 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38  2088..3430..8188
36430 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36440 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
36450 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53   + ( - col1 ) AS
36460 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
36470 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
36480 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
36490 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
364a0 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 28  LL cor0.col1 - (
364b0 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
364c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
364d0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .0..0..0....only
364e0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
364f0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
36500 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
36510 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
36520 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
36530 61 62 65 6c 2d 31 34 39 38 0d 0a 53 45 4c 45 43  abel-1498..SELEC
36540 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 43  T ALL - col1 * C
36550 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47  AST( col2 AS SIG
36560 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f  NED ) + col0 FRO
36570 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
36580 2d 0d 0a 2d 32 38 31 34 0d 0a 2d 36 32 0d 0a 2d  -..-2814..-62..-
36590 37 33 37 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7373....skipif m
365a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
365b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
365c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39  owsort label-149
365d0 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  8..SELECT ALL - 
365e0 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 63 6f  col1 * CAST ( co
365f0 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l2 AS INTEGER ) 
36600 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
36610 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
36620 31 34 0d 0a 2d 36 32 0d 0a 2d 37 33 37 33 0d 0a  14..-62..-7373..
36630 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36640 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
36650 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  CT + + col0 * co
36660 6c 30 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 - col0 FROM t
36670 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
36680 2d 0d 0a 31 31 39 30 0d 0a 35 35 32 0d 0a 37 38  -..1190..552..78
36690 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  32....query I ro
366a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
366b0 2b 20 63 6f 6c 30 20 2a 20 2d 20 38 38 20 2b 20  + col0 * - 88 + 
366c0 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  - col1 * + col1 
366d0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
366e0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
366f0 0a 2d 31 32 34 38 39 0d 0a 2d 31 36 31 31 33 0d  .-12489..-16113.
36700 0a 2d 39 35 30 38 0d 0a 0d 0a 73 6b 69 70 69 66  .-9508....skipif
36710 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
36720 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
36730 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
36740 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
36750 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
36760 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
36770 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63  NCT + col1 + - c
36780 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c  ol2 * - col2 col
36790 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
367a0 0d 0a 2d 2d 2d 2d 0d 0a 32 39 34 32 0d 0a 33 32  ..----..2942..32
367b0 35 39 0d 0a 39 32 32 39 0d 0a 0d 0a 73 6b 69 70  59..9229....skip
367c0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
367d0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
367e0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
367f0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
36800 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
36810 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
36820 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   + col2 * + col1
36830 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 63   - col0 * col2 c
36840 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
36850 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30   cor0..----..-30
36860 37 38 0d 0a 2d 36 34 33 32 0d 0a 31 32 34 32 0d  78..-6432..1242.
36870 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
36880 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
36890 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 31   cor0.col2 * + 1
368a0 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  6 FROM tab0 AS c
368b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 32 0d  or0..----..1312.
368c0 0a 31 36 0d 0a 35 32 38 0d 0a 0d 0a 71 75 65 72  .16..528....quer
368d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
368e0 45 43 54 20 41 4c 4c 20 2b 20 2b 20 39 37 20 2b  ECT ALL + + 97 +
368f0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46   col2 * + col1 F
36900 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
36910 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a 32 39 33  ..----..194..293
36920 35 0d 0a 37 35 35 39 0d 0a 0d 0a 71 75 65 72 79  5..7559....query
36930 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36940 43 54 20 41 4c 4c 20 31 20 2a 20 2d 20 32 33 20  CT ALL 1 * - 23 
36950 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
36960 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 32  0..----..-23..-2
36970 33 0d 0a 2d 32 33 0d 0a 0d 0a 71 75 65 72 79 20  3..-23....query 
36980 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36990 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  T + + cor0.col1 
369a0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  * col2 AS col1 F
369b0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
369c0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34  ..----..1248..14
369d0 30 34 0d 0a 35 37 30 0d 0a 0d 0a 73 6b 69 70 69  04..570....skipi
369e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
369f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
36a00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36a10 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2f 20 63  T ALL - col0 / c
36a20 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 43 41 53  ol2 + col2 + CAS
36a30 54 20 28 20 63 6f 6c 30 20 41 53 20 52 45 41 4c  T ( col0 AS REAL
36a40 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
36a50 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
36a60 2d 2d 0d 0a 31 32 30 0d 0a 31 37 36 0d 0a 35 37  --..120..176..57
36a70 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
36a80 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
36a90 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
36aa0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
36ab0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
36ac0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36ad0 4c 45 43 54 20 41 4c 4c 20 2d 20 32 33 20 63 6f  LECT ALL - 23 co
36ae0 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
36af0 62 30 20 63 6f 72 30 2c 20 74 61 62 30 2c 20 74  b0 cor0, tab0, t
36b00 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
36b10 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73  -..81 values has
36b20 68 69 6e 67 20 74 6f 20 63 38 63 34 66 30 62 64  hing to c8c4f0bd
36b30 39 32 35 34 31 33 66 37 66 39 35 64 66 31 64 31  925413f7f95df1d1
36b40 36 36 61 65 66 39 64 64 0d 0a 0d 0a 6f 6e 6c 79  66aef9dd....only
36b50 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
36b60 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
36b70 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
36b80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36b90 74 20 6c 61 62 65 6c 2d 31 35 30 39 0d 0a 53 45  t label-1509..SE
36ba0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
36bb0 39 35 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d  95 DIV col0 FROM
36bc0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
36bd0 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 31 0d 0a 0d 0a  ---..-1..-31....
36be0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
36bf0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
36c00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
36c10 61 62 65 6c 2d 31 35 30 39 0d 0a 53 45 4c 45 43  abel-1509..SELEC
36c20 54 20 44 49 53 54 49 4e 43 54 20 2d 20 39 35 20  T DISTINCT - 95 
36c30 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  / col0 FROM tab1
36c40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36c50 2d 31 0d 0a 2d 33 31 0d 0a 0d 0a 71 75 65 72 79  -1..-31....query
36c60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36c70 43 54 20 2d 20 28 20 63 6f 6c 31 20 29 20 2b 20  CT - ( col1 ) + 
36c80 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30  ( col0 ) AS col0
36c90 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
36ca0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31  r0..----..-24..1
36cb0 39 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  9..62....query I
36cc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36cd0 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 35 30   DISTINCT - - 50
36ce0 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 30   * - col0 - col0
36cf0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
36d00 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
36d10 0d 0a 2d 31 35 33 0d 0a 2d 33 32 36 34 0d 0a 2d  ..-153..-3264..-
36d20 34 30 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4080....query I 
36d30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36d40 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col2 + + col1 * 
36d50 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
36d60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36d70 2d 32 38 30 35 0d 0a 2d 37 33 38 30 0d 0a 2d 39  -2805..-7380..-9
36d80 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
36d90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
36da0 30 2e 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 2a 20  0.col1 - col2 * 
36db0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
36dc0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
36dd0 2d 2d 2d 2d 0d 0a 2d 32 37 35 32 0d 0a 2d 37 33  ----..-2752..-73
36de0 37 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  71..0....query I
36df0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36e00 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63   + col2 + cor0.c
36e10 6f 6c 30 20 2a 20 2b 20 39 38 20 41 53 20 63 6f  ol0 * + 98 AS co
36e20 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
36e30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 38 35  cor0..----..2385
36e40 0d 0a 33 34 33 31 0d 0a 38 38 30 34 0d 0a 0d 0a  ..3431..8804....
36e50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36e60 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30  .SELECT - - cor0
36e70 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b  .col1 * - col2 +
36e80 20 36 39 20 46 52 4f 4d 20 74 61 62 32 20 41 53   69 FROM tab2 AS
36e90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
36ea0 36 35 0d 0a 2d 35 37 37 0d 0a 2d 37 36 38 0d 0a  65..-577..-768..
36eb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36ec0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
36ed0 20 2a 20 63 6f 6c 32 20 2b 20 35 35 20 46 52 4f   * col2 + 55 FRO
36ee0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
36ef0 2d 2d 2d 2d 0d 0a 2d 31 33 38 39 0d 0a 2d 36 32  ----..-1389..-62
36f00 31 0d 0a 2d 36 37 34 0d 0a 0d 0a 6f 6e 6c 79 69  1..-674....onlyi
36f10 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
36f20 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
36f30 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
36f40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36f50 20 6c 61 62 65 6c 2d 31 35 31 37 0d 0a 53 45 4c   label-1517..SEL
36f60 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 44  ECT ALL + col0 D
36f70 49 56 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  IV - col2 + + co
36f80 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 63 6f  l2 * col0 - - co
36f90 6c 31 20 2a 20 28 20 63 6f 6c 31 20 29 20 2a 20  l1 * ( col1 ) * 
36fa0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
36fb0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
36fc0 2d 2d 2d 2d 0d 0a 32 33 39 30 34 0d 0a 33 36 36  ----..23904..366
36fd0 36 36 0d 0a 39 33 34 37 0d 0a 0d 0a 73 6b 69 70  66..9347....skip
36fe0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
36ff0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
37000 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
37010 2d 31 35 31 37 0d 0a 53 45 4c 45 43 54 20 41 4c  -1517..SELECT AL
37020 4c 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  L + col0 / - col
37030 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  2 + + col2 * col
37040 30 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 28 20 63  0 - - col1 * ( c
37050 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 41 53 20  ol1 ) * col2 AS 
37060 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
37070 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33  S cor0..----..23
37080 39 30 34 0d 0a 33 36 36 36 36 0d 0a 39 33 34 37  904..36666..9347
37090 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
370a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
370b0 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  INCT - col0 * - 
370c0 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f  cor0.col1 + + co
370d0 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30  r0.col1 * - col0
370e0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
370f0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
37100 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
37110 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
37120 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2b 20 74   tab0.col2 + + t
37130 61 62 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  ab0.col1 * col0 
37140 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
37150 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
37160 32 31 33 30 0d 0a 33 33 39 37 0d 0a 38 32 36 33  2130..3397..8263
37170 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
37180 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
37190 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
371a0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
371b0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
371c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
371d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
371e0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  col2 + col2 * + 
371f0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 63 6f  col0 * - col2 co
37200 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
37210 2d 2d 0d 0a 2d 32 30 37 39 39 33 0d 0a 2d 37 33  --..-207993..-73
37220 37 33 37 36 0d 0a 2d 38 38 30 32 0d 0a 0d 0a 71  7376..-8802....q
37230 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37240 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 31  SELECT tab1.col1
37250 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 74 61 62 31   - - col0 * tab1
37260 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
37270 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
37280 30 34 0d 0a 31 30 35 33 0d 0a 36 35 30 0d 0a 0d  04..1053..650...
37290 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
372a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
372b0 54 20 35 34 20 2b 20 63 6f 6c 30 20 41 53 20 63  T 54 + col0 AS c
372c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
372d0 2d 2d 2d 0d 0a 31 34 33 0d 0a 37 38 0d 0a 38 39  ---..143..78..89
372e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
372f0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
37300 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
37310 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
37320 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
37330 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37340 4c 45 43 54 20 2b 20 30 20 63 6f 6c 30 20 46 52  LECT + 0 col0 FR
37350 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab0..----..0
37360 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
37370 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37380 54 20 2b 20 36 39 20 2b 20 2b 20 63 6f 6c 31 20  T + 69 + + col1 
37390 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
373a0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
373b0 36 39 0d 0a 36 39 0d 0a 36 39 0d 0a 0d 0a 71 75  69..69..69....qu
373c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
373d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
373e0 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2b   ( cor0.col0 ) +
373f0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46   - col1 + col1 F
37400 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
37410 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a  ---..7..78..79..
37420 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37430 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
37440 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c  ( - col0 ) * col
37450 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
37460 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33  or0..----..-1343
37470 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d  ..-217..-4602...
37480 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37490 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 72  ..SELECT + ( cor
374a0 30 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31  0.col2 ) AS col1
374b0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30   FROM tab0, tab0
374c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
374d0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
374e0 20 74 6f 20 63 38 66 39 66 61 39 65 66 30 66 38   to c8f9fa9ef0f8
374f0 37 30 32 62 64 33 38 32 65 38 32 31 33 37 38 61  702bd382e821378a
37500 39 36 64 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  96d8....query I 
37510 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37520 2d 20 2d 20 31 30 20 2d 20 2b 20 35 30 20 41 53  - - 10 - + 50 AS
37530 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
37540 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 0d  cor0..----..-40.
37550 0a 2d 34 30 0d 0a 2d 34 30 0d 0a 0d 0a 71 75 65  .-40..-40....que
37560 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37570 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
37580 2b 20 32 34 20 2a 20 2d 20 31 20 2b 20 63 6f 6c  + 24 * - 1 + col
37590 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
375a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a  or0..----..113..
375b0 34 38 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20  48..59....query 
375c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
375d0 54 20 35 38 20 2b 20 2d 20 63 6f 6c 31 20 41 53  T 58 + - col1 AS
375e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
375f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
37600 31 0d 0a 32 37 0d 0a 34 31 0d 0a 0d 0a 71 75 65  1..27..41....que
37610 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37620 4c 45 43 54 20 2d 20 28 20 39 32 20 29 20 2b 20  LECT - ( 92 ) + 
37630 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
37640 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
37650 30 0d 0a 2d 35 39 0d 0a 2d 39 31 0d 0a 0d 0a 6f  0..-59..-91....o
37660 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
37670 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
37680 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
37690 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
376a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
376b0 74 20 6c 61 62 65 6c 2d 31 35 33 32 0d 0a 53 45  t label-1532..SE
376c0 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20 39  LECT ALL CAST( 9
376d0 38 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  8 AS SIGNED ) FR
376e0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
376f0 0a 2d 2d 2d 2d 0d 0a 39 38 0d 0a 39 38 0d 0a 39  .----..98..98..9
37700 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
37710 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
37720 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
37730 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 32 0d 0a  ort label-1532..
37740 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20  SELECT ALL CAST 
37750 28 20 39 38 20 41 53 20 49 4e 54 45 47 45 52 20  ( 98 AS INTEGER 
37760 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
37770 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 38 0d 0a 39  or0..----..98..9
37780 38 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  8..98....skipif 
37790 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
377a0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
377b0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
377c0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
377d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
377e0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 36 20 63  t..SELECT - 16 c
377f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
37800 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
37810 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
37820 69 6e 67 20 74 6f 20 62 65 32 32 61 63 37 36 62  ing to be22ac76b
37830 34 32 63 36 66 37 32 31 32 65 63 63 30 62 61 37  42c6f7212ecc0ba7
37840 63 38 39 65 62 33 34 0d 0a 0d 0a 71 75 65 72 79  c89eb34....query
37850 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37860 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
37870 39 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  98 AS col0 FROM 
37880 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
37890 2d 2d 0d 0a 31 36 0d 0a 36 35 0d 0a 39 37 0d 0a  --..16..65..97..
378a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
378b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 38  t..SELECT ALL 88
378c0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46   * + cor0.col2 F
378d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
378e0 0d 0a 2d 2d 2d 2d 0d 0a 32 39 30 34 0d 0a 37 32  ..----..2904..72
378f0 31 36 0d 0a 38 38 0d 0a 0d 0a 71 75 65 72 79 20  16..88....query 
37900 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37910 54 20 2d 20 28 20 36 34 20 29 20 2b 20 2d 20 63  T - ( 64 ) + - c
37920 6f 6c 31 20 2a 20 2b 20 28 20 2d 20 31 30 20 29  ol1 * + ( - 10 )
37930 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
37940 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 39 36 0d 0a 38  r0..----..796..8
37950 34 36 0d 0a 39 30 36 0d 0a 0d 0a 71 75 65 72 79  46..906....query
37960 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37970 43 54 20 38 38 20 41 53 20 63 6f 6c 32 20 46 52  CT 88 AS col2 FR
37980 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 63 6f  OM tab2, tab2 co
37990 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
379a0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36 62  es hashing to 6b
379b0 65 31 37 62 38 32 65 63 62 33 65 38 62 32 36 38  e17b82ecb3e8b268
379c0 66 63 62 34 62 61 36 31 30 64 64 62 33 37 0d 0a  fcb4ba610ddb37..
379d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
379e0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
379f0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
37a00 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
37a10 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
37a20 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 38 0d  sort label-1538.
37a30 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d  .SELECT col0 + -
37a40 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
37a50 49 47 4e 45 44 20 29 20 2a 20 31 39 20 41 53 20  IGNED ) * 19 AS 
37a60 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
37a70 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
37a80 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
37a90 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
37aa0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
37ab0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
37ac0 35 33 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  538..SELECT col0
37ad0 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   + - CAST ( NULL
37ae0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
37af0 31 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  19 AS col2 FROM 
37b00 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab1..----..NULL
37b10 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
37b20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37b30 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
37b40 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30   - col2 * - col0
37b50 20 2b 20 63 6f 6c 30 20 2a 20 38 20 2a 20 63 6f   + col0 * 8 * co
37b60 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 + col1 AS col
37b70 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
37b80 0d 0a 2d 2d 2d 2d 0d 0a 34 31 32 0d 0a 36 35 37  ..----..412..657
37b90 37 33 0d 0a 37 32 31 34 0d 0a 0d 0a 6f 6e 6c 79  73..7214....only
37ba0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
37bb0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
37bc0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
37bd0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
37be0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
37bf0 61 62 65 6c 2d 31 35 34 30 0d 0a 53 45 4c 45 43  abel-1540..SELEC
37c00 54 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b  T - ( - col2 ) +
37c10 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53   CAST( col0 AS S
37c20 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
37c30 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
37c40 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d  .121..176..57...
37c50 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
37c60 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
37c70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
37c80 6c 61 62 65 6c 2d 31 35 34 30 0d 0a 53 45 4c 45  label-1540..SELE
37c90 43 54 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20  CT - ( - col2 ) 
37ca0 2b 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53  + CAST ( col0 AS
37cb0 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
37cc0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
37cd0 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37  --..121..176..57
37ce0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37cf0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 37  ort..SELECT - 17
37d00 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
37d10 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d  b2..----..-17..-
37d20 31 37 0d 0a 2d 31 37 0d 0a 0d 0a 6f 6e 6c 79 69  17..-17....onlyi
37d30 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
37d40 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
37d50 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
37d60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37d70 20 6c 61 62 65 6c 2d 31 35 34 32 0d 0a 53 45 4c   label-1542..SEL
37d80 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b  ECT ALL col0 + +
37d90 20 63 6f 6c 31 20 44 49 56 20 36 36 20 63 6f 6c   col1 DIV 66 col
37da0 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
37db0 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 36 0d 0a  ..----..25..36..
37dc0 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  90....skipif pos
37dd0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
37de0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
37df0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
37e00 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
37e10 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
37e20 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
37e30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37e40 62 65 6c 2d 31 35 34 32 0d 0a 53 45 4c 45 43 54  bel-1542..SELECT
37e50 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   ALL col0 + + co
37e60 6c 31 20 2f 20 36 36 20 63 6f 6c 32 20 46 52 4f  l1 / 66 col2 FRO
37e70 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
37e80 2d 0d 0a 32 35 0d 0a 33 36 0d 0a 39 30 0d 0a 0d  -..25..36..90...
37e90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37ea0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
37eb0 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  + - col0 * + col
37ec0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
37ed0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 30 39  or0..----..-7209
37ee0 0d 0a 2d 37 36 38 0d 0a 30 0d 0a 0d 0a 71 75 65  ..-768..0....que
37ef0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37f00 4c 45 43 54 20 2d 20 32 32 20 2d 20 63 6f 6c 31  LECT - 22 - col1
37f10 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
37f20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a  r0..----..-108..
37f30 2d 31 31 33 0d 0a 2d 31 31 39 0d 0a 0d 0a 71 75  -113..-119....qu
37f40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37f50 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
37f60 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 2d 20   ( + col0 ) + - 
37f70 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
37f80 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
37f90 36 0d 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 71 75 65  6..-51..7....que
37fa0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37fb0 4c 45 43 54 20 2b 20 31 39 20 2a 20 63 6f 6c 31  LECT + 19 * col1
37fc0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
37fd0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 30 30 0d 0a 32 36  1..----..200..26
37fe0 30 0d 0a 35 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  0..520....onlyif
37ff0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
38000 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
38010 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
38020 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
38030 6c 61 62 65 6c 2d 31 35 34 37 0d 0a 53 45 4c 45  label-1547..SELE
38040 43 54 20 39 36 20 44 49 56 20 63 6f 6c 30 20 46  CT 96 DIV col0 F
38050 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
38060 31 0d 0a 31 0d 0a 31 33 0d 0a 0d 0a 73 6b 69 70  1..1..13....skip
38070 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
38080 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
38090 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
380a0 2d 31 35 34 37 0d 0a 53 45 4c 45 43 54 20 39 36  -1547..SELECT 96
380b0 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
380c0 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31  2..----..1..1..1
380d0 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
380e0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
380f0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
38100 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
38110 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
38120 2d 31 35 34 38 0d 0a 53 45 4c 45 43 54 20 33 34  -1548..SELECT 34
38130 20 2a 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f   * - col2 DIV co
38140 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
38150 2d 2d 0d 0a 2d 33 34 0d 0a 2d 33 34 0d 0a 2d 33  --..-34..-34..-3
38160 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
38170 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
38180 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
38190 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 38 0d 0a  ort label-1548..
381a0 53 45 4c 45 43 54 20 33 34 20 2a 20 2d 20 63 6f  SELECT 34 * - co
381b0 6c 32 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 / col2 FROM t
381c0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a  ab0..----..-34..
381d0 2d 33 34 0d 0a 2d 33 34 0d 0a 0d 0a 6f 6e 6c 79  -34..-34....only
381e0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
381f0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
38200 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
38210 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
38220 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
38230 61 62 65 6c 2d 31 35 34 39 0d 0a 53 45 4c 45 43  abel-1549..SELEC
38240 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T - CAST( NULL A
38250 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c  S SIGNED ) * col
38260 30 20 2a 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  0 * col1 col0 FR
38270 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab2..----..N
38280 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
38290 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
382a0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
382b0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
382c0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
382d0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
382e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
382f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
38300 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
38310 2d 31 35 34 39 0d 0a 53 45 4c 45 43 54 20 2d 20  -1549..SELECT - 
38320 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
38330 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30 20  NTEGER ) * col0 
38340 2a 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  * col1 col0 FROM
38350 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab2..----..NUL
38360 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
38370 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38380 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
38390 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a   col2 + + col1 *
383a0 20 38 37 20 46 52 4f 4d 20 74 61 62 31 20 63 6f   87 FROM tab1 co
383b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 35 0d 0a  r0..----..1035..
383c0 32 32 30 38 0d 0a 38 31 33 0d 0a 0d 0a 71 75 65  2208..813....que
383d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
383e0 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
383f0 6c 32 20 2a 20 32 35 20 2a 20 2b 20 63 6f 6c 30  l2 * 25 * + col0
38400 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
38410 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
38420 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 30 38 30 0d  0..----..192080.
38430 0a 34 30 35 33 0d 0a 39 31 32 36 34 0d 0a 0d 0a  .4053..91264....
38440 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38450 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
38460 20 2d 20 37 30 20 41 53 20 63 6f 6c 32 20 46 52   - 70 AS col2 FR
38470 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
38480 0a 2d 2d 2d 2d 0d 0a 2d 31 38 32 30 0d 0a 2d 31  .----..-1820..-1
38490 38 39 30 0d 0a 2d 32 36 36 30 0d 0a 0d 0a 6f 6e  890..-2660....on
384a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
384b0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
384c0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
384d0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
384e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
384f0 20 6c 61 62 65 6c 2d 31 35 35 33 0d 0a 53 45 4c   label-1553..SEL
38500 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
38510 32 20 2a 20 43 41 53 54 28 20 2d 20 63 6f 6c 32  2 * CAST( - col2
38520 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 53 49 47   * + col1 AS SIG
38530 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52  NED ) AS col0 FR
38540 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
38550 0a 2d 2d 2d 2d 0d 0a 2d 32 32 35 39 39 0d 0a 2d  .----..-22599..-
38560 32 34 35 34 38 0d 0a 2d 33 39 38 38 34 0d 0a 0d  24548..-39884...
38570 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
38580 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
38590 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
385a0 6c 61 62 65 6c 2d 31 35 35 33 0d 0a 53 45 4c 45  label-1553..SELE
385b0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
385c0 20 2a 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 32   * CAST ( - col2
385d0 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54   * + col1 AS INT
385e0 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46  EGER ) AS col0 F
385f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
38600 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 35 39 39 0d 0a  ..----..-22599..
38610 2d 32 34 35 34 38 0d 0a 2d 33 39 38 38 34 0d 0a  -24548..-39884..
38620 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
38630 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
38640 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
38650 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
38660 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
38670 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 34 0d  sort label-1554.
38680 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
38690 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32   + col1 + - col2
386a0 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
386b0 20 53 49 47 4e 45 44 20 29 20 2a 20 39 39 20 41   SIGNED ) * 99 A
386c0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
386d0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
386e0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
386f0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
38700 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
38710 61 62 65 6c 2d 31 35 35 34 0d 0a 53 45 4c 45 43  abel-1554..SELEC
38720 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
38730 31 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 43 41 53  1 + - col2 + CAS
38740 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
38750 47 45 52 20 29 20 2a 20 39 39 20 41 53 20 63 6f  GER ) * 99 AS co
38760 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
38770 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  --..NULL....only
38780 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
38790 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
387a0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
387b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
387c0 74 20 6c 61 62 65 6c 2d 31 35 35 35 0d 0a 53 45  t label-1555..SE
387d0 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
387e0 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  * col2 + + col1 
387f0 44 49 56 20 2d 20 37 38 20 41 53 20 63 6f 6c 32  DIV - 78 AS col2
38800 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
38810 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37  ..1248..1404..57
38820 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
38830 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
38840 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
38850 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 35 0d 0a  ort label-1555..
38860 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
38870 31 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  1 * col2 + + col
38880 31 20 2f 20 2d 20 37 38 20 41 53 20 63 6f 6c 32  1 / - 78 AS col2
38890 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
388a0 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37  ..1248..1404..57
388b0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
388c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
388d0 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d  TINCT - col0 + -
388e0 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f   col2 * col2 FRO
388f0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
38900 35 32 33 0d 0a 2d 37 33 36 0d 0a 2d 37 35 34 0d  523..-736..-754.
38910 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
38920 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
38930 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
38940 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
38950 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
38960 35 35 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  557..SELECT DIST
38970 49 4e 43 54 20 34 34 20 44 49 56 20 2b 20 63 6f  INCT 44 DIV + co
38980 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
38990 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  tab0..----..0..1
389a0 0d 0a 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..44....skipif m
389b0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
389c0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
389d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35  owsort label-155
389e0 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
389f0 43 54 20 34 34 20 2f 20 2b 20 63 6f 6c 32 20 41  CT 44 / + col2 A
38a00 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
38a10 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34 34  ..----..0..1..44
38a20 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
38a30 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72  IIIIIIIII rowsor
38a40 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
38a50 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 63  CT * FROM tab2 c
38a60 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
38a70 61 62 32 2c 20 74 61 62 30 20 63 6f 72 31 2c 20  ab2, tab0 cor1, 
38a80 74 61 62 30 20 41 53 20 63 6f 72 32 2c 20 74 61  tab0 AS cor2, ta
38a90 62 30 20 41 53 20 63 6f 72 33 0d 0a 2d 2d 2d 2d  b0 AS cor3..----
38aa0 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61  ..3645 values ha
38ab0 73 68 69 6e 67 20 74 6f 20 39 37 62 34 33 66 62  shing to 97b43fb
38ac0 65 37 39 65 65 63 64 30 62 63 36 39 32 31 33 39  e79eecd0bc692139
38ad0 32 34 30 33 62 36 36 36 64 0d 0a 0d 0a 71 75 65  2403b666d....que
38ae0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38af0 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 28 20  LECT - col2 * ( 
38b00 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46  col1 ) AS col2 F
38b10 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
38b20 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d  ..----..-2838..-
38b30 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65  7462..-97....que
38b40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38b50 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
38b60 6c 32 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20  l2 + + ( - col0 
38b70 29 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ) * - col1 AS co
38b80 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
38b90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31  cor0..----..1381
38ba0 0d 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d 0a 73  ..244..4628....s
38bb0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
38bc0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
38bd0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
38be0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
38bf0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
38c00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
38c10 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72  DISTINCT + + cor
38c20 30 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d  0.col2 col2 FROM
38c30 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
38c40 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d  ---..26..27..38.
38c50 0a 0d 0a 71 75