sqllogictest
Hex Artifact Content
Not logged in

Artifact eaf0a8344f8950bea6350984dc54c1e73f000895:


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 41 4c 4c 20 2d  rt..SELECT ALL -
02e0: 20 2d 20 28 20 2d 20 35 36 20 29 20 41 53 20 63   - ( - 56 ) AS c
02f0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
0300: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d 0a 2d  r0..----..-56..-
0310: 35 36 0d 0a 2d 35 36 0d 0a 0d 0a 71 75 65 72 79  56..-56....query
0320: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0330: 43 54 20 2d 20 28 20 2d 20 32 30 20 29 20 2a 20  CT - ( - 20 ) * 
0340: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
0350: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
0360: 2d 2d 2d 2d 0d 0a 35 32 30 0d 0a 35 34 30 0d 0a  ----..520..540..
0370: 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  760....query I r
0380: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
0390: 4c 4c 20 2b 20 36 34 20 2b 20 2d 20 63 6f 6c 30  LL + 64 + - col0
03a0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
03b0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
03c0: 0d 0a 2d 31 36 0d 0a 30 0d 0a 36 31 0d 0a 0d 0a  ..-16..0..61....
03d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
03e0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 28 20  .SELECT ALL ( ( 
03f0: 2b 20 63 6f 6c 30 20 29 20 29 20 46 52 4f 4d 20  + col0 ) ) FROM 
0400: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
0410: 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d  --..7..78..79...
0420: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0430: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
0440: 54 20 2d 20 28 20 2b 20 31 32 20 29 20 46 52 4f  T - ( + 12 ) FRO
0450: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
0460: 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 0d 0a 71 75 65  ----..-12....que
0470: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0480: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
0490: 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  - - cor0.col2 FR
04a0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
04b0: 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a 35  .----..-7..16..5
04c0: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
04d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38  sort..SELECT + 8
04e0: 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  6 AS col2 FROM t
04f0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
0500: 2d 0d 0a 38 36 0d 0a 38 36 0d 0a 38 36 0d 0a 0d  -..86..86..86...
0510: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0520: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
0530: 32 20 2a 20 2b 20 34 35 20 2a 20 63 6f 6c 32 20  2 * + 45 * col2 
0540: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
0550: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30  0 cor0..----..30
0560: 32 35 38 30 0d 0a 34 35 0d 0a 34 39 30 30 35 0d  2580..45..49005.
0570: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
0580: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28  rt..SELECT + - (
0590: 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 31 20 41   col2 ) * col1 A
05a0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
05b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
05c0: 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35  -1248..-1404..-5
05d0: 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  70....onlyif mys
05e0: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
05f0: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
0600: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
0610: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
0620: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
0630: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
0640: 54 20 43 41 53 54 28 20 35 33 20 41 53 20 53 49  T CAST( 53 AS SI
0650: 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 2a 20  GNED ) + col0 * 
0660: 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
0670: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
0680: 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 30 33 31 0d 0a 2d  ..----..-6031..-
0690: 36 31 38 38 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69  6188..4....skipi
06a0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
06b0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
06c0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
06d0: 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
06e0: 43 54 20 43 41 53 54 20 28 20 35 33 20 41 53 20  CT CAST ( 53 AS 
06f0: 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 30  INTEGER ) + col0
0700: 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
0710: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
0720: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 30 33 31  or0..----..-6031
0730: 0d 0a 2d 36 31 38 38 0d 0a 34 0d 0a 0d 0a 71 75  ..-6188..4....qu
0740: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0750: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f  ELECT ALL - ( co
0760: 6c 31 20 29 20 2b 20 63 6f 6c 32 20 41 53 20 63  l1 ) + col2 AS c
0770: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
0780: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d   cor0..----..28.
0790: 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79  .47..83....query
07a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
07b0: 43 54 20 41 4c 4c 20 2b 20 36 35 20 2a 20 63 6f  CT ALL + 65 * co
07c0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
07d0: 2d 2d 0d 0a 32 31 34 35 0d 0a 35 33 33 30 0d 0a  --..2145..5330..
07e0: 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  65....query I ro
07f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 36  wsort..SELECT 86
0800: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
0810: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 38 36  b2..----..86..86
0820: 0d 0a 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..86....query I 
0830: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0840: 41 4c 4c 20 2d 20 33 31 20 2d 20 2b 20 63 6f 6c  ALL - 31 - + col
0850: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
0860: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 30 0d  or0..----..-120.
0870: 0a 2d 35 35 0d 0a 2d 36 36 0d 0a 0d 0a 6f 6e 6c  .-55..-66....onl
0880: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
0890: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
08a0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
08b0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
08c0: 72 74 20 6c 61 62 65 6c 2d 31 34 0d 0a 53 45 4c  rt label-14..SEL
08d0: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 44  ECT ALL + col2 D
08e0: 49 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  IV col2 AS col0 
08f0: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
0900: 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d  ----..1..1..1...
0910: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
0920: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
0930: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
0940: 6c 61 62 65 6c 2d 31 34 0d 0a 53 45 4c 45 43 54  label-14..SELECT
0950: 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2f 20 63 6f   ALL + col2 / co
0960: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
0970: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
0980: 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .1..1..1....skip
0990: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
09a0: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
09b0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
09c0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
09d0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
09e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
09f0: 20 2b 20 38 33 20 29 20 2b 20 63 6f 6c 32 20 63   + 83 ) + col2 c
0a00: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
0a10: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35   cor0..----..-45
0a20: 0d 0a 2d 35 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75  ..-56..-57....qu
0a30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0a40: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
0a50: 20 2a 20 2b 20 34 32 20 2d 20 2d 20 63 6f 6c 32   * + 42 - - col2
0a60: 20 2a 20 35 35 20 46 52 4f 4d 20 74 61 62 31 20   * 55 FROM tab1 
0a70: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
0a80: 35 35 35 0d 0a 34 30 36 32 0d 0a 35 38 32 36 0d  555..4062..5826.
0a90: 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
0aa0: 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
0ab0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a  ELECT DISTINCT *
0ac0: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
0ad0: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
0ae0: 53 20 63 6f 72 31 2c 20 74 61 62 31 20 63 6f 72  S cor1, tab1 cor
0af0: 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c  2..----..972 val
0b00: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
0b10: 36 35 64 30 37 32 64 32 64 39 65 61 62 61 62 62  65d072d2d9eababb
0b20: 66 63 38 65 38 38 62 38 32 37 30 37 34 37 34 0d  fc8e88b82707474.
0b30: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
0b40: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
0b50: 4e 43 54 20 2b 20 38 32 20 2a 20 2b 20 63 6f 6c  NCT + 82 * + col
0b60: 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 + col2 FROM ta
0b70: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
0b80: 0d 0a 36 30 31 0d 0a 36 34 32 32 0d 0a 36 35 31  ..601..6422..651
0b90: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
0ba0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39  sort..SELECT - 9
0bb0: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
0bc0: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
0bd0: 2d 39 32 0d 0a 2d 39 32 0d 0a 2d 39 32 0d 0a 0d  -92..-92..-92...
0be0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0bf0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 33 20  ..SELECT ALL 33 
0c00: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
0c10: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
0c20: 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 0d 0a 35 37 0d  ..----..122..57.
0c30: 0a 36 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .68....skipif po
0c40: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
0c50: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
0c60: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
0c70: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
0c80: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0c90: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
0ca0: 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 32 20   cor0.col2 col2 
0cb0: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
0cc0: 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34  ----..1248..1404
0cd0: 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..570....query I
0ce0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0cf0: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
0d00: 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
0d10: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
0d20: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39  0..----..1..1089
0d30: 0d 0a 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20  ..6724....query 
0d40: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
0d50: 54 20 35 33 20 41 53 20 63 6f 6c 30 20 46 52 4f  T 53 AS col0 FRO
0d60: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
0d70: 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 33 0d 0a 35 33  ----..53..53..53
0d80: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0d90: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 32  ort..SELECT + 12
0da0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
0db0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 31 32  b0..----..12..12
0dc0: 0d 0a 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..12....query I 
0dd0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0de0: 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63  DISTINCT - ( + c
0df0: 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
0e00: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
0e10: 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a  17..-31..-59....
0e20: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0e30: 0a 53 45 4c 45 43 54 20 2d 20 31 20 2b 20 2b 20  .SELECT - 1 + + 
0e40: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
0e50: 2d 2d 2d 2d 0d 0a 30 0d 0a 33 32 0d 0a 38 31 0d  ----..0..32..81.
0e60: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
0e70: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
0e80: 2b 20 32 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  + 22 * + col2 * 
0e90: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
0ea0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36  M tab1..----..16
0eb0: 38 39 37 33 0d 0a 33 35 39 30 0d 0a 38 30 32 36  8973..3590..8026
0ec0: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
0ed0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
0ee0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
0ef0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
0f00: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
0f10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0f20: 45 4c 45 43 54 20 2b 20 37 33 20 63 6f 6c 31 20  ELECT + 73 col1 
0f30: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
0f40: 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 0d 0a 37 33 0d  0..----..73..73.
0f50: 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .73....query I r
0f60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
0f70: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63   col2 + - cor0.c
0f80: 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ol2 + cor0.col1 
0f90: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
0fa0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 35  0..----..-23..-5
0fb0: 39 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9..7....query I 
0fc0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0fd0: 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
0fe0: 30 20 2a 20 28 20 2d 20 31 38 20 29 20 46 52 4f  0 * ( - 18 ) FRO
0ff0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1000: 2d 2d 2d 2d 0d 0a 31 32 36 0d 0a 31 34 30 34 0d  ----..126..1404.
1010: 0a 31 34 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .1422....query I
1020: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1030: 20 2d 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 31   - col2 + ( col1
1040: 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63   ) * + col1 AS c
1050: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
1060: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 36   cor0..----..736
1070: 33 0d 0a 38 31 39 39 0d 0a 39 34 30 38 0d 0a 0d  3..8199..9408...
1080: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1090: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
10a0: 30 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  0 * col1 * col0 
10b0: 2b 20 63 6f 6c 31 20 2b 20 2b 20 28 20 2b 20 63  + col1 + + ( + c
10c0: 6f 6c 30 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c  ol0 ) * cor0.col
10d0: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
10e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 33 35  or0..----..11235
10f0: 35 0d 0a 31 35 39 39 0d 0a 33 36 35 30 39 39 0d  5..1599..365099.
1100: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1110: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
1120: 32 20 2b 20 35 38 20 46 52 4f 4d 20 74 61 62 31  2 + 58 FROM tab1
1130: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1140: 2d 33 38 0d 0a 31 0d 0a 34 0d 0a 0d 0a 71 75 65  -38..1..4....que
1150: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1160: 4c 45 43 54 20 63 6f 6c 31 20 2b 20 28 20 28 20  LECT col1 + ( ( 
1170: 2d 20 63 6f 6c 31 20 29 20 29 20 41 53 20 63 6f  - col1 ) ) AS co
1180: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1190: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
11a0: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
11b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
11c0: 4c 4c 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 2b  LL - tab1.col2 +
11d0: 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2b   + tab1.col1 * +
11e0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
11f0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
1200: 31 35 32 0d 0a 31 33 35 30 0d 0a 35 31 33 0d 0a  152..1350..513..
1210: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1220: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  t..SELECT - cor0
1230: 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a  .col0 + + col2 *
1240: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
1250: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1260: 0a 2d 31 31 31 33 0d 0a 2d 33 36 0d 0a 2d 36 38  .-1113..-36..-68
1270: 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  13....query I ro
1280: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1290: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
12a0: 32 34 20 2b 20 2b 20 31 32 20 2b 20 2d 20 63 6f  24 + + 12 + - co
12b0: 6c 31 20 2a 20 39 31 20 46 52 4f 4d 20 74 61 62  l1 * 91 FROM tab
12c0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
12d0: 0a 2d 32 39 37 37 0d 0a 2d 33 34 33 31 0d 0a 2d  .-2977..-3431..-
12e0: 37 32 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7229....query I 
12f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1300: 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63  ALL + - col2 + c
1310: 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  or0.col2 * col2 
1320: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1330: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1340: 0a 31 34 30 36 0d 0a 36 35 30 0d 0a 37 30 32 0d  .1406..650..702.
1350: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1360: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1370: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1380: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1390: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
13a0: 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  9..SELECT - col0
13b0: 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f   - col2 DIV + co
13c0: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
13d0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
13e0: 2d 2d 0d 0a 2d 32 35 0d 0a 2d 33 35 0d 0a 2d 38  --..-25..-35..-8
13f0: 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
1400: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1410: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1420: 6f 72 74 20 6c 61 62 65 6c 2d 33 39 0d 0a 53 45  ort label-39..SE
1430: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2d 20 63 6f  LECT - col0 - co
1440: 6c 32 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63  l2 / + col0 AS c
1450: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1460: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35   cor0..----..-25
1470: 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75  ..-35..-89....qu
1480: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1490: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b  ELECT - col1 + +
14a0: 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20   col1 * col0 AS 
14b0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
14c0: 2d 2d 2d 2d 0d 0a 31 39 37 38 0d 0a 33 32 39 38  ----..1978..3298
14d0: 0d 0a 38 30 30 38 0d 0a 0d 0a 71 75 65 72 79 20  ..8008....query 
14e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14f0: 54 20 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 72  T col2 * + ( cor
1500: 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31  0.col1 ) AS col1
1510: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1520: 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36  .----..2838..746
1530: 32 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  2..97....onlyif 
1540: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1550: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1560: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1570: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1580: 61 62 65 6c 2d 34 32 0d 0a 53 45 4c 45 43 54 20  abel-42..SELECT 
1590: 2b 20 28 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29  + ( + ( - col2 )
15a0: 20 29 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20   ) * - col1 + - 
15b0: 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20 41 53  col0 DIV col1 AS
15c0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
15d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
15e0: 35 33 33 0d 0a 36 34 32 0d 0a 38 33 37 0d 0a 0d  533..642..837...
15f0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1600: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1610: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1620: 6c 61 62 65 6c 2d 34 32 0d 0a 53 45 4c 45 43 54  label-42..SELECT
1630: 20 2b 20 28 20 2b 20 28 20 2d 20 63 6f 6c 32 20   + ( + ( - col2 
1640: 29 20 29 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d  ) ) * - col1 + -
1650: 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 41 53 20   col0 / col1 AS 
1660: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
1670: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
1680: 33 33 0d 0a 36 34 32 0d 0a 38 33 37 0d 0a 0d 0a  33..642..837....
1690: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16a0: 0a 53 45 4c 45 43 54 20 2d 20 28 20 33 30 20 29  .SELECT - ( 30 )
16b0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
16c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a 2d  r0..----..-30..-
16d0: 33 30 0d 0a 2d 33 30 0d 0a 0d 0a 71 75 65 72 79  30..-30....query
16e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16f0: 43 54 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20  CT ( - col1 ) * 
1700: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
1710: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1720: 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34  ----..-2838..-74
1730: 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79  62..-97....query
1740: 20 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f   IIIIIIIIIIII ro
1750: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1760: 4c 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  L * FROM tab2, t
1770: 61 62 30 20 63 6f 72 30 2c 20 74 61 62 31 2c 20  ab0 cor0, tab1, 
1780: 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
1790: 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68  --..972 values h
17a0: 61 73 68 69 6e 67 20 74 6f 20 34 39 63 38 62 66  ashing to 49c8bf
17b0: 33 65 39 33 31 61 38 39 38 62 61 37 61 66 36 33  3e931a898ba7af63
17c0: 64 30 65 33 37 37 65 62 37 39 0d 0a 0d 0a 71 75  d0e377eb79....qu
17d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17e0: 45 4c 45 43 54 20 2b 20 39 38 20 2b 20 63 6f 72  ELECT + 98 + cor
17f0: 30 2e 63 6f 6c 31 20 2b 20 2b 20 28 20 34 36 20  0.col1 + + ( 46 
1800: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
1810: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1820: 2d 0d 0a 31 36 31 0d 0a 31 37 35 0d 0a 32 30 33  -..161..175..203
1830: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1840: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1850: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1860: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1870: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1880: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 0d  owsort label-47.
1890: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
18a0: 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b  ol1 + + col2 * +
18b0: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
18c0: 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20  IGNED ) AS col1 
18d0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
18e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
18f0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
1900: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1910: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1920: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1930: 6c 2d 34 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63  l-47..SELECT - c
1940: 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  or0.col1 + + col
1950: 32 20 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  2 * + CAST ( NUL
1960: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  L AS INTEGER ) A
1970: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
1980: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1990: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
19a0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
19b0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
19c0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
19d0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
19e0: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
19f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a00: 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  LECT col1 + - co
1a10: 6c 32 20 2b 20 37 33 20 63 6f 6c 32 20 46 52 4f  l2 + 73 col2 FRO
1a20: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1a30: 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 32 36 0d 0a 34  ----..-10..26..4
1a40: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
1a50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
1a60: 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c   cor0.col2 + col
1a70: 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
1a80: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
1a90: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1aa0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 36  rt..SELECT - + 6
1ab0: 35 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  5 * + col2 FROM 
1ac0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1ad0: 2d 2d 0d 0a 2d 32 31 34 35 0d 0a 2d 35 33 33 30  --..-2145..-5330
1ae0: 0d 0a 2d 36 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-65....skipif 
1af0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1b00: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1b10: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1b20: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1b30: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b40: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
1b50: 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31   - col2 + - col1
1b60: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
1b70: 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d  .----..-54..-57.
1b80: 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-96....query I 
1b90: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ba0: 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  tab0.col2 FROM t
1bb0: 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62 31 20  ab0, tab1, tab1 
1bc0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
1bd0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1be0: 20 37 37 38 36 37 31 38 62 64 38 30 34 32 30 32   7786718bd804202
1bf0: 32 35 33 37 33 37 38 64 34 30 65 63 38 37 34 37  2537378d40ec8747
1c00: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
1c10: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
1c20: 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 28   col1 * col1 + (
1c30: 20 28 20 63 6f 6c 32 20 29 20 29 20 41 53 20 63   ( col2 ) ) AS c
1c40: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1c50: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 37   cor0..----..327
1c60: 0d 0a 33 35 30 37 0d 0a 39 38 38 0d 0a 0d 0a 71  ..3507..988....q
1c70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c80: 53 45 4c 45 43 54 20 28 20 2d 20 63 6f 6c 30 20  SELECT ( - col0 
1c90: 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ) + + col1 FROM 
1ca0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1cb0: 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d  --..2..62..62...
1cc0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cd0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
1ce0: 2a 20 2b 20 63 6f 6c 31 20 2b 20 37 36 20 46 52  * + col1 + 76 FR
1cf0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1d00: 0a 2d 2d 2d 2d 0d 0a 2d 32 31 33 0d 0a 2d 33 34  .----..-213..-34
1d10: 30 35 0d 0a 2d 38 38 35 0d 0a 0d 0a 71 75 65 72  05..-885....quer
1d20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d30: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
1d40: 20 2d 20 28 20 2b 20 36 34 20 29 20 41 53 20 63   - ( + 64 ) AS c
1d50: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
1d60: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31   cor0..----..-61
1d70: 0d 0a 30 0d 0a 31 36 0d 0a 0d 0a 71 75 65 72 79  ..0..16....query
1d80: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d90: 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  CT + + col0 + - 
1da0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1db0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1dc0: 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
1dd0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1de0: 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 32 32 20 41   - col0 + - 22 A
1df0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
1e00: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e10: 2d 31 31 31 0d 0a 2d 34 36 0d 0a 2d 35 37 0d 0a  -111..-46..-57..
1e20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e30: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1e40: 63 6f 72 31 2e 63 6f 6c 31 20 2a 20 2b 20 37 32  cor1.col1 * + 72
1e50: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1e60: 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
1e70: 2c 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  , tab2, tab1 AS 
1e80: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor1..----..81 v
1e90: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1ea0: 20 37 32 33 61 61 66 30 61 31 31 38 32 38 65 63   723aaf0a11828ec
1eb0: 65 35 35 36 36 66 30 62 39 30 63 36 31 66 63 62  e5566f0b90c61fcb
1ec0: 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  c....query I row
1ed0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
1ee0: 30 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  0.col0 * cor0.co
1ef0: 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  l1 + + col1 * - 
1f00: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
1f10: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1f20: 2d 2d 2d 2d 0d 0a 2d 36 32 30 0d 0a 33 30 36 38  ----..-620..3068
1f30: 0d 0a 36 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..697....query I
1f40: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1f50: 20 36 36 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 63   66 * col0 * + c
1f60: 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  or0.col0 AS col2
1f70: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1f80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 33 34 0d 0a  r0..----..3234..
1f90: 34 30 31 35 34 34 0d 0a 34 31 31 39 30 36 0d 0a  401544..411906..
1fa0: 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49  ..query IIIIIIII
1fb0: 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
1fc0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
1fd0: 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
1fe0: 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
1ff0: 6f 72 31 2c 20 74 61 62 31 2c 20 74 61 62 31 20  or1, tab1, tab1 
2000: 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor2..----..3
2010: 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69  645 values hashi
2020: 6e 67 20 74 6f 20 30 38 30 30 30 37 36 37 64 30  ng to 08000767d0
2030: 61 39 35 31 65 34 61 37 61 37 66 38 65 64 64 61  a951e4a7a7f8edda
2040: 30 37 66 62 36 34 0d 0a 0d 0a 73 6b 69 70 69 66  07fb64....skipif
2050: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2060: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2070: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2080: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2090: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
20a0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
20b0: 4e 43 54 20 2d 20 31 34 20 63 6f 6c 30 20 46 52  NCT - 14 col0 FR
20c0: 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
20d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
20e0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
20f0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2100: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2110: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2120: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2130: 36 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  64..SELECT ALL -
2140: 20 63 6f 6c 32 20 44 49 56 20 38 34 20 41 53 20   col2 DIV 84 AS 
2150: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
2160: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
2170: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2180: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2190: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
21a0: 6c 61 62 65 6c 2d 36 34 0d 0a 53 45 4c 45 43 54  label-64..SELECT
21b0: 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2f 20 38 34   ALL - col2 / 84
21c0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
21d0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b0..----..0..0..
21e0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
21f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38  sort..SELECT - 8
2200: 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  5 AS col2 FROM t
2210: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a  ab0..----..-85..
2220: 2d 38 35 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72  -85..-85....quer
2230: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2240: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a  ECT ALL - col2 *
2250: 20 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f   + ( col2 ) + co
2260: 6c 32 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 30  l2 + - tab1.col0
2270: 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   * col0 AS col1 
2280: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2290: 0a 2d 31 35 35 32 30 0d 0a 2d 32 38 37 31 0d 0a  .-15520..-2871..
22a0: 2d 37 32 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -7288....query I
22b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22c0: 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20   - ( + col1 ) * 
22d0: 2d 20 63 6f 6c 30 20 2b 20 2d 20 33 34 20 41 53  - col0 + - 34 AS
22e0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
22f0: 0a 2d 2d 2d 2d 0d 0a 31 33 30 39 0d 0a 31 38 33  .----..1309..183
2300: 0d 0a 34 35 36 38 0d 0a 0d 0a 71 75 65 72 79 20  ..4568....query 
2310: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2320: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 63  T DISTINCT + ( c
2330: 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol0 ) AS col1 FR
2340: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab1..----..3
2350: 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72  ..64..80....quer
2360: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2370: 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ECT + col1 * - c
2380: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
2390: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
23a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a  r0..----..-100..
23b0: 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 71 75  -169..-676....qu
23c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23d0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
23e0: 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 31   col1 ) * + col1
23f0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2400: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2410: 0d 0a 32 38 39 0d 0a 33 34 38 31 0d 0a 39 36 31  ..289..3481..961
2420: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2430: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2440: 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  INCT - col2 * + 
2450: 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52  col1 + - col2 FR
2460: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2470: 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 34 0d 0a 2d 31  .----..-1344..-1
2480: 34 35 38 0d 0a 2d 36 32 37 0d 0a 0d 0a 6f 6e 6c  458..-627....onl
2490: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
24a0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
24b0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
24c0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
24d0: 72 74 20 6c 61 62 65 6c 2d 37 32 0d 0a 53 45 4c  rt label-72..SEL
24e0: 45 43 54 20 2b 20 32 31 20 44 49 56 20 2d 20 63  ECT + 21 DIV - c
24f0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2500: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2510: 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
2520: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2530: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2540: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 0d  owsort label-72.
2550: 0a 53 45 4c 45 43 54 20 2b 20 32 31 20 2f 20 2d  .SELECT + 21 / -
2560: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2570: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2580: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
2590: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25a0: 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 63  T ALL + col0 + c
25b0: 6f 6c 30 20 2a 20 38 39 20 46 52 4f 4d 20 74 61  ol0 * 89 FROM ta
25c0: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b0 cor0..----..2
25d0: 31 36 30 0d 0a 33 31 35 30 0d 0a 38 30 31 30 0d  160..3150..8010.
25e0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
25f0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2600: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2610: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2620: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
2630: 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  4..SELECT ALL + 
2640: 28 20 63 6f 6c 31 20 29 20 44 49 56 20 2b 20 63  ( col1 ) DIV + c
2650: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
2660: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2670: 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
2680: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2690: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
26a0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 0d  owsort label-74.
26b0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
26c0: 63 6f 6c 31 20 29 20 2f 20 2b 20 63 6f 6c 32 20  col1 ) / + col2 
26d0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
26e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
26f0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2700: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2710: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2720: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2730: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2740: 37 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  75..SELECT DISTI
2750: 4e 43 54 20 63 6f 6c 31 20 44 49 56 20 2d 20 63  NCT col1 DIV - c
2760: 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 28 20 2b  or0.col2 + + ( +
2770: 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
2780: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2790: 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73  .54..57..96....s
27a0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
27b0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
27c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
27d0: 62 65 6c 2d 37 35 0d 0a 53 45 4c 45 43 54 20 44  bel-75..SELECT D
27e0: 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2f 20 2d  ISTINCT col1 / -
27f0: 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 28   cor0.col2 + + (
2800: 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   + col2 ) FROM t
2810: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2820: 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d  -..54..57..96...
2830: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2840: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
2850: 2b 20 32 37 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 27 AS col2 FRO
2860: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab0..----..11
2870: 33 0d 0a 31 31 38 0d 0a 31 32 34 0d 0a 0d 0a 6f  3..118..124....o
2880: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2890: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
28a0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
28b0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
28c0: 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 0d 0a 53  sort label-77..S
28d0: 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20  ELECT ALL CAST( 
28e0: 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
28f0: 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74   DIV col1 FROM t
2900: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab2..----..0..0.
2910: 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .2....skipif mys
2920: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2930: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2940: 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 0d 0a 53  sort label-77..S
2950: 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28  ELECT ALL CAST (
2960: 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
2970: 20 29 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) / col1 FROM t
2980: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab2..----..0..0.
2990: 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .2....query I ro
29a0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
29b0: 34 39 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c 30  49 * col0 - col0
29c0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
29d0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 0d 0a 33  b1..----..144..3
29e0: 30 37 32 0d 0a 33 38 34 30 0d 0a 0d 0a 71 75 65  072..3840....que
29f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a00: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 38 36  LECT DISTINCT 86
2a10: 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
2a20: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2a30: 0a 34 0d 0a 35 33 0d 0a 38 35 0d 0a 0d 0a 73 6b  .4..53..85....sk
2a40: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2a50: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2a60: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2a70: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2a80: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2a90: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2aa0: 49 53 54 49 4e 43 54 20 34 35 20 2d 20 63 6f 6c  ISTINCT 45 - col
2ab0: 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  1 col1 FROM tab2
2ac0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 31 34 0d  ..----..-14..14.
2ad0: 0a 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .28....onlyif my
2ae0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2af0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2b00: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2b10: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2b20: 65 6c 2d 38 31 0d 0a 53 45 4c 45 43 54 20 2d 20  el-81..SELECT - 
2b30: 63 6f 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c 31  col2 * tab1.col1
2b40: 20 44 49 56 20 2d 20 28 20 2d 20 63 6f 6c 30 20   DIV - ( - col0 
2b50: 29 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ) - col2 FROM ta
2b60: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 0d 0a  b1..----..-111..
2b70: 2d 35 32 32 0d 0a 2d 36 35 0d 0a 0d 0a 73 6b 69  -522..-65....ski
2b80: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2b90: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2ba0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2bb0: 6c 2d 38 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63  l-81..SELECT - c
2bc0: 6f 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20  ol2 * tab1.col1 
2bd0: 2f 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20 2d  / - ( - col0 ) -
2be0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2bf0: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 0d 0a 2d 35 32  .----..-111..-52
2c00: 32 0d 0a 2d 36 35 0d 0a 0d 0a 71 75 65 72 79 20  2..-65....query 
2c10: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c20: 54 20 35 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52  T 52 + - col0 FR
2c30: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
2c40: 32 36 0d 0a 2d 32 37 0d 0a 34 35 0d 0a 0d 0a 6f  26..-27..45....o
2c50: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2c60: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2c70: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2c80: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2c90: 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 0d 0a 53  sort label-83..S
2ca0: 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b  ELECT + col1 * +
2cb0: 20 63 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c   col1 + tab1.col
2cc0: 31 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c  1 + col0 DIV col
2cd0: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2ce0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 0d 0a  ab1..----..116..
2cf0: 31 38 38 0d 0a 37 30 32 0d 0a 0d 0a 73 6b 69 70  188..702....skip
2d00: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2d10: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2d20: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d30: 2d 38 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  -83..SELECT + co
2d40: 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 74 61  l1 * + col1 + ta
2d50: 62 31 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2f  b1.col1 + col0 /
2d60: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
2d70: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
2d80: 31 36 0d 0a 31 38 38 0d 0a 37 30 32 0d 0a 0d 0a  16..188..702....
2d90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2da0: 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 74  .SELECT col0 * t
2db0: 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  ab0.col0 AS col1
2dc0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2dd0: 0d 0a 31 32 32 35 0d 0a 35 37 36 0d 0a 37 39 32  ..1225..576..792
2de0: 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
2df0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2e00: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2e10: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2e20: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2e30: 2d 38 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  -85..SELECT + + 
2e40: 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 41 53  col1 DIV col2 AS
2e50: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2e60: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2e70: 0d 0a 32 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69  ..2..97....skipi
2e80: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2e90: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2ea0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2eb0: 38 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  85..SELECT + + c
2ec0: 6f 6c 31 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 / col2 AS co
2ed0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2ee0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32  cor0..----..1..2
2ef0: 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..97....onlyif m
2f00: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2f10: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2f20: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2f30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f40: 62 65 6c 2d 38 36 0d 0a 53 45 4c 45 43 54 20 44  bel-86..SELECT D
2f50: 49 53 54 49 4e 43 54 20 28 20 2d 20 63 6f 6c 31  ISTINCT ( - col1
2f60: 20 29 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f   ) + col0 DIV co
2f70: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
2f80: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2f90: 2d 2d 0d 0a 2d 38 35 0d 0a 2d 39 30 0d 0a 2d 39  --..-85..-90..-9
2fa0: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
2fb0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2fc0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2fd0: 6f 72 74 20 6c 61 62 65 6c 2d 38 36 0d 0a 53 45  ort label-86..SE
2fe0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
2ff0: 2d 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 30 20  - col1 ) + col0 
3000: 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  / col0 AS col0 F
3010: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
3020: 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 39 30  ..----..-85..-90
3030: 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-96....onlyif 
3040: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
3050: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
3060: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
3070: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
3080: 61 62 65 6c 2d 38 37 0d 0a 53 45 4c 45 43 54 20  abel-87..SELECT 
3090: 28 20 63 6f 6c 31 20 29 20 44 49 56 20 39 31 20  ( col1 ) DIV 91 
30a0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
30b0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
30c0: 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .0..1..1....skip
30d0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
30e0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
30f0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
3100: 2d 38 37 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f  -87..SELECT ( co
3110: 6c 31 20 29 20 2f 20 39 31 20 41 53 20 63 6f 6c  l1 ) / 91 AS col
3120: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
3130: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  or0..----..0..1.
3140: 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
3150: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
3160: 74 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab2.col2 AS col
3170: 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
3180: 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
3190: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
31a0: 20 68 61 73 68 69 6e 67 20 74 6f 20 34 30 66 64   hashing to 40fd
31b0: 38 63 63 30 64 65 39 32 65 61 36 38 64 37 33 36  8cc0de92ea68d736
31c0: 33 34 63 32 64 38 66 37 35 62 66 35 0d 0a 0d 0a  34c2d8f75bf5....
31d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31e0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31f0: 20 2d 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 31   - col0 * ( col1
3200: 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
3210: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34  tab1..----..-104
3220: 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a  0..-640..-78....
3230: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3240: 0a 53 45 4c 45 43 54 20 32 39 20 46 52 4f 4d 20  .SELECT 29 FROM 
3250: 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
3260: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
3270: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 65  es hashing to 1e
3280: 37 31 32 30 62 61 38 65 39 31 39 31 30 38 34 31  7120ba8e91910841
3290: 37 32 64 64 63 65 64 31 37 65 35 65 62 32 0d 0a  72ddced17e5eb2..
32a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32b0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
32c0: 43 54 20 2b 20 39 37 20 46 52 4f 4d 20 74 61 62  CT + 97 FROM tab
32d0: 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
32e0: 0a 2d 2d 2d 2d 0d 0a 39 37 0d 0a 0d 0a 71 75 65  .----..97....que
32f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3300: 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  LECT + cor0.col0
3310: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
3320: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
3330: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
3340: 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65  8..48..70....que
3350: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3360: 4c 45 43 54 20 2b 20 2b 20 33 20 41 53 20 63 6f  LECT + + 3 AS co
3370: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
3380: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 33  cor0..----..3..3
3390: 0d 0a 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..3....onlyif my
33a0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
33b0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
33c0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
33d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
33e0: 65 6c 2d 39 34 0d 0a 53 45 4c 45 43 54 20 41 4c  el-94..SELECT AL
33f0: 4c 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b  L - ( + col0 ) +
3400: 20 63 6f 6c 30 20 44 49 56 20 32 31 20 2b 20 2b   col0 DIV 21 + +
3410: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
3420: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
3430: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 33 0d 0a 33 0d 0a  .----..0..3..3..
3440: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
3450: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
3460: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3470: 20 6c 61 62 65 6c 2d 39 34 0d 0a 53 45 4c 45 43   label-94..SELEC
3480: 54 20 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 30  T ALL - ( + col0
3490: 20 29 20 2b 20 63 6f 6c 30 20 2f 20 32 31 20 2b   ) + col0 / 21 +
34a0: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
34b0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
34c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 33 0d 0a 33  0..----..0..3..3
34d0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
34e0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
34f0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
3500: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
3510: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
3520: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3530: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  LECT - col1 + - 
3540: 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
3550: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
3560: 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d 39 36 0d 0a  -137..-38..-96..
3570: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3580: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 38 39  t..SELECT - - 89
3590: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
35a0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
35b0: 0d 0a 38 39 0d 0a 38 39 0d 0a 38 39 0d 0a 0d 0a  ..89..89..89....
35c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
35d0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20  .SELECT ALL ( - 
35e0: 32 35 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  25 ) FROM tab2 A
35f0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
3600: 35 0d 0a 2d 32 35 0d 0a 2d 32 35 0d 0a 0d 0a 73  5..-25..-25....s
3610: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
3620: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
3630: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
3640: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
3650: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
3660: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3670: 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20  DISTINCT col0 + 
3680: 35 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  5 col2 FROM tab2
3690: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36a0: 31 32 0d 0a 38 33 0d 0a 38 34 0d 0a 0d 0a 71 75  12..83..84....qu
36b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36c0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
36d0: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 63   col2 * col2 + c
36e0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
36f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 35 0d  r0..----..-1065.
3700: 0a 2d 36 36 33 35 0d 0a 33 34 0d 0a 0d 0a 71 75  .-6635..34....qu
3710: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3720: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f  ELECT ALL + ( co
3730: 6c 32 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  l2 ) * cor0.col0
3740: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
3750: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32  r0..----..35..72
3760: 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79  98..792....query
3770: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3780: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
3790: 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
37a0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
37b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a  or0..----..-54..
37c0: 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72  -57..-96....quer
37d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37e0: 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
37f0: 2b 20 2d 20 38 30 20 41 53 20 63 6f 6c 31 20 46  + - 80 AS col1 F
3800: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
3810: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a  ..----..-1..-2..
3820: 2d 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -73....query I r
3830: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
3840: 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30  LL - col2 * cor0
3850: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
3860: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
3870: 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36  .----..-1444..-6
3880: 37 36 0d 0a 2d 37 32 39 0d 0a 0d 0a 71 75 65 72  76..-729....quer
3890: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
38a0: 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20 2b 20 38  ECT - col1 - + 8
38b0: 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  4 AS col0 FROM t
38c0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d  ab1..----..-110.
38d0: 0a 2d 39 34 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65  .-94..-97....que
38e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38f0: 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 35 30  LECT col2 + + 50
3900: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
3910: 0d 0a 37 36 0d 0a 37 37 0d 0a 38 38 0d 0a 0d 0a  ..76..77..88....
3920: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3930: 0a 53 45 4c 45 43 54 20 39 36 20 41 53 20 63 6f  .SELECT 96 AS co
3940: 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
3950: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
3960: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
3970: 6e 67 20 74 6f 20 32 32 63 35 31 34 31 61 36 32  ng to 22c5141a62
3980: 39 66 30 65 66 33 39 36 37 33 38 65 65 32 63 38  9f0ef396738ee2c8
3990: 62 65 36 33 30 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  be6303....onlyif
39a0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
39b0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
39c0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
39d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
39e0: 6c 61 62 65 6c 2d 31 30 37 0d 0a 53 45 4c 45 43  label-107..SELEC
39f0: 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 44  T ALL + - col2 D
3a00: 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46  IV + cor0.col0 F
3a10: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
3a20: 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-3..0..0...
3a30: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
3a40: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
3a50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
3a60: 6c 61 62 65 6c 2d 31 30 37 0d 0a 53 45 4c 45 43  label-107..SELEC
3a70: 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2f  T ALL + - col2 /
3a80: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
3a90: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
3aa0: 2d 0d 0a 2d 33 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f  -..-3..0..0....o
3ab0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
3ac0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
3ad0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
3ae0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
3af0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3b00: 74 20 6c 61 62 65 6c 2d 31 30 38 0d 0a 53 45 4c  t label-108..SEL
3b10: 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28 20  ECT ALL - CAST( 
3b20: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
3b30: 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   * col2 AS col2 
3b40: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
3b50: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
3b60: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
3b70: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
3b80: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
3b90: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
3ba0: 6c 2d 31 30 38 0d 0a 53 45 4c 45 43 54 20 41 4c  l-108..SELECT AL
3bb0: 4c 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  L - CAST ( NULL 
3bc0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63  AS INTEGER ) * c
3bd0: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
3be0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
3bf0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
3c00: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
3c10: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3c20: 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2a 20   ALL + - col2 * 
3c30: 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
3c40: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3c50: 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d  -..-2838..-7462.
3c60: 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-97....skipif p
3c70: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
3c80: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
3c90: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
3ca0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
3cb0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3cc0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
3cd0: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b   col1 * + col0 +
3ce0: 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 29   ( + cor0.col2 )
3cf0: 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46   * - col0 col1 F
3d00: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
3d10: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 36 0d 0a 2d 34  ..----..-406..-4
3d20: 33 34 35 0d 0a 2d 36 36 33 30 0d 0a 0d 0a 71 75  345..-6630....qu
3d30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3d40: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
3d50: 20 2d 20 39 36 20 46 52 4f 4d 20 74 61 62 30 20   - 96 FROM tab0 
3d60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 36 0d 0a  cor0..----..96..
3d70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3d80: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
3d90: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col1 + + col2 AS
3da0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
3db0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
3dc0: 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 71 75 65  8..47..83....que
3dd0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3de0: 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20 2d  LECT ALL - - ( -
3df0: 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 32 20 41   col1 ) + col2 A
3e00: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
3e10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3e20: 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 71 75  28..47..83....qu
3e30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3e40: 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a  ELECT + + col2 *
3e50: 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20   col0 + col2 AS 
3e60: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
3e70: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36  S cor0..----..36
3e80: 0d 0a 37 33 38 30 0d 0a 38 32 35 0d 0a 0d 0a 71  ..7380..825....q
3e90: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3ea0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
3eb0: 31 36 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  16 * + col0 FROM
3ec0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
3ed0: 2d 2d 2d 0d 0a 31 30 32 34 0d 0a 31 32 38 30 0d  ---..1024..1280.
3ee0: 0a 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .48....query I r
3ef0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
3f00: 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
3f10: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20  ol1 * - col1 AS 
3f20: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
3f30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d  or0..----..7396.
3f40: 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a 73  .8281..9409....s
3f50: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
3f60: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
3f70: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
3f80: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
3f90: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
3fa0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3fb0: 41 4c 4c 20 38 36 20 2b 20 2d 20 63 6f 6c 31 20  ALL 86 + - col1 
3fc0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
3fd0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30  S cor0..----..60
3fe0: 0d 0a 37 33 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72  ..73..76....quer
3ff0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4000: 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  ECT - col1 + + c
4010: 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
4020: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
4030: 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d  ..-33..-4..21...
4040: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4050: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
4060: 54 20 2d 20 32 36 20 46 52 4f 4d 20 74 61 62 31  T - 26 FROM tab1
4070: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4080: 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -26....query I r
4090: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
40a0: 20 38 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   87 AS col1 FROM
40b0: 20 74 61 62 32 2c 20 74 61 62 30 2c 20 74 61 62   tab2, tab0, tab
40c0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
40d0: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
40e0: 6e 67 20 74 6f 20 38 36 36 31 66 66 62 64 31 61  ng to 8661ffbd1a
40f0: 37 32 38 39 37 63 34 39 35 34 30 35 63 35 33 62  72897c495405c53b
4100: 38 31 36 65 35 30 0d 0a 0d 0a 71 75 65 72 79 20  816e50....query 
4110: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4120: 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  T col0 + + col1 
4130: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
4140: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
4150: 31 31 33 0d 0a 31 39 36 0d 0a 36 39 0d 0a 0d 0a  113..196..69....
4160: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4170: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
4180: 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  l2 * col2 + - co
4190: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
41a0: 2d 2d 0d 0a 2d 39 36 0d 0a 31 30 30 33 0d 0a 36  --..-96..1003..6
41b0: 36 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  633....skipif po
41c0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
41d0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
41e0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
41f0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
4200: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4210: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 36  .SELECT ALL + 76
4220: 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46   + - col0 col1 F
4230: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
4240: 2d 31 33 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 6f  -13..41..52....o
4250: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
4260: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
4270: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
4280: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
4290: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34 0d 0a  sort label-124..
42a0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
42b0: 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 63 6f  col0 * col0 * co
42c0: 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  l0 + - col0 + co
42d0: 6c 30 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63  l0 DIV col1 AS c
42e0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
42f0: 2d 2d 2d 0d 0a 33 33 36 0d 0a 34 37 34 34 37 35  ---..336..474475
4300: 0d 0a 34 39 32 39 36 34 0d 0a 0d 0a 73 6b 69 70  ..492964....skip
4310: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
4320: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
4330: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4340: 2d 31 32 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  -124..SELECT DIS
4350: 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c  TINCT col0 * col
4360: 30 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  0 * col0 + - col
4370: 30 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20  0 + col0 / col1 
4380: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
4390: 32 0d 0a 2d 2d 2d 2d 0d 0a 33 33 36 0d 0a 34 37  2..----..336..47
43a0: 34 34 37 35 0d 0a 34 39 32 39 36 34 0d 0a 0d 0a  4475..492964....
43b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
43c0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
43d0: 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31   * col0 + - col1
43e0: 20 2a 20 2b 20 35 39 20 41 53 20 63 6f 6c 31 20   * + 59 AS col1 
43f0: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
4400: 0a 2d 34 32 38 32 0d 0a 2d 35 36 38 38 0d 0a 31  .-4282..-5688..1
4410: 39 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  929....query I r
4420: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
4430: 49 53 54 49 4e 43 54 20 2d 20 38 33 20 2b 20 63  ISTINCT - 83 + c
4440: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
4450: 2d 2d 2d 0d 0a 2d 34 38 0d 0a 2d 35 39 0d 0a 36  ---..-48..-59..6
4460: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4470: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
4480: 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 32 38 20 46  r0.col0 * - 28 F
4490: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
44a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
44b0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
44c0: 6f 20 39 38 32 34 62 62 37 32 32 65 32 32 31 63  o 9824bb722e221c
44d0: 30 66 32 61 65 37 39 63 32 31 64 35 61 36 35 31  0f2ae79c21d5a651
44e0: 64 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  d2....query I ro
44f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
4500: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
4510: 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f  + tab2.col1 * co
4520: 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
4530: 2d 2d 0d 0a 32 32 38 33 31 0d 0a 32 37 31 35 31  --..22831..27151
4540: 38 0d 0a 36 37 32 37 0d 0a 0d 0a 71 75 65 72 79  8..6727....query
4550: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4560: 43 54 20 44 49 53 54 49 4e 43 54 20 36 31 20 2b  CT DISTINCT 61 +
4570: 20 33 36 20 46 52 4f 4d 20 74 61 62 31 20 41 53   36 FROM tab1 AS
4580: 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
4590: 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
45a0: 2d 2d 2d 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69  ---..97....onlyi
45b0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
45c0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
45d0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
45e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
45f0: 20 6c 61 62 65 6c 2d 31 33 30 0d 0a 53 45 4c 45   label-130..SELE
4600: 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 44  CT - cor0.col2 D
4610: 49 56 20 2b 20 63 6f 6c 31 20 2b 20 28 20 2d 20  IV + col1 + ( - 
4620: 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46  col2 ) AS col1 F
4630: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
4640: 2d 2d 2d 0d 0a 2d 31 30 33 0d 0a 2d 35 36 0d 0a  ---..-103..-56..
4650: 2d 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -62....skipif my
4660: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
4670: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
4680: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30 0d  wsort label-130.
4690: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
46a0: 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31 20 2b 20 28  ol2 / + col1 + (
46b0: 20 2d 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   - col2 ) AS col
46c0: 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
46d0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 0d 0a 2d 35  ..----..-103..-5
46e0: 36 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72 79 20  6..-62....query 
46f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4700: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72  T DISTINCT + cor
4710: 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  0.col0 * + col1 
4720: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
4730: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
4740: 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a  .1040..640..78..
4750: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4760: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
4770: 20 2a 20 63 6f 6c 32 20 2b 20 32 20 41 53 20 63   * col2 + 2 AS c
4780: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
4790: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 36 0d  r0..----..-1246.
47a0: 0a 2d 31 34 30 32 0d 0a 2d 35 36 38 0d 0a 0d 0a  .-1402..-568....
47b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
47c0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
47d0: 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l0 * + cor0.col1
47e0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
47f0: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b0 cor0..----..2
4800: 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
4810: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4820: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
4830: 4e 43 54 20 2d 20 2d 20 34 34 20 2b 20 2d 20 63  NCT - - 44 + - c
4840: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
4850: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
4860: 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d  ---..-10..-13..-
4870: 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  52....query I ro
4880: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
4890: 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  L - cor0.col1 * 
48a0: 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
48b0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
48c0: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34  ..----..1040..64
48d0: 30 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  0..78....skipif 
48e0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
48f0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
4900: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
4910: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
4920: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4930: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 33 33  t..SELECT + + 33
4940: 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63   * + cor0.col0 c
4950: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
4960: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35   cor0..----..115
4970: 35 0d 0a 32 39 33 37 0d 0a 37 39 32 0d 0a 0d 0a  5..2937..792....
4980: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4990: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
49a0: 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 41   col0 + + col1 A
49b0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
49c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
49d0: 31 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71  137..38..96....q
49e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
49f0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
4a00: 2d 20 2b 20 37 35 20 41 53 20 63 6f 6c 31 20 46  - + 75 AS col1 F
4a10: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
4a20: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 35 0d 0a 0d 0a 6f  ..----..-75....o
4a30: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
4a40: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
4a50: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
4a60: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
4a70: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39 0d 0a  sort label-139..
4a80: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 63  SELECT ALL - ( c
4a90: 6f 6c 32 20 29 20 2a 20 2b 20 32 33 20 2b 20 2b  ol2 ) * + 23 + +
4aa0: 20 63 6f 6c 31 20 44 49 56 20 2b 20 74 61 62 30   col1 DIV + tab0
4ab0: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
4ac0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
4ad0: 31 38 38 35 0d 0a 2d 32 31 0d 0a 2d 37 35 36 0d  1885..-21..-756.
4ae0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
4af0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
4b00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4b10: 74 20 6c 61 62 65 6c 2d 31 33 39 0d 0a 53 45 4c  t label-139..SEL
4b20: 45 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 32  ECT ALL - ( col2
4b30: 20 29 20 2a 20 2b 20 32 33 20 2b 20 2b 20 63 6f   ) * + 23 + + co
4b40: 6c 31 20 2f 20 2b 20 74 61 62 30 2e 63 6f 6c 30  l1 / + tab0.col0
4b50: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
4b60: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 38 35 0d  b0..----..-1885.
4b70: 0a 2d 32 31 0d 0a 2d 37 35 36 0d 0a 0d 0a 6f 6e  .-21..-756....on
4b80: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
4b90: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
4ba0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
4bb0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
4bc0: 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30 0d 0a 53  ort label-140..S
4bd0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
4be0: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63   + col2 * cor0.c
4bf0: 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29  ol1 + ( + col1 )
4c00: 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 30   DIV - cor0.col0
4c10: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
4c20: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
4c30: 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 33  ..1534..646..833
4c40: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
4c50: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
4c60: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
4c70: 72 74 20 6c 61 62 65 6c 2d 31 34 30 0d 0a 53 45  rt label-140..SE
4c80: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
4c90: 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  + col2 * cor0.co
4ca0: 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20  l1 + ( + col1 ) 
4cb0: 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  / - cor0.col0 AS
4cc0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
4cd0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
4ce0: 35 33 34 0d 0a 36 34 36 0d 0a 38 33 33 0d 0a 0d  534..646..833...
4cf0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4d00: 0d 0a 53 45 4c 45 43 54 20 2b 20 32 37 20 41 53  ..SELECT + 27 AS
4d10: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
4d20: 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 37 0d 0a 32  .----..27..27..2
4d30: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
4d40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
4d50: 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a  TINCT + + col1 *
4d60: 20 2b 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63   + ( col2 ) AS c
4d70: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
4d80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33   cor0..----..283
4d90: 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71  8..7462..97....q
4da0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4db0: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
4dc0: 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  + - col1 AS col1
4dd0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
4de0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37  r0..----..28..47
4df0: 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..83....query I 
4e00: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4e10: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
4e20: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  * - cor0.col0 FR
4e30: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
4e40: 0a 2d 2d 2d 2d 0d 0a 34 30 39 36 0d 0a 36 34 30  .----..4096..640
4e50: 30 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..9....query I 
4e60: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4e70: 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 37 31 20  + - col1 + + 71 
4e80: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
4e90: 30 0d 0a 2d 2d 2d 2d 0d 0a 34 35 0d 0a 35 38 0d  0..----..45..58.
4ea0: 0a 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .61....onlyif my
4eb0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
4ec0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
4ed0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
4ee0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
4ef0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
4f00: 31 34 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  146..SELECT ALL 
4f10: 2b 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28  + col1 * - CAST(
4f20: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
4f30: 29 20 2b 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63  ) + - ( + cor0.c
4f40: 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29  ol1 + ( + col2 )
4f50: 20 29 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   ) * + col1 FROM
4f60: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
4f70: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
4f80: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
4f90: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
4fa0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
4fb0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
4fc0: 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  6..SELECT ALL + 
4fd0: 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20 28 20  col1 * - CAST ( 
4fe0: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
4ff0: 29 20 2b 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63  ) + - ( + cor0.c
5000: 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29  ol1 + ( + col2 )
5010: 20 29 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   ) * + col1 FROM
5020: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
5030: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
5040: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
5050: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5060: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
5070: 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
5080: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
5090: 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32  -..35..7298..792
50a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
50b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
50c0: 63 6f 6c 30 20 2b 20 2d 20 33 31 20 2a 20 63 6f  col0 + - 31 * co
50d0: 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
50e0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
50f0: 0a 2d 31 36 37 37 0d 0a 2d 31 38 33 31 0d 0a 2d  .-1677..-1831..-
5100: 33 30 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3056....query I 
5110: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5120: 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31  cor0.col0 + col1
5130: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
5140: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
5150: 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a  ..29..74..93....
5160: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5170: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b  .SELECT col2 * +
5180: 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72   cor0.col1 * cor
5190: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
51a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor0..----..364
51b0: 38 30 0d 0a 34 32 31 32 0d 0a 39 39 38 34 30 0d  80..4212..99840.
51c0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
51d0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
51e0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
51f0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
5200: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
5210: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5220: 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32  ECT ALL + + col2
5230: 20 2a 20 37 31 20 2b 20 2d 20 32 36 20 63 6f 6c   * 71 + - 26 col
5240: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
5250: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 31 37 0d  or0..----..2317.
5260: 0a 34 35 0d 0a 35 37 39 36 0d 0a 0d 0a 73 6b 69  .45..5796....ski
5270: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
5280: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
5290: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
52a0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
52b0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
52c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
52d0: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 63 6f  col0 * - col0 co
52e0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
52f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a  0..----..-1225..
5300: 2d 35 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71  -576..-7921....q
5310: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
5320: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b  SELECT ALL + ( +
5330: 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52 4f   cor0.col1 ) FRO
5340: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
5350: 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d  -..17..31..59...
5360: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5370: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62  ..SELECT ALL tab
5380: 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  1.col0 AS col0 F
5390: 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
53a0: 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
53b0: 4e 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  N tab1..----..27
53c0: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
53d0: 74 6f 20 37 37 38 62 35 30 35 37 35 61 39 62 39  to 778b50575a9b9
53e0: 31 34 34 38 31 31 39 65 65 30 65 65 31 61 39 63  1448119ee0ee1a9c
53f0: 34 34 66 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  44f....query I r
5400: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
5410: 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2d 20 2b  ol0 * - col2 - +
5420: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
5430: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
5440: 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 37 0d 0a 2d 32  .----..-2087..-2
5450: 32 30 0d 0a 2d 33 30 31 39 0d 0a 0d 0a 71 75 65  20..-3019....que
5460: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5470: 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72  LECT ALL - - cor
5480: 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  0.col0 + - col2 
5490: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
54a0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  0 cor0..----..-9
54b0: 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69  ..34..7....onlyi
54c0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
54d0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
54e0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
54f0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
5500: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
5510: 62 65 6c 2d 31 35 37 0d 0a 53 45 4c 45 43 54 20  bel-157..SELECT 
5520: 43 41 53 54 28 20 2d 20 63 6f 6c 30 20 41 53 20  CAST( - col0 AS 
5530: 53 49 47 4e 45 44 20 29 20 63 6f 6c 30 20 46 52  SIGNED ) col0 FR
5540: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
5550: 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a  .----..-7..-78..
5560: 2d 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -79....skipif po
5570: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
5580: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
5590: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
55a0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
55b0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
55c0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
55d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
55e0: 61 62 65 6c 2d 31 35 37 0d 0a 53 45 4c 45 43 54  abel-157..SELECT
55f0: 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 30 20 41   CAST ( - col0 A
5600: 53 20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 30  S INTEGER ) col0
5610: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
5620: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37  r0..----..-7..-7
5630: 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20  8..-79....query 
5640: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5650: 54 20 41 4c 4c 20 2b 20 2d 20 34 39 20 2d 20 38  T ALL + - 49 - 8
5660: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
5670: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 31 0d  or0..----..-131.
5680: 0a 2d 31 33 31 0d 0a 2d 31 33 31 0d 0a 0d 0a 71  .-131..-131....q
5690: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
56a0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
56b0: 2d 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  - - col1 * col2 
56c0: 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  - + col1 FROM ta
56d0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
56e0: 0d 0a 31 34 37 35 0d 0a 36 32 39 0d 0a 38 30 36  ..1475..629..806
56f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5700: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
5710: 63 6f 6c 32 20 2d 20 28 20 2d 20 63 6f 6c 30 20  col2 - ( - col0 
5720: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
5730: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
5740: 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a  -..-9..34..7....
5750: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5760: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
5770: 6f 6c 30 20 2a 20 34 30 20 46 52 4f 4d 20 74 61  ol0 * 40 FROM ta
5780: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
5790: 0d 0a 32 38 30 0d 0a 33 31 32 30 0d 0a 33 31 36  ..280..3120..316
57a0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
57b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
57c0: 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b   + + cor0.col1 +
57d0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
57e0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
57f0: 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38  .----..55..58..8
5800: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
5810: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
5820: 20 2d 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 63 6f   - + col1 - + co
5830: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
5840: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30  cor0..----..-110
5850: 0d 0a 2d 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a  ..-132..-180....
5860: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5870: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
5880: 20 2b 20 2b 20 39 38 20 46 52 4f 4d 20 74 61 62   + + 98 FROM tab
5890: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
58a0: 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .98....query I r
58b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
58c0: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b  ISTINCT - col0 +
58d0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
58e0: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
58f0: 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  --..0....query I
5900: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5910: 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   ALL col2 + - co
5920: 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  r0.col1 AS col2 
5930: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
5940: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34  0..----..-33..-4
5950: 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..21....query I 
5960: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5970: 2d 20 2b 20 37 35 20 2b 20 63 6f 6c 32 20 41 53  - + 75 + col2 AS
5980: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
5990: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
59a0: 34 32 0d 0a 2d 37 34 0d 0a 37 0d 0a 0d 0a 71 75  42..-74..7....qu
59b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
59c0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
59d0: 20 32 36 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20   26 * col0 FROM 
59e0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
59f0: 2d 2d 0d 0a 2d 31 38 32 0d 0a 2d 32 30 32 38 0d  --..-182..-2028.
5a00: 0a 2d 32 30 35 34 0d 0a 0d 0a 71 75 65 72 79 20  .-2054....query 
5a10: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5a20: 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2d  T ALL + col0 * -
5a30: 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20 31   cor0.col0 - - 1
5a40: 36 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  6 * + col1 AS co
5a50: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
5a60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 34  cor0..----..-514
5a70: 30 0d 0a 2d 35 39 36 39 0d 0a 34 34 37 0d 0a 0d  0..-5969..447...
5a80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5a90: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
5aa0: 54 20 37 39 20 2a 20 63 6f 6c 32 20 2b 20 2b 20  T 79 * col2 + + 
5ab0: 28 20 2b 20 31 36 20 29 20 46 52 4f 4d 20 74 61  ( + 16 ) FROM ta
5ac0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
5ad0: 0d 0a 32 36 32 33 0d 0a 36 34 39 34 0d 0a 39 35  ..2623..6494..95
5ae0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
5af0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
5b00: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
5b10: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
5b20: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
5b30: 31 37 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  171..SELECT col0
5b40: 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20 35 32   DIV - col1 + 52
5b50: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
5b60: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
5b70: 0d 0a 34 36 0d 0a 34 36 0d 0a 35 32 0d 0a 0d 0a  ..46..46..52....
5b80: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
5b90: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
5ba0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5bb0: 61 62 65 6c 2d 31 37 31 0d 0a 53 45 4c 45 43 54  abel-171..SELECT
5bc0: 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 2b   col0 / - col1 +
5bd0: 20 35 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   52 AS col1 FROM
5be0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
5bf0: 2d 2d 2d 0d 0a 34 36 0d 0a 34 36 0d 0a 35 32 0d  ---..46..46..52.
5c00: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5c10: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
5c20: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c   cor0.col0 * col
5c30: 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  2 + col1 FROM ta
5c40: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
5c50: 33 32 0d 0a 37 33 38 39 0d 0a 38 37 38 0d 0a 0d  32..7389..878...
5c60: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
5c70: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
5c80: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
5c90: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
5ca0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 33  owsort label-173
5cb0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
5cc0: 2b 20 2b 20 63 6f 6c 31 20 44 49 56 20 28 20 63  + + col1 DIV ( c
5cd0: 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol2 ) FROM tab0 
5ce0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
5cf0: 38 34 0d 0a 2d 39 30 0d 0a 30 0d 0a 0d 0a 73 6b  84..-90..0....sk
5d00: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
5d10: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
5d20: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
5d30: 65 6c 2d 31 37 33 0d 0a 53 45 4c 45 43 54 20 2d  el-173..SELECT -
5d40: 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2f   col1 + + col1 /
5d50: 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
5d60: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
5d70: 2d 0d 0a 2d 38 34 0d 0a 2d 39 30 0d 0a 30 0d 0a  -..-84..-90..0..
5d80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5d90: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
5da0: 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  CT + - col0 * - 
5db0: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col0 + + col1 * 
5dc0: 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  - col1 + cor0.co
5dd0: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
5de0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
5df0: 2d 2d 0d 0a 2d 38 38 35 0d 0a 32 36 32 39 0d 0a  --..-885..2629..
5e00: 35 39 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  5990....onlyif m
5e10: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
5e20: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
5e30: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
5e40: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
5e50: 62 65 6c 2d 31 37 35 0d 0a 53 45 4c 45 43 54 20  bel-175..SELECT 
5e60: 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  + - col2 * col1 
5e70: 2b 20 35 34 20 44 49 56 20 63 6f 6c 32 20 63 6f  + 54 DIV col2 co
5e80: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
5e90: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33  cor0..----..-283
5ea0: 37 0d 0a 2d 34 33 0d 0a 2d 37 34 36 32 0d 0a 0d  7..-43..-7462...
5eb0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
5ec0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
5ed0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
5ee0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
5ef0: 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
5f00: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
5f10: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
5f20: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
5f30: 37 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  75..SELECT + - c
5f40: 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 35 34 20  ol2 * col1 + 54 
5f50: 2f 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  / col2 col1 FROM
5f60: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
5f70: 2d 2d 2d 0d 0a 2d 32 38 33 37 0d 0a 2d 34 33 0d  ---..-2837..-43.
5f80: 0a 2d 37 34 36 32 0d 0a 0d 0a 71 75 65 72 79 20  .-7462....query 
5f90: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5fa0: 54 20 32 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  T 22 * + col2 + 
5fb0: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
5fc0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
5fd0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
5fe0: 31 0d 0a 31 33 31 38 0d 0a 32 31 39 32 0d 0a 0d  1..1318..2192...
5ff0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6000: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
6010: 6f 6c 31 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 - col2 AS co
6020: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
6030: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d  cor0..----..-55.
6040: 0a 2d 35 38 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65  .-58..-85....que
6050: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
6060: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  LECT - col0 * - 
6070: 74 61 62 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32  tab0.col1 + col2
6080: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
6090: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d 0a  b0..----..2097..
60a0: 33 33 39 36 0d 0a 38 31 38 31 0d 0a 0d 0a 71 75  3396..8181....qu
60b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
60c0: 45 4c 45 43 54 20 34 32 20 41 53 20 63 6f 6c 32  ELECT 42 AS col2
60d0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
60e0: 0d 0a 34 32 0d 0a 34 32 0d 0a 34 32 0d 0a 0d 0a  ..42..42..42....
60f0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
6100: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
6110: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
6120: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
6130: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38 30 0d  wsort label-180.
6140: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
6150: 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 44   * col1 + col1 D
6160: 49 56 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53  IV ( + col0 ) AS
6170: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
6180: 0a 2d 2d 2d 2d 0d 0a 32 38 34 31 0d 0a 37 34 36  .----..2841..746
6190: 33 0d 0a 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..99....skipif 
61a0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
61b0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
61c0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38  rowsort label-18
61d0: 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  0..SELECT ALL co
61e0: 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  l2 * col1 + col1
61f0: 20 2f 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53   / ( + col0 ) AS
6200: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
6210: 0a 2d 2d 2d 2d 0d 0a 32 38 34 31 0d 0a 37 34 36  .----..2841..746
6220: 33 0d 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  3..99....query I
6230: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6240: 20 41 4c 4c 20 38 30 20 41 53 20 63 6f 6c 31 20   ALL 80 AS col1 
6250: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
6260: 0a 38 30 0d 0a 38 30 0d 0a 38 30 0d 0a 0d 0a 71  .80..80..80....q
6270: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6280: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63  SELECT ALL + ( c
6290: 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 29 20 46  ol1 + + col2 ) F
62a0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
62b0: 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75  55..58..85....qu
62c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
62d0: 45 4c 45 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c  ELECT - cor1.col
62e0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
62f0: 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
6300: 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  0, tab2 AS cor1.
6310: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
6320: 20 68 61 73 68 69 6e 67 20 74 6f 20 63 38 32 64   hashing to c82d
6330: 66 31 64 65 33 63 62 36 36 36 32 32 34 36 39 30  f1de3cb666224690
6340: 61 38 33 66 33 64 37 39 30 64 37 39 0d 0a 0d 0a  a83f3d790d79....
6350: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6360: 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 30  .SELECT - ( col0
6370: 20 29 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63   ) + - col1 AS c
6380: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
6390: 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37 34 0d 0a 2d  ---..-29..-74..-
63a0: 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  93....query I ro
63b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 37  wsort..SELECT 87
63c0: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
63d0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
63e0: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
63f0: 20 74 6f 20 66 61 30 63 64 64 38 36 34 38 33 38   to fa0cdd864838
6400: 34 34 63 64 61 33 62 62 38 30 36 65 30 33 32 64  44cda3bb806e032d
6410: 35 63 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5c64....query I 
6420: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6430: 2b 20 37 32 20 2d 20 2d 20 63 6f 6c 31 20 41 53  + 72 - - col1 AS
6440: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
6450: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d  cor0..----..103.
6460: 0a 31 33 31 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72  .131..89....quer
6470: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6480: 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  ECT - col0 * col
6490: 31 20 2b 20 63 6f 6c 32 20 2a 20 32 39 20 46 52  1 + col2 * 29 FR
64a0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
64b0: 0a 2d 2d 2d 2d 0d 0a 31 30 31 33 0d 0a 31 34 38  .----..1013..148
64c0: 38 0d 0a 31 37 34 34 0d 0a 0d 0a 6f 6e 6c 79 69  8..1744....onlyi
64d0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
64e0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
64f0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
6500: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6510: 20 6c 61 62 65 6c 2d 31 38 38 0d 0a 53 45 4c 45   label-188..SELE
6520: 43 54 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20  CT + + col2 DIV 
6530: 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  col1 + col0 * + 
6540: 32 38 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  28 FROM tab2 cor
6550: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a 32 31  0..----..196..21
6560: 38 34 0d 0a 32 32 31 34 0d 0a 0d 0a 73 6b 69 70  84..2214....skip
6570: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
6580: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
6590: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
65a0: 2d 31 38 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  -188..SELECT + +
65b0: 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 2b 20 63   col2 / col1 + c
65c0: 6f 6c 30 20 2a 20 2b 20 32 38 20 46 52 4f 4d 20  ol0 * + 28 FROM 
65d0: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
65e0: 0a 31 39 36 0d 0a 32 31 38 34 0d 0a 32 32 31 34  .196..2184..2214
65f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6600: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
6610: 20 2a 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31   * col2 - + col1
6620: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
6630: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 35 0d 0a  r0..----..1475..
6640: 36 32 39 0d 0a 38 30 36 0d 0a 0d 0a 71 75 65 72  629..806....quer
6650: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6660: 45 43 54 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29  ECT + - ( col0 )
6670: 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
6680: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
6690: 2d 0d 0a 34 30 39 36 0d 0a 36 34 30 30 0d 0a 39  -..4096..6400..9
66a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
66b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
66c0: 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 2d 20 28  ( + col1 ) + - (
66d0: 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   - col1 ) AS col
66e0: 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
66f0: 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32  ..----..172..182
6700: 0d 0a 31 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..194....onlyif 
6710: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
6720: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
6730: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
6740: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
6750: 61 62 65 6c 2d 31 39 32 0d 0a 53 45 4c 45 43 54  abel-192..SELECT
6760: 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20   + ( - col2 ) + 
6770: 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 30 20  col1 DIV - col0 
6780: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
6790: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 33 36  0..----..-3..-36
67a0: 0d 0a 2d 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-83....skipif 
67b0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
67c0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
67d0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39  rowsort label-19
67e0: 32 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20  2..SELECT + ( - 
67f0: 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20 2f 20  col2 ) + col1 / 
6800: 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
6810: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6820: 2d 33 0d 0a 2d 33 36 0d 0a 2d 38 33 0d 0a 0d 0a  -3..-36..-83....
6830: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6840: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 35 37  .SELECT ALL - 57
6850: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
6860: 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 35 37 0d  .----..-57..-57.
6870: 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-57....query I 
6880: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6890: 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2d  ALL - + col0 * -
68a0: 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20   col2 + col1 AS 
68b0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
68c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
68d0: 32 0d 0a 37 33 38 39 0d 0a 38 37 38 0d 0a 0d 0a  2..7389..878....
68e0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
68f0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
6900: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
6910: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
6920: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 35 0d  wsort label-195.
6930: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
6940: 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 63   cor0.col1 DIV c
6950: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
6960: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
6970: 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37  ---..-7..-78..-7
6980: 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
6990: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
69a0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
69b0: 6f 72 74 20 6c 61 62 65 6c 2d 31 39 35 0d 0a 53  ort label-195..S
69c0: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63  ELECT - col0 * c
69d0: 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 31 20  or0.col1 / col1 
69e0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
69f0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
6a00: 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d  .-7..-78..-79...
6a10: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6a20: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
6a30: 20 39 34 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20   94 * col2 FROM 
6a40: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
6a50: 2d 2d 0d 0a 2d 32 34 34 34 0d 0a 2d 32 35 33 38  --..-2444..-2538
6a60: 0d 0a 2d 33 35 37 32 0d 0a 0d 0a 71 75 65 72 79  ..-3572....query
6a70: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6a80: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 34  CT DISTINCT + 54
6a90: 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
6aa0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
6ab0: 2d 0d 0a 31 34 30 34 0d 0a 31 34 35 38 0d 0a 32  -..1404..1458..2
6ac0: 30 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  052....query I r
6ad0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
6ae0: 20 35 32 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20   52 + - col1 AS 
6af0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
6b00: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
6b10: 0d 0a 33 39 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72  ..39..42....quer
6b20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6b30: 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  ECT col2 * col2 
6b40: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
6b50: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
6b60: 2d 2d 2d 0d 0a 31 34 38 32 0d 0a 37 30 32 0d 0a  ---..1482..702..
6b70: 37 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  756....query I r
6b80: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
6b90: 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 32 35  LL - col1 * + 25
6ba0: 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
6bb0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
6bc0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 30 0d  or0..----..-240.
6bd0: 0a 2d 33 31 32 0d 0a 2d 36 32 34 0d 0a 0d 0a 71  .-312..-624....q
6be0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6bf0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
6c00: 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 46 52  - col2 - col2 FR
6c10: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
6c20: 2d 2d 0d 0a 2d 35 32 0d 0a 2d 35 34 0d 0a 2d 37  --..-52..-54..-7
6c30: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
6c40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
6c50: 6f 6c 31 20 2a 20 34 36 20 41 53 20 63 6f 6c 32  ol1 * 46 AS col2
6c60: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
6c70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 0d  r0..----..-1196.
6c80: 0a 2d 34 36 30 0d 0a 2d 35 39 38 0d 0a 0d 0a 71  .-460..-598....q
6c90: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6ca0: 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 31  SELECT tab0.col1
6cb0: 20 2a 20 28 20 2b 20 38 39 20 29 20 41 53 20 63   * ( + 89 ) AS c
6cc0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
6cd0: 2d 2d 2d 0d 0a 37 36 35 34 0d 0a 38 30 39 39 0d  ---..7654..8099.
6ce0: 0a 38 36 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .8633....query I
6cf0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6d00: 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 28 20 63 6f   - col0 * + ( co
6d10: 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l2 ) AS col2 FRO
6d20: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
6d30: 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34  ----..-162..-364
6d40: 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72  8..-7680....quer
6d50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6d60: 45 43 54 20 2b 20 2b 20 35 37 20 46 52 4f 4d 20  ECT + + 57 FROM 
6d70: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
6d80: 2d 2d 0d 0a 35 37 0d 0a 35 37 0d 0a 35 37 0d 0a  --..57..57..57..
6d90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6da0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
6db0: 2e 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col2 + cor0.col
6dc0: 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  1 * col0 AS col1
6dd0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
6de0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d 0a  r0..----..2097..
6df0: 33 33 39 36 0d 0a 38 31 38 31 0d 0a 0d 0a 71 75  3396..8181....qu
6e00: 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
6e10: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6e20: 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31   ALL * FROM tab1
6e30: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20  , tab2 AS cor0, 
6e40: 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72 31 0d  tab0, tab0 cor1.
6e50: 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65  .----..972 value
6e60: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 39 62  s hashing to 09b
6e70: 31 32 30 61 38 66 66 31 33 65 62 61 66 65 61 37  120a8ff13ebafea7
6e80: 61 66 31 30 63 32 31 35 32 32 34 31 62 0d 0a 0d  af10c2152241b...
6e90: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
6ea0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
6eb0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
6ec0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
6ed0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
6ee0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6ef0: 54 20 41 4c 4c 20 2d 20 36 30 20 2a 20 2b 20 63  T ALL - 60 * + c
6f00: 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
6f10: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
6f20: 0d 0a 2d 33 32 34 30 0d 0a 2d 33 34 32 30 0d 0a  ..-3240..-3420..
6f30: 2d 35 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -5760....query I
6f40: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6f50: 20 2d 20 28 20 32 36 20 29 20 41 53 20 63 6f 6c   - ( 26 ) AS col
6f60: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
6f70: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a  or0..----..-26..
6f80: 2d 32 36 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72  -26..-26....quer
6f90: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6fa0: 45 43 54 20 2d 20 2b 20 28 20 2b 20 63 6f 6c 30  ECT - + ( + col0
6fb0: 20 29 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63   ) * - col0 AS c
6fc0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
6fd0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32   cor0..----..122
6fe0: 35 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a  5..576..7921....
6ff0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7000: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
7010: 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   - - cor0.col0 +
7020: 20 36 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   69 AS col2 FROM
7030: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
7040: 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 35 38 0d 0a 39  ---..104..158..9
7050: 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
7060: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
7070: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
7080: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  ort..SELECT CAST
7090: 20 28 20 39 35 20 41 53 20 52 45 41 4c 20 29 20   ( 95 AS REAL ) 
70a0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
70b0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
70c0: 0a 39 35 0d 0a 39 35 0d 0a 39 35 0d 0a 0d 0a 71  .95..95..95....q
70d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
70e0: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
70f0: 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  + col2 * cor0.co
7100: 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 * col0 FROM t
7110: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
7120: 31 33 35 34 0d 0a 31 35 38 32 34 33 0d 0a 32 33  1354..158243..23
7130: 37 31 37 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  7175....skipif p
7140: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
7150: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
7160: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
7170: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
7180: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7190: 0d 0a 53 45 4c 45 43 54 20 2b 20 32 30 20 2b 20  ..SELECT + 20 + 
71a0: 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  + col0 * + col2 
71b0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
71c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35  S cor0..----..55
71d0: 0d 0a 37 33 31 38 0d 0a 38 31 32 0d 0a 0d 0a 71  ..7318..812....q
71e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
71f0: 53 45 4c 45 43 54 20 2d 20 38 35 20 2a 20 2d 20  SELECT - 85 * - 
7200: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
7210: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
7220: 2d 2d 2d 2d 0d 0a 31 31 30 35 0d 0a 32 32 31 30  ----..1105..2210
7230: 0d 0a 38 35 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..850....onlyif 
7240: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
7250: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
7260: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
7270: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
7280: 61 62 65 6c 2d 32 31 36 0d 0a 53 45 4c 45 43 54  abel-216..SELECT
7290: 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 34 37   DISTINCT + ( 47
72a0: 20 29 20 2d 20 2d 20 63 6f 6c 32 20 44 49 56 20   ) - - col2 DIV 
72b0: 2d 20 37 38 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 78 AS col1 FRO
72c0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
72d0: 2d 2d 2d 2d 0d 0a 34 36 0d 0a 34 37 0d 0a 0d 0a  ----..46..47....
72e0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
72f0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
7300: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
7310: 61 62 65 6c 2d 32 31 36 0d 0a 53 45 4c 45 43 54  abel-216..SELECT
7320: 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 34 37   DISTINCT + ( 47
7330: 20 29 20 2d 20 2d 20 63 6f 6c 32 20 2f 20 2d 20   ) - - col2 / - 
7340: 37 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  78 AS col1 FROM 
7350: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
7360: 2d 2d 0d 0a 34 36 0d 0a 34 37 0d 0a 0d 0a 71 75  --..46..47....qu
7370: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7380: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20  ELECT ALL - ( - 
7390: 32 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  2 ) * + col0 AS 
73a0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
73b0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
73c0: 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 73 6b 69  8..48..70....ski
73d0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
73e0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
73f0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
7400: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
7410: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
7420: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
7430: 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 63 6f  - col1 + col0 co
7440: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
7450: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d  cor0..----..-24.
7460: 0a 31 39 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79  .19..62....query
7470: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7480: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
7490: 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 32 20 29 20  l0 * - ( col2 ) 
74a0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
74b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d  0..----..-162..-
74c0: 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71  3648..-7680....q
74d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
74e0: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
74f0: 34 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  4 FROM tab2..---
7500: 2d 0d 0a 31 30 34 0d 0a 31 30 38 0d 0a 31 35 32  -..104..108..152
7510: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7520: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
7530: 49 4e 43 54 20 2b 20 28 20 63 6f 72 30 2e 63 6f  INCT + ( cor0.co
7540: 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l2 ) FROM tab0 A
7550: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
7560: 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69  .33..82....skipi
7570: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
7580: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
7590: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
75a0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
75b0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
75c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
75d0: 49 4e 43 54 20 2b 20 33 32 20 2a 20 2d 20 63 6f  INCT + 32 * - co
75e0: 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
75f0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
7600: 0a 2d 31 31 32 30 0d 0a 2d 32 38 34 38 0d 0a 2d  .-1120..-2848..-
7610: 37 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  768....query I r
7620: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
7630: 4c 4c 20 2b 20 38 36 20 2a 20 63 6f 6c 30 20 2a  LL + 86 * col0 *
7640: 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31   - col0 + + col1
7650: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
7660: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 32 32 34  r0..----..-35224
7670: 36 0d 0a 2d 35 35 30 33 38 37 0d 0a 2d 37 34 38  6..-550387..-748
7680: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7690: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
76a0: 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2d 20 2d 20  INCT + col2 - - 
76b0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
76c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a  or0..----..171..
76d0: 33 36 0d 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  36..57....onlyif
76e0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
76f0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
7700: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
7710: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7720: 6c 61 62 65 6c 2d 32 32 35 0d 0a 53 45 4c 45 43  label-225..SELEC
7730: 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2a  T ALL + + col1 *
7740: 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 32   col1 DIV - col2
7750: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
7760: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7770: 0d 0a 2d 31 30 30 0d 0a 2d 32 32 34 0d 0a 2d 39  ..-100..-224..-9
7780: 34 30 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  409....skipif my
7790: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
77a0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
77b0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 35 0d  wsort label-225.
77c0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
77d0: 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2f 20 2d 20  col1 * col1 / - 
77e0: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
77f0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
7800: 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 32 32 34  ----..-100..-224
7810: 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79  ..-9409....query
7820: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7830: 43 54 20 2b 20 28 20 28 20 2d 20 63 6f 6c 30 20  CT + ( ( - col0 
7840: 29 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ) ) + cor0.col0 
7850: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
7860: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
7870: 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .0..0..0....skip
7880: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
7890: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
78a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
78b0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41  CT DISTINCT - CA
78c0: 53 54 20 28 20 28 20 63 6f 6c 32 20 29 20 41 53  ST ( ( col2 ) AS
78d0: 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62   REAL ) FROM tab
78e0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
78f0: 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a  .-26..-27..-38..
7900: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
7910: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
7920: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
7930: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
7940: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
7950: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 38 0d 0a  sort label-228..
7960: 53 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c  SELECT CAST( NUL
7970: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  L AS SIGNED ) * 
7980: 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f  cor0.col1 + + co
7990: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
79a0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
79b0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
79c0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
79d0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
79e0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
79f0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 38  owsort label-228
7a00: 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20  ..SELECT CAST ( 
7a10: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
7a20: 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  ) * cor0.col1 + 
7a30: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
7a40: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
7a50: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
7a60: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
7a70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7a80: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 33  ECT ALL col1 + 3
7a90: 39 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  9 * col1 FROM ta
7aa0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
7ab0: 0d 0a 31 32 34 30 0d 0a 32 33 36 30 0d 0a 36 38  ..1240..2360..68
7ac0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
7ad0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33  sort..SELECT - 3
7ae0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
7af0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
7b00: 33 0d 0a 2d 33 0d 0a 2d 33 0d 0a 0d 0a 6f 6e 6c  3..-3..-3....onl
7b10: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
7b20: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
7b30: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
7b40: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
7b50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7b60: 6c 61 62 65 6c 2d 32 33 31 0d 0a 53 45 4c 45 43  label-231..SELEC
7b70: 54 20 35 31 20 2a 20 2d 20 28 20 2d 20 74 61 62  T 51 * - ( - tab
7b80: 32 2e 63 6f 6c 32 20 29 20 2a 20 43 41 53 54 28  2.col2 ) * CAST(
7b90: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
7ba0: 29 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ) + + col2 AS co
7bb0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
7bc0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
7bd0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
7be0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
7bf0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
7c00: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 31  owsort label-231
7c10: 0d 0a 53 45 4c 45 43 54 20 35 31 20 2a 20 2d 20  ..SELECT 51 * - 
7c20: 28 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 29 20  ( - tab2.col2 ) 
7c30: 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  * CAST ( NULL AS
7c40: 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 63   INTEGER ) + + c
7c50: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
7c60: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab2..----..NUL
7c70: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
7c80: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
7c90: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
7ca0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
7cb0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
7cc0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
7cd0: 6f 72 74 20 6c 61 62 65 6c 2d 32 33 32 0d 0a 53  ort label-232..S
7ce0: 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 4e 55  ELECT - CAST( NU
7cf0: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
7d00: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
7d10: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43  , tab2 AS cor0 C
7d20: 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 0d 0a  ROSS JOIN tab0..
7d30: 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
7d40: 68 61 73 68 69 6e 67 20 74 6f 20 31 36 62 65 38  hashing to 16be8
7d50: 38 36 38 61 31 65 36 66 34 65 38 38 35 30 35 30  868a1e6f4e885050
7d60: 39 66 39 33 32 37 61 66 65 39 30 0d 0a 0d 0a 73  9f9327afe90....s
7d70: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
7d80: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
7d90: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
7da0: 62 65 6c 2d 32 33 32 0d 0a 53 45 4c 45 43 54 20  bel-232..SELECT 
7db0: 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
7dc0: 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
7dd0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l0 FROM tab2, ta
7de0: 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b2 AS cor0 CROSS
7df0: 20 4a 4f 49 4e 20 74 61 62 30 0d 0a 2d 2d 2d 2d   JOIN tab0..----
7e00: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
7e10: 69 6e 67 20 74 6f 20 31 36 62 65 38 38 36 38 61  ing to 16be8868a
7e20: 31 65 36 66 34 65 38 38 35 30 35 30 39 66 39 33  1e6f4e8850509f93
7e30: 32 37 61 66 65 39 30 0d 0a 0d 0a 71 75 65 72 79  27afe90....query
7e40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7e50: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
7e60: 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + + col0 AS col
7e70: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
7e80: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a  or0..----..171..
7e90: 33 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69 66  36..57....skipif
7ea0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
7eb0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
7ec0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
7ed0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
7ee0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
7ef0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 34  rt..SELECT - - 4
7f00: 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  1 col0 FROM tab2
7f10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7f20: 34 31 0d 0a 34 31 0d 0a 34 31 0d 0a 0d 0a 71 75  41..41..41....qu
7f30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7f40: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
7f50: 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  l0 + cor0.col1 *
7f60: 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 34   cor0.col0 + - 4
7f70: 38 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  8 FROM tab0 AS c
7f80: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 39 32 0d  or0..----..1992.
7f90: 0a 33 33 31 32 0d 0a 37 39 36 32 0d 0a 0d 0a 71  .3312..7962....q
7fa0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7fb0: 53 45 4c 45 43 54 20 2d 20 31 37 20 2a 20 2d 20  SELECT - 17 * - 
7fc0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
7fd0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
7fe0: 30 33 0d 0a 32 38 39 0d 0a 35 32 37 0d 0a 0d 0a  03..289..527....
7ff0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8000: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
8010: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
8020: 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
8030: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
8040: 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
8050: 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  1..----..81 valu
8060: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 38  es hashing to 78
8070: 36 61 32 34 30 66 38 30 62 65 66 36 66 39 63 36  6a240f80bef6f9c6
8080: 61 31 39 30 65 39 32 63 64 34 66 39 65 38 0d 0a  a190e92cd4f9e8..
8090: 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49  ..query IIIIIIII
80a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
80b0: 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62  T ALL * FROM tab
80c0: 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  0, tab0 AS cor0 
80d0: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20  CROSS JOIN tab2 
80e0: 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
80f0: 34 33 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  43 values hashin
8100: 67 20 74 6f 20 63 65 35 33 63 30 65 38 38 33 39  g to ce53c0e8839
8110: 63 39 36 39 62 30 35 31 33 35 36 38 64 61 36 65  c969b0513568da6e
8120: 62 32 63 34 62 0d 0a 0d 0a 71 75 65 72 79 20 49  b2c4b....query I
8130: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8140: 20 41 4c 4c 20 31 37 20 41 53 20 63 6f 6c 30 20   ALL 17 AS col0 
8150: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
8160: 0a 31 37 0d 0a 31 37 0d 0a 31 37 0d 0a 0d 0a 6f  .17..17..17....o
8170: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
8180: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
8190: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
81a0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
81b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
81c0: 74 20 6c 61 62 65 6c 2d 32 34 30 0d 0a 53 45 4c  t label-240..SEL
81d0: 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 43  ECT + col2 + + C
81e0: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
81f0: 4e 45 44 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63  NED ) * - cor0.c
8200: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
8210: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
8220: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
8230: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
8240: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
8250: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
8260: 6c 61 62 65 6c 2d 32 34 30 0d 0a 53 45 4c 45 43  label-240..SELEC
8270: 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 43 41 53  T + col2 + + CAS
8280: 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
8290: 47 45 52 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63  GER ) * - cor0.c
82a0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
82b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
82c0: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
82d0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
82e0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
82f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8300: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
8310: 20 2d 20 63 6f 6c 31 20 2b 20 43 41 53 54 20 28   - col1 + CAST (
8320: 20 36 36 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20   66 + - col0 AS 
8330: 52 45 41 4c 20 29 20 2a 20 63 6f 6c 32 20 46 52  REAL ) * col2 FR
8340: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
8350: 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37 37 0d 0a 2d 36  .----..-1977..-6
8360: 36 0d 0a 31 33 30 30 0d 0a 0d 0a 71 75 65 72 79  6..1300....query
8370: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8380: 43 54 20 2d 20 63 6f 6c 30 20 2b 20 28 20 2b 20  CT - col0 + ( + 
8390: 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 30 20  col1 ) + - col0 
83a0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
83b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 31 0d 0a 2d  0..----..-141..-
83c0: 39 37 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72 79 20  97..17....query 
83d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
83e0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72  T DISTINCT + cor
83f0: 30 2e 63 6f 6c 31 20 2b 20 36 33 20 2b 20 63 6f  0.col1 + 63 + co
8400: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
8410: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
8420: 2d 2d 0d 0a 31 31 38 0d 0a 31 32 31 0d 0a 31 34  --..118..121..14
8430: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  8....query IIIII
8440: 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
8450: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a  rt..SELECT ALL *
8460: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
8470: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
8480: 53 20 63 6f 72 31 2c 20 74 61 62 30 2c 20 74 61  S cor1, tab0, ta
8490: 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d  b2 AS cor2..----
84a0: 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61  ..3645 values ha
84b0: 73 68 69 6e 67 20 74 6f 20 37 31 31 38 30 66 39  shing to 71180f9
84c0: 66 33 65 66 61 64 66 30 65 65 33 61 37 66 65 63  f3efadf0ee3a7fec
84d0: 39 36 37 38 32 30 38 61 64 0d 0a 0d 0a 71 75 65  9678208ad....que
84e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
84f0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
8500: 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  * col1 * - col1 
8510: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
8520: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
8530: 0a 31 37 37 35 30 34 0d 0a 33 32 39 33 31 35 0d  .177504..329315.
8540: 0a 37 33 37 30 30 39 0d 0a 0d 0a 6f 6e 6c 79 69  .737009....onlyi
8550: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
8560: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
8570: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
8580: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8590: 20 6c 61 62 65 6c 2d 32 34 36 0d 0a 53 45 4c 45   label-246..SELE
85a0: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
85b0: 20 44 49 56 20 2b 20 28 20 2b 20 63 6f 6c 32 20   DIV + ( + col2 
85c0: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
85d0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
85e0: 2d 0d 0a 31 0d 0a 32 0d 0a 39 37 0d 0a 0d 0a 73  -..1..2..97....s
85f0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
8600: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
8610: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
8620: 62 65 6c 2d 32 34 36 0d 0a 53 45 4c 45 43 54 20  bel-246..SELECT 
8630: 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2f 20  DISTINCT col1 / 
8640: 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 41 53 20  + ( + col2 ) AS 
8650: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
8660: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
8670: 0a 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  .2..97....query 
8680: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8690: 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 36 34 20  T - col0 + + 64 
86a0: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
86b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
86c0: 2d 33 32 0d 0a 2d 37 33 0d 0a 32 36 0d 0a 0d 0a  -32..-73..26....
86d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
86e0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
86f0: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31  cor0.col2 * col1
8700: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
8710: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d  r0..----..-1534.
8720: 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71  .-646..-837....q
8730: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8740: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
8750: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  col2 * col0 + co
8760: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
8770: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 37  cor0..----..2087
8780: 0d 0a 32 32 30 0d 0a 33 30 31 39 0d 0a 0d 0a 71  ..220..3019....q
8790: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
87a0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62  SELECT ALL + tab
87b0: 32 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46 52  2.col2 + col2 FR
87c0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab2..----..5
87d0: 32 0d 0a 35 34 0d 0a 37 36 0d 0a 0d 0a 71 75 65  2..54..76....que
87e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
87f0: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20  LECT ALL col2 + 
8800: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  + col1 + col0 * 
8810: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
8820: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab1..----..11
8830: 34 39 0d 0a 31 35 38 0d 0a 37 30 37 0d 0a 0d 0a  49..158..707....
8840: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8850: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
8860: 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab1.col1 FROM t
8870: 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62 31 20  ab1, tab2, tab1 
8880: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
8890: 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
88a0: 20 74 6f 20 63 37 38 39 30 34 36 39 65 61 62 62   to c7890469eabb
88b0: 32 63 36 66 63 38 31 34 35 34 62 33 35 64 32 33  2c6fc81454b35d23
88c0: 33 33 62 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  33b6....onlyif m
88d0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
88e0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
88f0: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
8900: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
8910: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8920: 2d 32 35 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -253..SELECT + c
8930: 6f 6c 31 20 2b 20 2b 20 43 41 53 54 28 20 4e 55  ol1 + + CAST( NU
8940: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
8950: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
8960: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8970: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
8980: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
8990: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
89a0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
89b0: 72 74 20 6c 61 62 65 6c 2d 32 35 33 0d 0a 53 45  rt label-253..SE
89c0: 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  LECT + col1 + + 
89d0: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
89e0: 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31  NTEGER ) AS col1
89f0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
8a00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
8a10: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e  NULL..NULL....on
8a20: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
8a30: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
8a40: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
8a50: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
8a60: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8a70: 20 6c 61 62 65 6c 2d 32 35 34 0d 0a 53 45 4c 45   label-254..SELE
8a80: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 28 20 2d 20  CT + col2 * ( - 
8a90: 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 31 20  col2 ) + - col1 
8aa0: 2f 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  / + CAST( NULL A
8ab0: 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
8ac0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
8ad0: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
8ae0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
8af0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
8b00: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
8b10: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
8b20: 6c 2d 32 35 34 0d 0a 53 45 4c 45 43 54 20 2b 20  l-254..SELECT + 
8b30: 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f 6c 32 20  col2 * ( - col2 
8b40: 29 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 43  ) + - col1 / + C
8b50: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
8b60: 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20  TEGER ) AS col1 
8b70: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
8b80: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
8b90: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
8ba0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
8bb0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
8bc0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
8bd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
8be0: 6c 61 62 65 6c 2d 32 35 35 0d 0a 53 45 4c 45 43  label-255..SELEC
8bf0: 54 20 2d 20 33 31 20 44 49 56 20 63 6f 72 31 2e  T - 31 DIV cor1.
8c00: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
8c10: 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  M tab0, tab0 AS 
8c20: 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
8c30: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
8c40: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64  ues hashing to d
8c50: 31 62 33 33 39 30 62 66 33 63 32 32 34 65 35 32  1b3390bf3c224e52
8c60: 37 62 66 36 38 66 34 33 66 65 61 36 36 35 66 0d  7bf68f43fea665f.
8c70: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
8c80: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
8c90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8ca0: 74 20 6c 61 62 65 6c 2d 32 35 35 0d 0a 53 45 4c  t label-255..SEL
8cb0: 45 43 54 20 2d 20 33 31 20 2f 20 63 6f 72 31 2e  ECT - 31 / cor1.
8cc0: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
8cd0: 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  M tab0, tab0 AS 
8ce0: 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
8cf0: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
8d00: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64  ues hashing to d
8d10: 31 62 33 33 39 30 62 66 33 63 32 32 34 65 35 32  1b3390bf3c224e52
8d20: 37 62 66 36 38 66 34 33 66 65 61 36 36 35 66 0d  7bf68f43fea665f.
8d30: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8d40: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
8d50: 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 30 20 2a  ol2 + ( - col0 *
8d60: 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 29 20 46   - tab0.col0 ) F
8d70: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
8d80: 31 32 32 36 0d 0a 36 30 39 0d 0a 38 30 30 33 0d  1226..609..8003.
8d90: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8da0: 72 74 0d 0a 53 45 4c 45 43 54 20 38 31 20 46 52  rt..SELECT 81 FR
8db0: 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  OM tab2, tab0 AS
8dc0: 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
8dd0: 6f 72 31 2c 20 74 61 62 30 2c 20 74 61 62 32 20  or1, tab0, tab2 
8de0: 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor2..----..2
8df0: 34 33 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  43 values hashin
8e00: 67 20 74 6f 20 64 65 63 38 39 35 38 64 63 62 61  g to dec8958dcba
8e10: 65 32 37 33 30 65 34 61 36 32 39 66 61 61 38 36  e2730e4a629faa86
8e20: 63 37 63 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49  c7c01....query I
8e30: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8e40: 20 41 4c 4c 20 2d 20 32 37 20 2a 20 63 6f 6c 31   ALL - 27 * col1
8e50: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
8e60: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
8e70: 0d 0a 2d 32 37 30 0d 0a 2d 33 35 31 0d 0a 2d 37  ..-270..-351..-7
8e80: 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
8e90: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
8ea0: 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 32 20  col1 ) * + col2 
8eb0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
8ec0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  0 cor0..----..28
8ed0: 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a  38..7462..97....
8ee0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8ef0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
8f00: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  col2 * col0 + co
8f10: 6c 31 20 2a 20 2d 20 39 34 20 2b 20 2d 20 63 6f  l1 * - 94 + - co
8f20: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
8f30: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
8f40: 0a 2d 32 36 30 39 0d 0a 2d 34 36 35 32 0d 0a 2d  .-2609..-4652..-
8f50: 38 39 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8982....query I 
8f60: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8f70: 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
8f80: 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  2 + col2 AS col1
8f90: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
8fa0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73  r0..----..0....s
8fb0: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
8fc0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
8fd0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
8fe0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
8ff0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
9000: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9010: 41 4c 4c 20 2d 20 36 33 20 2a 20 2d 20 63 6f 6c  ALL - 63 * - col
9020: 32 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52  2 + col1 col1 FR
9030: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
9040: 0a 2d 2d 2d 2d 0d 0a 31 36 39 37 0d 0a 31 37 33  .----..1697..173
9050: 32 0d 0a 32 34 31 31 0d 0a 0d 0a 71 75 65 72 79  2..2411....query
9060: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9070: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
9080: 6c 32 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  l2 - col2 * col2
9090: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
90a0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
90b0: 0d 0a 2d 31 31 32 32 0d 0a 2d 32 0d 0a 2d 36 38  ..-1122..-2..-68
90c0: 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  06....query I ro
90d0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
90e0: 4c 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  L col0 + + col2 
90f0: 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  * - col2 + - col
9100: 30 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72  0 * col0 * - cor
9110: 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  0.col2 AS col0 F
9120: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
9130: 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 39 0d 0a 31 37  ..----..1259..17
9140: 39 34 33 0d 0a 36 34 32 38 38 37 0d 0a 0d 0a 71  943..642887....q
9150: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9160: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20  SELECT + + col1 
9170: 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
9180: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
9190: 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34  ..----..1248..14
91a0: 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79  04..570....query
91b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
91c0: 43 54 20 41 4c 4c 20 2b 20 36 35 20 46 52 4f 4d  CT ALL + 65 FROM
91d0: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
91e0: 0d 0a 36 35 0d 0a 36 35 0d 0a 36 35 0d 0a 0d 0a  ..65..65..65....
91f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9200: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 31  .SELECT ALL cor1
9210: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c  .col2 FROM tab2,
9220: 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
9230: 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
9240: 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
9250: 68 69 6e 67 20 74 6f 20 37 37 38 36 37 31 38 62  hing to 7786718b
9260: 64 38 30 34 32 30 32 32 35 33 37 33 37 38 64 34  d8042022537378d4
9270: 30 65 63 38 37 34 37 35 0d 0a 0d 0a 6f 6e 6c 79  0ec87475....only
9280: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
9290: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
92a0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
92b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
92c0: 74 20 6c 61 62 65 6c 2d 32 36 38 0d 0a 53 45 4c  t label-268..SEL
92d0: 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c  ECT ALL cor0.col
92e0: 32 20 2a 20 63 6f 6c 32 20 44 49 56 20 38 35 20  2 * col2 DIV 85 
92f0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
9300: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
9310: 0a 31 36 0d 0a 37 0d 0a 38 0d 0a 0d 0a 73 6b 69  .16..7..8....ski
9320: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
9330: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
9340: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
9350: 6c 2d 32 36 38 0d 0a 53 45 4c 45 43 54 20 41 4c  l-268..SELECT AL
9360: 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  L cor0.col2 * co
9370: 6c 32 20 2f 20 38 35 20 41 53 20 63 6f 6c 30 20  l2 / 85 AS col0 
9380: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
9390: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 37 0d 0a  0..----..16..7..
93a0: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
93b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
93c0: 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d  TINCT + col1 * -
93d0: 20 35 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   58 AS col0 FROM
93e0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
93f0: 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 35 38 30  ---..-1508..-580
9400: 0d 0a 2d 37 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-754....onlyif
9410: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
9420: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
9430: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
9440: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
9450: 6c 61 62 65 6c 2d 32 37 30 0d 0a 53 45 4c 45 43  label-270..SELEC
9460: 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2d  T ALL + col0 * -
9470: 20 39 37 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b   97 + col2 DIV +
9480: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
9490: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
94a0: 2d 2d 0d 0a 2d 32 39 30 0d 0a 2d 36 32 30 37 0d  --..-290..-6207.
94b0: 0a 2d 37 37 35 39 0d 0a 0d 0a 73 6b 69 70 69 66  .-7759....skipif
94c0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
94d0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
94e0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
94f0: 37 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  70..SELECT ALL +
9500: 20 63 6f 6c 30 20 2a 20 2d 20 39 37 20 2b 20 63   col0 * - 97 + c
9510: 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20  ol2 / + col2 AS 
9520: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
9530: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 30 0d  or0..----..-290.
9540: 0a 2d 36 32 30 37 0d 0a 2d 37 37 35 39 0d 0a 0d  .-6207..-7759...
9550: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9560: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
9570: 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  T - - col0 + - c
9580: 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 * + cor0.col
9590: 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  1 * + col0 AS co
95a0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
95b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 31  cor0..----..-231
95c0: 0d 0a 2d 34 30 38 39 36 0d 0a 2d 38 33 31 32 30  ..-40896..-83120
95d0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
95e0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
95f0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
9600: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
9610: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
9620: 32 37 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  272..SELECT DIST
9630: 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  INCT - cor0.col2
9640: 20 2b 20 2b 20 32 38 20 2a 20 63 6f 6c 32 20 44   + + 28 * col2 D
9650: 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 63  IV - cor0.col2 c
9660: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
9670: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
9680: 34 0d 0a 2d 38 32 0d 0a 2d 38 35 0d 0a 0d 0a 73  4..-82..-85....s
9690: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
96a0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
96b0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
96c0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
96d0: 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
96e0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
96f0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
9700: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 32  owsort label-272
9710: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
9720: 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  T - cor0.col2 + 
9730: 2b 20 32 38 20 2a 20 63 6f 6c 32 20 2f 20 2d 20  + 28 * col2 / - 
9740: 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46  cor0.col2 col1 F
9750: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
9760: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 0d 0a 2d 38  ..----..-124..-8
9770: 32 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72 79 20  2..-85....query 
9780: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9790: 54 20 63 6f 6c 30 20 2a 20 34 31 20 46 52 4f 4d  T col0 * 41 FROM
97a0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
97b0: 2d 2d 2d 0d 0a 32 38 37 0d 0a 33 31 39 38 0d 0a  ---..287..3198..
97c0: 33 32 33 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3239....onlyif m
97d0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
97e0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
97f0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
9800: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9810: 62 65 6c 2d 32 37 34 0d 0a 53 45 4c 45 43 54 20  bel-274..SELECT 
9820: 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20 28 20 37  - col0 DIV - ( 7
9830: 33 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  3 ) FROM tab2 AS
9840: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
9850: 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1..1....skipif m
9860: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
9870: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
9880: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 34  owsort label-274
9890: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
98a0: 2f 20 2d 20 28 20 37 33 20 29 20 46 52 4f 4d 20  / - ( 73 ) FROM 
98b0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
98c0: 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71  --..0..1..1....q
98d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
98e0: 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e 63 6f  SELECT + tab1.co
98f0: 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 74 61  l0 - + col2 * ta
9900: 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b1.col2 FROM tab
9910: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 33 0d 0a  1..----..-2913..
9920: 2d 33 31 38 35 0d 0a 2d 39 31 33 36 0d 0a 0d 0a  -3185..-9136....
9930: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9940: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
9950: 20 2b 20 2d 20 35 32 20 2b 20 63 6f 6c 32 20 2a   + - 52 + col2 *
9960: 20 2b 20 63 6f 6c 31 20 2a 20 34 38 20 46 52 4f   + col1 * 48 FRO
9970: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
9980: 2d 2d 2d 2d 0d 0a 31 33 36 31 37 32 0d 0a 33 35  ----..136172..35
9990: 38 31 32 34 0d 0a 34 36 30 34 0d 0a 0d 0a 6f 6e  8124..4604....on
99a0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
99b0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
99c0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
99d0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
99e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
99f0: 20 6c 61 62 65 6c 2d 32 37 37 0d 0a 53 45 4c 45   label-277..SELE
9a00: 43 54 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20  CT + ( - col1 ) 
9a10: 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 43 41  * cor0.col2 + CA
9a20: 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ST( col2 AS SIGN
9a30: 45 44 20 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52  ED ) + + col0 FR
9a40: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
9a50: 0a 2d 2d 2d 2d 0d 0a 2d 32 37 38 31 0d 0a 2d 36  .----..-2781..-6
9a60: 31 0d 0a 2d 37 32 39 31 0d 0a 0d 0a 73 6b 69 70  1..-7291....skip
9a70: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
9a80: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
9a90: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
9aa0: 2d 32 37 37 0d 0a 53 45 4c 45 43 54 20 2b 20 28  -277..SELECT + (
9ab0: 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f 72 30   - col1 ) * cor0
9ac0: 2e 63 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 63  .col2 + CAST ( c
9ad0: 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
9ae0: 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + + col0 FROM t
9af0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
9b00: 2d 0d 0a 2d 32 37 38 31 0d 0a 2d 36 31 0d 0a 2d  -..-2781..-61..-
9b10: 37 32 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7291....onlyif m
9b20: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
9b30: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
9b40: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
9b50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9b60: 62 65 6c 2d 32 37 38 0d 0a 53 45 4c 45 43 54 20  bel-278..SELECT 
9b70: 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 44 49  DISTINCT col1 DI
9b80: 56 20 2d 20 35 30 20 46 52 4f 4d 20 74 61 62 32  V - 50 FROM tab2
9b90: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9ba0: 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -1..0....skipif 
9bb0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
9bc0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
9bd0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37  rowsort label-27
9be0: 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  8..SELECT DISTIN
9bf0: 43 54 20 63 6f 6c 31 20 2f 20 2d 20 35 30 20 46  CT col1 / - 50 F
9c00: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
9c10: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 0d  ..----..-1..0...
9c20: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
9c30: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
9c40: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
9c50: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
9c60: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 39  owsort label-279
9c70: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53  ..SELECT ALL CAS
9c80: 54 28 20 2b 20 63 6f 6c 31 20 41 53 20 53 49 47  T( + col1 AS SIG
9c90: 4e 45 44 20 29 20 2a 20 74 61 62 32 2e 63 6f 6c  NED ) * tab2.col
9ca0: 31 20 2b 20 38 30 20 44 49 56 20 2d 20 74 61 62  1 + 80 DIV - tab
9cb0: 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  2.col1 AS col2 F
9cc0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
9cd0: 32 38 35 0d 0a 33 34 38 30 0d 0a 39 35 39 0d 0a  285..3480..959..
9ce0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
9cf0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
9d00: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9d10: 20 6c 61 62 65 6c 2d 32 37 39 0d 0a 53 45 4c 45   label-279..SELE
9d20: 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 2b 20  CT ALL CAST ( + 
9d30: 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
9d40: 29 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20  ) * tab2.col1 + 
9d50: 38 30 20 2f 20 2d 20 74 61 62 32 2e 63 6f 6c 31  80 / - tab2.col1
9d60: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
9d70: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 38 35 0d 0a 33  b2..----..285..3
9d80: 34 38 30 0d 0a 39 35 39 0d 0a 0d 0a 71 75 65 72  480..959....quer
9d90: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9da0: 45 43 54 20 2b 20 38 20 46 52 4f 4d 20 74 61 62  ECT + 8 FROM tab
9db0: 31 2c 20 74 61 62 30 2c 20 74 61 62 32 20 41 53  1, tab0, tab2 AS
9dc0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
9dd0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
9de0: 6f 20 33 33 30 36 39 61 64 63 33 63 31 31 34 32  o 33069adc3c1142
9df0: 64 33 31 35 31 31 65 63 38 38 66 63 66 61 34 30  d31511ec88fcfa40
9e00: 61 66 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  af....onlyif mys
9e10: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
9e20: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
9e30: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
9e40: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
9e50: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
9e60: 38 31 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 43  81..SELECT - - C
9e70: 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47  AST( col1 AS SIG
9e80: 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 32 20 63  NED ) + - col2 c
9e90: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
9ea0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
9eb0: 0d 0a 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 73 6b  ..-47..-83....sk
9ec0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
9ed0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
9ee0: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
9ef0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
9f00: 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
9f10: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
9f20: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
9f30: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38 31 0d  wsort label-281.
9f40: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 43 41 53 54  .SELECT - - CAST
9f50: 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   ( col1 AS INTEG
9f60: 45 52 20 29 20 2b 20 2d 20 63 6f 6c 32 20 63 6f  ER ) + - col2 co
9f70: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
9f80: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d  cor0..----..-28.
9f90: 0a 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65  .-47..-83....que
9fa0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9fb0: 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 33 38 20  LECT ALL + + 38 
9fc0: 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  * col0 + - col1 
9fd0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
9fe0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
9ff0: 0a 31 32 33 33 0d 0a 33 32 39 31 0d 0a 38 32 36  .1233..3291..826
a000: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
a010: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
a020: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
a030: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
a040: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
a050: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a060: 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c  LECT ALL + - col
a070: 31 20 2d 20 2d 20 28 20 63 6f 6c 30 20 29 20 2a  1 - - ( col0 ) *
a080: 20 31 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   12 col1 FROM ta
a090: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
a0a0: 0d 0a 32 30 32 0d 0a 33 32 33 0d 0a 39 37 37 0d  ..202..323..977.
a0b0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a0c0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
a0d0: 31 20 2a 20 33 36 20 2d 20 2d 20 63 6f 6c 31 20  1 * 36 - - col1 
a0e0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
a0f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 31 30 0d 0a  0..----..-3010..
a100: 2d 33 31 38 35 0d 0a 2d 33 33 39 35 0d 0a 0d 0a  -3185..-3395....
a110: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a120: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
a130: 35 35 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  55 ) + cor0.col2
a140: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
a150: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
a160: 30 39 0d 0a 31 31 32 0d 0a 31 35 31 0d 0a 0d 0a  09..112..151....
a170: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a180: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
a190: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   - cor0.col1 FRO
a1a0: 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72  M tab0, tab1 cor
a1b0: 30 2c 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d  0, tab1 cor1..--
a1c0: 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32  --..-10..-13..-2
a1d0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
a1e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
a1f0: 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   - col1 + - col0
a200: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
a210: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
a220: 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d 39 36  ..-137..-38..-96
a230: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
a240: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
a250: 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20  - col0 + col0 * 
a260: 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
a270: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
a280: 0d 0a 2d 34 31 36 30 0d 0a 2d 36 34 38 30 0d 0a  ..-4160..-6480..
a290: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a2a0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 33 31  t..SELECT - - 31
a2b0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
a2c0: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  b2 cor0..----..3
a2d0: 31 0d 0a 33 31 0d 0a 33 31 0d 0a 0d 0a 71 75 65  1..31..31....que
a2e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a2f0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
a300: 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col2 + - col0 * 
a310: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20  - cor0.col0 + - 
a320: 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
a330: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
a340: 2d 0d 0a 31 32 32 33 0d 0a 35 31 30 0d 0a 37 37  -..1223..510..77
a350: 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
a360: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
a370: 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 28 20  STINCT col0 + ( 
a380: 2d 20 63 6f 6c 32 20 29 20 2a 20 2d 20 34 32 20  - col2 ) * - 42 
a390: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
a3a0: 0a 31 31 34 31 0d 0a 31 31 37 30 0d 0a 31 36 37  .1141..1170..167
a3b0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
a3c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
a3d0: 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  or0.col2 + - col
a3e0: 30 20 2a 20 38 31 20 41 53 20 63 6f 6c 30 20 46  0 * 81 AS col0 F
a3f0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
a400: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 35  ..----..-189..-5
a410: 31 32 37 0d 0a 2d 36 33 38 34 0d 0a 0d 0a 71 75  127..-6384....qu
a420: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
a430: 45 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f 6c 31  ELECT ALL ( col1
a440: 20 29 20 2b 20 2b 20 28 20 2b 20 32 37 20 29 20   ) + + ( + 27 ) 
a450: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
a460: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
a470: 0a 31 31 33 0d 0a 31 31 38 0d 0a 31 32 34 0d 0a  .113..118..124..
a480: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a490: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
a4a0: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  CT + col2 * - co
a4b0: 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 37 35  l1 + col1 * + 75
a4c0: 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
a4d0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34  1 cor0..----..44
a4e0: 34 36 0d 0a 34 37 34 33 30 0d 0a 37 36 37 35 32  46..47430..76752
a4f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
a500: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
a510: 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  INCT + - col2 * 
a520: 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2d 20 33 37  cor0.col2 - - 37
a530: 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32   * col2 * - col2
a540: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
a550: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 38 30  r0..----..-11080
a560: 38 0d 0a 2d 31 32 33 34 36 32 0d 0a 2d 33 35 30  8..-123462..-350
a570: 32 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  208....query I r
a580: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
a590: 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29   ( - cor0.col2 )
a5a0: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
a5b0: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  2 cor0..----..0.
a5c0: 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
a5d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a5e0: 20 35 36 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c   56 + col1 * col
a5f0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
a600: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
a610: 2d 0d 0a 32 31 32 30 0d 0a 33 34 35 31 0d 0a 38  -..2120..3451..8
a620: 31 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  155....query I r
a630: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
a640: 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b   - col2 * col0 +
a650: 20 38 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53   83 FROM tab1 AS
a660: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35   cor0..----..-35
a670: 36 35 0d 0a 2d 37 35 39 37 0d 0a 2d 37 39 0d 0a  65..-7597..-79..
a680: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
a690: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
a6a0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
a6b0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
a6c0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
a6d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a6e0: 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20  CT ALL + - col0 
a6f0: 2a 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  * col2 col1 FROM
a700: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
a710: 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d  ---..-35..-7298.
a720: 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-792....query I
a730: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a740: 20 44 49 53 54 49 4e 43 54 20 39 30 20 2b 20 28   DISTINCT 90 + (
a750: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 29   - col1 * col0 )
a760: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
a770: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37 34 0d  b0..----..-1974.
a780: 0a 2d 33 33 30 35 0d 0a 2d 38 30 30 39 0d 0a 0d  .-3305..-8009...
a790: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a7a0: 0d 0a 53 45 4c 45 43 54 20 33 38 20 41 53 20 63  ..SELECT 38 AS c
a7b0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol0 FROM tab1, t
a7c0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
a7d0: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
a7e0: 69 6e 67 20 74 6f 20 61 66 61 64 64 61 64 30 61  ing to afaddad0a
a7f0: 34 65 33 61 31 36 38 33 61 31 63 38 63 62 65 36  4e3a1683a1c8cbe6
a800: 65 62 35 32 32 61 37 0d 0a 0d 0a 71 75 65 72 79  eb522a7....query
a810: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a820: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
a830: 39 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  93 AS col2 FROM 
a840: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a  tab2..----..55..
a850: 36 36 0d 0a 36 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  66..67....onlyif
a860: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
a870: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
a880: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
a890: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
a8a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
a8b0: 65 6c 2d 33 30 33 0d 0a 53 45 4c 45 43 54 20 44  el-303..SELECT D
a8c0: 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 4e 55  ISTINCT CAST( NU
a8d0: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  LL AS SIGNED ) +
a8e0: 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53 20 63   ( - col2 ) AS c
a8f0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
a900: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
a910: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
a920: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
a930: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
a940: 6c 2d 33 30 33 0d 0a 53 45 4c 45 43 54 20 44 49  l-303..SELECT DI
a950: 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 4e 55  STINCT CAST ( NU
a960: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
a970: 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53 20  + ( - col2 ) AS 
a980: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
a990: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
a9a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
a9b0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
a9c0: 20 63 6f 6c 32 20 2b 20 2b 20 74 61 62 32 2e 63   col2 + + tab2.c
a9d0: 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 * col0 FROM 
a9e0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31  tab2..----..1381
a9f0: 0d 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d 0a 71  ..244..4628....q
aa00: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
aa10: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
aa20: 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col2 + + col1 * 
aa30: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
aa40: 2d 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34 34 0d  ----..1381..244.
aa50: 0a 34 36 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .4628....query I
aa60: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
aa70: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b   + col2 * col2 +
aa80: 20 2d 20 63 6f 6c 30 20 2a 20 34 35 20 2a 20 2b   - col0 * 45 * +
aa90: 20 63 6f 6c 31 20 2b 20 34 32 20 41 53 20 63 6f   col1 + 42 AS co
aaa0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
aab0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 35  cor0..----..-255
aac0: 30 39 0d 0a 2d 33 37 35 34 32 0d 0a 2d 35 35 32  09..-37542..-552
aad0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
aae0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
aaf0: 31 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  16 AS col1 FROM 
ab00: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
ab10: 2d 2d 0d 0a 31 36 0d 0a 31 36 0d 0a 31 36 0d 0a  --..16..16..16..
ab20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ab30: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 30 20 2a  t..SELECT - 70 *
ab40: 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 32   col1 + col0 * 2
ab50: 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  3 AS col1 FROM t
ab60: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
ab70: 2d 0d 0a 2d 31 37 35 31 0d 0a 37 37 32 0d 0a 39  -..-1751..772..9
ab80: 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
ab90: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
aba0: 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 31 2e  STINCT + + cor1.
abb0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
abc0: 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
abd0: 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  N tab1 AS cor1..
abe0: 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d  ----..3..64..80.
abf0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
ac00: 72 74 0d 0a 53 45 4c 45 43 54 20 33 39 20 46 52  rt..SELECT 39 FR
ac10: 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
ac20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
ac30: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
ac40: 20 35 65 63 63 34 64 33 64 65 36 38 61 65 38 32   5ecc4d3de68ae82
ac50: 38 61 32 64 35 32 32 64 66 66 38 35 37 31 63 62  8a2d522dff8571cb
ac60: 66 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  f....skipif post
ac70: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
ac80: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
ac90: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
aca0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
acb0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
acc0: 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63  ELECT + col1 + c
acd0: 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
ace0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31  b0..----..110..1
acf0: 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79  32..180....query
ad00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ad10: 43 54 20 2b 20 31 31 20 41 53 20 63 6f 6c 31 20  CT + 11 AS col1 
ad20: 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 2c  FROM tab2, tab1,
ad30: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
ad40: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
ad50: 61 73 68 69 6e 67 20 74 6f 20 36 39 31 31 36 37  ashing to 691167
ad60: 33 37 66 33 66 35 37 65 32 65 33 32 37 33 66 36  37f3f57e2e3273f6
ad70: 64 62 62 30 34 64 30 33 36 63 0d 0a 0d 0a 71 75  dbb04d036c....qu
ad80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ad90: 45 4c 45 43 54 20 41 4c 4c 20 36 34 20 41 53 20  ELECT ALL 64 AS 
ada0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  col2 FROM tab0, 
adb0: 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
adc0: 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
add0: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
ade0: 69 6e 67 20 74 6f 20 63 38 62 31 39 66 34 63 33  ing to c8b19f4c3
adf0: 66 66 33 38 37 30 30 63 64 32 62 62 38 61 30 37  ff38700cd2bb8a07
ae00: 37 62 66 32 39 62 39 0d 0a 0d 0a 71 75 65 72 79  7bf29b9....query
ae10: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ae20: 43 54 20 41 4c 4c 20 2b 20 38 31 20 41 53 20 63  CT ALL + 81 AS c
ae30: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
ae40: 61 62 32 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a  ab2, tab0 cor0..
ae50: 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
ae60: 68 61 73 68 69 6e 67 20 74 6f 20 30 61 38 35 36  hashing to 0a856
ae70: 33 39 65 30 64 64 64 62 66 66 64 61 62 32 63 62  39e0dddbffdab2cb
ae80: 31 36 62 30 32 37 63 62 33 36 30 0d 0a 0d 0a 71  16b027cb360....q
ae90: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
aea0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
aeb0: 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  1 * col0 AS col0
aec0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
aed0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a  r0..----..2064..
aee0: 33 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75  3395..8099....qu
aef0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
af00: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
af10: 20 2d 20 28 20 63 6f 6c 31 20 29 20 2a 20 2b 20   - ( col1 ) * + 
af20: 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
af30: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
af40: 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39  -..2838..7462..9
af50: 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
af60: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
af70: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
af80: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
af90: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
afa0: 2d 33 31 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -317..SELECT col
afb0: 30 20 44 49 56 20 63 6f 6c 30 20 2b 20 2d 20 63  0 DIV col0 + - c
afc0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
afd0: 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 37 37 0d 0a 2d 37  ---..-6..-77..-7
afe0: 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
aff0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
b000: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
b010: 6f 72 74 20 6c 61 62 65 6c 2d 33 31 37 0d 0a 53  ort label-317..S
b020: 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20 63 6f 6c  ELECT col0 / col
b030: 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  0 + - col0 FROM 
b040: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a  tab2..----..-6..
b050: 2d 37 37 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72  -77..-78....quer
b060: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b070: 45 43 54 20 34 31 20 46 52 4f 4d 20 74 61 62 31  ECT 41 FROM tab1
b080: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
b090: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
b0a0: 61 73 68 69 6e 67 20 74 6f 20 35 62 31 38 39 38  ashing to 5b1898
b0b0: 36 62 62 32 39 34 34 31 32 62 33 64 39 66 30 37  6bb294412b3d9f07
b0c0: 62 37 65 36 66 63 38 32 31 65 0d 0a 0d 0a 71 75  b7e6fc821e....qu
b0d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
b0e0: 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 28  ELECT col1 * + (
b0f0: 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 2b   col1 ) * col2 +
b100: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
b110: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
b120: 36 33 32 30 0d 0a 33 36 35 35 38 0d 0a 35 37 35  6320..36558..575
b130: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
b140: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
b150: 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  or0.col1 * + col
b160: 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  0 * cor0.col2 FR
b170: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
b180: 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30 0d 0a 34 32  .----..36480..42
b190: 31 32 0d 0a 39 39 38 34 30 0d 0a 0d 0a 71 75 65  12..99840....que
b1a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b1b0: 4c 45 43 54 20 28 20 2b 20 63 6f 72 30 2e 63 6f  LECT ( + cor0.co
b1c0: 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l1 ) AS col2 FRO
b1d0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
b1e0: 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39  ----..17..31..59
b1f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
b200: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
b210: 32 32 20 2a 20 2d 20 32 37 20 41 53 20 63 6f 6c  22 * - 27 AS col
b220: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
b230: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 39 34 0d 0a  or0..----..594..
b240: 35 39 34 0d 0a 35 39 34 0d 0a 0d 0a 71 75 65 72  594..594....quer
b250: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b260: 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  ECT + col2 + - c
b270: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol2 * + col1 FRO
b280: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
b290: 31 35 32 0d 0a 2d 31 33 35 30 0d 0a 2d 35 31 33  152..-1350..-513
b2a0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
b2b0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
b2c0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
b2d0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
b2e0: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
b2f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b300: 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20 35 36 20  LECT ALL ( - 56 
b310: 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  ) col1 FROM tab0
b320: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
b330: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
b340: 61 73 68 69 6e 67 20 74 6f 20 33 64 33 64 61 62  ashing to 3d3dab
b350: 34 30 30 65 65 66 39 33 63 30 39 38 61 63 62 62  400eef93c098acbb
b360: 62 61 33 66 63 39 62 64 63 36 0d 0a 0d 0a 71 75  ba3fc9bdc6....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 2b 20 28 20 2b 20 34 34 20 29  ELECT + ( + 44 )
b390: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
b3a0: 0d 0a 34 34 0d 0a 34 34 0d 0a 34 34 0d 0a 0d 0a  ..44..44..44....
b3b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b3c0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 35 20 46  .SELECT ALL 85 F
b3d0: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
b3e0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
b3f0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
b400: 6f 20 61 61 66 61 38 65 35 63 66 62 39 65 30 32  o aafa8e5cfb9e02
b410: 63 65 61 38 37 31 37 38 33 33 65 37 35 38 31 66  cea8717833e7581f
b420: 37 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  7b....query I ro
b430: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
b440: 4c 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63  L + + col2 + + c
b450: 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  or0.col0 * col1 
b460: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
b470: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d 0a 33  0..----..2097..3
b480: 33 39 36 0d 0a 38 31 38 31 0d 0a 0d 0a 6f 6e 6c  396..8181....onl
b490: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
b4a0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
b4b0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
b4c0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
b4d0: 72 74 20 6c 61 62 65 6c 2d 33 32 38 0d 0a 53 45  rt label-328..SE
b4e0: 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 44 49  LECT + - col2 DI
b4f0: 56 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  V cor0.col1 AS c
b500: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
b510: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d  r0..----..-2..0.
b520: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
b530: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
b540: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
b550: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 38 0d 0a  sort label-328..
b560: 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
b570: 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  / cor0.col1 AS c
b580: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
b590: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d  r0..----..-2..0.
b5a0: 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
b5b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
b5c0: 4c 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  L - - col2 + + c
b5d0: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol2 * + col2 FRO
b5e0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
b5f0: 2d 0d 0a 32 39 37 30 0d 0a 33 33 30 36 0d 0a 39  -..2970..3306..9
b600: 33 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  312....query I r
b610: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
b620: 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30  ISTINCT - + cor0
b630: 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f  .col0 * col1 FRO
b640: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
b650: 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33  ----..-2064..-33
b660: 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 6f 6e 6c  95..-8099....onl
b670: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
b680: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
b690: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
b6a0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
b6b0: 72 74 20 6c 61 62 65 6c 2d 33 33 31 0d 0a 53 45  rt label-331..SE
b6c0: 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20  LECT - col2 DIV 
b6d0: 2b 20 34 39 20 46 52 4f 4d 20 74 61 62 30 20 41  + 49 FROM tab0 A
b6e0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
b6f0: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
b700: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
b710: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
b720: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
b730: 33 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  31..SELECT - col
b740: 32 20 2f 20 2b 20 34 39 20 46 52 4f 4d 20 74 61  2 / + 49 FROM ta
b750: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
b760: 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  ..-1..0..0....qu
b770: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
b780: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
b790: 20 2b 20 38 39 20 46 52 4f 4d 20 74 61 62 32 20   + 89 FROM tab2 
b7a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
b7b0: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
b7c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
b7d0: 20 2d 20 63 6f 6c 30 20 2a 20 31 32 20 2b 20 63   - col0 * 12 + c
b7e0: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
b7f0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
b800: 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 39 31 30 0d 0a  ---..-57..-910..
b810: 2d 39 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -910....query I 
b820: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b830: 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
b840: 2d 20 35 38 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 58 AS col2 FRO
b850: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
b860: 2d 2d 2d 2d 0d 0a 2d 34 30 36 0d 0a 2d 34 35 32  ----..-406..-452
b870: 34 0d 0a 2d 34 35 38 32 0d 0a 0d 0a 71 75 65 72  4..-4582....quer
b880: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b890: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
b8a0: 20 63 6f 6c 32 20 2b 20 2d 20 36 32 20 46 52 4f   col2 + - 62 FRO
b8b0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
b8c0: 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 36 31 0d 0a  ----..-29..-61..
b8d0: 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
b8e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
b8f0: 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 2d  - ( + col0 ) * -
b900: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 41   col0 + - col2 A
b910: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
b920: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d   cor0..----..22.
b930: 0a 36 30 35 38 0d 0a 36 32 30 33 0d 0a 0d 0a 71  .6058..6203....q
b940: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
b950: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20  SELECT - col1 + 
b960: 38 35 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  85 * + col0 * - 
b970: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
b980: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
b990: 31 39 36 0d 0a 2d 35 31 37 31 39 39 0d 0a 2d 35  196..-517199..-5
b9a0: 33 30 35 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  30502....query I
b9b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b9c0: 20 41 4c 4c 20 2b 20 37 34 20 41 53 20 63 6f 6c   ALL + 74 AS col
b9d0: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
b9e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 0d 0a 37  or0..----..74..7
b9f0: 34 0d 0a 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49  4..74....query I
ba00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ba10: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b   DISTINCT col0 +
ba20: 20 33 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53   33 FROM tab1 AS
ba30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33   cor0..----..113
ba40: 0d 0a 33 36 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79  ..36..97....only
ba50: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
ba60: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
ba70: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
ba80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ba90: 74 20 6c 61 62 65 6c 2d 33 34 30 0d 0a 53 45 4c  t label-340..SEL
baa0: 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 63  ECT - - col1 * c
bab0: 6f 6c 31 20 44 49 56 20 2d 20 63 6f 72 30 2e 63  ol1 DIV - cor0.c
bac0: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
bad0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
bae0: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 32  ---..-1..-1..-12
baf0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
bb00: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
bb10: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
bb20: 72 74 20 6c 61 62 65 6c 2d 33 34 30 0d 0a 53 45  rt label-340..SE
bb30: 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20  LECT - - col1 * 
bb40: 63 6f 6c 31 20 2f 20 2d 20 63 6f 72 30 2e 63 6f  col1 / - cor0.co
bb50: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
bb60: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
bb70: 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 32 0d  --..-1..-1..-12.
bb80: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
bb90: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
bba0: 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 35  ol2 + col2 * - 5
bbb0: 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  7 FROM tab2 AS c
bbc0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 38  or0..----..-1508
bbd0: 0d 0a 2d 31 35 36 36 0d 0a 2d 32 32 30 34 0d 0a  ..-1566..-2204..
bbe0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
bbf0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
bc00: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
bc10: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
bc20: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34  rowsort label-34
bc30: 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  2..SELECT - - co
bc40: 6c 31 20 44 49 56 20 2d 20 31 37 20 46 52 4f 4d  l1 DIV - 17 FROM
bc50: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
bc60: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 33 0d  ---..-1..-1..-3.
bc70: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
bc80: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
bc90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
bca0: 74 20 6c 61 62 65 6c 2d 33 34 32 0d 0a 53 45 4c  t label-342..SEL
bcb0: 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2f 20 2d  ECT - - col1 / -
bcc0: 20 31 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53   17 FROM tab2 AS
bcd0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
bce0: 0a 2d 31 0d 0a 2d 33 0d 0a 0d 0a 71 75 65 72 79  .-1..-3....query
bcf0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
bd00: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
bd10: 6c 32 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32  l2 + ( cor0.col2
bd20: 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46   ) * cor0.col2 F
bd30: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
bd40: 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 32 0d 0a 37 30  ..----..1482..70
bd50: 32 0d 0a 37 35 36 0d 0a 0d 0a 71 75 65 72 79 20  2..756....query 
bd60: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
bd70: 54 20 2d 20 63 6f 6c 30 20 2a 20 37 34 20 2b 20  T - col0 * 74 + 
bd80: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
bd90: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
bda0: 2d 2d 2d 2d 0d 0a 2d 32 31 39 0d 0a 2d 34 36 37  ----..-219..-467
bdb0: 32 0d 0a 2d 35 38 34 30 0d 0a 0d 0a 71 75 65 72  2..-5840....quer
bdc0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
bdd0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72  ECT DISTINCT cor
bde0: 30 2e 63 6f 6c 32 20 2a 20 38 36 20 46 52 4f 4d  0.col2 * 86 FROM
bdf0: 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
be00: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 36 34 34 0d  or0..----..4644.
be10: 0a 34 39 30 32 0d 0a 38 32 35 36 0d 0a 0d 0a 71  .4902..8256....q
be20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
be30: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
be40: 2d 20 37 38 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 78 AS col0 FRO
be50: 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61  M tab1, tab0, ta
be60: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
be70: 0d 0a 2d 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-78....onlyif 
be80: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
be90: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
bea0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
beb0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
bec0: 61 62 65 6c 2d 33 34 37 0d 0a 53 45 4c 45 43 54  abel-347..SELECT
bed0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
bee0: 20 34 38 20 44 49 56 20 63 6f 6c 31 20 41 53 20   48 DIV col1 AS 
bef0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
bf00: 2d 2d 2d 2d 0d 0a 31 33 0d 0a 31 37 0d 0a 34 36  ----..13..17..46
bf10: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
bf20: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
bf30: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
bf40: 72 74 20 6c 61 62 65 6c 2d 33 34 37 0d 0a 53 45  rt label-347..SE
bf50: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
bf60: 6c 30 20 2a 20 34 38 20 2f 20 63 6f 6c 31 20 41  l0 * 48 / col1 A
bf70: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
bf80: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 31 37 0d 0a  ..----..13..17..
bf90: 34 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  46....skipif pos
bfa0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
bfb0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
bfc0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
bfd0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
bfe0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
bff0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 32 20  SELECT ALL + 92 
c000: 2b 20 35 38 20 63 6f 6c 31 20 46 52 4f 4d 20 74  + 58 col1 FROM t
c010: 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
c020: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
c030: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 62 65  s hashing to 3be
c040: 31 31 36 33 34 34 33 62 61 64 31 61 35 36 38 35  1163443bad1a5685
c050: 62 34 64 37 64 32 30 37 62 31 64 36 31 0d 0a 0d  b4d7d207b1d61...
c060: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c070: 0d 0a 53 45 4c 45 43 54 20 2b 20 34 37 20 46 52  ..SELECT + 47 FR
c080: 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
c090: 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
c0a0: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
c0b0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
c0c0: 33 66 39 39 31 36 33 32 65 39 63 37 63 35 31 34  3f991632e9c7c514
c0d0: 32 65 31 64 38 30 38 35 37 63 64 31 30 61 32 64  2e1d80857cd10a2d
c0e0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
c0f0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
c100: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
c110: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
c120: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
c130: 33 35 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  350..SELECT - co
c140: 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20  l1 + + col2 DIV 
c150: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
c160: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c170: 2d 31 32 0d 0a 2d 32 35 0d 0a 2d 39 0d 0a 0d 0a  -12..-25..-9....
c180: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
c190: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
c1a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
c1b0: 61 62 65 6c 2d 33 35 30 0d 0a 53 45 4c 45 43 54  abel-350..SELECT
c1c0: 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   - col1 + + col2
c1d0: 20 2f 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   / + col2 FROM t
c1e0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
c1f0: 2d 0d 0a 2d 31 32 0d 0a 2d 32 35 0d 0a 2d 39 0d  -..-12..-25..-9.
c200: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
c210: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
c220: 32 20 2b 20 37 36 20 2a 20 63 6f 6c 32 20 46 52  2 + 76 * col2 FR
c230: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
c240: 0a 2d 2d 2d 2d 0d 0a 32 30 30 32 0d 0a 32 30 37  .----..2002..207
c250: 39 0d 0a 32 39 32 36 0d 0a 0d 0a 71 75 65 72 79  9..2926....query
c260: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c270: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 34 32  CT + col2 * + 42
c280: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
c290: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
c2a0: 0d 0a 31 33 38 36 0d 0a 33 34 34 34 0d 0a 34 32  ..1386..3444..42
c2b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c2c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
c2d0: 2b 20 38 37 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 87 AS col2 FRO
c2e0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 37  M tab1..----..87
c2f0: 0d 0a 38 37 0d 0a 38 37 0d 0a 0d 0a 71 75 65 72  ..87..87....quer
c300: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c310: 45 43 54 20 41 4c 4c 20 2d 20 28 20 2b 20 63 6f  ECT ALL - ( + co
c320: 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  l1 ) FROM tab0..
c330: 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a  ----..-86..-91..
c340: 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -97....query I r
c350: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
c360: 20 32 36 20 2d 20 2b 20 33 32 20 2a 20 63 6f 6c   26 - + 32 * col
c370: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
c380: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
c390: 2d 32 35 30 0d 0a 2d 32 35 32 32 0d 0a 2d 32 35  -250..-2522..-25
c3a0: 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  54....query I ro
c3b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
c3c0: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 63 6f  - cor0.col0 - co
c3d0: 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
c3e0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
c3f0: 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a 0d 0a  .-24..19..62....
c400: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c410: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63  .SELECT col2 * c
c420: 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 + + cor0.col
c430: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
c440: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
c450: 2d 0d 0a 31 32 36 31 0d 0a 31 34 33 30 0d 0a 35  -..1261..1430..5
c460: 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
c470: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
c480: 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c  ( col0 ) * + col
c490: 31 20 2b 20 63 6f 6c 31 20 2a 20 34 35 20 2a 20  1 + col1 * 45 * 
c4a0: 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
c4b0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
c4c0: 2d 2d 2d 2d 0d 0a 32 37 37 32 37 0d 0a 33 37 34  ----..27727..374
c4d0: 34 38 0d 0a 36 34 34 32 38 0d 0a 0d 0a 6f 6e 6c  48..64428....onl
c4e0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
c4f0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
c500: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
c510: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
c520: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
c530: 6c 61 62 65 6c 2d 33 35 39 0d 0a 53 45 4c 45 43  label-359..SELEC
c540: 54 20 41 4c 4c 20 43 41 53 54 28 20 39 33 20 41  T ALL CAST( 93 A
c550: 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63  S SIGNED ) + - c
c560: 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  or0.col1 * - col
c570: 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0 col1 FROM tab1
c580: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c590: 31 31 33 33 0d 0a 31 37 31 0d 0a 37 33 33 0d 0a  1133..171..733..
c5a0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
c5b0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
c5c0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
c5d0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
c5e0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
c5f0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
c600: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
c610: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
c620: 33 35 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  359..SELECT ALL 
c630: 43 41 53 54 20 28 20 39 33 20 41 53 20 49 4e 54  CAST ( 93 AS INT
c640: 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 72 30 2e  EGER ) + - cor0.
c650: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 63 6f  col1 * - col0 co
c660: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
c670: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 33  cor0..----..1133
c680: 0d 0a 31 37 31 0d 0a 37 33 33 0d 0a 0d 0a 71 75  ..171..733....qu
c690: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c6a0: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a  ELECT ALL col1 *
c6b0: 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29   + ( cor0.col1 )
c6c0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
c6d0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
c6e0: 0d 0a 32 38 39 0d 0a 33 34 38 31 0d 0a 39 36 31  ..289..3481..961
c6f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c700: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
c710: 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 28 20  l2 * col1 + - ( 
c720: 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  + col1 ) FROM ta
c730: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
c740: 0d 0a 31 32 33 35 0d 0a 31 33 37 38 0d 0a 35 36  ..1235..1378..56
c750: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
c760: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 37 20  sort..SELECT 67 
c770: 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  + - col0 AS col2
c780: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
c790: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a 33  r0..----..-13..3
c7a0: 0d 0a 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..64....onlyif m
c7b0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
c7c0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
c7d0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
c7e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
c7f0: 62 65 6c 2d 33 36 33 0d 0a 53 45 4c 45 43 54 20  bel-363..SELECT 
c800: 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  - col0 + - col0 
c810: 44 49 56 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20  DIV - col2 col0 
c820: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
c830: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 38  0..----..-24..-8
c840: 38 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  8..0....skipif p
c850: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
c860: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
c870: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
c880: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
c890: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
c8a0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
c8b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
c8c0: 6c 61 62 65 6c 2d 33 36 33 0d 0a 53 45 4c 45 43  label-363..SELEC
c8d0: 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  T - col0 + - col
c8e0: 30 20 2f 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20  0 / - col2 col0 
c8f0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
c900: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 38  0..----..-24..-8
c910: 38 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8..0....query I 
c920: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c930: 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72  + - col0 + - cor
c940: 30 2e 63 6f 6c 30 20 2a 20 33 38 20 41 53 20 63  0.col0 * 38 AS c
c950: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
c960: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37   cor0..----..-27
c970: 33 0d 0a 2d 33 30 34 32 0d 0a 2d 33 30 38 31 0d  3..-3042..-3081.
c980: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
c990: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
c9a0: 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 41 53  + - tab2.col1 AS
c9b0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
c9c0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
c9d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c9e0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
c9f0: 43 54 20 2d 20 31 38 20 2a 20 63 6f 6c 30 20 41  CT - 18 * col0 A
ca00: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
ca10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ca20: 2d 31 31 35 32 0d 0a 2d 31 34 34 30 0d 0a 2d 35  -1152..-1440..-5
ca30: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
ca40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
ca50: 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 41   - col0 - col1 A
ca60: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
ca70: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ca80: 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d 39 36 0d 0a  -137..-38..-96..
ca90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
caa0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
cab0: 32 32 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63  22 + - col0 AS c
cac0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
cad0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
cae0: 0d 0a 2d 32 0d 0a 2d 36 37 0d 0a 0d 0a 71 75 65  ..-2..-67....que
caf0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
cb00: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
cb10: 2a 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20  * - col1 - col1 
cb20: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
cb30: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34 0d 0a 2d  0..----..-194..-
cb40: 32 39 32 34 0d 0a 2d 37 35 35 33 0d 0a 0d 0a 71  2924..-7553....q
cb50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
cb60: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
cb70: 2d 20 2d 20 28 20 63 6f 6c 30 20 29 20 41 53 20  - - ( col0 ) AS 
cb80: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
cb90: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33  or0..----..24..3
cba0: 35 0d 0a 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  5..89....onlyif 
cbb0: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
cbc0: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
cbd0: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
cbe0: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
cbf0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
cc00: 6c 2d 33 37 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-371..SELECT DI
cc10: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2d 20  STINCT - col0 - 
cc20: 2d 20 63 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e  - col0 * CAST( N
cc30: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
cc40: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
cc50: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
cc60: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
cc70: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
cc80: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
cc90: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
cca0: 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
ccb0: 43 54 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 63 6f  CT - col0 - - co
ccc0: 6c 30 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c  l0 * CAST ( NULL
ccd0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
cce0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
ccf0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
cd00: 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
cd10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
cd20: 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  LL - col2 * - co
cd30: 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 28 20 36 33  r0.col1 * - ( 63
cd40: 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72   ) FROM tab2 cor
cd50: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 36 39 38 0d  0..----..-40698.
cd60: 0a 2d 35 32 37 33 31 0d 0a 2d 39 36 36 34 32 0d  .-52731..-96642.
cd70: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
cd80: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 37 20  rt..SELECT - 47 
cd90: 2a 20 63 6f 6c 30 20 2b 20 28 20 34 39 20 29 20  * col0 + ( 49 ) 
cda0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
cdb0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 37 39 0d 0a  0..----..-1079..
cdc0: 2d 31 35 39 36 0d 0a 2d 34 31 33 34 0d 0a 0d 0a  -1596..-4134....
cdd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
cde0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
cdf0: 63 6f 6c 32 20 29 20 2d 20 2b 20 63 6f 72 30 2e  col2 ) - + cor0.
ce00: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
ce10: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
ce20: 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
ce30: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ce40: 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 39 34 20 41   ALL col0 + 94 A
ce50: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
ce60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ce70: 31 31 38 0d 0a 31 32 39 0d 0a 31 38 33 0d 0a 0d  118..129..183...
ce80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ce90: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
cea0: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  * - cor0.col2 + 
ceb0: 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col1 * - cor0.co
cec0: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
ced0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
cee0: 2d 2d 0d 0a 2d 37 30 0d 0a 31 33 32 36 0d 0a 32  --..-70..1326..2
cef0: 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  08....query I ro
cf00: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
cf10: 63 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 30 20  col2 + ( - col0 
cf20: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
cf30: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
cf40: 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d 0a 32 30 0d  -..-41..-52..20.
cf50: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
cf60: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
cf70: 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  NCT + col1 * col
cf80: 30 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  0 * col2 + + col
cf90: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
cfa0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 39 30  or0..----..36490
cfb0: 0d 0a 34 32 33 38 0d 0a 39 39 38 35 33 0d 0a 0d  ..4238..99853...
cfc0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
cfd0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
cfe0: 38 33 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  83 FROM tab0 AS 
cff0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 0d  cor0..----..107.
d000: 0a 31 31 38 0d 0a 31 37 32 0d 0a 0d 0a 71 75 65  .118..172....que
d010: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d020: 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20  LECT + - col1 + 
d030: 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53  + col2 * col2 AS
d040: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
d050: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
d060: 34 32 37 0d 0a 36 31 37 0d 0a 36 39 38 0d 0a 0d  427..617..698...
d070: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d080: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
d090: 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  T cor0.col2 + + 
d0a0: 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  col2 + cor0.col2
d0b0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
d0c0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
d0d0: 0d 0a 32 34 36 0d 0a 33 0d 0a 39 39 0d 0a 0d 0a  ..246..3..99....
d0e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d0f0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
d100: 20 2a 20 63 6f 6c 32 20 2d 20 2b 20 35 39 20 41   * col2 - + 59 A
d110: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
d120: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d130: 31 31 38 39 0d 0a 31 33 34 35 0d 0a 35 31 31 0d  1189..1345..511.
d140: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
d150: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
d160: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
d170: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
d180: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..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 74 61 62 32 2e 63 6f 6c 32 20 63 6f  ECT tab2.col2 co
d1b0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
d1c0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
d1d0: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
d1e0: 6e 67 20 74 6f 20 35 39 31 31 62 61 63 35 31 34  ng to 5911bac514
d1f0: 34 31 66 34 66 66 36 34 30 62 32 61 32 62 37 32  41f4ff640b2a2b72
d200: 31 65 61 38 65 33 0d 0a 0d 0a 71 75 65 72 79 20  1ea8e3....query 
d210: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d220: 54 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b 20  T tab2.col2 * + 
d230: 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  col1 + col1 * co
d240: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
d250: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 32  tab2..----..1292
d260: 0d 0a 31 36 37 34 0d 0a 33 30 36 38 0d 0a 0d 0a  ..1674..3068....
d270: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
d280: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
d290: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
d2a0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
d2b0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 35 0d  wsort label-385.
d2c0: 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 32 36  .SELECT - ( - 26
d2d0: 20 29 20 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20   ) + col0 DIV + 
d2e0: 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49  CAST( col0 AS SI
d2f0: 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
d300: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d   cor0..----..27.
d310: 0a 32 37 0d 0a 32 37 0d 0a 0d 0a 73 6b 69 70 69  .27..27....skipi
d320: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
d330: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
d340: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d350: 33 38 35 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  385..SELECT - ( 
d360: 2d 20 32 36 20 29 20 2b 20 63 6f 6c 30 20 2f 20  - 26 ) + col0 / 
d370: 2b 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53  + CAST ( col0 AS
d380: 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
d390: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
d3a0: 0a 32 37 0d 0a 32 37 0d 0a 32 37 0d 0a 0d 0a 71  .27..27..27....q
d3b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d3c0: 53 45 4c 45 43 54 20 28 20 2d 20 28 20 63 6f 6c  SELECT ( - ( col
d3d0: 30 20 29 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2a  0 ) ) * - col2 *
d3e0: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a   col0 + - col0 *
d3f0: 20 35 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   59 AS col1 FROM
d400: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
d410: 2d 2d 2d 0d 0a 2d 38 34 30 0d 0a 31 37 35 39 32  ---..-840..17592
d420: 0d 0a 36 34 34 32 37 31 0d 0a 0d 0a 71 75 65 72  ..644271....quer
d430: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
d440: 45 43 54 20 41 4c 4c 20 2b 20 2d 20 34 39 20 2a  ECT ALL + - 49 *
d450: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
d460: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
d470: 31 31 37 36 0d 0a 2d 31 37 31 35 0d 0a 2d 34 33  1176..-1715..-43
d480: 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
d490: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 31  wsort..SELECT 21
d4a0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
d4b0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
d4c0: 0d 0a 32 31 0d 0a 32 31 0d 0a 32 31 0d 0a 0d 0a  ..21..21..21....
d4d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d4e0: 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 28 20  .SELECT + ( + ( 
d4f0: 2b 20 63 6f 6c 32 20 29 20 29 20 2b 20 2d 20 35  + col2 ) ) + - 5
d500: 33 20 2a 20 31 34 20 46 52 4f 4d 20 74 61 62 32  3 * 14 FROM tab2
d510: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d520: 2d 37 30 34 0d 0a 2d 37 31 35 0d 0a 2d 37 31 36  -704..-715..-716
d530: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d540: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
d550: 49 4e 43 54 20 2b 20 28 20 36 39 20 29 20 2a 20  INCT + ( 69 ) * 
d560: 2d 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d  - tab0.col1 FROM
d570: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 39   tab0..----..-59
d580: 33 34 0d 0a 2d 36 32 37 39 0d 0a 2d 36 36 39 33  34..-6279..-6693
d590: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d5a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
d5b0: 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l1 * - col2 * co
d5c0: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
d5d0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39  tab2..----..-109
d5e0: 38 32 0d 0a 2d 32 35 39 34 37 0d 0a 2d 39 30 35  82..-25947..-905
d5f0: 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  06....query I ro
d600: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
d610: 4c 20 2d 20 32 35 20 2b 20 63 6f 72 30 2e 63 6f  L - 25 + cor0.co
d620: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
d630: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
d640: 2d 2d 0d 0a 2d 31 38 0d 0a 35 33 0d 0a 35 34 0d  --..-18..53..54.
d650: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
d660: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
d670: 2a 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63  * tab0.col1 AS c
d680: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
d690: 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32 38 31 0d  ---..7396..8281.
d6a0: 0a 39 34 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .9409....onlyif 
d6b0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
d6c0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
d6d0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..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 39 34 0d 0a 53 45 4c 45 43 54  abel-394..SELECT
d700: 20 2b 20 28 20 2d 20 28 20 63 6f 6c 30 20 29 20   + ( - ( col0 ) 
d710: 29 20 2a 20 63 6f 6c 31 20 44 49 56 20 2b 20 63  ) * col1 DIV + c
d720: 6f 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f  ol0 - + col1 FRO
d730: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
d740: 31 38 0d 0a 2d 33 34 0d 0a 2d 36 32 0d 0a 0d 0a  18..-34..-62....
d750: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
d760: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
d770: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
d780: 61 62 65 6c 2d 33 39 34 0d 0a 53 45 4c 45 43 54  abel-394..SELECT
d790: 20 2b 20 28 20 2d 20 28 20 63 6f 6c 30 20 29 20   + ( - ( col0 ) 
d7a0: 29 20 2a 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c  ) * col1 / + col
d7b0: 30 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  0 - + col1 FROM 
d7c0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38  tab2..----..-118
d7d0: 0d 0a 2d 33 34 0d 0a 2d 36 32 0d 0a 0d 0a 6f 6e  ..-34..-62....on
d7e0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
d7f0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
d800: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
d810: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
d820: 6f 72 74 20 6c 61 62 65 6c 2d 33 39 35 0d 0a 53  ort label-395..S
d830: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 44  ELECT ALL col0 D
d840: 49 56 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 63 6f  IV - col1 - - co
d850: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
d860: 2d 2d 0d 0a 32 35 0d 0a 32 37 0d 0a 33 34 0d 0a  --..25..27..34..
d870: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
d880: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
d890: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d8a0: 20 6c 61 62 65 6c 2d 33 39 35 0d 0a 53 45 4c 45   label-395..SELE
d8b0: 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2f 20 2d 20  CT ALL col0 / - 
d8c0: 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 46 52  col1 - - col2 FR
d8d0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab2..----..2
d8e0: 35 0d 0a 32 37 0d 0a 33 34 0d 0a 0d 0a 71 75 65  5..27..34....que
d8f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d900: 4c 45 43 54 20 2b 20 33 20 2a 20 2b 20 63 6f 6c  LECT + 3 * + col
d910: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
d920: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
d930: 33 30 0d 0a 33 39 0d 0a 37 38 0d 0a 0d 0a 71 75  30..39..78....qu
d940: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d950: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
d960: 20 63 6f 6c 32 20 2d 20 2b 20 35 31 20 46 52 4f   col2 - + 51 FRO
d970: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
d980: 30 35 0d 0a 2d 31 30 38 0d 0a 2d 31 34 37 0d 0a  05..-108..-147..
d990: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d9a0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
d9b0: 43 54 20 74 61 62 30 2e 63 6f 6c 30 20 2d 20 37  CT tab0.col0 - 7
d9c0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
d9d0: 0d 0a 31 37 0d 0a 32 38 0d 0a 38 32 0d 0a 0d 0a  ..17..28..82....
d9e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d9f0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
da00: 20 2b 20 37 37 20 2b 20 2d 20 63 6f 72 30 2e 63   + 77 + - cor0.c
da10: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
da20: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
da30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a  or0..----..-14..
da40: 2d 32 30 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79  -20..-9....query
da50: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
da60: 43 54 20 63 6f 72 31 2e 63 6f 6c 32 20 46 52 4f  CT cor1.col2 FRO
da70: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43  M tab1 AS cor0 C
da80: 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20  ROSS JOIN tab0, 
da90: 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
daa0: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
dab0: 73 68 69 6e 67 20 74 6f 20 37 37 38 36 37 31 38  shing to 7786718
dac0: 62 64 38 30 34 32 30 32 32 35 33 37 33 37 38 64  bd8042022537378d
dad0: 34 30 65 63 38 37 34 37 35 0d 0a 0d 0a 71 75 65  40ec87475....que
dae0: 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 20  ry IIIIIIIIIIII 
daf0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
db00: 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  ALL * FROM tab0 
db10: 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
db20: 49 4e 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  IN tab0, tab0 AS
db30: 20 63 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63   cor1, tab1 AS c
db40: 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76  or2..----..972 v
db50: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
db60: 20 38 38 32 31 33 61 30 64 65 34 63 30 61 34 34   88213a0de4c0a44
db70: 61 61 65 66 65 38 62 62 66 66 62 63 61 66 34 34  aaefe8bbffbcaf44
db80: 61 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  a....query IIIII
db90: 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
dba0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
dbb0: 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  NCT * FROM tab0 
dbc0: 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
dbd0: 49 4e 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f  IN tab0, tab1 co
dbe0: 72 31 2c 20 74 61 62 32 2c 20 74 61 62 32 20 41  r1, tab2, tab2 A
dbf0: 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36  S cor2..----..36
dc00: 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  45 values hashin
dc10: 67 20 74 6f 20 62 36 32 63 31 65 62 63 36 38 31  g to b62c1ebc681
dc20: 61 63 61 37 32 64 31 33 66 65 61 64 62 38 38 38  aca72d13feadb888
dc30: 62 33 62 65 37 0d 0a 0d 0a 71 75 65 72 79 20 49  b3be7....query I
dc40: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
dc50: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
dc60: 20 2b 20 39 34 20 2b 20 2b 20 63 6f 6c 32 20 41   + 94 + + col2 A
dc70: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
dc80: 0d 0a 2d 2d 2d 2d 0d 0a 36 38 35 0d 0a 37 33 35  ..----..685..735
dc90: 38 0d 0a 37 34 36 34 0d 0a 0d 0a 71 75 65 72 79  8..7464....query
dca0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
dcb0: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
dcc0: 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 46  .col2 + - col2 F
dcd0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
dce0: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
dcf0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
dd00: 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  LECT + + col1 * 
dd10: 63 6f 6c 32 20 2b 20 32 32 20 41 53 20 63 6f 6c  col2 + 22 AS col
dd20: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
dd30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 30 0d  or0..----..1270.
dd40: 0a 31 34 32 36 0d 0a 35 39 32 0d 0a 0d 0a 71 75  .1426..592....qu
dd50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
dd60: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
dd70: 6f 6c 30 20 2a 20 33 37 20 2b 20 2b 20 63 6f 6c  ol0 * 37 + + col
dd80: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
dd90: 2d 0d 0a 31 33 39 32 0d 0a 33 33 38 34 0d 0a 39  -..1392..3384..9
dda0: 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
ddb0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
ddc0: 63 6f 6c 30 20 2b 20 39 34 20 41 53 20 63 6f 6c  col0 + 94 AS col
ddd0: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
dde0: 2d 0d 0a 35 0d 0a 35 39 0d 0a 37 30 0d 0a 0d 0a  -..5..59..70....
ddf0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
de00: 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 30 2e 63  .SELECT - tab0.c
de10: 6f 6c 30 20 2a 20 2b 20 39 33 20 41 53 20 63 6f  ol0 * + 93 AS co
de20: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
de30: 2d 2d 0d 0a 2d 32 32 33 32 0d 0a 2d 33 32 35 35  --..-2232..-3255
de40: 0d 0a 2d 38 32 37 37 0d 0a 0d 0a 71 75 65 72 79  ..-8277....query
de50: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
de60: 43 54 20 28 20 37 35 20 29 20 46 52 4f 4d 20 74  CT ( 75 ) FROM t
de70: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 35 0d 0a 37  ab0..----..75..7
de80: 35 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  5..75....query I
de90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
dea0: 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 34 30   DISTINCT - + 40
deb0: 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   + col0 * - col0
dec0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
ded0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
dee0: 0d 0a 2d 36 31 32 34 0d 0a 2d 36 32 38 31 0d 0a  ..-6124..-6281..
def0: 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -89....query I r
df00: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
df10: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 35   - cor0.col0 * 5
df20: 35 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  5 + - col2 AS co
df30: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
df40: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 39  cor0..----..-219
df50: 0d 0a 2d 33 35 37 37 0d 0a 2d 34 34 39 36 0d 0a  ..-3577..-4496..
df60: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
df70: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
df80: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
df90: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
dfa0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
dfb0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
dfc0: 43 54 20 36 37 20 2b 20 39 33 20 63 6f 6c 30 20  CT 67 + 93 col0 
dfd0: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
dfe0: 2d 2d 2d 2d 0d 0a 31 36 30 0d 0a 31 36 30 0d 0a  ----..160..160..
dff0: 31 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  160....query I r
e000: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
e010: 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 41   col0 + + col1 A
e020: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
e030: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
e040: 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d 0a 0d 0a  -19..-62..24....
e050: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e060: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
e070: 20 2d 20 2b 20 35 20 2b 20 2d 20 36 35 20 41 53   - + 5 + - 65 AS
e080: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
e090: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
e0a0: 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
e0b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
e0c0: 4c 20 2b 20 2d 20 28 20 2b 20 34 20 29 20 2a 20  L + - ( + 4 ) * 
e0d0: 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
e0e0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
e0f0: 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 32 32 38  ..----..216..228
e100: 0d 0a 33 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..384....query I
e110: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
e120: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
e130: 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f   col2 + col0 FRO
e140: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
e150: 2d 2d 2d 2d 0d 0a 31 35 32 33 0d 0a 37 33 36 0d  ----..1523..736.
e160: 0a 37 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .754....query I 
e170: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e180: 63 6f 6c 31 20 2a 20 36 35 20 2b 20 2b 20 63 6f  col1 * 65 + + co
e190: 6c 32 20 2a 20 28 20 39 35 20 29 20 41 53 20 63  l2 * ( 95 ) AS c
e1a0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
e1b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 36   cor0..----..606
e1c0: 35 0d 0a 36 38 32 30 0d 0a 39 39 36 35 0d 0a 0d  5..6820..9965...
e1d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e1e0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
e1f0: 54 20 63 6f 6c 32 20 2a 20 2d 20 37 20 46 52 4f  T col2 * - 7 FRO
e200: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
e210: 2d 0d 0a 2d 31 38 32 0d 0a 2d 31 38 39 0d 0a 2d  -..-182..-189..-
e220: 32 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  266....query I r
e230: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
e240: 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2d   col2 * col0 + -
e250: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
e260: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
e270: 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 32 30 30 32  .----..162..2002
e280: 0d 0a 32 39 36 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..2964....skipif
e290: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
e2a0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
e2b0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
e2c0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
e2d0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
e2e0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
e2f0: 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 63   ( cor0.col0 ) c
e300: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
e310: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor0..----..-3.
e320: 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65  .-64..-80....que
e330: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
e340: 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  LECT - col2 + co
e350: 6c 32 20 2a 20 2b 20 28 20 36 37 20 2a 20 2d 20  l2 * + ( 67 * - 
e360: 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46  col0 ) AS col2 F
e370: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
e380: 2d 31 32 36 39 30 0d 0a 2d 31 33 35 39 30 32 0d  -12690..-135902.
e390: 0a 2d 32 30 31 31 37 32 0d 0a 0d 0a 71 75 65 72  .-201172....quer
e3a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e3b0: 45 43 54 20 28 20 2d 20 74 61 62 32 2e 63 6f 6c  ECT ( - tab2.col
e3c0: 30 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  0 ) + cor0.col0 
e3d0: 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
e3e0: 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f  cor0, tab1 AS co
e3f0: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
e400: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64  ues hashing to d
e410: 34 30 65 37 36 61 64 33 65 63 62 61 31 63 64 63  40e76ad3ecba1cdc
e420: 35 31 33 66 37 34 31 34 32 35 66 65 30 38 61 0d  513f741425fe08a.
e430: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e440: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31  rt..SELECT ALL 1
e450: 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  8 AS col1 FROM t
e460: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
e470: 2d 0d 0a 31 38 0d 0a 31 38 0d 0a 31 38 0d 0a 0d  -..18..18..18...
e480: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e490: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
e4a0: 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20   col0 * col1 AS 
e4b0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
e4c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
e4d0: 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39  064..-3395..-809
e4e0: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
e4f0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
e500: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
e510: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
e520: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
e530: 2d 34 32 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -425..SELECT ALL
e540: 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f   - col1 DIV - co
e550: 6c 31 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20  l1 + + ( - col0 
e560: 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  ) * col0 AS col1
e570: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
e580: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 35 0d  r0..----..-4095.
e590: 0a 2d 36 33 39 39 0d 0a 2d 38 0d 0a 0d 0a 73 6b  .-6399..-8....sk
e5a0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
e5b0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
e5c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
e5d0: 65 6c 2d 34 32 35 0d 0a 53 45 4c 45 43 54 20 41  el-425..SELECT A
e5e0: 4c 4c 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63 6f  LL - col1 / - co
e5f0: 6c 31 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20  l1 + + ( - col0 
e600: 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  ) * col0 AS col1
e610: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
e620: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 35 0d  r0..----..-4095.
e630: 0a 2d 36 33 39 39 0d 0a 2d 38 0d 0a 0d 0a 6f 6e  .-6399..-8....on
e640: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
e650: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
e660: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
e670: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
e680: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e690: 20 6c 61 62 65 6c 2d 34 32 36 0d 0a 53 45 4c 45   label-426..SELE
e6a0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
e6b0: 6c 32 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20  l2 * CAST( NULL 
e6c0: 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f  AS SIGNED ) + co
e6d0: 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 28 20  l1 - - col2 * ( 
e6e0: 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46  col0 ) AS col0 F
e6f0: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
e700: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
e710: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
e720: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
e730: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
e740: 6c 2d 34 32 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-426..SELECT DI
e750: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20  STINCT + col2 * 
e760: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
e770: 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 31 20  NTEGER ) + col1 
e780: 2d 20 2d 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c  - - col2 * ( col
e790: 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
e7a0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
e7b0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
e7c0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
e7d0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
e7e0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
e7f0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
e800: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
e810: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
e820: 4e 43 54 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 31  NCT + col1 - - 1
e830: 37 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  7 col1 FROM tab2
e840: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
e850: 33 34 0d 0a 34 38 0d 0a 37 36 0d 0a 0d 0a 71 75  34..48..76....qu
e860: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
e870: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63  ELECT - col1 + c
e880: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
e890: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
e8a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
e8b0: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
e8c0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
e8d0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
e8e0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
e8f0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
e900: 2d 34 32 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -429..SELECT - c
e910: 6f 6c 31 20 44 49 56 20 2d 20 43 41 53 54 28 20  ol1 DIV - CAST( 
e920: 2d 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  - col2 AS SIGNED
e930: 20 29 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   ) - + col1 FROM
e940: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
e950: 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d  ---..-10..-13..-
e960: 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  26....skipif mys
e970: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
e980: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
e990: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 32 39 0d 0a  sort label-429..
e9a0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20  SELECT - col1 / 
e9b0: 2d 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20  - CAST ( - col2 
e9c0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 2b  AS INTEGER ) - +
e9d0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
e9e0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
e9f0: 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a  10..-13..-26....
ea00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ea10: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
ea20: 6c 31 20 2b 20 2b 20 39 32 20 2a 20 63 6f 6c 31  l1 + + 92 * col1
ea30: 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   * cor0.col2 AS 
ea40: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
ea50: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
ea60: 34 38 32 39 0d 0a 31 32 39 31 39 34 0d 0a 35 32  4829..129194..52
ea70: 34 35 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  450....onlyif my
ea80: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
ea90: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
eaa0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
eab0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
eac0: 65 6c 2d 34 33 31 0d 0a 53 45 4c 45 43 54 20 41  el-431..SELECT A
ead0: 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  LL + col2 + - co
eae0: 6c 30 20 44 49 56 20 63 6f 6c 30 20 2b 20 63 6f  l0 DIV col0 + co
eaf0: 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  l2 * col2 * - co
eb00: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
eb10: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
eb20: 2d 33 35 39 30 35 0d 0a 2d 35 35 31 32 38 37 0d  -35905..-551287.
eb30: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
eb40: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
eb50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
eb60: 74 20 6c 61 62 65 6c 2d 34 33 31 0d 0a 53 45 4c  t label-431..SEL
eb70: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b  ECT ALL + col2 +
eb80: 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2b   - col0 / col0 +
eb90: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 2d   col2 * col2 * -
eba0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
ebb0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
ebc0: 31 0d 0a 2d 33 35 39 30 35 0d 0a 2d 35 35 31 32  1..-35905..-5512
ebd0: 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  87....query I ro
ebe0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
ebf0: 6c 30 20 2d 20 28 20 63 6f 6c 32 20 29 20 41 53  l0 - ( col2 ) AS
ec00: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
ec10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
ec20: 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 71 75 65 72  9..34..7....quer
ec30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ec40: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a  ECT ALL + col0 *
ec50: 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20   col1 + col1 AS 
ec60: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
ec70: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
ec80: 34 0d 0a 31 30 35 33 0d 0a 36 35 30 0d 0a 0d 0a  4..1053..650....
ec90: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
eca0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
ecb0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
ecc0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
ecd0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
ece0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ecf0: 20 44 49 53 54 49 4e 43 54 20 38 34 20 63 6f 6c   DISTINCT 84 col
ed00: 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
ed10: 2d 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -..84....query I
ed20: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ed30: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
ed40: 20 2a 20 2b 20 34 32 20 2b 20 2d 20 63 6f 6c 30   * + 42 + - col0
ed50: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
ed60: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
ed70: 0d 0a 31 34 33 35 0d 0a 33 36 34 39 0d 0a 39 38  ..1435..3649..98
ed80: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
ed90: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
eda0: 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2d 20 2b  TINCT - col1 - +
edb0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
edc0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
edd0: 31 30 39 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a 0d  109..-67..-80...
ede0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
edf0: 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
ee00: 32 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  2 - col1 AS col2
ee10: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
ee20: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d 31 37  .----..-119..-17
ee30: 33 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20  3..-98....query 
ee40: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
ee50: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
ee60: 6f 6c 31 20 2a 20 28 20 28 20 63 6f 72 30 2e 63  ol1 * ( ( cor0.c
ee70: 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 32 20 29  ol2 ) * + col2 )
ee80: 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31   + col0 * + col1
ee90: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
eea0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
eeb0: 0d 0a 2d 31 31 38 37 36 38 0d 0a 2d 33 31 38 35  ..-118768..-3185
eec0: 30 0d 0a 2d 37 35 37 33 38 0d 0a 0d 0a 71 75 65  0..-75738....que
eed0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
eee0: 4c 45 43 54 20 41 4c 4c 20 33 30 20 2d 20 63 6f  LECT ALL 30 - co
eef0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
ef00: 2d 2d 0d 0a 2d 32 34 0d 0a 2d 32 37 0d 0a 2d 36  --..-24..-27..-6
ef10: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
ef20: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
ef30: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
ef40: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
ef50: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
ef60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ef70: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
ef80: 6f 6c 32 20 2a 20 2d 20 28 20 31 31 20 2a 20 2d  ol2 * - ( 11 * -
ef90: 20 63 6f 6c 30 20 29 20 63 6f 6c 31 20 46 52 4f   col0 ) col1 FRO
efa0: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
efb0: 2d 0d 0a 32 30 37 39 0d 0a 32 32 33 30 38 0d 0a  -..2079..22308..
efc0: 33 33 30 32 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  33022....onlyif 
efd0: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
efe0: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
eff0: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
f000: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
f010: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
f020: 6c 2d 34 34 31 0d 0a 53 45 4c 45 43 54 20 2d 20  l-441..SELECT - 
f030: 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 4e 55 4c  col1 * CAST( NUL
f040: 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 41  L AS DECIMAL ) A
f050: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
f060: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
f070: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
f080: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
f090: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
f0a0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
f0b0: 72 74 20 6c 61 62 65 6c 2d 34 34 31 0d 0a 53 45  rt label-441..SE
f0c0: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 43 41  LECT - col1 * CA
f0d0: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
f0e0: 4c 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  L ) AS col0 FROM
f0f0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
f100: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
f110: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
f120: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f130: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
f140: 20 2a 20 2d 20 37 31 20 2b 20 28 20 2d 20 63 6f   * - 71 + ( - co
f150: 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l2 ) AS col0 FRO
f160: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
f170: 2d 2d 2d 2d 0d 0a 2d 36 31 33 39 0d 0a 2d 36 35  ----..-6139..-65
f180: 34 33 0d 0a 2d 36 38 38 38 0d 0a 0d 0a 71 75 65  43..-6888....que
f190: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f1a0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
f1b0: 74 61 62 30 2e 63 6f 6c 31 20 2a 20 38 30 20 41  tab0.col1 * 80 A
f1c0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
f1d0: 0d 0a 2d 2d 2d 2d 0d 0a 36 38 38 30 0d 0a 37 32  ..----..6880..72
f1e0: 38 30 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72  80..7760....quer
f1f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f200: 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  ECT col1 * col0 
f210: 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  * - col0 AS col2
f220: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
f230: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32  r0..----..-11882
f240: 35 0d 0a 2d 34 39 35 33 36 0d 0a 2d 37 32 30 38  5..-49536..-7208
f250: 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  11....query I ro
f260: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
f270: 2b 20 63 6f 6c 31 20 2b 20 37 30 20 2a 20 63 6f  + col1 + 70 * co
f280: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
f290: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
f2a0: 2d 2d 0d 0a 35 32 31 0d 0a 35 35 31 39 0d 0a 35  --..521..5519..5
f2b0: 35 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  547....query I r
f2c0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
f2d0: 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63   + col0 + cor0.c
f2e0: 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol1 * col2 FROM 
f2f0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
f300: 2d 2d 0d 0a 31 33 32 38 0d 0a 31 34 30 37 0d 0a  --..1328..1407..
f310: 36 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  634....query I r
f320: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
f330: 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2b 20 63 6f   col2 * + ( + co
f340: 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63  l1 ) FROM tab0 c
f350: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d  or0..----..2838.
f360: 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65  .7462..97....que
f370: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f380: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
f390: 74 61 62 32 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f  tab2.col1 + - co
f3a0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
f3b0: 2d 2d 0d 0a 2d 35 35 0d 0a 2d 35 38 0d 0a 2d 38  --..-55..-58..-8
f3c0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
f3d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
f3e0: 54 49 4e 43 54 20 2b 20 63 6f 72 31 2e 63 6f 6c  TINCT + cor1.col
f3f0: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
f400: 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
f410: 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
f420: 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39  .----..86..91..9
f430: 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
f440: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
f450: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
f460: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
f470: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
f480: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f490: 45 4c 45 43 54 20 2b 20 28 20 2d 20 28 20 63 6f  ELECT + ( - ( co
f4a0: 6c 32 20 29 20 29 20 2b 20 2b 20 28 20 63 6f 6c  l2 ) ) + + ( col
f4b0: 32 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  2 ) col1 FROM ta
f4c0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
f4d0: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c  ..0..0..0....onl
f4e0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
f4f0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
f500: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
f510: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
f520: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
f530: 6c 61 62 65 6c 2d 34 35 31 0d 0a 53 45 4c 45 43  label-451..SELEC
f540: 54 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20  T CAST( col0 AS 
f550: 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 72 30 2e  SIGNED ) * cor0.
f560: 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 46 52  col2 + - col2 FR
f570: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
f580: 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 32 30 30 32  .----..162..2002
f590: 0d 0a 32 39 36 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..2964....skipif
f5a0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
f5b0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
f5c0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
f5d0: 35 31 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20  51..SELECT CAST 
f5e0: 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  ( col0 AS INTEGE
f5f0: 52 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  R ) * cor0.col2 
f600: 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + - col2 FROM ta
f610: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
f620: 0d 0a 31 36 32 0d 0a 32 30 30 32 0d 0a 32 39 36  ..162..2002..296
f630: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
f640: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
f650: 20 63 6f 6c 30 20 2b 20 2d 20 35 33 20 2a 20 2b   col0 + - 53 * +
f660: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
f670: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
f680: 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 38 32 30  --..-1248..-1820
f690: 0d 0a 2d 34 36 32 38 0d 0a 0d 0a 71 75 65 72 79  ..-4628....query
f6a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
f6b0: 43 54 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f  CT ALL + tab1.co
f6c0: 6c 31 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 31  l1 + + tab1.col1
f6d0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
f6e0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32 36  b1..----..20..26
f6f0: 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..52....query I 
f700: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f710: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
f720: 2a 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 46  * + ( - col0 ) F
f730: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
f740: 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39 32  -35..-7298..-792
f750: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f760: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
f770: 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  INCT + - cor0.co
f780: 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
f790: 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
f7a0: 2c 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  , tab2..----..-5
f7b0: 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 6f  4..-57..-96....o
f7c0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
f7d0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
f7e0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
f7f0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
f800: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35 36 0d 0a  sort label-456..
f810: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
f820: 31 20 2b 20 63 6f 6c 30 20 44 49 56 20 74 61 62  1 + col0 DIV tab
f830: 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  0.col0 AS col0 F
f840: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
f850: 38 37 0d 0a 39 32 0d 0a 39 38 0d 0a 0d 0a 73 6b  87..92..98....sk
f860: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
f870: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
f880: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
f890: 65 6c 2d 34 35 36 0d 0a 53 45 4c 45 43 54 20 41  el-456..SELECT A
f8a0: 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  LL + col1 + col0
f8b0: 20 2f 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20   / tab0.col0 AS 
f8c0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
f8d0: 2d 2d 2d 2d 0d 0a 38 37 0d 0a 39 32 0d 0a 39 38  ----..87..92..98
f8e0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
f8f0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
f900: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
f910: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
f920: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
f930: 34 35 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  457..SELECT ALL 
f940: 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2d 20 31 39  tab0.col2 + - 19
f950: 20 44 49 56 20 2d 20 32 34 20 41 53 20 63 6f 6c   DIV - 24 AS col
f960: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
f970: 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a  -..1..33..82....
f980: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
f990: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
f9a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
f9b0: 61 62 65 6c 2d 34 35 37 0d 0a 53 45 4c 45 43 54  abel-457..SELECT
f9c0: 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 32 20 2b   ALL tab0.col2 +
f9d0: 20 2d 20 31 39 20 2f 20 2d 20 32 34 20 41 53 20   - 19 / - 24 AS 
f9e0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
f9f0: 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d  ----..1..33..82.
fa00: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
fa10: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
fa20: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
fa30: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
fa40: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
fa50: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35 38 0d  wsort label-458.
fa60: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b  .SELECT col2 * +
fa70: 20 43 41 53 54 28 20 63 6f 6c 31 20 2a 20 63 6f   CAST( col1 * co
fa80: 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  l1 AS SIGNED ) A
fa90: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
faa0: 0d 0a 2d 2d 2d 2d 0d 0a 32 34 34 30 36 38 0d 0a  ..----..244068..
fab0: 36 37 39 30 34 32 0d 0a 39 34 30 39 0d 0a 0d 0a  679042..9409....
fac0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
fad0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
fae0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
faf0: 61 62 65 6c 2d 34 35 38 0d 0a 53 45 4c 45 43 54  abel-458..SELECT
fb00: 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 20 28   col2 * + CAST (
fb10: 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20   col1 * col1 AS 
fb20: 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
fb30: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
fb40: 2d 0d 0a 32 34 34 30 36 38 0d 0a 36 37 39 30 34  -..244068..67904
fb50: 32 0d 0a 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79  2..9409....query
fb60: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
fb70: 43 54 20 2b 20 36 34 20 2a 20 2b 20 63 6f 6c 32  CT + 64 * + col2
fb80: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
fb90: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 31 32 0d 0a  r0..----..2112..
fba0: 35 32 34 38 0d 0a 36 34 0d 0a 0d 0a 6f 6e 6c 79  5248..64....only
fbb0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
fbc0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
fbd0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
fbe0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fbf0: 74 20 6c 61 62 65 6c 2d 34 36 30 0d 0a 53 45 4c  t label-460..SEL
fc00: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49  ECT cor0.col2 DI
fc10: 56 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  V col2 + - col0 
fc20: 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
fc30: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
fc40: 0d 0a 2d 31 36 31 0d 0a 2d 33 36 34 37 0d 0a 2d  ..-161..-3647..-
fc50: 37 36 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7679....skipif m
fc60: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
fc70: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
fc80: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 30  owsort label-460
fc90: 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
fca0: 6c 32 20 2f 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  l2 / col2 + - co
fcb0: 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l0 * + col2 FROM
fcc0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
fcd0: 2d 2d 2d 0d 0a 2d 31 36 31 0d 0a 2d 33 36 34 37  ---..-161..-3647
fce0: 0d 0a 2d 37 36 37 39 0d 0a 0d 0a 71 75 65 72 79  ..-7679....query
fcf0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
fd00: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
fd10: 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l2 + + cor0.col0
fd20: 20 2a 20 32 30 20 46 52 4f 4d 20 74 61 62 31 20   * 20 FROM tab1 
fd30: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
fd40: 32 32 33 0d 0a 31 35 30 34 0d 0a 36 0d 0a 0d 0a  223..1504..6....
fd50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
fd60: 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d  .SELECT col1 + -
fd70: 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   cor0.col2 * + c
fd80: 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
fd90: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
fda0: 0d 0a 2d 32 37 35 32 0d 0a 2d 37 33 37 31 0d 0a  ..-2752..-7371..
fdb0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
fdc0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
fdd0: 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41   - col0 + col1 A
fde0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
fdf0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39   cor0..----..-19
fe00: 0d 0a 2d 36 32 0d 0a 32 34 0d 0a 0d 0a 6f 6e 6c  ..-62..24....onl
fe10: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
fe20: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
fe30: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
fe40: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
fe50: 72 74 20 6c 61 62 65 6c 2d 34 36 34 0d 0a 53 45  rt label-464..SE
fe60: 4c 45 43 54 20 2b 20 28 20 2d 20 63 6f 6c 32 20  LECT + ( - col2 
fe70: 29 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 32 20  ) DIV cor0.col2 
fe80: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
fe90: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
fea0: 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73  .-1..-1..-1....s
feb0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
fec0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
fed0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
fee0: 62 65 6c 2d 34 36 34 0d 0a 53 45 4c 45 43 54 20  bel-464..SELECT 
fef0: 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2f 20 63  + ( - col2 ) / c
ff00: 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  or0.col2 AS col1
ff10: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
ff20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
ff30: 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-1....query I 
ff40: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ff50: 41 4c 4c 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 31  ALL + + ( - col1
ff60: 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
ff70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d  cor0..----..-86.
ff80: 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65  .-91..-97....que
ff90: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
ffa0: 4c 45 43 54 20 2b 20 2d 20 37 20 2b 20 2d 20 63  LECT + - 7 + - c
ffb0: 6f 6c 32 20 2a 20 2b 20 34 31 20 46 52 4f 4d 20  ol2 * + 41 FROM 
ffc0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
ffd0: 2d 2d 0d 0a 2d 31 33 36 30 0d 0a 2d 33 33 36 39  --..-1360..-3369
ffe0: 0d 0a 2d 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-48....query I
fff0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10000 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2b 20 74 61   col0 + + ( + ta
10010 62 31 2e 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31  b1.col0 + - tab1
10020 2e 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 32  .col2 ) * - col2
10030 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
10040 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 34 37  ab1..----..-2547
10050 32 0d 0a 31 32 32 39 36 30 0d 0a 38 32 36 35 0d  2..122960..8265.
10060 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
10070 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
10080 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
10090 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
100a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
100b0 36 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  68..SELECT ALL -
100c0 20 31 36 20 44 49 56 20 2b 20 38 34 20 46 52 4f   16 DIV + 84 FRO
100d0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab1..----..0.
100e0 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
100f0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
10100 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
10110 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36  rowsort label-46
10120 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  8..SELECT ALL - 
10130 31 36 20 2f 20 2b 20 38 34 20 46 52 4f 4d 20 74  16 / + 84 FROM t
10140 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab1..----..0..0.
10150 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
10160 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
10170 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
10180 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
10190 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
101a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
101b0 36 39 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28  69..SELECT CAST(
101c0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
101d0 29 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20  ) + - tab2.col2 
101e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
101f0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
10200 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
10210 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
10220 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
10230 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
10240 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
10250 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
10260 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
10270 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10280 74 20 6c 61 62 65 6c 2d 34 36 39 0d 0a 53 45 4c  t label-469..SEL
10290 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  ECT CAST ( NULL 
102a0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d  AS INTEGER ) + -
102b0 20 74 61 62 32 2e 63 6f 6c 32 20 63 6f 6c 31 20   tab2.col2 col1 
102c0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
102d0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
102e0 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  L....onlyif mysq
102f0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
10300 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
10310 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
10320 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
10330 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37  rowsort label-47
10340 30 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 30  0..SELECT ( col0
10350 20 29 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2d 20   ) * - col1 * - 
10360 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
10370 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 46 52  GNED ) + col0 FR
10380 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
10390 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
103a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
103b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
103c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
103d0 74 20 6c 61 62 65 6c 2d 34 37 30 0d 0a 53 45 4c  t label-470..SEL
103e0 45 43 54 20 28 20 63 6f 6c 30 20 29 20 2a 20 2d  ECT ( col0 ) * -
103f0 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20 28   col1 * - CAST (
10400 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
10410 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   ) + col0 FROM t
10420 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
10430 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f  .NULL..NULL....o
10440 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
10450 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
10460 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
10470 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
10480 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10490 74 20 6c 61 62 65 6c 2d 34 37 31 0d 0a 53 45 4c  t label-471..SEL
104a0 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20 4e 55  ECT ALL CAST( NU
104b0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  LL AS SIGNED ) *
104c0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
104d0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab2..----..N
104e0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
104f0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
10500 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
10510 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10520 74 20 6c 61 62 65 6c 2d 34 37 31 0d 0a 53 45 4c  t label-471..SEL
10530 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 4e  ECT ALL CAST ( N
10540 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
10550 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   * col0 AS col1 
10560 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
10570 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
10580 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  L....onlyif mysq
10590 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
105a0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
105b0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
105c0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
105d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37  rowsort label-47
105e0 32 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20  2..SELECT CAST( 
105f0 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 33 34 20  ( col0 ) * + 34 
10600 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  + col1 AS SIGNED
10610 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
10620 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d  tab1..----..128.
10630 0a 32 31 38 36 0d 0a 32 37 33 33 0d 0a 0d 0a 73  .2186..2733....s
10640 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
10650 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
10660 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10670 62 65 6c 2d 34 37 32 0d 0a 53 45 4c 45 43 54 20  bel-472..SELECT 
10680 43 41 53 54 20 28 20 28 20 63 6f 6c 30 20 29 20  CAST ( ( col0 ) 
10690 2a 20 2b 20 33 34 20 2b 20 63 6f 6c 31 20 41 53  * + 34 + col1 AS
106a0 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
106b0 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
106c0 2d 2d 0d 0a 31 32 38 0d 0a 32 31 38 36 0d 0a 32  --..128..2186..2
106d0 37 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  733....query I r
106e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
106f0 4c 4c 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 32  LL col0 + - tab2
10700 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 31  .col0 + col0 * 1
10710 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  7 AS col1 FROM t
10720 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a  ab2..----..119..
10730 31 33 32 36 0d 0a 31 33 34 33 0d 0a 0d 0a 71 75  1326..1343....qu
10740 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10750 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
10760 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f   + tab1.col2 FRO
10770 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
10780 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d 0a 71  8..114..192....q
10790 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
107a0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20  SELECT - col1 + 
107b0 63 6f 6c 31 20 2a 20 2d 20 39 30 20 46 52 4f 4d  col1 * - 90 FROM
107c0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
107d0 2d 2d 2d 0d 0a 2d 31 35 34 37 0d 0a 2d 32 38 32  ---..-1547..-282
107e0 31 0d 0a 2d 35 33 36 39 0d 0a 0d 0a 71 75 65 72  1..-5369....quer
107f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10800 45 43 54 20 41 4c 4c 20 2d 20 39 31 20 2b 20 63  ECT ALL - 91 + c
10810 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30  or0.col2 AS col0
10820 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
10830 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 38 0d 0a 2d  r0..----..-58..-
10840 39 0d 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72 79 20  9..-90....query 
10850 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10860 54 20 44 49 53 54 49 4e 43 54 20 2d 20 33 31 20  T DISTINCT - 31 
10870 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
10880 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 0d 0a 0d 0a  0..----..-31....
10890 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
108a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 37 20 2a  .SELECT ALL 37 *
108b0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
108c0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
108d0 2d 0d 0a 32 35 39 0d 0a 32 38 38 36 0d 0a 32 39  -..259..2886..29
108e0 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  23....query I ro
108f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
10900 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  L - cor0.col0 + 
10910 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
10920 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
10930 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 31  ..----..-110..-1
10940 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 71 75 65 72  32..-180....quer
10950 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10960 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b  ECT - + col2 + +
10970 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63   col2 * + cor0.c
10980 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
10990 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
109a0 2d 2d 2d 0d 0a 31 34 30 36 0d 0a 36 35 30 0d 0a  ---..1406..650..
109b0 37 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  702....query I r
109c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
109d0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63   col2 + + cor0.c
109e0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
109f0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
10a00 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35  ---..121..176..5
10a10 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
10a20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35  sort..SELECT - 5
10a30 37 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  7 + - col0 * - c
10a40 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 * col1 FROM 
10a50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
10a60 2d 2d 0d 0a 31 37 37 34 34 37 0d 0a 33 32 39 32  --..177447..3292
10a70 35 38 0d 0a 37 33 36 39 35 32 0d 0a 0d 0a 71 75  58..736952....qu
10a80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10a90 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20  ELECT cor0.col1 
10aa0 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 2b  + ( + col0 ) * +
10ab0 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f   col1 * col1 FRO
10ac0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
10ad0 2d 2d 2d 2d 0d 0a 31 37 37 35 39 30 0d 0a 33 32  ----..177590..32
10ae0 39 34 31 32 0d 0a 37 33 37 31 30 30 0d 0a 0d 0a  9412..737100....
10af0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10b00 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 36 20  .SELECT ALL + 6 
10b10 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
10b20 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
10b30 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
10b40 68 61 73 68 69 6e 67 20 74 6f 20 35 64 31 63 62  hashing to 5d1cb
10b50 39 30 65 64 35 38 66 61 37 35 37 33 38 39 35 64  90ed58fa7573895d
10b60 32 66 39 35 62 32 31 31 38 32 31 0d 0a 0d 0a 71  2f95b211821....q
10b70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10b80 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 35 35 20  SELECT ALL - 55 
10b90 2a 20 2b 20 38 34 20 2d 20 63 6f 6c 31 20 41 53  * + 84 - col1 AS
10ba0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
10bb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
10bc0 34 37 30 36 0d 0a 2d 34 37 31 31 0d 0a 2d 34 37  4706..-4711..-47
10bd0 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  17....query I ro
10be0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
10bf0 4c 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20 2d  L ( - col2 ) + -
10c00 20 63 6f 6c 31 20 2a 20 28 20 2d 20 28 20 63 6f   col1 * ( - ( co
10c10 6c 30 20 29 20 29 20 2b 20 63 6f 6c 30 20 46 52  l0 ) ) + col0 FR
10c20 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
10c30 2d 2d 0d 0a 31 30 32 34 0d 0a 32 37 0d 0a 36 34  --..1024..27..64
10c40 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
10c50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
10c60 54 49 4e 43 54 20 2d 20 38 32 20 46 52 4f 4d 20  TINCT - 82 FROM 
10c70 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
10c80 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  r0, tab2 AS cor1
10c90 2c 20 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a  , tab2 AS cor2..
10ca0 2d 2d 2d 2d 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65  ----..-82....que
10cb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10cc0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
10cd0 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col2 * - cor0.co
10ce0 6c 30 20 2d 20 2d 20 28 20 2d 20 63 6f 6c 32 20  l0 - - ( - col2 
10cf0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
10d00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 36 0d  or0..----..-216.
10d10 0a 2d 33 37 30 35 0d 0a 2d 37 37 37 36 0d 0a 0d  .-3705..-7776...
10d20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10d30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
10d40 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 * col2 FROM ta
10d50 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor0..----..2
10d60 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d  916..3249..9216.
10d70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10d80 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39 38 20  rt..SELECT - 98 
10d90 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  + - col0 AS col0
10da0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
10db0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 0d 0a  r0..----..-105..
10dc0 2d 31 37 36 0d 0a 2d 31 37 37 0d 0a 0d 0a 73 6b  -176..-177....sk
10dd0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
10de0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
10df0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
10e00 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
10e10 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
10e20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
10e30 49 53 54 49 4e 43 54 20 2d 20 32 35 20 2b 20 63  ISTINCT - 25 + c
10e40 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
10e50 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
10e60 0d 0a 2d 32 32 0d 0a 33 39 0d 0a 35 35 0d 0a 0d  ..-22..39..55...
10e70 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
10e80 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
10e90 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
10ea0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
10eb0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
10ec0 6f 72 74 20 6c 61 62 65 6c 2d 34 39 32 0d 0a 53  ort label-492..S
10ed0 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55  ELECT + CAST( NU
10ee0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  LL AS SIGNED ) *
10ef0 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41   - col1 * col1 A
10f00 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
10f10 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
10f20 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
10f30 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
10f40 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
10f50 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10f60 2d 34 39 32 0d 0a 53 45 4c 45 43 54 20 2b 20 43  -492..SELECT + C
10f70 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
10f80 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 31  TEGER ) * - col1
10f90 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   * col1 AS col2 
10fa0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
10fb0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
10fc0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
10fd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31  sort..SELECT + 1
10fe0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
10ff0 2d 0d 0a 31 30 0d 0a 31 30 0d 0a 31 30 0d 0a 0d  -..10..10..10...
11000 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
11010 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
11020 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
11030 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
11040 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 34  owsort label-494
11050 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
11060 54 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c  T col1 DIV - col
11070 31 20 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  1 - + col0 FROM 
11080 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
11090 2d 2d 0d 0a 2d 32 35 0d 0a 2d 33 36 0d 0a 2d 39  --..-25..-36..-9
110a0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
110b0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
110c0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
110d0 6f 72 74 20 6c 61 62 65 6c 2d 34 39 34 0d 0a 53  ort label-494..S
110e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
110f0 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31 20 2d 20 2b  ol1 / - col1 - +
11100 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
11110 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
11120 32 35 0d 0a 2d 33 36 0d 0a 2d 39 30 0d 0a 0d 0a  25..-36..-90....
11130 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11140 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
11150 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l2 + col2 AS col
11160 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
11170 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31 31 34  ..----..108..114
11180 0d 0a 31 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..192....onlyif 
11190 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
111a0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
111b0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
111c0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
111d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
111e0 6c 2d 34 39 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-496..SELECT DI
111f0 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20  STINCT col1 + - 
11200 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28 20 4e  col0 * + CAST( N
11210 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
11220 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
11230 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
11240 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
11250 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
11260 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
11270 6c 61 62 65 6c 2d 34 39 36 0d 0a 53 45 4c 45 43  label-496..SELEC
11280 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
11290 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53  + - col0 * + CAS
112a0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
112b0 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20  GER ) FROM tab1 
112c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
112d0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
112e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
112f0 20 35 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c   51 * col1 + col
11300 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
11310 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
11320 2d 0d 0a 2d 31 35 35 30 0d 0a 2d 32 39 35 30 0d  -..-1550..-2950.
11330 0a 2d 38 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-850....query I
11340 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11350 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30   + + col0 + cor0
11360 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20  .col2 FROM tab1 
11370 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
11380 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71  21..176..57....q
11390 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
113a0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28  SELECT ALL + - (
113b0 20 2b 20 63 6f 6c 32 20 29 20 2a 20 2b 20 39 20   + col2 ) * + 9 
113c0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
113d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
113e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 35 0d 0a 2d 32  ..----..-175..-2
113f0 31 32 0d 0a 2d 33 32 35 0d 0a 0d 0a 71 75 65 72  12..-325....quer
11400 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11410 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
11420 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 31 20 2a   col1 - - col1 *
11430 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41   col1 * - col0 A
11440 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
11450 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11460 2d 31 37 37 34 31 38 0d 0a 2d 33 32 39 32 31 38  -177418..-329218
11470 0d 0a 2d 37 33 36 39 31 38 0d 0a 0d 0a 73 6b 69  ..-736918....ski
11480 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
11490 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
114a0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
114b0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
114c0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
114d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
114e0 4c 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  L + col0 + col1 
114f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
11500 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39  ----..137..38..9
11510 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
11520 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
11530 20 63 6f 6c 30 20 2b 20 2b 20 33 36 20 46 52 4f   col0 + + 36 FRO
11540 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
11550 30 0d 0a 31 31 36 0d 0a 33 39 0d 0a 0d 0a 71 75  0..116..39....qu
11560 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11570 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 36 37  ELECT ALL + + 67
11580 20 2a 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20   * tab1.col0 AS 
11590 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
115a0 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
115b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r0..----..27 val
115c0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39  ues hashing to 9
115d0 34 64 65 62 36 35 35 63 62 64 33 33 35 63 32 62  4deb655cbd335c2b
115e0 37 32 61 63 65 33 33 30 33 62 30 66 37 30 62 0d  72ace3303b0f70b.
115f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11600 72 74 0d 0a 53 45 4c 45 43 54 20 38 36 20 46 52  rt..SELECT 86 FR
11610 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 38  OM tab2..----..8
11620 36 0d 0a 38 36 0d 0a 38 36 0d 0a 0d 0a 71 75 65  6..86..86....que
11630 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11640 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2d 20  LECT + col0 - - 
11650 37 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  70 AS col2 FROM 
11660 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
11670 2d 2d 0d 0a 31 34 38 0d 0a 31 34 39 0d 0a 37 37  --..148..149..77
11680 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
11690 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
116a0 6c 30 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l0 + col1 + + co
116b0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
116c0 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d  0..----..86..91.
116d0 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .97....onlyif my
116e0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
116f0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
11700 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
11710 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
11720 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
11730 35 30 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  507..SELECT + - 
11740 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54 28 20 2d  col2 + + CAST( -
11750 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20   col2 AS SIGNED 
11760 29 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  ) * col2 AS col2
11770 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
11780 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 37 30 0d  r0..----..-2970.
11790 0a 2d 33 33 30 36 0d 0a 2d 39 33 31 32 0d 0a 0d  .-3306..-9312...
117a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
117b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
117c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
117d0 6c 61 62 65 6c 2d 35 30 37 0d 0a 53 45 4c 45 43  label-507..SELEC
117e0 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 43  T + - col2 + + C
117f0 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 41 53 20  AST ( - col2 AS 
11800 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 32  INTEGER ) * col2
11810 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
11820 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
11830 0d 0a 2d 32 39 37 30 0d 0a 2d 33 33 30 36 0d 0a  ..-2970..-3306..
11840 2d 39 33 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -9312....query I
11850 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11860 20 63 6f 6c 32 20 2a 20 28 20 28 20 63 6f 72 30   col2 * ( ( cor0
11870 2e 63 6f 6c 31 20 29 20 29 20 2b 20 63 6f 6c 30  .col1 ) ) + col0
11880 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11890 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
118a0 36 31 32 0d 0a 37 32 35 0d 0a 38 34 34 0d 0a 0d  612..725..844...
118b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
118c0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20  ..SELECT col0 - 
118d0 28 20 28 20 63 6f 6c 31 20 29 20 29 20 46 52 4f  ( ( col1 ) ) FRO
118e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
118f0 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36  ----..-24..19..6
11900 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
11910 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
11920 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63  ol0 * col1 * + c
11930 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  or0.col0 + col2 
11940 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
11950 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
11960 0a 31 31 38 38 32 36 0d 0a 34 39 35 36 39 0d 0a  .118826..49569..
11970 37 32 30 38 39 33 0d 0a 0d 0a 71 75 65 72 79 20  720893....query 
11980 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11990 54 20 63 6f 6c 32 20 2a 20 36 33 20 2d 20 63 6f  T col2 * 63 - co
119a0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
119b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
119c0 2d 2d 0d 0a 2d 33 34 0d 0a 31 39 39 33 0d 0a 35  --..-34..1993..5
119d0 30 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  075....query I r
119e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
119f0 49 53 54 49 4e 43 54 20 2d 20 74 61 62 31 2e 63  ISTINCT - tab1.c
11a00 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
11a10 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30   tab1, tab2 cor0
11a20 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d  ..----..-3..-64.
11a30 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-80....query I 
11a40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11a50 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ALL + col1 * - c
11a60 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 * col0 FROM 
11a70 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35  tab1..----..-135
11a80 32 30 0d 0a 2d 32 30 32 38 0d 0a 2d 36 34 30 30  20..-2028..-6400
11a90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
11aa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
11ab0 6c 30 20 2a 20 28 20 2b 20 37 37 20 29 20 2d 20  l0 * ( + 77 ) - 
11ac0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
11ad0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
11ae0 37 30 0d 0a 2d 36 30 36 35 0d 0a 2d 36 31 30 30  70..-6065..-6100
11af0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
11b00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
11b10 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  col0 + col2 * co
11b20 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
11b30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 31 34  cor0..----..2814
11b40 0d 0a 36 32 0d 0a 37 33 37 33 0d 0a 0d 0a 6f 6e  ..62..7373....on
11b50 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
11b60 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
11b70 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
11b80 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
11b90 6f 72 74 20 6c 61 62 65 6c 2d 35 31 36 0d 0a 53  ort label-516..S
11ba0 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 44 49 56  ELECT - col0 DIV
11bb0 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20   col0 col0 FROM 
11bc0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  tab0..----..-1..
11bd0 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66  -1..-1....skipif
11be0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
11bf0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
11c00 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
11c10 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
11c20 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
11c30 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
11c40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11c50 74 20 6c 61 62 65 6c 2d 35 31 36 0d 0a 53 45 4c  t label-516..SEL
11c60 45 43 54 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c  ECT - col0 / col
11c70 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0 col0 FROM tab0
11c80 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a  ..----..-1..-1..
11c90 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -1....query I ro
11ca0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
11cb0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2d 20  STINCT + col2 - 
11cc0 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col1 * + col0 FR
11cd0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
11ce0 32 34 0d 0a 2d 35 38 33 0d 0a 2d 39 34 34 0d 0a  24..-583..-944..
11cf0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
11d00 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
11d10 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
11d20 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
11d30 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31  rowsort label-51
11d40 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  8..SELECT DISTIN
11d50 43 54 20 2b 20 63 6f 6c 30 20 2a 20 35 32 20 2d  CT + col0 * 52 -
11d60 20 2d 20 28 20 63 6f 6c 30 20 29 20 44 49 56 20   - ( col0 ) DIV 
11d70 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
11d80 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 38 32 30  ----..1248..1820
11d90 0d 0a 34 36 32 38 0d 0a 0d 0a 73 6b 69 70 69 66  ..4628....skipif
11da0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
11db0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
11dc0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
11dd0 31 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  18..SELECT DISTI
11de0 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 35 32 20  NCT + col0 * 52 
11df0 2d 20 2d 20 28 20 63 6f 6c 30 20 29 20 2f 20 63  - - ( col0 ) / c
11e00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
11e10 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 38 32 30 0d  ---..1248..1820.
11e20 0a 34 36 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .4628....query I
11e30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11e40 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 31 39 20 46   ALL col1 * 19 F
11e50 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
11e60 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 34 0d 0a 31 37  ..----..1634..17
11e70 32 39 0d 0a 31 38 34 33 0d 0a 0d 0a 6f 6e 6c 79  29..1843....only
11e80 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
11e90 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
11ea0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
11eb0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
11ec0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
11ed0 61 62 65 6c 2d 35 32 30 0d 0a 53 45 4c 45 43 54  abel-520..SELECT
11ee0 20 2d 20 43 41 53 54 28 20 2d 20 63 6f 72 30 2e   - CAST( - cor0.
11ef0 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29  col1 AS SIGNED )
11f00 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46   * + col1 col0 F
11f10 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
11f20 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d 0a 33 34 38  ..----..289..348
11f30 31 0d 0a 39 36 31 0d 0a 0d 0a 73 6b 69 70 69 66  1..961....skipif
11f40 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
11f50 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
11f60 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
11f70 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
11f80 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
11f90 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
11fa0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11fb0 74 20 6c 61 62 65 6c 2d 35 32 30 0d 0a 53 45 4c  t label-520..SEL
11fc0 45 43 54 20 2d 20 43 41 53 54 20 28 20 2d 20 63  ECT - CAST ( - c
11fd0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 49 4e 54 45  or0.col1 AS INTE
11fe0 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c 31 20 63  GER ) * + col1 c
11ff0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
12000 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39   cor0..----..289
12010 0d 0a 33 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a 73  ..3481..961....s
12020 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
12030 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
12040 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
12050 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
12060 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
12070 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12080 44 49 53 54 49 4e 43 54 20 2d 20 39 33 20 63 6f  DISTINCT - 93 co
12090 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
120a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 33 0d  cor0..----..-93.
120b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
120c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
120d0 4e 43 54 20 2d 20 2b 20 32 37 20 41 53 20 63 6f  NCT - + 27 AS co
120e0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
120f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d  cor0..----..-27.
12100 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12110 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
12120 4e 43 54 20 2b 20 2b 20 36 33 20 2a 20 2d 20 63  NCT + + 63 * - c
12130 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
12140 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
12150 37 31 0d 0a 2d 31 39 35 33 0d 0a 2d 33 37 31 37  71..-1953..-3717
12160 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
12170 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
12180 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
12190 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
121a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
121b0 35 32 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  524..SELECT ALL 
121c0 2d 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 44  - + ( - col0 ) D
121d0 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  IV col0 FROM tab
121e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
121f0 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .1..1..1....skip
12200 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
12210 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
12220 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12230 2d 35 32 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -524..SELECT ALL
12240 20 2d 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20   - + ( - col0 ) 
12250 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  / col0 FROM tab2
12260 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12270 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69  1..1..1....onlyi
12280 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
12290 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
122a0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
122b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
122c0 20 6c 61 62 65 6c 2d 35 32 35 0d 0a 53 45 4c 45   label-525..SELE
122d0 43 54 20 63 6f 6c 30 20 44 49 56 20 2d 20 37 30  CT col0 DIV - 70
122e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
122f0 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d  .----..-1..0..0.
12300 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
12310 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
12320 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
12330 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
12340 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
12350 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
12360 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
12370 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12380 2d 35 32 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -525..SELECT col
12390 30 20 2f 20 2d 20 37 30 20 63 6f 6c 31 20 46 52  0 / - 70 col1 FR
123a0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
123b0 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  1..0..0....query
123c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
123d0 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2a  CT + tab2.col2 *
123e0 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 63   col1 + col0 * c
123f0 6f 6c 31 20 2a 20 2b 20 33 33 20 46 52 4f 4d 20  ol1 * + 33 FROM 
12400 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34  tab2..----..1534
12410 30 30 0d 0a 34 34 39 36 35 0d 0a 37 39 39 38 0d  00..44965..7998.
12420 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12430 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
12440 30 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  0 * - col1 AS co
12450 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
12460 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34  --..1343..217..4
12470 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  602....query I r
12480 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
12490 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2b  ISTINCT col2 * +
124a0 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30 20 46   col2 - - col0 F
124b0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
124c0 32 39 31 39 0d 0a 33 33 31 33 0d 0a 39 32 39 36  2919..3313..9296
124d0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
124e0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
124f0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
12500 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
12510 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
12520 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32 39  owsort label-529
12530 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
12540 54 20 2b 20 63 6f 6c 31 20 2d 20 43 41 53 54 28  T + col1 - CAST(
12550 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
12560 29 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ) * - col2 AS co
12570 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
12580 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
12590 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
125a0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
125b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
125c0 2d 35 32 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  -529..SELECT DIS
125d0 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2d 20 43  TINCT + col1 - C
125e0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
125f0 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 32  TEGER ) * - col2
12600 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
12610 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b0..----..NULL..
12620 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12630 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
12640 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2b   + tab0.col0 * +
12650 20 32 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63   2 - + col2 AS c
12660 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
12670 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 37 31 0d 0a 35  ---..-28..-71..5
12680 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12690 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
126a0 20 2a 20 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20   * ( col1 ) + - 
126b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
126c0 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a 36 35 30 0d 0a  ----..156..650..
126d0 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
126e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
126f0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col0 * - col2 + 
12700 63 6f 6c 30 20 2b 20 35 20 2a 20 36 33 20 41 53  col0 + 5 * 63 AS
12710 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
12720 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
12730 34 32 31 0d 0a 33 33 39 36 0d 0a 35 31 31 0d 0a  421..3396..511..
12740 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
12750 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
12760 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
12770 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
12780 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
12790 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33 33 0d 0a  sort label-533..
127a0 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 4e  SELECT - CAST( N
127b0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
127c0 2a 20 38 39 20 2b 20 63 6f 6c 31 20 2d 20 2d 20  * 89 + col1 - - 
127d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
127e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
127f0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
12800 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
12810 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
12820 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12830 20 6c 61 62 65 6c 2d 35 33 33 0d 0a 53 45 4c 45   label-533..SELE
12840 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT - CAST ( NULL
12850 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
12860 38 39 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 63 6f  89 + col1 - - co
12870 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
12880 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
12890 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
128a0 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
128b0 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
128c0 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
128d0 31 2c 20 74 61 62 32 20 63 6f 72 30 20 43 52 4f  1, tab2 cor0 CRO
128e0 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61  SS JOIN tab0, ta
128f0 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30  b1 AS cor1, tab0
12900 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
12910 33 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68  3645 values hash
12920 69 6e 67 20 74 6f 20 36 34 33 31 32 64 63 36 36  ing to 64312dc66
12930 64 66 31 37 37 64 38 63 37 34 35 63 36 33 63 30  df177d8c745c63c0
12940 62 64 64 34 64 63 37 0d 0a 0d 0a 73 6b 69 70 69  bdd4dc7....skipi
12950 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
12960 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
12970 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
12980 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
12990 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
129a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
129b0 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  l0 * col1 + - co
129c0 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
129d0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  0 cor0..----..-2
129e0 30 38 38 0d 0a 2d 33 34 33 30 0d 0a 2d 38 31 38  088..-3430..-818
129f0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
12a00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
12a10 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63  TINCT - col0 * c
12a20 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
12a30 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
12a40 0d 0a 2d 34 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36  ..-49..-6084..-6
12a50 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  241....query I r
12a60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
12a70 49 53 54 49 4e 43 54 20 2d 20 2b 20 32 36 20 2a  ISTINCT - + 26 *
12a80 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
12a90 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
12aa0 2d 2d 0d 0a 2d 32 31 33 32 0d 0a 2d 32 36 0d 0a  --..-2132..-26..
12ab0 2d 38 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -858....query I 
12ac0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12ad0 41 4c 4c 20 2d 20 38 33 20 46 52 4f 4d 20 74 61  ALL - 83 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 2d 38 33 0d 0a 2d 38 33 0d 0a 2d 38 33 0d  ..-83..-83..-83.
12b00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12b10 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
12b20 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 31   ( col2 ) * col1
12b30 20 2b 20 2d 20 33 31 20 46 52 4f 4d 20 74 61 62   + - 31 FROM tab
12b40 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
12b50 0a 2d 31 35 36 35 0d 0a 2d 36 37 37 0d 0a 2d 38  .-1565..-677..-8
12b60 36 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  68....skipif pos
12b70 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
12b80 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
12b90 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
12ba0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
12bb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12bc0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
12bd0 35 31 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  51 + col0 + - co
12be0 72 30 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f  r0.col2 col2 FRO
12bf0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
12c00 2d 2d 2d 2d 0d 0a 2d 31 32 33 33 0d 0a 2d 31 37  ----..-1233..-17
12c10 35 31 0d 0a 2d 34 35 33 32 0d 0a 0d 0a 71 75 65  51..-4532....que
12c20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12c30 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20  LECT ALL col0 * 
12c40 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c  ( col1 ) + - col
12c50 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
12c60 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 30 0d 0a 33 33  ..----..2040..33
12c70 36 30 0d 0a 38 30 31 30 0d 0a 0d 0a 71 75 65 72  60..8010....quer
12c80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12c90 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 34  ECT DISTINCT + 4
12ca0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
12cb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 0d 0a 73  r0..----..4....s
12cc0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
12cd0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
12ce0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
12cf0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
12d00 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
12d10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12d20 41 4c 4c 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29  ALL + ( - col0 )
12d30 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 63   * col2 + col1 c
12d40 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
12d50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30   cor0..----..-70
12d60 36 0d 0a 2d 37 32 30 37 0d 0a 36 32 0d 0a 0d 0a  6..-7207..62....
12d70 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
12d80 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
12d90 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
12da0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
12db0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34 34 0d  wsort label-544.
12dc0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
12dd0 6c 31 20 2a 20 38 35 20 2b 20 63 6f 6c 32 20 2a  l1 * 85 + col2 *
12de0 20 2b 20 39 39 20 2b 20 2b 20 63 6f 6c 30 20 44   + 99 + + col0 D
12df0 49 56 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  IV + col0 AS col
12e00 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
12e10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 34 30  or0..----..-2440
12e20 0d 0a 32 33 31 38 0d 0a 33 39 0d 0a 0d 0a 73 6b  ..2318..39....sk
12e30 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
12e40 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
12e50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
12e60 65 6c 2d 35 34 34 0d 0a 53 45 4c 45 43 54 20 41  el-544..SELECT A
12e70 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 38 35 20 2b  LL - col1 * 85 +
12e80 20 63 6f 6c 32 20 2a 20 2b 20 39 39 20 2b 20 2b   col2 * + 99 + +
12e90 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20 41   col0 / + col0 A
12ea0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
12eb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12ec0 2d 32 34 34 30 0d 0a 32 33 31 38 0d 0a 33 39 0d  -2440..2318..39.
12ed0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12ee0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
12ef0 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2b 20 63 6f   col2 * - ( + co
12f00 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  l0 ) FROM tab2 A
12f10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
12f20 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32  89..-2028..-3002
12f30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12f40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38 39  ort..SELECT - 89
12f50 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20   - tab2.col0 AS 
12f60 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
12f70 2d 2d 2d 2d 0d 0a 2d 31 36 37 0d 0a 2d 31 36 38  ----..-167..-168
12f80 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-96....query I
12f90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12fa0 20 35 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   53 AS col2 FROM
12fb0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d   tab2..----..53.
12fc0 0a 35 33 0d 0a 35 33 0d 0a 0d 0a 6f 6e 6c 79 69  .53..53....onlyi
12fd0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
12fe0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
12ff0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
13000 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
13010 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
13020 62 65 6c 2d 35 34 38 0d 0a 53 45 4c 45 43 54 20  bel-548..SELECT 
13030 2b 20 43 41 53 54 28 20 38 31 20 41 53 20 53 49  + CAST( 81 AS SI
13040 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46  GNED ) AS col0 F
13050 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
13060 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  S cor0, tab1 AS 
13070 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
13080 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
13090 20 30 61 38 35 36 33 39 65 30 64 64 64 62 66 66   0a85639e0dddbff
130a0 64 61 62 32 63 62 31 36 62 30 32 37 63 62 33 36  dab2cb16b027cb36
130b0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
130c0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
130d0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
130e0 6f 72 74 20 6c 61 62 65 6c 2d 35 34 38 0d 0a 53  ort label-548..S
130f0 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 38  ELECT + CAST ( 8
13100 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  1 AS INTEGER ) A
13110 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
13120 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20  , tab0 AS cor0, 
13130 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
13140 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
13150 73 68 69 6e 67 20 74 6f 20 30 61 38 35 36 33 39  shing to 0a85639
13160 65 30 64 64 64 62 66 66 64 61 62 32 63 62 31 36  e0dddbffdab2cb16
13170 62 30 32 37 63 62 33 36 30 0d 0a 0d 0a 71 75 65  b027cb360....que
13180 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13190 4c 45 43 54 20 2d 20 2d 20 34 32 20 41 53 20 63  LECT - - 42 AS c
131a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
131b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d   cor0..----..42.
131c0 0a 34 32 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72 79  .42..42....query
131d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
131e0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 31 32  CT DISTINCT + 12
131f0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
13200 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
13210 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 37 36 0d  0..----..15..76.
13220 0a 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .92....query I r
13230 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
13240 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  LL + - col0 + co
13250 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
13260 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  1 cor0..----..-5
13270 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 6f 6e  4..-67..23....on
13280 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
13290 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
132a0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
132b0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
132c0 6f 72 74 20 6c 61 62 65 6c 2d 35 35 32 0d 0a 53  ort label-552..S
132d0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
132e0 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 33 31   + - col0 DIV 31
132f0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
13300 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
13310 0d 0a 35 34 0d 0a 35 35 0d 0a 39 34 0d 0a 0d 0a  ..54..55..94....
13320 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
13330 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
13340 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
13350 61 62 65 6c 2d 35 35 32 0d 0a 53 45 4c 45 43 54  abel-552..SELECT
13360 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2d 20   ALL + col2 + - 
13370 63 6f 6c 30 20 2f 20 33 31 20 41 53 20 63 6f 6c  col0 / 31 AS col
13380 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
13390 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  or0..----..54..5
133a0 35 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  5..94....query I
133b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
133c0 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 28 20 63 6f   - col1 * - ( co
133d0 6c 31 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l1 ) + col2 FROM
133e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
133f0 2d 2d 2d 0d 0a 37 34 32 39 0d 0a 38 33 36 33 0d  ---..7429..8363.
13400 0a 39 34 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .9410....onlyif 
13410 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
13420 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
13430 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
13440 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
13450 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
13460 6c 2d 35 35 34 0d 0a 53 45 4c 45 43 54 20 2b 20  l-554..SELECT + 
13470 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 43 41  cor0.col1 * + CA
13480 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ST( col2 AS SIGN
13490 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63  ED ) FROM tab2 c
134a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d  or0..----..1534.
134b0 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 73 6b 69  .646..837....ski
134c0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
134d0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
134e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
134f0 6c 2d 35 35 34 0d 0a 53 45 4c 45 43 54 20 2b 20  l-554..SELECT + 
13500 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 43 41  cor0.col1 * + CA
13510 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54  ST ( col2 AS INT
13520 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32  EGER ) FROM tab2
13530 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33   cor0..----..153
13540 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 6f  4..646..837....o
13550 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
13560 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
13570 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
13580 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
13590 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
135a0 74 20 6c 61 62 65 6c 2d 35 35 35 0d 0a 53 45 4c  t label-555..SEL
135b0 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  ECT + CAST( NULL
135c0 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
135d0 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
135e0 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f  cor0, tab0 AS co
135f0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
13600 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31  ues hashing to 1
13610 36 62 65 38 38 36 38 61 31 65 36 66 34 65 38 38  6be8868a1e6f4e88
13620 35 30 35 30 39 66 39 33 32 37 61 66 65 39 30 0d  50509f9327afe90.
13630 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
13640 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
13650 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13660 74 20 6c 61 62 65 6c 2d 35 35 35 0d 0a 53 45 4c  t label-555..SEL
13670 45 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ECT + CAST ( NUL
13680 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
13690 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41  ROM tab2, tab0 A
136a0 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  S cor0, tab0 AS 
136b0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
136c0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
136d0 20 31 36 62 65 38 38 36 38 61 31 65 36 66 34 65   16be8868a1e6f4e
136e0 38 38 35 30 35 30 39 66 39 33 32 37 61 66 65 39  8850509f9327afe9
136f0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
13700 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
13710 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 31  TINCT + col0 * 1
13720 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  2 + - col0 FROM 
13730 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
13740 2d 2d 0d 0a 33 33 0d 0a 37 30 34 0d 0a 38 38 30  --..33..704..880
13750 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
13760 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
13770 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
13780 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
13790 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
137a0 35 35 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  557..SELECT DIST
137b0 49 4e 43 54 20 63 6f 6c 32 20 2b 20 33 39 20 44  INCT col2 + 39 D
137c0 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  IV col1 AS col0 
137d0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
137e0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 38 0d  0..----..26..28.
137f0 0a 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .40....skipif my
13800 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
13810 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
13820 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 37 0d  wsort label-557.
13830 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
13840 20 63 6f 6c 32 20 2b 20 33 39 20 2f 20 63 6f 6c   col2 + 39 / col
13850 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
13860 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
13870 2d 0d 0a 32 36 0d 0a 32 38 0d 0a 34 30 0d 0a 0d  -..26..28..40...
13880 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13890 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
138a0 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a   col0 + + col2 *
138b0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
138c0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
138d0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a 32 31  0..----..196..21
138e0 30 36 0d 0a 33 30 38 31 0d 0a 0d 0a 73 6b 69 70  06..3081....skip
138f0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
13900 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
13910 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
13920 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
13930 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
13940 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
13950 20 37 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   7 col2 FROM tab
13960 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
13970 0a 37 0d 0a 37 0d 0a 37 0d 0a 0d 0a 73 6b 69 70  .7..7..7....skip
13980 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
13990 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
139a0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
139b0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
139c0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
139d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
139e0 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 63   col1 + - col1 c
139f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
13a00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
13a10 32 0d 0a 2d 31 38 32 0d 0a 2d 31 39 34 0d 0a 0d  2..-182..-194...
13a20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13a30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
13a40 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20  * - cor0.col0 - 
13a50 31 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  12 * - col0 FROM
13a60 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
13a70 2d 2d 2d 0d 0a 2d 31 30 35 0d 0a 2d 31 30 39 32  ---..-105..-1092
13a80 0d 0a 2d 32 30 35 34 0d 0a 0d 0a 71 75 65 72 79  ..-2054....query
13a90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13aa0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
13ab0 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32  r0.col2 + + col2
13ac0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
13ad0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
13ae0 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d 0a  08..114..192....
13af0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
13b00 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
13b10 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
13b20 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
13b30 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 36 33 0d  wsort label-563.
13b40 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
13b50 20 2b 20 2d 20 33 39 20 2d 20 2b 20 63 6f 6c 31   + - 39 - + col1
13b60 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63   DIV - col1 AS c
13b70 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
13b80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 38   cor0..----..-38
13b90 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
13ba0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
13bb0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
13bc0 72 74 20 6c 61 62 65 6c 2d 35 36 33 0d 0a 53 45  rt label-563..SE
13bd0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
13be0 2d 20 33 39 20 2d 20 2b 20 63 6f 6c 31 20 2f 20  - 39 - + col1 / 
13bf0 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
13c00 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
13c10 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 38 0d 0a 0d 0a 71  ..----..-38....q
13c20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13c30 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
13c40 2d 20 39 35 20 2a 20 2b 20 63 6f 6c 31 20 2d 20  - 95 * + col1 - 
13c50 36 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  67 AS col0 FROM 
13c60 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
13c70 2d 2d 0d 0a 2d 38 32 33 37 0d 0a 2d 38 37 31 32  --..-8237..-8712
13c80 0d 0a 2d 39 32 38 32 0d 0a 0d 0a 71 75 65 72 79  ..-9282....query
13c90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13ca0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20  CT ALL + col0 * 
13cb0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
13cc0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
13cd0 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35  ----..2064..3395
13ce0 0d 0a 38 30 39 39 0d 0a 0d 0a 73 6b 69 70 69 66  ..8099....skipif
13cf0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
13d00 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
13d10 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
13d20 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
13d30 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
13d40 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
13d50 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  or0.col2 + - col
13d60 31 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  1 * col0 * col2 
13d70 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
13d80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
13d90 31 39 36 32 36 0d 0a 2d 35 30 39 39 36 0d 0a 2d  19626..-50996..-
13da0 35 38 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5832....query I 
13db0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13dc0 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20 2d 20 63  + - ( col2 ) - c
13dd0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
13de0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35   cor0..----..-55
13df0 0d 0a 2d 35 38 0d 0a 2d 38 35 0d 0a 0d 0a 71 75  ..-58..-85....qu
13e00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13e10 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34  ELECT DISTINCT 4
13e20 39 20 2a 20 63 6f 6c 31 20 2b 20 31 38 20 41 53  9 * col1 + 18 AS
13e30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
13e40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 32  cor0..----..1292
13e50 0d 0a 35 30 38 0d 0a 36 35 35 0d 0a 0d 0a 71 75  ..508..655....qu
13e60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13e70 45 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c 30  ELECT - ( - col0
13e80 20 29 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   ) + - col0 FROM
13e90 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab1..----..0..
13ea0 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
13eb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13ec0 28 20 63 6f 6c 31 20 29 20 2b 20 74 61 62 30 2e  ( col1 ) + tab0.
13ed0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
13ee0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  M tab0..----..17
13ef0 32 0d 0a 31 38 32 0d 0a 31 39 34 0d 0a 0d 0a 71  2..182..194....q
13f00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13f10 53 45 4c 45 43 54 20 63 6f 6c 31 20 2d 20 31 33  SELECT col1 - 13
13f20 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
13f30 0d 0a 2d 33 0d 0a 30 0d 0a 31 33 0d 0a 0d 0a 6f  ..-3..0..13....o
13f40 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
13f50 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
13f60 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
13f70 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
13f80 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 32 0d 0a  sort label-572..
13f90 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c  SELECT - ( + col
13fa0 31 20 29 20 44 49 56 20 2b 20 63 6f 6c 32 20 2b  1 ) DIV + col2 +
13fb0 20 34 33 20 44 49 56 20 28 20 63 6f 6c 30 20 29   43 DIV ( col0 )
13fc0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
13fd0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  b0..----..-1..-1
13fe0 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-96....skipif 
13ff0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
14000 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
14010 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37  rowsort label-57
14020 32 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20  2..SELECT - ( + 
14030 63 6f 6c 31 20 29 20 2f 20 2b 20 63 6f 6c 32 20  col1 ) / + col2 
14040 2b 20 34 33 20 2f 20 28 20 63 6f 6c 30 20 29 20  + 43 / ( col0 ) 
14050 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
14060 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  0..----..-1..-1.
14070 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-96....query I 
14080 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14090 2d 20 2d 20 34 31 20 2a 20 63 6f 6c 30 20 2b 20  - - 41 * col0 + 
140a0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
140b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
140c0 31 30 31 37 0d 0a 31 34 33 36 0d 0a 33 37 33 31  1017..1436..3731
140d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
140e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 35 20 2b  ort..SELECT 95 +
140f0 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
14100 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a  ab0..----..128..
14110 31 37 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  177..96....query
14120 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14130 43 54 20 2d 20 31 38 20 2a 20 2b 20 63 6f 6c 32  CT - 18 * + col2
14140 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
14150 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
14160 0d 0a 2d 31 34 37 36 0d 0a 2d 31 38 0d 0a 2d 35  ..-1476..-18..-5
14170 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  94....query I ro
14180 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
14190 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20  STINCT + col2 * 
141a0 2b 20 63 6f 6c 31 20 2a 20 74 61 62 32 2e 63 6f  + col1 * tab2.co
141b0 6c 32 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 46  l2 + tab2.col1 F
141c0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
141d0 32 32 36 33 30 0d 0a 32 34 35 36 35 0d 0a 33 39  22630..24565..39
141e0 39 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  943....query I r
141f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38  owsort..SELECT 8
14200 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
14210 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 32 0d 0a 38  ab1..----..82..8
14220 32 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  2..82....query I
14230 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14240 20 39 38 20 2b 20 2b 20 35 30 20 46 52 4f 4d 20   98 + + 50 FROM 
14250 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
14260 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20  SS JOIN tab2 AS 
14270 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
14280 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
14290 33 36 66 65 39 61 32 34 33 64 63 36 32 35 35 31  36fe9a243dc62551
142a0 36 64 38 61 33 33 32 64 35 34 34 63 37 31 62 39  6d8a332d544c71b9
142b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
142c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
142d0 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20  - col0 + col0 * 
142e0 2d 20 31 35 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 15 AS col1 FRO
142f0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
14300 2d 2d 2d 2d 0d 0a 2d 31 30 32 34 0d 0a 2d 31 32  ----..-1024..-12
14310 38 30 0d 0a 2d 34 38 0d 0a 0d 0a 71 75 65 72 79  80..-48....query
14320 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14330 43 54 20 44 49 53 54 49 4e 43 54 20 39 30 20 46  CT DISTINCT 90 F
14340 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63  ROM tab0, tab1 c
14350 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 30 0d 0a 0d  or0..----..90...
14360 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
14370 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
14380 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
14390 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
143a0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
143b0 6f 72 74 20 6c 61 62 65 6c 2d 35 38 31 0d 0a 53  ort label-581..S
143c0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
143d0 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
143e0 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61   ) FROM tab2, ta
143f0 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b0 AS cor0, tab1
14400 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20 41   AS cor1, tab0 A
14410 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor2..----..81
14420 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
14430 74 6f 20 63 62 33 33 63 33 30 64 36 66 35 32 62  to cb33c30d6f52b
14440 62 62 32 34 33 33 38 61 32 39 33 63 37 34 30 66  bb24338a293c740f
14450 32 39 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  29c....skipif my
14460 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
14470 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
14480 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38 31 0d  wsort label-581.
14490 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41  .SELECT ALL - CA
144a0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
144b0 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32  EGER ) FROM tab2
144c0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20  , tab0 AS cor0, 
144d0 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61  tab1 AS cor1, ta
144e0 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d  b0 AS cor2..----
144f0 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68  ..81 values hash
14500 69 6e 67 20 74 6f 20 63 62 33 33 63 33 30 64 36  ing to cb33c30d6
14510 66 35 32 62 62 62 32 34 33 33 38 61 32 39 33 63  f52bbb24338a293c
14520 37 34 30 66 32 39 63 0d 0a 0d 0a 71 75 65 72 79  740f29c....query
14530 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14540 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  CT - cor0.col2 +
14550 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46   col2 * - col0 F
14560 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
14570 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 37 33  ..----..-36..-73
14580 38 30 0d 0a 2d 38 32 35 0d 0a 0d 0a 71 75 65 72  80..-825....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 63 6f 6c 30 20 2a 20 2d 20 35 35 20  ECT col0 * - 55 
145b0 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
145c0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
145d0 0d 0a 2d 31 31 39 33 35 0d 0a 2d 32 35 33 31 31  ..-11935..-25311
145e0 30 0d 0a 2d 37 33 38 36 35 0d 0a 0d 0a 71 75 65  0..-73865....que
145f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14600 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20  LECT - col1 + + 
14610 33 36 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  36 FROM tab0..--
14620 2d 2d 0d 0a 2d 35 30 0d 0a 2d 35 35 0d 0a 2d 36  --..-50..-55..-6
14630 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
14640 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
14650 54 49 4e 43 54 20 2d 20 28 20 74 61 62 30 2e 63  TINCT - ( tab0.c
14660 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 2c  ol1 ) FROM tab0,
14670 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
14680 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d  ---..-86..-91..-
14690 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
146a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
146b0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20  STINCT + col0 * 
146c0 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  - col0 * + col0 
146d0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
146e0 0a 2d 32 36 32 31 34 34 0d 0a 2d 32 37 0d 0a 2d  .-262144..-27..-
146f0 35 31 32 30 30 30 0d 0a 0d 0a 71 75 65 72 79 20  512000....query 
14700 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14710 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
14720 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  2 * + col1 AS co
14730 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
14740 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a  --..2838..7462..
14750 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
14760 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
14770 4c 20 63 6f 72 31 2e 63 6f 6c 30 20 46 52 4f 4d  L cor1.col0 FROM
14780 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
14790 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
147a0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
147b0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 65  es hashing to 1e
147c0 31 66 31 30 39 35 33 65 62 38 65 66 66 65 39 62  1f10953eb8effe9b
147d0 32 30 65 37 34 36 66 38 61 37 66 64 38 33 0d 0a  20e746f8a7fd83..
147e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
147f0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
14800 43 54 20 31 36 20 46 52 4f 4d 20 74 61 62 31 0d  CT 16 FROM tab1.
14810 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 0d 0a 71 75 65  .----..16....que
14820 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14830 4c 45 43 54 20 2d 20 34 34 20 2b 20 2b 20 63 6f  LECT - 44 + + co
14840 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
14850 2d 2d 0d 0a 2d 31 31 0d 0a 2d 34 33 0d 0a 33 38  --..-11..-43..38
14860 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
14870 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
14880 2d 20 38 39 20 46 52 4f 4d 20 74 61 62 30 20 41  - 89 FROM tab0 A
14890 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
148a0 39 0d 0a 2d 38 39 0d 0a 2d 38 39 0d 0a 0d 0a 71  9..-89..-89....q
148b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
148c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
148d0 28 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 29  ( + ( + col0 ) )
148e0 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f   + + col2 - - co
148f0 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 * col2 FROM t
14900 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
14910 2d 0d 0a 32 39 37 33 0d 0a 33 33 37 30 0d 0a 39  -..2973..3370..9
14920 33 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  392....query I r
14930 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
14940 49 53 54 49 4e 43 54 20 2b 20 35 34 20 2b 20 31  ISTINCT + 54 + 1
14950 37 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  7 FROM tab0 AS c
14960 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 31 0d 0a 0d  or0..----..71...
14970 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14980 0d 0a 53 45 4c 45 43 54 20 2b 20 38 32 20 2a 20  ..SELECT + 82 * 
14990 31 34 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  14 FROM tab1 AS 
149a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 38  cor0..----..1148
149b0 0d 0a 31 31 34 38 0d 0a 31 31 34 38 0d 0a 0d 0a  ..1148..1148....
149c0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
149d0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
149e0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
149f0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
14a00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39 35 0d  wsort label-595.
14a10 0a 53 45 4c 45 43 54 20 31 38 20 44 49 56 20 63  .SELECT 18 DIV c
14a20 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
14a30 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
14a40 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 38 0d 0a 0d  ---..0..0..18...
14a50 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
14a60 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
14a70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
14a80 6c 61 62 65 6c 2d 35 39 35 0d 0a 53 45 4c 45 43  label-595..SELEC
14a90 54 20 31 38 20 2f 20 63 6f 6c 32 20 41 53 20 63  T 18 / col2 AS c
14aa0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
14ab0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
14ac0 30 0d 0a 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49  0..18....query I
14ad0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14ae0 20 41 4c 4c 20 28 20 2d 20 63 6f 6c 32 20 29 20   ALL ( - col2 ) 
14af0 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  * - col0 AS col2
14b00 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
14b10 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d  ..35..7298..792.
14b20 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
14b30 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
14b40 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
14b50 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30   tab0, tab0 cor0
14b60 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
14b70 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
14b80 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73  ----..972 values
14b90 20 68 61 73 68 69 6e 67 20 74 6f 20 65 36 31 30   hashing to e610
14ba0 61 63 64 36 30 66 33 34 32 31 32 37 65 36 63 64  acd60f342127e6cd
14bb0 62 61 31 38 36 37 33 64 39 66 30 65 0d 0a 0d 0a  ba18673d9f0e....
14bc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14bd0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
14be0 20 2d 20 36 33 20 46 52 4f 4d 20 74 61 62 32 20   - 63 FROM tab2 
14bf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 33 0d  cor0..----..-63.
14c00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14c10 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 38 39 20  rt..SELECT ( 89 
14c20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
14c30 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
14c40 2d 0d 0a 38 39 0d 0a 38 39 0d 0a 38 39 0d 0a 0d  -..89..89..89...
14c50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14c60 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 37 20 29  ..SELECT - ( 7 )
14c70 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
14c80 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
14c90 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 38 0d 0a 2d  0..----..-378..-
14ca0 33 39 39 0d 0a 2d 36 37 32 0d 0a 0d 0a 71 75 65  399..-672....que
14cb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14cc0 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c  LECT ALL - + col
14cd0 32 20 2b 20 28 20 63 6f 6c 30 20 29 20 46 52 4f  2 + ( col0 ) FRO
14ce0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
14cf0 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d 0a  -..-16..-51..7..
14d00 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
14d10 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
14d20 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
14d30 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
14d40 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
14d50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14d60 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  CT + - cor0.col0
14d70 20 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46   + - col1 col0 F
14d80 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
14d90 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 33  ..----..-137..-3
14da0 38 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  8..-96....skipif
14db0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
14dc0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
14dd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14de0 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54   DISTINCT - CAST
14df0 20 28 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31   ( + col1 * col1
14e00 20 2b 20 28 20 2d 20 28 20 63 6f 6c 32 20 29 20   + ( - ( col2 ) 
14e10 29 20 2a 20 28 20 2b 20 63 6f 6c 32 20 29 20 41  ) * ( + col2 ) A
14e20 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 32  S REAL ) AS col2
14e30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
14e40 0d 0a 32 32 34 30 0d 0a 33 31 34 39 0d 0a 39 30  ..2240..3149..90
14e50 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  47....query I ro
14e60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
14e70 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 46 52  L + tab1.col2 FR
14e80 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
14e90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
14ea0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
14eb0 20 38 30 63 61 30 61 31 63 63 33 33 37 61 37 37   80ca0a1cc337a77
14ec0 31 34 61 38 39 39 30 61 37 36 34 63 66 64 62 31  14a8990a764cfdb1
14ed0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
14ee0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
14ef0 20 38 37 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20   87 + cor0.col0 
14f00 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
14f10 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 0d 0a 31 36  0..----..151..16
14f20 37 0d 0a 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7..90....onlyif 
14f30 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
14f40 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
14f50 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
14f60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
14f70 61 62 65 6c 2d 36 30 36 0d 0a 53 45 4c 45 43 54  abel-606..SELECT
14f80 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f   + col1 DIV + co
14f90 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
14fa0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  cor0..----..1..1
14fb0 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
14fc0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
14fd0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
14fe0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30 36 0d  wsort label-606.
14ff0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2f  .SELECT + col1 /
15000 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
15010 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
15020 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .1..1..1....quer
15030 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15040 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  ECT col2 + + col
15050 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
15060 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
15070 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d  -..121..176..57.
15080 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
15090 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
150a0 31 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  1 * - col0 FROM 
150b0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
150c0 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34  .-1343..-217..-4
150d0 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  602....query I r
150e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
150f0 6f 6c 32 20 2a 20 36 35 20 46 52 4f 4d 20 74 61  ol2 * 65 FROM ta
15100 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 30 0d 0a  b2..----..1690..
15110 31 37 35 35 0d 0a 32 34 37 30 0d 0a 0d 0a 71 75  1755..2470....qu
15120 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15130 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 30  ELECT ALL + tab0
15140 2e 63 6f 6c 32 20 2a 20 2b 20 28 20 2b 20 63 6f  .col2 * + ( + co
15150 72 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c  r0.col1 ) AS col
15160 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
15170 31 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  1, tab2 cor0..--
15180 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
15190 73 68 69 6e 67 20 74 6f 20 34 61 63 35 36 65 62  shing to 4ac56eb
151a0 31 62 31 32 30 31 62 31 62 30 37 35 35 37 62 33  1b1201b1b07557b3
151b0 39 33 39 38 66 39 62 38 35 0d 0a 0d 0a 71 75 65  9398f9b85....que
151c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
151d0 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  LECT + + cor0.co
151e0 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 * col0 FROM t
151f0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
15200 34 39 0d 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a  49..6084..6241..
15210 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15220 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
15230 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  - col1 + - col2 
15240 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
15250 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
15260 30 39 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a 0d 0a  09..-67..-80....
15270 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15280 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c  .SELECT tab0.col
15290 32 20 2a 20 2d 20 34 34 20 46 52 4f 4d 20 74 61  2 * - 44 FROM ta
152a0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 32 0d  b0..----..-1452.
152b0 0a 2d 33 36 30 38 0d 0a 2d 34 34 0d 0a 0d 0a 71  .-3608..-44....q
152c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
152d0 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20  SELECT + + col1 
152e0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  - cor0.col2 AS c
152f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
15300 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33  r0..----..-21..3
15310 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3..4....query I 
15320 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15330 2d 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 33 36 20  - - col2 + - 36 
15340 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
15350 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 32 31 0d  0..----..18..21.
15360 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .60....query I r
15370 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
15380 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  LL + col2 + + co
15390 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l1 + col0 AS col
153a0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
153b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a  or0..----..133..
153c0 31 34 33 0d 0a 32 36 32 0d 0a 0d 0a 71 75 65 72  143..262....quer
153d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
153e0 45 43 54 20 39 31 20 46 52 4f 4d 20 74 61 62 30  ECT 91 FROM tab0
153f0 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab2 cor0..---
15400 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
15410 69 6e 67 20 74 6f 20 35 37 34 38 36 32 37 65 66  ing to 5748627ef
15420 35 66 64 38 36 61 32 31 63 64 35 35 39 66 64 32  5fd86a21cd559fd2
15430 37 38 64 37 32 37 37 0d 0a 0d 0a 71 75 65 72 79  78d7277....query
15440 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15450 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  CT - cor0.col1 +
15460 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
15470 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
15480 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37 0d  0..----..28..47.
15490 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .83....query I r
154a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
154b0 20 2b 20 28 20 2b 20 32 31 20 29 20 41 53 20 63   + ( + 21 ) AS c
154c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
154d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   cor0..----..-21
154e0 0d 0a 2d 32 31 0d 0a 2d 32 31 0d 0a 0d 0a 71 75  ..-21..-21....qu
154f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15500 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b  ELECT - col0 + +
15510 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 46   col0 + - col0 F
15520 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
15530 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d  ..----..-3..-64.
15540 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-80....query I 
15550 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15560 2b 20 28 20 32 31 20 29 20 41 53 20 63 6f 6c 32  + ( 21 ) AS col2
15570 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
15580 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 32 31  r0..----..21..21
15590 0d 0a 32 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..21....skipif p
155a0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
155b0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
155c0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
155d0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
155e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
155f0 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c  ..SELECT + ( col
15600 32 20 29 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 63  2 ) * col0 * + c
15610 6f 6c 30 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20  ol0 + col2 col1 
15620 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
15630 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 33 35 32 39 0d  0..----..233529.
15640 0a 35 34 30 0d 0a 36 31 34 34 39 36 0d 0a 0d 0a  .540..614496....
15650 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15660 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
15670 72 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r1.col2 FROM tab
15680 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  2, tab2 AS cor0,
15690 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
156a0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
156b0 61 73 68 69 6e 67 20 74 6f 20 66 39 64 34 62 62  ashing to f9d4bb
156c0 38 36 37 37 64 62 37 62 39 38 63 37 65 64 38 39  8677db7b98c7ed89
156d0 64 30 36 65 36 65 38 63 64 36 0d 0a 0d 0a 71 75  d06e6e8cd6....qu
156e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
156f0 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b  ELECT + col0 * +
15700 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2d   col2 + col2 * -
15710 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
15720 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
15730 31 35 33 36 0d 0a 2d 32 37 35 34 0d 0a 33 39 39  1536..-2754..399
15740 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15750 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  ort..SELECT - ta
15760 62 31 2e 63 6f 6c 32 20 2b 20 74 61 62 31 2e 63  b1.col2 + tab1.c
15770 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20  ol2 + + col1 AS 
15780 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
15790 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36  ----..10..13..26
157a0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
157b0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
157c0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
157d0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
157e0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
157f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15800 4c 45 43 54 20 2d 20 63 6f 6c 32 20 63 6f 6c 32  LECT - col2 col2
15810 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45   FROM tab1 WHERE
15820 20 28 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30   ( col2 - - col0
15830 20 29 20 4e 4f 54 20 49 4e 20 28 20 63 6f 6c 30   ) NOT IN ( col0
15840 20 29 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d   )..----..-54..-
15850 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e 6c 79 69  57..-96....onlyi
15860 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
15870 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
15880 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
15890 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
158a0 20 6c 61 62 65 6c 2d 36 32 37 0d 0a 53 45 4c 45   label-627..SELE
158b0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
158c0 20 44 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63   DIV - col2 AS c
158d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
158e0 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69  ---..-1....skipi
158f0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
15900 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
15910 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
15920 36 32 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  627..SELECT DIST
15930 49 4e 43 54 20 63 6f 6c 32 20 2f 20 2d 20 63 6f  INCT col2 / - co
15940 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
15950 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  tab1..----..-1..
15960 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
15970 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
15980 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
15990 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
159a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32  rowsort label-62
159b0 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  8..SELECT ALL + 
159c0 74 61 62 31 2e 63 6f 6c 30 20 44 49 56 20 2d 20  tab1.col0 DIV - 
159d0 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col0 col1 FROM t
159e0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  ab1..----..-1..-
159f0 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..-1....skipif 
15a00 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
15a10 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
15a20 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
15a30 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
15a40 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
15a50 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
15a60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15a70 20 6c 61 62 65 6c 2d 36 32 38 0d 0a 53 45 4c 45   label-628..SELE
15a80 43 54 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f  CT ALL + tab1.co
15a90 6c 30 20 2f 20 2d 20 63 6f 6c 30 20 63 6f 6c 31  l0 / - col0 col1
15aa0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
15ab0 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a  ..-1..-1..-1....
15ac0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
15ad0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
15ae0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
15af0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
15b00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 39 0d  wsort label-629.
15b10 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32  .SELECT ALL tab2
15b20 2e 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 31  .col2 DIV - col1
15b30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
15b40 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d  b2..----..-2..0.
15b50 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
15b60 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
15b70 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
15b80 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 39 0d 0a  sort label-629..
15b90 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32 2e  SELECT ALL tab2.
15ba0 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 41 53  col2 / - col1 AS
15bb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
15bc0 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d 0a 30 0d  .----..-2..0..0.
15bd0 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
15be0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15bf0 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  TINCT * FROM tab
15c00 30 20 57 48 45 52 45 20 2b 20 63 6f 6c 32 20 3d  0 WHERE + col2 =
15c10 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   NULL..----....q
15c20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15c30 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
15c40 2d 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30 20  - col1 - - col0 
15c50 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
15c60 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 34 30 38  ..----..-17..408
15c70 36 0d 0a 36 33 38 37 0d 0a 0d 0a 6f 6e 6c 79 69  6..6387....onlyi
15c80 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
15c90 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
15ca0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
15cb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15cc0 20 6c 61 62 65 6c 2d 36 33 32 0d 0a 53 45 4c 45   label-632..SELE
15cd0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56 20  CT ALL col2 DIV 
15ce0 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab1.col1 AS col
15cf0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
15d00 2d 0d 0a 32 0d 0a 35 0d 0a 37 0d 0a 0d 0a 73 6b  -..2..5..7....sk
15d10 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
15d20 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
15d30 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
15d40 65 6c 2d 36 33 32 0d 0a 53 45 4c 45 43 54 20 41  el-632..SELECT A
15d50 4c 4c 20 63 6f 6c 32 20 2f 20 74 61 62 31 2e 63  LL col2 / tab1.c
15d60 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
15d70 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a   tab1..----..2..
15d80 35 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 49  5..7....query II
15d90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15da0 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57 48  T * FROM tab0 WH
15db0 45 52 45 20 4e 4f 54 20 28 20 63 6f 6c 32 20 2d  ERE NOT ( col2 -
15dc0 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32   + col0 * + col2
15dd0 20 29 20 4e 4f 54 20 49 4e 20 28 20 63 6f 6c 31   ) NOT IN ( col1
15de0 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79   )..----....only
15df0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
15e00 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
15e10 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
15e20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15e30 74 20 6c 61 62 65 6c 2d 36 33 34 0d 0a 53 45 4c  t label-634..SEL
15e40 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
15e50 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 32 20 63  ol2 DIV + col2 c
15e60 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
15e70 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ---..1....skipif
15e80 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
15e90 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
15ea0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
15eb0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
15ec0 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
15ed0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
15ee0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15ef0 74 20 6c 61 62 65 6c 2d 36 33 34 0d 0a 53 45 4c  t label-634..SEL
15f00 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
15f10 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 63 6f 6c  ol2 / + col2 col
15f20 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
15f30 2d 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -..1....skipif p
15f40 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
15f50 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
15f60 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
15f70 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
15f80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15f90 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20  ..SELECT col0 - 
15fa0 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  + col0 col2 FROM
15fb0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
15fc0 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
15fd0 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
15fe0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
15ff0 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 41  CT * FROM tab1 A
16000 53 20 63 6f 72 30 20 57 48 45 52 45 20 28 20 4e  S cor0 WHERE ( N
16010 55 4c 4c 20 29 20 3c 3d 20 63 6f 6c 30 0d 0a 2d  ULL ) <= col0..-
16020 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  ---....query III
16030 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16040 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45   * FROM tab1 WHE
16050 52 45 20 4e 4f 54 20 2b 20 63 6f 6c 31 20 2b 20  RE NOT + col1 + 
16060 63 6f 6c 32 20 4e 4f 54 20 49 4e 20 28 20 63 6f  col2 NOT IN ( co
16070 6c 30 20 2a 20 74 61 62 31 2e 63 6f 6c 32 20 2b  l0 * tab1.col2 +
16080 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   col2 )..----...
16090 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
160a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74  ..SELECT ALL + t
160b0 61 62 32 2e 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c  ab2.col1 - + col
160c0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
160d0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab2..----..0..0.
160e0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
160f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
16100 63 6f 6c 32 20 2d 20 74 61 62 31 2e 63 6f 6c 30  col2 - tab1.col0
16110 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
16120 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36  b1..----..-7..16
16130 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..51....query I 
16140 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16150 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2d 20 74 61  col0 * col2 - ta
16160 62 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41  b0.col2 * col0 A
16170 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
16180 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
16190 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
161a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46  sort..SELECT * F
161b0 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e  ROM tab1 WHERE N
161c0 4f 54 20 4e 55 4c 4c 20 3e 3d 20 4e 55 4c 4c 0d  OT NULL >= NULL.
161d0 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
161e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
161f0 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 63   col0 * col2 * c
16200 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
16210 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   tab1..----..364
16220 38 30 0d 0a 34 32 31 32 0d 0a 39 39 38 34 30 0d  80..4212..99840.
16230 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
16240 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46  sort..SELECT * F
16250 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e  ROM tab0 WHERE N
16260 4f 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31  OT col1 + + col1
16270 20 2a 20 2d 20 63 6f 6c 31 20 4e 4f 54 20 49 4e   * - col1 NOT IN
16280 20 28 20 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63   ( col2 + tab0.c
16290 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  ol1 + col0 * + c
162a0 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ol1 )..----....q
162b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
162c0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
162d0 2b 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63  + tab2.col1 AS c
162e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
162f0 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d 33 34 38 31  ---..-289..-3481
16300 0d 0a 2d 39 36 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..-961....skipif
16310 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
16320 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
16330 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
16340 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
16350 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
16360 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
16370 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  NCT - col0 * col
16380 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  2 col1 FROM tab1
16390 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33  ..----..-162..-3
163a0 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75  648..-7680....qu
163b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
163c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
163d0 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 41 53 20   col2 - col2 AS 
163e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
163f0 2d 2d 2d 2d 0d 0a 2d 35 32 0d 0a 2d 35 34 0d 0a  ----..-52..-54..
16400 2d 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -76....query I r
16410 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
16420 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2a   col2 * - col0 *
16430 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
16440 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
16450 0a 2d 31 32 32 35 0d 0a 2d 31 39 30 30 38 0d 0a  .-1225..-19008..
16460 2d 36 34 39 35 32 32 0d 0a 0d 0a 71 75 65 72 79  -649522....query
16470 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16480 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2d  CT col1 * col1 -
16490 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f   tab1.col0 AS co
164a0 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
164b0 2d 2d 0d 0a 33 36 0d 0a 36 37 33 0d 0a 38 39 0d  --..36..673..89.
164c0 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
164d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
164e0 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  TINCT * FROM tab
164f0 31 20 57 48 45 52 45 20 28 20 2b 20 63 6f 6c 31  1 WHERE ( + col1
16500 20 29 20 49 4e 20 28 20 63 6f 6c 32 20 29 0d 0a   ) IN ( col2 )..
16510 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
16520 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16530 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20  + col1 + + col0 
16540 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
16550 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33  0..----..110..13
16560 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20  2..180....query 
16570 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
16580 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74  ECT ALL * FROM t
16590 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 28 20  ab2 WHERE NOT ( 
165a0 63 6f 6c 30 20 29 20 49 4e 20 28 20 2b 20 63 6f  col0 ) IN ( + co
165b0 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l0 )..----....qu
165c0 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
165d0 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
165e0 61 62 31 20 57 48 45 52 45 20 4e 55 4c 4c 20 42  ab1 WHERE NULL B
165f0 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20  ETWEEN NULL AND 
16600 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  NULL..----....qu
16610 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16620 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d  ELECT - col0 * -
16630 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20   col1 + col0 AS 
16640 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
16650 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a 37 30 34 0d  ----..1120..704.
16660 0a 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .81....onlyif my
16670 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
16680 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
16690 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
166a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
166b0 65 6c 2d 36 35 34 0d 0a 53 45 4c 45 43 54 20 41  el-654..SELECT A
166c0 4c 4c 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20  LL + col0 DIV - 
166d0 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col0 + col1 FROM
166e0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d   tab2..----..16.
166f0 0a 33 30 0d 0a 35 38 0d 0a 0d 0a 73 6b 69 70 69  .30..58....skipi
16700 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
16710 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
16720 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
16730 36 35 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  654..SELECT ALL 
16740 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20  + col0 / - col0 
16750 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
16760 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 33 30 0d 0a  ..----..16..30..
16770 35 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  58....onlyif mys
16780 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
16790 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
167a0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
167b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
167c0 6c 2d 36 35 35 0d 0a 53 45 4c 45 43 54 20 2b 20  l-655..SELECT + 
167d0 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 44 49 56 20  col1 - col0 DIV 
167e0 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  tab0.col0 AS col
167f0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
16800 2d 0d 0a 38 35 0d 0a 39 30 0d 0a 39 36 0d 0a 0d  -..85..90..96...
16810 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
16820 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
16830 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
16840 6c 61 62 65 6c 2d 36 35 35 0d 0a 53 45 4c 45 43  label-655..SELEC
16850 54 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20  T + col1 - col0 
16860 2f 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  / tab0.col0 AS c
16870 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
16880 2d 2d 2d 0d 0a 38 35 0d 0a 39 30 0d 0a 39 36 0d  ---..85..90..96.
16890 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
168a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
168b0 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 * + cor0.col
168c0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
168d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a  or0..----..100..
168e0 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 6f 6e 6c 79  169..676....only
168f0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
16900 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
16910 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
16920 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16930 74 20 6c 61 62 65 6c 2d 36 35 37 0d 0a 53 45 4c  t label-657..SEL
16940 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
16950 44 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  DIV - col2 AS co
16960 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
16970 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
16980 2d 33 35 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  -35..0....skipif
16990 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
169a0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
169b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
169c0 35 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  57..SELECT + cor
169d0 30 2e 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 32 20  0.col0 / - col2 
169e0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
169f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
16a00 0a 2d 31 0d 0a 2d 33 35 0d 0a 30 0d 0a 0d 0a 71  .-1..-35..0....q
16a10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16a20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
16a30 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20  - col2 * col0 * 
16a40 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
16a50 2d 2d 2d 2d 0d 0a 2d 32 30 37 39 33 36 0d 0a 2d  ----..-207936..-
16a60 37 33 37 32 38 30 0d 0a 2d 38 37 34 38 0d 0a 0d  737280..-8748...
16a70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16a80 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
16a90 54 20 63 6f 6c 32 20 2a 20 74 61 62 32 2e 63 6f  T col2 * tab2.co
16aa0 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l2 * - col1 FROM
16ab0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32   tab2..----..-22
16ac0 35 39 39 0d 0a 2d 32 34 35 34 38 0d 0a 2d 33 39  599..-24548..-39
16ad0 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  884....query I r
16ae0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
16af0 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab0.col1 FROM 
16b00 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
16b10 53 53 20 4a 4f 49 4e 20 74 61 62 30 0d 0a 2d 2d  SS JOIN tab0..--
16b20 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
16b30 68 69 6e 67 20 74 6f 20 35 38 65 64 34 36 37 61  hing to 58ed467a
16b40 39 61 33 33 32 65 34 64 37 62 66 61 61 39 61 62  9a332e4d7bfaa9ab
16b50 64 62 62 64 30 36 33 66 0d 0a 0d 0a 71 75 65 72  dbbd063f....quer
16b60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16b70 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d 20 2d  ECT ALL col0 - -
16b80 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
16b90 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
16ba0 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d  .----..104..117.
16bb0 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .34....query I r
16bc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
16bd0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a  ISTINCT - col1 *
16be0 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31   - col2 * - col1
16bf0 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   + - col2 * + co
16c00 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
16c10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 36  cor0..----..-246
16c20 39 30 36 0d 0a 2d 36 38 36 35 30 34 0d 0a 2d 39  906..-686504..-9
16c30 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  506....query I r
16c40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
16c50 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a   col0 + - col2 *
16c60 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
16c70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
16c80 0a 2d 31 38 32 0d 0a 2d 31 39 35 30 0d 0a 2d 32  .-182..-1950..-2
16c90 39 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  923....query I r
16ca0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
16cb0 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  LL - col1 * col1
16cc0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
16cd0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
16ce0 0a 2d 32 35 31 0d 0a 2d 33 34 35 35 0d 0a 2d 39  .-251..-3455..-9
16cf0 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  34....onlyif mys
16d00 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
16d10 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
16d20 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
16d30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
16d40 6c 2d 36 36 35 0d 0a 53 45 4c 45 43 54 20 2d 20  l-665..SELECT - 
16d50 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  - cor0.col2 * co
16d60 6c 31 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52  l1 DIV + col1 FR
16d70 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
16d80 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33  .----..26..27..3
16d90 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
16da0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
16db0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
16dc0 6f 72 74 20 6c 61 62 65 6c 2d 36 36 35 0d 0a 53  ort label-665..S
16dd0 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63  ELECT - - cor0.c
16de0 6f 6c 32 20 2a 20 63 6f 6c 31 20 2f 20 2b 20 63  ol2 * col1 / + c
16df0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
16e00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d   cor0..----..26.
16e10 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79  .27..38....query
16e20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16e30 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20  CT ALL + - col0 
16e40 2b 20 38 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 81 AS col2 FRO
16e50 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
16e60 2d 0d 0a 2d 38 0d 0a 34 36 0d 0a 35 37 0d 0a 0d  -..-8..46..57...
16e70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16e80 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
16e90 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  T + + cor0.col1 
16ea0 2a 20 2b 20 35 36 20 46 52 4f 4d 20 74 61 62 30  * + 56 FROM tab0
16eb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16ec0 34 38 31 36 0d 0a 35 30 39 36 0d 0a 35 34 33 32  4816..5096..5432
16ed0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16ee0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
16ef0 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20  INCT - - col2 * 
16f00 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
16f10 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
16f20 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a  ---..1534..646..
16f30 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  837....query I r
16f40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
16f50 4c 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  LL + + cor0.col2
16f60 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
16f70 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  b1 cor0..----..5
16f80 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65  4..57..96....que
16f90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16fa0 4c 45 43 54 20 63 6f 6c 31 20 2a 20 31 20 46 52  LECT col1 * 1 FR
16fb0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
16fc0 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a  --..86..91..97..
16fd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16fe0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
16ff0 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a  r0.col0 + col0 *
17000 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
17010 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
17020 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a 36 31 36 32 0d  .----..56..6162.
17030 0a 36 33 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .6320....skipif 
17040 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
17050 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
17060 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
17070 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
17080 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17090 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
170a0 20 31 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   10 col0 FROM ta
170b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
170c0 0d 0a 32 30 0d 0a 32 33 0d 0a 33 36 0d 0a 0d 0a  ..20..23..36....
170d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
170e0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30  .SELECT + - col0
170f0 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20   * - ( + col2 ) 
17100 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
17110 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35  0 cor0..----..35
17120 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71  ..7298..792....q
17130 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17140 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
17150 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  - - cor0.col0 AS
17160 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
17170 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37  cor0..----..7..7
17180 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  8..79....query I
17190 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
171a0 20 44 49 53 54 49 4e 43 54 20 39 32 20 2a 20 63   DISTINCT 92 * c
171b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
171c0 2d 2d 2d 0d 0a 34 39 36 38 0d 0a 35 32 34 34 0d  ---..4968..5244.
171d0 0a 38 38 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .8832....query I
171e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
171f0 20 41 4c 4c 20 2d 20 74 61 62 31 2e 63 6f 6c 31   ALL - tab1.col1
17200 20 2a 20 34 31 20 2b 20 2d 20 63 6f 6c 30 20 2d   * 41 + - col0 -
17210 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
17220 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
17230 31 30 37 32 0d 0a 2d 35 33 38 0d 0a 2d 36 39 33  1072..-538..-693
17240 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
17250 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
17260 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
17270 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
17280 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
17290 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 37  owsort label-677
172a0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
172b0 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  * + CAST( NULL A
172c0 53 20 44 45 43 49 4d 41 4c 20 29 20 41 53 20 63  S DECIMAL ) AS c
172d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
172e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
172f0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
17300 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
17310 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
17320 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
17330 6c 61 62 65 6c 2d 36 37 37 0d 0a 53 45 4c 45 43  label-677..SELEC
17340 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53  T - col1 * + CAS
17350 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c  T ( NULL AS REAL
17360 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
17370 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
17380 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
17390 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
173a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
173b0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20  + col1 * col1 + 
173c0 34 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  45 AS col2 FROM 
173d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
173e0 2d 2d 0d 0a 31 34 35 0d 0a 32 31 34 0d 0a 37 32  --..145..214..72
173f0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
17400 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
17410 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  1 * - col2 + col
17420 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
17430 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 35 32  ab0..----..-2752
17440 0d 0a 2d 37 33 37 31 0d 0a 30 0d 0a 0d 0a 6f 6e  ..-7371..0....on
17450 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
17460 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
17470 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
17480 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
17490 6f 72 74 20 6c 61 62 65 6c 2d 36 38 30 0d 0a 53  ort label-680..S
174a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
174b0 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56  ol0 - + col2 DIV
174c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
174d0 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 37 0d 0a 37 38  .----..7..77..78
174e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
174f0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
17500 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
17510 72 74 20 6c 61 62 65 6c 2d 36 38 30 0d 0a 53 45  rt label-680..SE
17520 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
17530 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 2f 20 63 6f  l0 - + col2 / co
17540 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
17550 2d 2d 0d 0a 37 0d 0a 37 37 0d 0a 37 38 0d 0a 0d  --..7..77..78...
17560 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17570 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
17580 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol0 + col2 * col
17590 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
175a0 2d 0d 0a 31 33 32 38 0d 0a 31 34 30 37 0d 0a 36  -..1328..1407..6
175b0 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
175c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
175d0 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 41 53  L + tab1.col1 AS
175e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
175f0 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 4e  WHERE NOT NULL N
17600 4f 54 20 49 4e 20 28 20 63 6f 6c 32 20 29 0d 0a  OT IN ( col2 )..
17610 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
17620 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17630 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  ALL - col1 * + c
17640 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63  ol1 * col0 + + c
17650 6f 6c 30 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20  ol0 - tab2.col1 
17660 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
17670 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 37 36 39 0d  2..----..-22769.
17680 0a 2d 32 37 31 34 39 39 0d 0a 2d 36 37 35 31 0d  .-271499..-6751.
17690 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
176a0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
176b0 20 63 6f 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63   col1 * + tab0.c
176c0 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
176d0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45  l1 FROM tab0 WHE
176e0 52 45 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 49  RE col0 * col0 I
176f0 4e 20 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  N ( col2 * col0 
17700 2a 20 2b 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d  * + col1 )..----
17710 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
17720 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
17730 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
17740 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
17750 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
17760 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17770 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 74 61  LECT col1 * + ta
17780 62 31 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32  b1.col2 + + col2
17790 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
177a0 0a 2d 2d 2d 2d 0d 0a 31 33 34 34 0d 0a 31 34 35  .----..1344..145
177b0 38 0d 0a 36 32 37 0d 0a 0d 0a 71 75 65 72 79 20  8..627....query 
177c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
177d0 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2d 20 74  T ALL + col0 - t
177e0 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  ab2.col0 AS col2
177f0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
17800 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
17810 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17820 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  LECT col1 + - co
17830 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
17840 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
17850 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
17860 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
17870 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 41  ISTINCT - col1 A
17880 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
17890 20 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20 28   WHERE NULL IN (
178a0 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   col2 )..----...
178b0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
178c0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
178d0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
178e0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
178f0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
17900 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17910 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61 62  T DISTINCT - tab
17920 32 2e 63 6f 6c 30 20 2a 20 2b 20 74 61 62 32 2e  2.col0 * + tab2.
17930 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
17940 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d  ab2..----..-189.
17950 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d  .-2028..-3002...
17960 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17970 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
17980 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20  T col2 * col2 * 
17990 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
179a0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35  M tab1..----..15
179b0 37 34 36 34 0d 0a 31 38 35 31 39 33 0d 0a 38 38  7464..185193..88
179c0 34 37 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4736....query I 
179d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
179e0 41 4c 4c 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20  ALL + tab2.col1 
179f0 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  * + col0 AS col0
17a00 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
17a10 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30  ..1343..217..460
17a20 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
17a30 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
17a40 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
17a50 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
17a60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
17a70 2d 36 39 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -692..SELECT col
17a80 31 20 44 49 56 20 74 61 62 32 2e 63 6f 6c 30 20  1 DIV tab2.col0 
17a90 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
17aa0 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 34  2..----..0..0..4
17ab0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
17ac0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
17ad0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
17ae0 72 74 20 6c 61 62 65 6c 2d 36 39 32 0d 0a 53 45  rt label-692..SE
17af0 4c 45 43 54 20 63 6f 6c 31 20 2f 20 74 61 62 32  LECT col1 / tab2
17b00 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
17b10 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab2..----..0
17b20 0d 0a 30 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20  ..0..4....query 
17b30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17b40 54 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20  T - tab0.col1 + 
17b50 63 6f 6c 30 20 2b 20 74 61 62 30 2e 63 6f 6c 30  col0 + tab0.col0
17b60 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
17b70 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 38 37 0d 0a  ..-27..-38..87..
17b80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17b90 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
17ba0 43 54 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b  CT tab2.col2 * +
17bb0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
17bc0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
17bd0 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a  89..2028..3002..
17be0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
17bf0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
17c00 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
17c10 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
17c20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39  rowsort label-69
17c30 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
17c40 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  CT - col0 + - co
17c50 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  l2 * - col0 + - 
17c60 74 61 62 31 2e 63 6f 6c 30 20 44 49 56 20 2d 20  tab1.col0 DIV - 
17c70 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
17c80 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35  M tab1..----..15
17c90 39 0d 0a 33 35 38 35 0d 0a 37 36 30 30 0d 0a 0d  9..3585..7600...
17ca0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
17cb0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
17cc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
17cd0 6c 61 62 65 6c 2d 36 39 35 0d 0a 53 45 4c 45 43  label-695..SELEC
17ce0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
17cf0 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  0 + - col2 * - c
17d00 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c  ol0 + - tab1.col
17d10 30 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  0 / - col2 AS co
17d20 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
17d30 2d 2d 0d 0a 31 35 39 0d 0a 33 35 38 35 0d 0a 37  --..159..3585..7
17d40 36 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  600....query I r
17d50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
17d60 4c 4c 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30  LL col0 + - col0
17d70 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 74 61   * - col1 + + ta
17d80 62 32 2e 63 6f 6c 31 20 2a 20 2d 20 74 61 62 32  b2.col1 * - tab2
17d90 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
17da0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab2..----..7
17db0 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72  ..78..79....quer
17dc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17dd0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
17de0 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
17df0 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62 30  tab1, tab2, tab0
17e00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17e10 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65  1..33..82....que
17e20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17e30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
17e40 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52  - col0 * col0 FR
17e50 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
17e60 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38 34 0d 0a  --..-49..-6084..
17e70 2d 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -6241....query I
17e80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17e90 20 41 4c 4c 20 2b 20 2d 20 39 39 20 2a 20 63 6f   ALL + - 99 * co
17ea0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
17eb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 37  cor0..----..-297
17ec0 0d 0a 2d 36 33 33 36 0d 0a 2d 37 39 32 30 0d 0a  ..-6336..-7920..
17ed0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17ee0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
17ef0 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   * + col2 + col0
17f00 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
17f10 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
17f20 0d 0a 2d 37 32 30 39 0d 0a 2d 37 36 38 0d 0a 30  ..-7209..-768..0
17f30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17f40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
17f50 2b 20 63 6f 6c 32 20 29 20 2a 20 2b 20 37 39 20  + col2 ) * + 79 
17f60 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
17f70 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  2 cor0..----..20
17f80 35 34 0d 0a 32 31 33 33 0d 0a 33 30 30 32 0d 0a  54..2133..3002..
17f90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17fa0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
17fb0 43 54 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 30  CT + col1 - col0
17fc0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
17fd0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
17fe0 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71  54..-67..23....q
17ff0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18000 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
18010 2d 20 63 6f 6c 32 20 2b 20 32 34 20 2a 20 63 6f  - col2 + 24 * co
18020 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
18030 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
18040 2d 2d 0d 0a 31 38 38 36 0d 0a 32 33 0d 0a 37 35  --..1886..23..75
18050 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
18060 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
18070 32 20 2a 20 2b 20 38 30 20 46 52 4f 4d 20 74 61  2 * + 80 FROM ta
18080 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
18090 0d 0a 34 33 32 30 0d 0a 34 35 36 30 0d 0a 37 36  ..4320..4560..76
180a0 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  80....onlyif mys
180b0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
180c0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
180d0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
180e0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
180f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
18100 30 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  05..SELECT DISTI
18110 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 43  NCT - col0 + - C
18120 41 53 54 28 20 28 20 2b 20 63 6f 6c 31 20 29 20  AST( ( + col1 ) 
18130 2b 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  + + col0 AS SIGN
18140 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ED ) AS col2 FRO
18150 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
18160 2d 2d 2d 2d 0d 0a 2d 31 37 35 0d 0a 2d 32 31 35  ----..-175..-215
18170 0d 0a 2d 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-45....skipif 
18180 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
18190 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
181a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 30  rowsort label-70
181b0 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
181c0 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 43 41  CT - col0 + - CA
181d0 53 54 20 28 20 28 20 2b 20 63 6f 6c 31 20 29 20  ST ( ( + col1 ) 
181e0 2b 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45  + + col0 AS INTE
181f0 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52  GER ) AS col2 FR
18200 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
18210 0a 2d 2d 2d 2d 0d 0a 2d 31 37 35 0d 0a 2d 32 31  .----..-175..-21
18220 35 0d 0a 2d 34 35 0d 0a 0d 0a 71 75 65 72 79 20  5..-45....query 
18230 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18240 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 37  T ALL + col0 * 7
18250 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  6 FROM tab0 AS c
18260 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 34 0d  or0..----..1824.
18270 0a 32 36 36 30 0d 0a 36 37 36 34 0d 0a 0d 0a 71  .2660..6764....q
18280 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18290 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20  SELECT - - col0 
182a0 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  * - col1 AS col2
182b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
182c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d  r0..----..-2064.
182d0 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d  .-3395..-8099...
182e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
182f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
18300 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
18310 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
18320 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
18330 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18340 54 20 2d 20 63 6f 6c 30 20 2a 20 31 36 20 63 6f  T - col0 * 16 co
18350 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
18360 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32  cor0..----..-102
18370 34 0d 0a 2d 31 32 38 30 0d 0a 2d 34 38 0d 0a 0d  4..-1280..-48...
18380 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18390 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
183a0 6f 6c 32 20 2a 20 2d 20 32 35 20 41 53 20 63 6f  ol2 * - 25 AS co
183b0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
183c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35  cor0..----..-205
183d0 30 0d 0a 2d 32 35 0d 0a 2d 38 32 35 0d 0a 0d 0a  0..-25..-825....
183e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
183f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
18400 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a   - col2 + col2 *
18410 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
18420 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
18430 0a 2d 32 30 35 34 0d 0a 2d 32 31 36 0d 0a 2d 33  .-2054..-216..-3
18440 30 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  040....query I r
18450 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
18460 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  LL + - col2 + co
18470 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46  l1 * cor0.col1 F
18480 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
18490 0d 0a 2d 2d 2d 2d 0d 0a 34 33 0d 0a 36 32 32 0d  ..----..43..622.
184a0 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .73....query I r
184b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
184c0 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b  LL cor0.col0 * +
184d0 20 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d   ( - col1 ) FROM
184e0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
184f0 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d  ..-1040..-640..-
18500 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  78....query I ro
18510 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
18520 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20  STINCT + col2 * 
18530 33 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  35 AS col0 FROM 
18540 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
18550 2d 2d 0d 0a 31 38 39 30 0d 0a 31 39 39 35 0d 0a  --..1890..1995..
18560 33 33 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3360....query I 
18570 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18580 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63  DISTINCT - ( + c
18590 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f  or0.col2 ) AS co
185a0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
185b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  cor0..----..-26.
185c0 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65  .-27..-38....que
185d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
185e0 4c 45 43 54 20 2b 20 39 37 20 46 52 4f 4d 20 74  LECT + 97 FROM t
185f0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
18600 2d 0d 0a 39 37 0d 0a 39 37 0d 0a 39 37 0d 0a 0d  -..97..97..97...
18610 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
18620 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
18630 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
18640 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
18650 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
18660 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18670 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 35  T DISTINCT - ( 5
18680 38 20 29 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c  8 ) * + col1 col
18690 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
186a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 38 38  or0..----..-4988
186b0 0d 0a 2d 35 32 37 38 0d 0a 2d 35 36 32 36 0d 0a  ..-5278..-5626..
186c0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
186d0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
186e0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
186f0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
18700 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
18710 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18720 43 54 20 2b 20 34 33 20 63 6f 6c 30 20 46 52 4f  CT + 43 col0 FRO
18730 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
18740 2d 0d 0a 34 33 0d 0a 34 33 0d 0a 34 33 0d 0a 0d  -..43..43..43...
18750 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18760 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 30 2e  ..SELECT - tab0.
18770 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 32 20 29 20  col1 + ( col2 ) 
18780 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
18790 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d  .-53..-9..-96...
187a0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
187b0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
187c0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
187d0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
187e0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
187f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18800 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
18810 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  2 col1 FROM tab0
18820 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
18830 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
18840 61 73 68 69 6e 67 20 74 6f 20 30 64 63 39 62 62  ashing to 0dc9bb
18850 65 33 39 32 64 35 32 64 66 39 33 64 32 61 31 31  e392d52df93d2a11
18860 35 64 37 66 36 32 32 64 62 61 0d 0a 0d 0a 71 75  5d7f622dba....qu
18870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18880 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
18890 20 38 33 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20   83 + cor0.col1 
188a0 2a 20 2d 20 36 36 20 46 52 4f 4d 20 74 61 62 30  * - 66 FROM tab0
188b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
188c0 2d 35 37 35 39 0d 0a 2d 36 30 38 39 0d 0a 2d 36  -5759..-6089..-6
188d0 34 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  485....query I r
188e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
188f0 20 38 34 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   84 FROM tab0, t
18900 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
18910 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31 20  2 AS cor1, tab1 
18920 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor2..----..8
18930 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
18940 20 74 6f 20 61 61 61 62 63 31 32 36 36 61 31 62   to aaabc1266a1b
18950 62 34 66 34 37 37 30 39 31 66 66 62 63 32 34 33  b4f477091ffbc243
18960 63 38 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  c849....query I 
18970 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18980 2b 20 33 36 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  + 36 + cor0.col2
18990 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
189a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 32 0d 0a 36 33  r0..----..62..63
189b0 0d 0a 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..74....query I 
189c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
189d0 41 4c 4c 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29  ALL - ( - col2 )
189e0 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
189f0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39  1 cor0..----..29
18a00 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d 0a  16..3249..9216..
18a10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18a20 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
18a30 43 54 20 2d 20 2b 20 28 20 2d 20 63 6f 6c 32 20  CT - + ( - col2 
18a40 29 20 2b 20 33 37 20 2a 20 63 6f 6c 30 20 2a 20  ) + 37 * col0 * 
18a50 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
18a60 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
18a70 2d 2d 2d 2d 0d 0a 32 33 37 33 37 0d 0a 32 39 34  ----..23737..294
18a80 30 0d 0a 33 38 35 37 36 0d 0a 0d 0a 71 75 65 72  0..38576....quer
18a90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18aa0 45 43 54 20 32 39 20 2b 20 2d 20 63 6f 6c 31 20  ECT 29 + - col1 
18ab0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
18ac0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 36  0..----..-57..-6
18ad0 32 0d 0a 2d 36 38 0d 0a 0d 0a 71 75 65 72 79 20  2..-68....query 
18ae0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18af0 54 20 44 49 53 54 49 4e 43 54 20 39 38 20 2b 20  T DISTINCT 98 + 
18b00 31 38 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63  18 * - col1 AS c
18b10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
18b20 2d 2d 2d 0d 0a 2d 31 33 36 0d 0a 2d 33 37 30 0d  ---..-136..-370.
18b30 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-82....query I 
18b40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18b50 36 32 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  62 + col1 * col1
18b60 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
18b70 0d 0a 31 30 32 33 0d 0a 33 35 31 0d 0a 33 35 34  ..1023..351..354
18b80 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
18b90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
18ba0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b   + cor0.col1 * +
18bb0 20 63 6f 6c 32 20 2a 20 35 37 20 41 53 20 63 6f   col2 * 57 AS co
18bc0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
18bd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 34 39  cor0..----..3249
18be0 30 0d 0a 37 31 31 33 36 0d 0a 38 30 30 32 38 0d  0..71136..80028.
18bf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18c00 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
18c10 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b   col1 * + col1 +
18c20 20 63 6f 6c 32 20 2a 20 2b 20 28 20 34 20 29 20   col2 * + ( 4 ) 
18c30 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
18c40 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d  2..----..-137..-
18c50 33 33 37 37 0d 0a 2d 38 35 33 0d 0a 0d 0a 71 75  3377..-853....qu
18c60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18c70 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
18c80 20 2b 20 33 31 20 29 20 41 53 20 63 6f 6c 32 20   + 31 ) AS col2 
18c90 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
18ca0 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
18cb0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d   cor1..----..31.
18cc0 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
18cd0 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
18ce0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a  ELECT DISTINCT *
18cf0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
18d00 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20  , tab1 AS cor0, 
18d10 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
18d20 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68  --..972 values h
18d30 61 73 68 69 6e 67 20 74 6f 20 36 37 63 35 33 30  ashing to 67c530
18d40 30 62 63 35 63 62 61 30 62 65 34 66 35 34 61 34  0bc5cba0be4f54a4
18d50 34 34 64 63 36 66 30 35 62 39 0d 0a 0d 0a 71 75  44dc6f05b9....qu
18d60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18d70 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 31 30 20  ELECT col1 + 10 
18d80 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
18d90 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  2 cor0..----..27
18da0 0d 0a 34 31 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72  ..41..69....quer
18db0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18dc0 45 43 54 20 41 4c 4c 20 28 20 63 6f 6c 32 20 29  ECT ALL ( col2 )
18dd0 20 2b 20 2b 20 38 31 20 41 53 20 63 6f 6c 30 20   + + 81 AS col0 
18de0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
18df0 0a 31 31 34 0d 0a 31 36 33 0d 0a 38 32 0d 0a 0d  .114..163..82...
18e00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18e10 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
18e20 2b 20 2d 20 63 6f 6c 31 20 2a 20 74 61 62 31 2e  + - col1 * tab1.
18e30 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
18e40 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab1..----..-3
18e50 36 0d 0a 2d 36 37 33 0d 0a 2d 38 39 0d 0a 0d 0a  6..-673..-89....
18e60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18e70 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31  .SELECT - - col1
18e80 20 2b 20 63 6f 6c 31 20 2a 20 28 20 2d 20 63 6f   + col1 * ( - co
18e90 6c 30 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  l0 ) * col0 FROM
18ea0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
18eb0 2d 2d 2d 0d 0a 2d 31 31 38 37 32 38 0d 0a 2d 34  ---..-118728..-4
18ec0 39 34 35 30 0d 0a 2d 37 32 30 37 32 30 0d 0a 0d  9450..-720720...
18ed0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18ee0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
18ef0 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20  T - cor0.col0 - 
18f00 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
18f10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
18f20 34 0d 0a 2d 31 35 36 0d 0a 2d 31 35 38 0d 0a 0d  4..-156..-158...
18f30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18f40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
18f50 6f 72 30 2e 63 6f 6c 31 20 2d 20 63 6f 72 30 2e  or0.col1 - cor0.
18f60 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
18f70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
18f80 31 39 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d  19..-173..-98...
18f90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18fa0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
18fb0 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  + + col1 * col0 
18fc0 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  * - cor0.col2 FR
18fd0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
18fe0 0a 2d 2d 2d 2d 0d 0a 2d 33 33 36 30 0d 0a 2d 36  .----..-3360..-6
18ff0 36 34 30 32 39 0d 0a 2d 36 38 30 38 38 0d 0a 0d  64029..-68088...
19000 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19010 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
19020 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 * col1 FROM 
19030 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38  tab1..----..1248
19040 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71  ..1404..570....q
19050 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19060 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
19070 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  - cor0.col0 FROM
19080 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
19090 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 63 6f  OSS JOIN tab1 co
190a0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36  r1..----..-3..-6
190b0 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20  4..-80....query 
190c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
190d0 54 20 2d 20 28 20 2d 20 74 61 62 30 2e 63 6f 6c  T - ( - tab0.col
190e0 30 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  0 ) FROM tab0..-
190f0 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d  ---..24..35..89.
19100 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
19110 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
19120 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
19130 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
19140 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
19150 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19160 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d  ECT ALL col1 * -
19170 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20   col0 col0 FROM 
19180 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34  tab2..----..-134
19190 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a  3..-217..-4602..
191a0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
191b0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
191c0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
191d0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
191e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34  rowsort label-74
191f0 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  3..SELECT ALL co
19200 6c 30 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63  l0 DIV col1 AS c
19210 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
19220 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
19230 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
19240 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
19250 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
19260 61 62 65 6c 2d 37 34 33 0d 0a 53 45 4c 45 43 54  abel-743..SELECT
19270 20 41 4c 4c 20 63 6f 6c 30 20 2f 20 63 6f 6c 31   ALL col0 / col1
19280 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
19290 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b0..----..0..0..
192a0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
192b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
192c0 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63  TINCT - col2 * c
192d0 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 * col1 FROM 
192e0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34  tab1..----..-364
192f0 38 30 0d 0a 2d 34 32 31 32 0d 0a 2d 39 39 38 34  80..-4212..-9984
19300 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
19310 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74  sort..SELECT + t
19320 61 62 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  ab0.col1 * - col
19330 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
19340 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34  ab0..----..-2064
19350 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a  ..-3395..-8099..
19360 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19370 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
19380 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30  CT col1 * + col0
19390 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
193a0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
193b0 0a 32 33 34 0d 0a 34 30 39 36 30 0d 0a 38 33 32  .234..40960..832
193c0 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  00....query III 
193d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
193e0 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  ALL * FROM tab0 
193f0 57 48 45 52 45 20 4e 4f 54 20 2b 20 63 6f 6c 32  WHERE NOT + col2
19400 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32   + col0 * + col2
19410 20 4e 4f 54 20 42 45 54 57 45 45 4e 20 2d 20 63   NOT BETWEEN - c
19420 6f 6c 31 20 41 4e 44 20 2d 20 63 6f 6c 31 20 41  ol1 AND - col1 A
19430 4e 44 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28  ND NULL NOT IN (
19440 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32   - col2 * - col2
19450 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72   )..----....quer
19460 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19470 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  ECT cor0.col1 + 
19480 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20  - col1 * + col2 
19490 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
194a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
194b0 0a 2d 31 34 37 35 0d 0a 2d 36 32 39 0d 0a 2d 38  .-1475..-629..-8
194c0 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  06....query I ro
194d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
194e0 4c 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  L - col1 + col2 
194f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
19500 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  0 cor0..----..-5
19510 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 71 75  3..-9..-96....qu
19520 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19530 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d  ELECT - col2 + -
19540 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
19550 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
19560 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
19570 2d 0d 0a 2d 31 33 38 31 0d 0a 2d 32 34 34 0d 0a  -..-1381..-244..
19580 2d 34 36 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -4628....query I
19590 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
195a0 20 44 49 53 54 49 4e 43 54 20 28 20 63 6f 6c 32   DISTINCT ( col2
195b0 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   ) * col1 + - co
195c0 6c 30 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20 41  l0 * tab0.col1 A
195d0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
195e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 39 38 0d 0a 2d  ..----..-3298..-
195f0 36 33 37 0d 0a 37 37 34 0d 0a 0d 0a 71 75 65 72  637..774....quer
19600 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19610 45 43 54 20 41 4c 4c 20 28 20 63 6f 6c 30 20 29  ECT ALL ( col0 )
19620 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t
19630 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a  ab1..----..-16..
19640 2d 35 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20  -51..7....query 
19650 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19660 54 20 63 6f 6c 30 20 2b 20 2b 20 32 37 20 2a 20  T col0 + + 27 * 
19670 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col0 + + col2 AS
19680 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
19690 0a 2d 2d 2d 2d 0d 0a 32 32 31 30 0d 0a 32 32 33  .----..2210..223
196a0 0d 0a 32 32 35 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..2250....skipif
196b0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
196c0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
196d0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
196e0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
196f0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
19700 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62  rt..SELECT + tab
19710 31 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 63 6f  1.col1 * col0 co
19720 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
19730 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37  --..1040..640..7
19740 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
19750 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
19760 20 63 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 31   col2 + - ( col1
19770 20 2a 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d   * + col1 ) FROM
19780 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35   tab2..----..-25
19790 31 0d 0a 2d 33 34 35 35 0d 0a 2d 39 33 34 0d 0a  1..-3455..-934..
197a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
197b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
197c0 63 6f 6c 32 20 2b 20 2b 20 36 38 20 46 52 4f 4d  col2 + + 68 FROM
197d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
197e0 2d 2d 2d 0d 0a 2d 32 38 0d 0a 31 31 0d 0a 31 34  ---..-28..11..14
197f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19800 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
19810 2d 20 2b 20 31 32 20 46 52 4f 4d 20 74 61 62 30  - + 12 FROM tab0
19820 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19830 2d 31 32 0d 0a 2d 31 32 0d 0a 2d 31 32 0d 0a 0d  -12..-12..-12...
19840 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
19850 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
19860 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
19870 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
19880 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
19890 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
198a0 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 32  T ALL col1 * + 2
198b0 37 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  7 col2 FROM tab1
198c0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 30 0d 0a 33 35 31  ..----..270..351
198d0 0d 0a 37 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..702....onlyif 
198e0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
198f0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
19900 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
19910 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
19920 61 62 65 6c 2d 37 35 39 0d 0a 53 45 4c 45 43 54  abel-759..SELECT
19930 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 37 39   DISTINCT + + 79
19940 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c   DIV col1 AS col
19950 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
19960 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d  or0..----..1..2.
19970 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .4....skipif mys
19980 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
19990 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
199a0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35 39 0d 0a  sort label-759..
199b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
199c0 2b 20 2b 20 37 39 20 2f 20 63 6f 6c 31 20 41 53  + + 79 / col1 AS
199d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
199e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
199f0 0d 0a 32 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20  ..2..4....query 
19a00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19a10 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72  T DISTINCT + cor
19a20 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  0.col0 + + col1 
19a30 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  * col2 + + col2 
19a40 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
19a50 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 38 0d 0a 37  0..----..1638..7
19a60 36 33 0d 0a 38 37 31 0d 0a 0d 0a 71 75 65 72 79  63..871....query
19a70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19a80 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  CT - col1 * col0
19a90 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
19aa0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
19ab0 0a 2d 31 34 32 32 0d 0a 2d 32 32 34 0d 0a 2d 34  .-1422..-224..-4
19ac0 36 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  680....onlyif my
19ad0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
19ae0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
19af0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
19b00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
19b10 65 6c 2d 37 36 32 0d 0a 53 45 4c 45 43 54 20 63  el-762..SELECT c
19b20 6f 6c 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol1 DIV cor0.col
19b30 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  2 + - col2 * - c
19b40 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  or0.col1 * + col
19b50 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
19b60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a  or0..----..194..
19b70 36 31 31 38 38 35 0d 0a 39 33 36 35 36 0d 0a 0d  611885..93656...
19b80 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
19b90 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
19ba0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
19bb0 6c 61 62 65 6c 2d 37 36 32 0d 0a 53 45 4c 45 43  label-762..SELEC
19bc0 54 20 63 6f 6c 31 20 2f 20 63 6f 72 30 2e 63 6f  T col1 / cor0.co
19bd0 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  l2 + - col2 * - 
19be0 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f  cor0.col1 * + co
19bf0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
19c00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d  cor0..----..194.
19c10 0a 36 31 31 38 38 35 0d 0a 39 33 36 35 36 0d 0a  .611885..93656..
19c20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19c30 74 0d 0a 53 45 4c 45 43 54 20 32 31 20 2a 20 2d  t..SELECT 21 * -
19c40 20 74 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab2.col2 FROM 
19c50 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 36  tab2..----..-546
19c60 0d 0a 2d 35 36 37 0d 0a 2d 37 39 38 0d 0a 0d 0a  ..-567..-798....
19c70 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
19c80 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
19c90 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
19ca0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
19cb0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 36 34 0d  wsort label-764.
19cc0 0a 53 45 4c 45 43 54 20 2d 20 37 32 20 44 49 56  .SELECT - 72 DIV
19cd0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
19ce0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
19cf0 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d  .----..-1..-2..-
19d00 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
19d10 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
19d20 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
19d30 6f 72 74 20 6c 61 62 65 6c 2d 37 36 34 0d 0a 53  ort label-764..S
19d40 45 4c 45 43 54 20 2d 20 37 32 20 2f 20 63 6f 6c  ELECT - 72 / col
19d50 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
19d60 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
19d70 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 34 0d 0a 0d  -..-1..-2..-4...
19d80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19d90 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 38 34 20  ..SELECT - + 84 
19da0 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + + col0 FROM ta
19db0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
19dc0 0d 0a 2d 32 30 0d 0a 2d 34 0d 0a 2d 38 31 0d 0a  ..-20..-4..-81..
19dd0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
19de0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
19df0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
19e00 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
19e10 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 36  rowsort label-76
19e20 36 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  6..SELECT + + co
19e30 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  l0 * + col1 + co
19e40 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30  r0.col1 * + col0
19e50 20 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30   - col1 DIV col0
19e60 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
19e70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 38 36 0d 0a  r0..----..2686..
19e80 34 33 30 0d 0a 39 32 30 34 0d 0a 0d 0a 73 6b 69  430..9204....ski
19e90 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
19ea0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
19eb0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
19ec0 6c 2d 37 36 36 0d 0a 53 45 4c 45 43 54 20 2b 20  l-766..SELECT + 
19ed0 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  + col0 * + col1 
19ee0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20  + cor0.col1 * + 
19ef0 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2f 20 63 6f  col0 - col1 / co
19f00 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
19f10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 38 36  cor0..----..2686
19f20 0d 0a 34 33 30 0d 0a 39 32 30 34 0d 0a 0d 0a 73  ..430..9204....s
19f30 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
19f40 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
19f50 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
19f60 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
19f70 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
19f80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19f90 41 4c 4c 20 28 20 2b 20 74 61 62 31 2e 63 6f 6c  ALL ( + tab1.col
19fa0 32 20 29 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d  2 ) + - col2 * -
19fb0 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 63   col0 + - col2 c
19fc0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
19fd0 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a  ---..162..3648..
19fe0 37 36 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  7680....skipif p
19ff0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1a000 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1a010 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1a020 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1a030 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a040 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
1a050 2b 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20  + + col0 - col0 
1a060 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
1a070 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39  or0..----..86..9
1a080 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  1..97....query I
1a090 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a0a0 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   - + col0 * + co
1a0b0 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l1 + col2 AS col
1a0c0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1a0d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 33 31  or0..----..-2031
1a0e0 0d 0a 2d 33 33 39 34 0d 0a 2d 38 30 31 37 0d 0a  ..-3394..-8017..
1a0f0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1a100 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1a110 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1a120 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1a130 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1a140 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a150 43 54 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 32 20  CT + + ( + col2 
1a160 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  ) + cor0.col2 * 
1a170 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d  - col1 col1 FROM
1a180 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1a190 0d 0a 2d 32 38 30 35 0d 0a 2d 37 33 38 30 0d 0a  ..-2805..-7380..
1a1a0 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -96....query I r
1a1b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1a1c0 49 53 54 49 4e 43 54 20 2d 20 34 20 2b 20 74 61  ISTINCT - 4 + ta
1a1d0 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  b0.col0 AS col1 
1a1e0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
1a1f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a  cor0..----..20..
1a200 33 31 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20  31..85....query 
1a210 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a220 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  T + col2 * col1 
1a230 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  * + cor0.col1 FR
1a240 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1a250 0a 2d 2d 2d 2d 0d 0a 32 34 34 30 36 38 0d 0a 36  .----..244068..6
1a260 37 39 30 34 32 0d 0a 39 34 30 39 0d 0a 0d 0a 6f  79042..9409....o
1a270 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1a280 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1a290 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1a2a0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1a2b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a2c0 74 20 6c 61 62 65 6c 2d 37 37 33 0d 0a 53 45 4c  t label-773..SEL
1a2d0 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  ECT CAST( NULL A
1a2e0 53 20 53 49 47 4e 45 44 20 29 20 2a 20 28 20 2d  S SIGNED ) * ( -
1a2f0 20 74 61 62 31 2e 63 6f 6c 32 20 29 20 2b 20 63   tab1.col2 ) + c
1a300 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
1a310 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab1..----..NUL
1a320 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1a330 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1a340 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1a350 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1a360 6c 61 62 65 6c 2d 37 37 33 0d 0a 53 45 4c 45 43  label-773..SELEC
1a370 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  T CAST ( NULL AS
1a380 20 49 4e 54 45 47 45 52 20 29 20 2a 20 28 20 2d   INTEGER ) * ( -
1a390 20 74 61 62 31 2e 63 6f 6c 32 20 29 20 2b 20 63   tab1.col2 ) + c
1a3a0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
1a3b0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab1..----..NUL
1a3c0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1a3d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a3e0 0d 0a 53 45 4c 45 43 54 20 32 32 20 2a 20 2d 20  ..SELECT 22 * - 
1a3f0 37 31 20 2a 20 63 6f 6c 30 20 2d 20 2b 20 63 6f  71 * col0 - + co
1a400 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
1a410 2d 2d 0d 0a 2d 31 33 39 31 30 37 0d 0a 2d 33 37  --..-139107..-37
1a420 35 31 32 0d 0a 2d 35 34 37 30 35 0d 0a 0d 0a 6f  512..-54705....o
1a430 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1a440 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1a450 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1a460 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1a470 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 35 0d 0a  sort label-775..
1a480 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1a490 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 32 20  col1 DIV - col2 
1a4a0 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
1a4b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 38 33  ..----..-35..-83
1a4c0 0d 0a 2d 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-98....skipif 
1a4d0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1a4e0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1a4f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37  rowsort label-77
1a500 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
1a510 43 54 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32  CT col1 / - col2
1a520 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
1a530 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 38  0..----..-35..-8
1a540 33 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20  3..-98....query 
1a550 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a560 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  T col0 + + col2 
1a570 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  - col1 * col2 FR
1a580 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
1a590 31 30 37 32 0d 0a 2d 31 33 34 37 0d 0a 2d 34 34  1072..-1347..-44
1a5a0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
1a5b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1a5c0 54 49 4e 43 54 20 37 38 20 2d 20 74 61 62 30 2e  TINCT 78 - tab0.
1a5d0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
1a5e0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  M tab0..----..-4
1a5f0 0d 0a 34 35 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72  ..45..77....quer
1a600 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a610 45 43 54 20 44 49 53 54 49 4e 43 54 20 33 37 20  ECT DISTINCT 37 
1a620 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  - + col1 AS col2
1a630 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1a640 0d 0a 2d 32 32 0d 0a 32 30 0d 0a 36 0d 0a 0d 0a  ..-22..20..6....
1a650 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a660 0a 53 45 4c 45 43 54 20 2d 20 36 34 20 2b 20 2b  .SELECT - 64 + +
1a670 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 41   col1 + - col2 A
1a680 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1a690 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 0d 0a 2d 31  ..----..-111..-1
1a6a0 34 37 0d 0a 2d 39 32 0d 0a 0d 0a 71 75 65 72 79  47..-92....query
1a6b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a6c0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
1a6d0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   - col1 AS col1 
1a6e0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1a6f0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
1a700 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1a710 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f  STINCT - cor0.co
1a720 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
1a730 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1a740 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a  .-54..-57..-96..
1a750 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a760 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1a770 2b 20 33 35 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  + 35 + cor0.col0
1a780 20 2a 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d   * ( col0 ) FROM
1a790 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1a7a0 2d 2d 2d 0d 0a 34 31 33 31 0d 0a 34 34 0d 0a 36  ---..4131..44..6
1a7b0 34 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  435....query I r
1a7c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36  owsort..SELECT 6
1a7d0 31 20 2b 20 35 36 20 46 52 4f 4d 20 74 61 62 32  1 + 56 FROM tab2
1a7e0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
1a7f0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
1a800 61 73 68 69 6e 67 20 74 6f 20 66 66 66 61 30 35  ashing to fffa05
1a810 61 62 65 36 32 63 62 35 33 39 65 64 63 39 35 37  abe62cb539edc957
1a820 36 33 36 62 33 35 34 35 38 33 0d 0a 0d 0a 71 75  636b354583....qu
1a830 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a840 45 4c 45 43 54 20 39 34 20 46 52 4f 4d 20 74 61  ELECT 94 FROM ta
1a850 62 32 2c 20 74 61 62 32 20 63 6f 72 30 2c 20 74  b2, tab2 cor0, t
1a860 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
1a870 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
1a880 68 69 6e 67 20 74 6f 20 61 34 64 32 33 39 36 32  hing to a4d23962
1a890 36 63 66 30 35 34 36 61 63 31 62 32 66 35 37 62  6cf0546ac1b2f57b
1a8a0 62 38 34 30 37 30 38 39 0d 0a 0d 0a 6f 6e 6c 79  b8407089....only
1a8b0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1a8c0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1a8d0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1a8e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a8f0 74 20 6c 61 62 65 6c 2d 37 38 35 0d 0a 53 45 4c  t label-785..SEL
1a900 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74  ECT DISTINCT - t
1a910 61 62 30 2e 63 6f 6c 32 20 2a 20 34 30 20 44 49  ab0.col2 * 40 DI
1a920 56 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20  V - tab0.col2 + 
1a930 28 20 37 34 20 29 20 46 52 4f 4d 20 74 61 62 30  ( 74 ) FROM tab0
1a940 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
1a950 2d 2d 2d 2d 0d 0a 31 31 34 0d 0a 0d 0a 73 6b 69  ----..114....ski
1a960 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1a970 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1a980 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1a990 6c 2d 37 38 35 0d 0a 53 45 4c 45 43 54 20 44 49  l-785..SELECT DI
1a9a0 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e 63 6f  STINCT - tab0.co
1a9b0 6c 32 20 2a 20 34 30 20 2f 20 2d 20 74 61 62 30  l2 * 40 / - tab0
1a9c0 2e 63 6f 6c 32 20 2b 20 28 20 37 34 20 29 20 46  .col2 + ( 74 ) F
1a9d0 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
1a9e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
1a9f0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1aa00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1aa10 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 32   - col0 + - tab2
1aa20 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2a  .col0 * + col2 *
1aa30 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
1aa40 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 39 39 37 0d  2..----..113997.
1aa50 0a 35 30 39 36 0d 0a 35 32 36 35 30 0d 0a 0d 0a  .5096..52650....
1aa60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1aa70 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2d  .SELECT - col2 -
1aa80 20 2b 20 36 30 20 46 52 4f 4d 20 74 61 62 31 0d   + 60 FROM tab1.
1aa90 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 0d 0a 2d 31 31  .----..-114..-11
1aaa0 37 0d 0a 2d 31 35 36 0d 0a 0d 0a 71 75 65 72 79  7..-156....query
1aab0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1aac0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
1aad0 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20   + - ( - col1 ) 
1aae0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1aaf0 0a 31 31 38 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a  .118..34..62....
1ab00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ab10 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
1ab20 6f 6c 30 20 2b 20 2d 20 37 36 20 46 52 4f 4d 20  ol0 + - 76 FROM 
1ab30 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1ab40 0a 2d 31 35 34 0d 0a 2d 31 35 35 0d 0a 2d 38 33  .-154..-155..-83
1ab50 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1ab60 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1ab70 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1ab80 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1ab90 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1aba0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1abb0 4c 45 43 54 20 31 31 20 63 6f 6c 31 20 46 52 4f  LECT 11 col1 FRO
1abc0 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
1abd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
1abe0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1abf0 66 34 64 31 39 39 35 38 34 62 34 34 37 33 32 66  f4d199584b44732f
1ac00 31 61 38 39 37 65 36 36 39 31 62 34 65 61 30 30  1a897e6691b4ea00
1ac10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ac20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
1ac30 6c 30 20 2b 20 31 34 20 2a 20 2d 20 63 6f 6c 31  l0 + 14 * - col1
1ac40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1ac50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 38 0d  r0..----..-1228.
1ac60 0a 2d 31 33 36 33 0d 0a 2d 31 33 39 33 0d 0a 0d  .-1363..-1393...
1ac70 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1ac80 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1ac90 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1aca0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1acb0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1acc0 6f 72 74 20 6c 61 62 65 6c 2d 37 39 32 0d 0a 53  ort label-792..S
1acd0 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55  ELECT + CAST( NU
1ace0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  LL AS SIGNED ) *
1acf0 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
1ad00 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1ad10 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
1ad20 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
1ad30 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1ad40 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1ad50 6f 72 74 20 6c 61 62 65 6c 2d 37 39 32 0d 0a 53  ort label-792..S
1ad60 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 4e  ELECT + CAST ( N
1ad70 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
1ad80 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
1ad90 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1ada0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
1adb0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
1adc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1add0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63   cor0.col0 + + c
1ade0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
1adf0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
1ae00 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a 0d  ..128..160..6...
1ae10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ae20 0d 0a 53 45 4c 45 43 54 20 2b 20 32 20 2a 20 2d  ..SELECT + 2 * -
1ae30 20 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   7 FROM tab1 AS 
1ae40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d  cor0..----..-14.
1ae50 0a 2d 31 34 0d 0a 2d 31 34 0d 0a 0d 0a 71 75 65  .-14..-14....que
1ae60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ae70 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 31 20  LECT + ( + col1 
1ae80 29 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  ) * col1 * col2 
1ae90 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1aea0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 34 30 36 38 0d  0..----..244068.
1aeb0 0a 36 37 39 30 34 32 0d 0a 39 34 30 39 0d 0a 0d  .679042..9409...
1aec0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1aed0 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 36  ..SELECT + ( - 6
1aee0 31 20 29 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  1 ) * col1 AS co
1aef0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
1af00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 34  cor0..----..-524
1af10 36 0d 0a 2d 35 35 35 31 0d 0a 2d 35 39 31 37 0d  6..-5551..-5917.
1af20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1af30 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1af40 4e 43 54 20 2b 20 34 20 2b 20 2b 20 63 6f 6c 31  NCT + 4 + + col1
1af50 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
1af60 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1af70 2d 2d 2d 2d 0d 0a 31 31 34 0d 0a 31 33 36 0d 0a  ----..114..136..
1af80 31 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  184....query I r
1af90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1afa0 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31  ISTINCT + + col1
1afb0 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   + + col1 + col1
1afc0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1afd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 0d 0a 33 39  r0..----..30..39
1afe0 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..78....query I 
1aff0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1b000 41 4c 4c 20 2b 20 2b 20 33 31 20 2b 20 63 6f 6c  ALL + + 31 + col
1b010 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
1b020 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1b030 2d 0d 0a 31 30 39 0d 0a 31 31 30 0d 0a 33 38 0d  -..109..110..38.
1b040 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b050 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
1b060 2b 20 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  + 8 AS col0 FROM
1b070 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1b080 2d 2d 2d 0d 0a 33 32 0d 0a 34 33 0d 0a 39 37 0d  ---..32..43..97.
1b090 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b0a0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1b0b0 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  NCT - cor0.col1 
1b0c0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  + + cor0.col1 AS
1b0d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1b0e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1b0f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1b100 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1b110 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1b120 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1b130 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1b140 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b150 4c 45 43 54 20 41 4c 4c 20 32 30 20 63 6f 6c 31  LECT ALL 20 col1
1b160 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1b170 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32 30  r0..----..20..20
1b180 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..20....query I 
1b190 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1b1a0 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  + + col0 * col0 
1b1b0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1b1c0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39  2 cor0..----..49
1b1d0 0d 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a  ..6084..6241....
1b1e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b1f0 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c  .SELECT tab0.col
1b200 30 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 46 52  0 + tab0.col1 FR
1b210 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
1b220 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a  10..132..180....
1b230 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b240 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
1b250 72 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r1.col0 FROM tab
1b260 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  1, tab0 AS cor0,
1b270 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
1b280 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
1b290 61 73 68 69 6e 67 20 74 6f 20 37 37 38 62 35 30  ashing to 778b50
1b2a0 35 37 35 61 39 62 39 31 34 34 38 31 31 39 65 65  575a9b91448119ee
1b2b0 30 65 65 31 61 39 63 34 34 66 0d 0a 0d 0a 71 75  0ee1a9c44f....qu
1b2c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b2d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 32  ELECT DISTINCT 2
1b2e0 35 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  5 + + cor0.col1 
1b2f0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1b300 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a 31 31 36 0d 0a  ----..111..116..
1b310 31 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  122....query I r
1b320 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1b330 4c 4c 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 30  LL + col1 - col0
1b340 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1b350 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d  r0..----..-19..-
1b360 36 32 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20  62..24....query 
1b370 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b380 54 20 41 4c 4c 20 2d 20 28 20 2d 20 63 6f 6c 31  T ALL - ( - col1
1b390 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * + col1 + + co
1b3a0 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
1b3b0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  M tab0..----..73
1b3c0 31 30 0d 0a 38 31 39 30 0d 0a 39 33 31 32 0d 0a  10..8190..9312..
1b3d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b3e0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20  t..SELECT - ( + 
1b3f0 35 20 29 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20  5 ) + tab0.col0 
1b400 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1b410 0a 31 39 0d 0a 33 30 0d 0a 38 34 0d 0a 0d 0a 71  .19..30..84....q
1b420 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1b430 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1b440 2b 20 34 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  + 4 FROM tab1 co
1b450 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 0d 0a 71  r0..----..4....q
1b460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1b470 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 37 20  SELECT ALL - 87 
1b480 2b 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  + + ( + cor0.col
1b490 32 20 29 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63  2 ) * col1 * - c
1b4a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1b4b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
1b4c0 30 36 39 0d 0a 2d 32 36 30 33 34 0d 0a 2d 39 30  069..-26034..-90
1b4d0 35 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  593....query I r
1b4e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1b4f0 20 2d 20 37 20 46 52 4f 4d 20 74 61 62 30 20 41   - 7 FROM tab0 A
1b500 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d  S cor0..----..7.
1b510 0a 37 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .7..7....query I
1b520 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b530 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 31   ALL + cor0.col1
1b540 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 28 20   + ( col0 ) * ( 
1b550 63 6f 6c 30 20 29 20 2d 20 63 6f 6c 30 20 2a 20  col0 ) - col0 * 
1b560 2b 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  + ( col0 ) FROM 
1b570 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1b580 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a  --..10..13..26..
1b590 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b5a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1b5b0 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  CT + - cor0.col0
1b5c0 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32   * col0 - - col2
1b5d0 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
1b5e0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1b5f0 2d 0d 0a 2d 33 32 33 39 0d 0a 2d 34 30 35 36 0d  -..-3239..-4056.
1b600 0a 31 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .140....query I 
1b610 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1b620 39 34 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  94 + + col1 * - 
1b630 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
1b640 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
1b650 33 30 32 0d 0a 2d 38 31 38 37 0d 0a 2d 39 33 31  302..-8187..-931
1b660 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
1b670 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
1b680 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
1b690 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
1b6a0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
1b6b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31  rowsort label-81
1b6c0 36 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 43 41  6..SELECT - + CA
1b6d0 53 54 28 20 2d 20 28 20 63 6f 6c 31 20 29 20 41  ST( - ( col1 ) A
1b6e0 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63  S SIGNED ) * - c
1b6f0 6f 72 30 2e 63 6f 6c 31 20 2b 20 36 30 20 41 53  or0.col1 + 60 AS
1b700 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1b710 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1b720 32 32 39 0d 0a 2d 33 34 32 31 0d 0a 2d 39 30 31  229..-3421..-901
1b730 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1b740 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1b750 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1b760 72 74 20 6c 61 62 65 6c 2d 38 31 36 0d 0a 53 45  rt label-816..SE
1b770 4c 45 43 54 20 2d 20 2b 20 43 41 53 54 20 28 20  LECT - + CAST ( 
1b780 2d 20 28 20 63 6f 6c 31 20 29 20 41 53 20 49 4e  - ( col1 ) AS IN
1b790 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 72 30  TEGER ) * - cor0
1b7a0 2e 63 6f 6c 31 20 2b 20 36 30 20 41 53 20 63 6f  .col1 + 60 AS co
1b7b0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1b7c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 39  cor0..----..-229
1b7d0 0d 0a 2d 33 34 32 31 0d 0a 2d 39 30 31 0d 0a 0d  ..-3421..-901...
1b7e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b7f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1b800 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  T + col2 * - col
1b810 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 + col1 FROM ta
1b820 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1b830 0d 0a 2d 32 37 35 32 0d 0a 2d 37 33 37 31 0d 0a  ..-2752..-7371..
1b840 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1b850 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1b860 54 49 4e 43 54 20 2d 20 28 20 2b 20 63 6f 6c 30  TINCT - ( + col0
1b870 20 29 20 2b 20 36 33 20 46 52 4f 4d 20 74 61 62   ) + 63 FROM tab
1b880 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1b890 0a 2d 31 35 0d 0a 2d 31 36 0d 0a 35 36 0d 0a 0d  .-15..-16..56...
1b8a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b8b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 20 2a  ..SELECT ALL 6 *
1b8c0 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
1b8d0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1b8e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a  cor0..----..42..
1b8f0 34 36 38 0d 0a 34 37 34 0d 0a 0d 0a 6f 6e 6c 79  468..474....only
1b900 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1b910 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1b920 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1b930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b940 74 20 6c 61 62 65 6c 2d 38 32 30 0d 0a 53 45 4c  t label-820..SEL
1b950 45 43 54 20 41 4c 4c 20 2b 20 33 33 20 44 49 56  ECT ALL + 33 DIV
1b960 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1b970 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1b980 0d 0a 31 0d 0a 33 33 0d 0a 0d 0a 73 6b 69 70 69  ..1..33....skipi
1b990 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1b9a0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1b9b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b9c0 38 32 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  820..SELECT ALL 
1b9d0 2b 20 33 33 20 2f 20 63 6f 6c 32 20 46 52 4f 4d  + 33 / col2 FROM
1b9e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1b9f0 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 33 0d 0a 0d  ---..0..1..33...
1ba00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ba10 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1ba20 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72  T + col1 + - cor
1ba30 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  0.col1 AS col1 F
1ba40 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1ba50 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
1ba60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ba70 4c 45 43 54 20 2d 20 2d 20 33 30 20 46 52 4f 4d  LECT - - 30 FROM
1ba80 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
1ba90 0d 0a 33 30 0d 0a 33 30 0d 0a 33 30 0d 0a 0d 0a  ..30..30..30....
1baa0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1bab0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
1bac0 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  ( col2 ) FROM ta
1bad0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
1bae0 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 6f 6e 6c 79  ..33..82....only
1baf0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1bb00 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1bb10 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1bb20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bb30 74 20 6c 61 62 65 6c 2d 38 32 34 0d 0a 53 45 4c  t label-824..SEL
1bb40 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
1bb50 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b   col0 * - col0 +
1bb60 20 39 37 20 44 49 56 20 2d 20 36 33 20 41 53 20   97 DIV - 63 AS 
1bb70 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1bb80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
1bb90 32 34 0d 0a 35 37 35 0d 0a 37 39 32 30 0d 0a 0d  24..575..7920...
1bba0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1bbb0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1bbc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1bbd0 6c 61 62 65 6c 2d 38 32 34 0d 0a 53 45 4c 45 43  label-824..SELEC
1bbe0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
1bbf0 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 39  ol0 * - col0 + 9
1bc00 37 20 2f 20 2d 20 36 33 20 41 53 20 63 6f 6c 30  7 / - 63 AS col0
1bc10 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1bc20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 34 0d 0a  r0..----..1224..
1bc30 35 37 35 0d 0a 37 39 32 30 0d 0a 0d 0a 71 75 65  575..7920....que
1bc40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1bc50 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1bc60 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  col1 + cor0.col2
1bc70 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1bc80 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1bc90 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a  ..55..58..85....
1bca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1bcb0 0a 53 45 4c 45 43 54 20 2d 20 39 33 20 2a 20 2d  .SELECT - 93 * -
1bcc0 20 63 6f 6c 32 20 2b 20 2b 20 33 30 20 46 52 4f   col2 + + 30 FRO
1bcd0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1bce0 2d 2d 2d 2d 0d 0a 31 32 33 0d 0a 33 30 39 39 0d  ----..123..3099.
1bcf0 0a 37 36 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .7656....query I
1bd00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1bd10 20 41 4c 4c 20 2b 20 28 20 2b 20 63 6f 6c 30 20   ALL + ( + col0 
1bd20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
1bd30 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a  -..7..78..79....
1bd40 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1bd50 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1bd60 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1bd70 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1bd80 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1bd90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1bda0 20 2b 20 37 39 20 2b 20 2b 20 37 38 20 63 6f 6c   + 79 + + 78 col
1bdb0 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
1bdc0 2d 0d 0a 31 35 37 0d 0a 31 35 37 0d 0a 31 35 37  -..157..157..157
1bdd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1bde0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
1bdf0 38 37 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  87 * + col0 AS c
1be00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
1be10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 31   cor0..----..261
1be20 0d 0a 35 35 36 38 0d 0a 36 39 36 30 0d 0a 0d 0a  ..5568..6960....
1be30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1be40 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2d 20 2b  .SELECT col1 - +
1be50 20 38 39 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   89 FROM tab2..-
1be60 2d 2d 2d 0d 0a 2d 33 30 0d 0a 2d 35 38 0d 0a 2d  ---..-30..-58..-
1be70 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  72....query I ro
1be80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1be90 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2b 20  col1 * col2 + + 
1bea0 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col2 + - cor0.co
1beb0 6c 30 20 2a 20 2b 20 31 20 2a 20 28 20 63 6f 6c  l0 * + 1 * ( col
1bec0 31 20 2a 20 2d 20 28 20 2d 20 34 38 20 29 20 29  1 * - ( - 48 ) )
1bed0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1bee0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1bef0 0d 0a 2d 33 31 32 33 33 0d 0a 2d 35 30 39 34 0d  ..-31233..-5094.
1bf00 0a 2d 35 31 30 37 32 0d 0a 0d 0a 73 6b 69 70 69  .-51072....skipi
1bf10 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1bf20 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1bf30 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1bf40 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1bf50 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1bf60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1bf70 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  INCT + col2 * co
1bf80 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
1bf90 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35  0 cor0..----..35
1bfa0 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71  ..7298..792....q
1bfb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1bfc0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
1bfd0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
1bfe0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1bff0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34  ..----..1040..64
1c000 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  0..78....query I
1c010 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c020 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30   ALL - cor0.col0
1c030 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 63 6f   + ( col0 ) * co
1c040 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1c050 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d  cor0..----..182.
1c060 0a 31 39 35 30 0d 0a 32 39 32 33 0d 0a 0d 0a 71  .1950..2923....q
1c070 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c080 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20  SELECT - - col0 
1c090 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
1c0a0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1c0b0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
1c0c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c0d0 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2d 20 28 20  LECT - col2 - ( 
1c0e0 37 36 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 29  76 * cor0.col0 )
1c0f0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1c100 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 32 0d 0a  r0..----..-282..
1c110 2d 34 39 32 31 0d 0a 2d 36 31 37 36 0d 0a 0d 0a  -4921..-6176....
1c120 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c130 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
1c140 63 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 72 30 2e  col1 + ( + cor0.
1c150 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30  col1 ) FROM tab0
1c160 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c170 31 37 32 0d 0a 31 38 32 0d 0a 31 39 34 0d 0a 0d  172..182..194...
1c180 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c190 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1c1a0 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 35 36 20  T - col0 + + 56 
1c1b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1c1c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1c1d0 0a 2d 32 34 0d 0a 2d 38 0d 0a 35 33 0d 0a 0d 0a  .-24..-8..53....
1c1e0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1c1f0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1c200 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1c210 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1c220 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 39 0d  wsort label-839.
1c230 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b  .SELECT col0 + +
1c240 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 63   cor0.col0 DIV c
1c250 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1c260 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a   cor0..----..7..
1c270 37 39 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66  79..83....skipif
1c280 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1c290 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1c2a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1c2b0 33 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  39..SELECT col0 
1c2c0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20  + + cor0.col0 / 
1c2d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1c2e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d  S cor0..----..7.
1c2f0 0a 37 39 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79  .79..83....query
1c300 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c310 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20  CT ALL + col1 * 
1c320 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
1c330 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
1c340 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a 36 37 36  -..100..169..676
1c350 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c360 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1c370 2d 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f 6c  - col2 * ( - col
1c380 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  2 ) FROM tab2 AS
1c390 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34   cor0..----..144
1c3a0 34 0d 0a 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71  4..676..729....q
1c3b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c3c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1c3d0 2b 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c  + + col0 - - col
1c3e0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
1c3f0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1c400 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d  -..104..117..34.
1c410 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c420 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1c430 20 38 38 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   88 FROM tab0, t
1c440 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a  ab1, tab1 cor0..
1c450 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
1c460 68 61 73 68 69 6e 67 20 74 6f 20 65 62 38 63 62  hashing to eb8cb
1c470 65 66 61 37 64 38 33 31 65 31 61 30 31 38 33 65  efa7d831e1a0183e
1c480 39 31 39 65 32 63 61 65 66 33 32 0d 0a 0d 0a 73  919e2caef32....s
1c490 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1c4a0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1c4b0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1c4c0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1c4d0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1c4e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c4f0 2b 20 35 32 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  + 52 + + col1 + 
1c500 63 6f 6c 31 20 2a 20 2d 20 33 33 20 63 6f 6c 30  col1 * - 33 col0
1c510 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1c520 0d 0a 2d 32 37 30 30 0d 0a 2d 32 38 36 30 0d 0a  ..-2700..-2860..
1c530 2d 33 30 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -3052....query I
1c540 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c550 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
1c560 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   - - col1 FROM t
1c570 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32  ab0..----..2..62
1c580 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c590 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1c5a0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20  + cor0.col0 * - 
1c5b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1c5c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
1c5d0 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32 34 31 0d  9..-6084..-6241.
1c5e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c5f0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
1c600 30 2e 63 6f 6c 30 20 2b 20 28 20 2b 20 63 6f 6c  0.col0 + ( + col
1c610 32 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20  2 ) * - col1 AS 
1c620 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
1c630 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1c640 36 31 32 0d 0a 2d 37 32 35 0d 0a 2d 38 34 34 0d  612..-725..-844.
1c650 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c660 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1c670 6f 72 30 2e 63 6f 6c 30 20 2a 20 28 20 63 6f 72  or0.col0 * ( cor
1c680 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  0.col2 + - col1 
1c690 29 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  ) * - col0 AS co
1c6a0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
1c6b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 32  cor0..----..-192
1c6c0 35 31 32 0d 0a 2d 32 35 32 0d 0a 2d 35 33 31 32  512..-252..-5312
1c6d0 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
1c6e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1c6f0 4c 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 37  L - + col0 * + 7
1c700 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  8 AS col0 FROM t
1c710 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1c720 2d 0d 0a 2d 32 33 34 0d 0a 2d 34 39 39 32 0d 0a  -..-234..-4992..
1c730 2d 36 32 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -6240....query I
1c740 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c750 20 2d 20 35 20 46 52 4f 4d 20 74 61 62 31 2c 20   - 5 FROM tab1, 
1c760 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1c770 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
1c780 68 69 6e 67 20 74 6f 20 37 34 36 36 35 66 62 62  hing to 74665fbb
1c790 34 37 64 35 62 31 37 64 61 30 31 31 62 63 61 35  47d5b17da011bca5
1c7a0 36 37 31 39 35 62 32 31 0d 0a 0d 0a 6f 6e 6c 79  67195b21....only
1c7b0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1c7c0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1c7d0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1c7e0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1c7f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1c800 61 62 65 6c 2d 38 35 31 0d 0a 53 45 4c 45 43 54  abel-851..SELECT
1c810 20 2d 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53   - CAST( col0 AS
1c820 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
1c830 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1c840 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39  -..-24..-35..-89
1c850 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1c860 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1c870 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1c880 72 74 20 6c 61 62 65 6c 2d 38 35 31 0d 0a 53 45  rt label-851..SE
1c890 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 63 6f  LECT - CAST ( co
1c8a0 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
1c8b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1c8c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33  0..----..-24..-3
1c8d0 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20  5..-89....query 
1c8e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c8f0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 28  T DISTINCT + + (
1c900 20 38 38 20 29 20 41 53 20 63 6f 6c 31 20 46 52   88 ) AS col1 FR
1c910 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1c920 0a 2d 2d 2d 2d 0d 0a 38 38 0d 0a 0d 0a 71 75 65  .----..88....que
1c930 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 20  ry IIIIIIIIIIII 
1c940 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c950 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20  DISTINCT * FROM 
1c960 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20  tab1 cor0 CROSS 
1c970 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61 62 30 20  JOIN tab0, tab0 
1c980 63 6f 72 31 2c 20 74 61 62 31 20 63 6f 72 32 0d  cor1, tab1 cor2.
1c990 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65  .----..972 value
1c9a0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 61 66  s hashing to 9af
1c9b0 36 37 64 36 66 39 38 30 31 30 34 36 34 61 66 35  67d6f98010464af5
1c9c0 64 35 36 30 62 66 39 34 39 64 34 38 37 0d 0a 0d  d560bf949d487...
1c9d0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1c9e0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1c9f0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1ca00 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1ca10 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1ca20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ca30 54 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20  T - tab1.col1 + 
1ca40 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
1ca50 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a  ab1..----..-23..
1ca60 35 34 0d 0a 36 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  54..67....onlyif
1ca70 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1ca80 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1ca90 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1caa0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1cab0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1cac0 65 6c 2d 38 35 35 0d 0a 53 45 4c 45 43 54 20 2b  el-855..SELECT +
1cad0 20 63 6f 6c 30 20 2d 20 2d 20 43 41 53 54 28 20   col0 - - CAST( 
1cae0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
1caf0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1cb00 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
1cb10 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
1cb20 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1cb30 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1cb40 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35 35 0d 0a  sort label-855..
1cb50 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2d 20  SELECT + col0 - 
1cb60 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
1cb70 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
1cb80 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab1..----..NULL
1cb90 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
1cba0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1cbb0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1cbc0 20 2b 20 63 6f 6c 31 20 2a 20 28 20 2d 20 28 20   + col1 * ( - ( 
1cbd0 2d 20 63 6f 6c 32 20 29 20 29 20 2b 20 38 30 20  - col2 ) ) + 80 
1cbe0 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  * col0 AS col1 F
1cbf0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1cc00 31 33 39 37 0d 0a 36 39 36 36 0d 0a 37 37 37 34  1397..6966..7774
1cc10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1cc20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 31  ort..SELECT tab1
1cc30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41  .col1 * - col0 A
1cc40 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1cc50 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d  ..----..-1040..-
1cc60 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 6f 6e 6c 79  640..-78....only
1cc70 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1cc80 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1cc90 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1cca0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ccb0 74 20 6c 61 62 65 6c 2d 38 35 38 0d 0a 53 45 4c  t label-858..SEL
1ccc0 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 30 2e 63  ECT ALL + tab0.c
1ccd0 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20 46 52 4f  ol2 DIV col2 FRO
1cce0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab0..----..1.
1ccf0 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..1....skipif 
1cd00 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1cd10 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1cd20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35  rowsort label-85
1cd30 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  8..SELECT ALL + 
1cd40 74 61 62 30 2e 63 6f 6c 32 20 2f 20 63 6f 6c 32  tab0.col2 / col2
1cd50 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1cd60 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65  ..1..1..1....que
1cd70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1cd80 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20  LECT - + col1 * 
1cd90 2b 20 63 6f 6c 30 20 2b 20 2b 20 33 36 20 46 52  + col0 + + 36 FR
1cda0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1cdb0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 34 0d 0a 2d 34  .----..-1004..-4
1cdc0 32 0d 0a 2d 36 30 34 0d 0a 0d 0a 71 75 65 72 79  2..-604....query
1cdd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cde0 43 54 20 2b 20 37 31 20 2a 20 2d 20 63 6f 6c 31  CT + 71 * - col1
1cdf0 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + - col0 AS col
1ce00 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
1ce10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31 33 30  or0..----..-6130
1ce20 0d 0a 2d 36 35 35 30 0d 0a 2d 36 39 32 32 0d 0a  ..-6550..-6922..
1ce30 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1ce40 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1ce50 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1ce60 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1ce70 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1ce80 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 31 0d 0a  sort label-861..
1ce90 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1cea0 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20  + col2 + col1 * 
1ceb0 2b 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20  + CAST( col1 AS 
1cec0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
1ced0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1cee0 0d 0a 33 32 37 0d 0a 33 35 30 37 0d 0a 39 38 38  ..327..3507..988
1cef0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1cf00 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1cf10 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1cf20 72 74 20 6c 61 62 65 6c 2d 38 36 31 0d 0a 53 45  rt label-861..SE
1cf30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1cf40 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col2 + col1 * + 
1cf50 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49  CAST ( col1 AS I
1cf60 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
1cf70 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1cf80 0d 0a 33 32 37 0d 0a 33 35 30 37 0d 0a 39 38 38  ..327..3507..988
1cf90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1cfa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 32  ort..SELECT + 72
1cfb0 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
1cfc0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
1cfd0 2d 0d 0a 2d 31 38 37 32 0d 0a 2d 37 32 30 0d 0a  -..-1872..-720..
1cfe0 2d 39 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -936....query I 
1cff0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d000 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ALL - cor0.col2 
1d010 2a 20 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  * 2 AS col1 FROM
1d020 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1d030 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 31 31 34 0d  ---..-108..-114.
1d040 0a 2d 31 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-192....skipif 
1d050 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1d060 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1d070 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1d080 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1d090 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d0a0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
1d0b0 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 31 20   cor0.col1 col1 
1d0c0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1d0d0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33  0..----..2064..3
1d0e0 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 6f 6e 6c  395..8099....onl
1d0f0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1d100 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1d110 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1d120 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1d130 72 74 20 6c 61 62 65 6c 2d 38 36 35 0d 0a 53 45  rt label-865..SE
1d140 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
1d150 32 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20  2 DIV col1 FROM 
1d160 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1d170 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
1d180 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1d190 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1d1a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1d1b0 62 65 6c 2d 38 36 35 0d 0a 53 45 4c 45 43 54 20  bel-865..SELECT 
1d1c0 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2f 20 63  ALL - - col2 / c
1d1d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1d1e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
1d1f0 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
1d200 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d210 32 36 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  26 FROM tab2, ta
1d220 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b1 cor0..----..9
1d230 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1d240 74 6f 20 32 64 31 63 33 31 32 39 65 64 31 37 66  to 2d1c3129ed17f
1d250 64 37 32 31 64 34 38 37 36 62 32 31 63 30 33 35  d721d4876b21c035
1d260 35 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  584....query I r
1d270 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1d280 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a  ISTINCT - col2 *
1d290 20 37 34 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   74 FROM tab1..-
1d2a0 2d 2d 2d 0d 0a 2d 33 39 39 36 0d 0a 2d 34 32 31  ---..-3996..-421
1d2b0 38 0d 0a 2d 37 31 30 34 0d 0a 0d 0a 73 6b 69 70  8..-7104....skip
1d2c0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1d2d0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1d2e0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1d2f0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1d300 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1d310 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1d320 30 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20  0 * + col1 col1 
1d330 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1d340 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33  0..----..2064..3
1d350 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 6f 6e 6c  395..8099....onl
1d360 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
1d370 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
1d380 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
1d390 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
1d3a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1d3b0 6c 61 62 65 6c 2d 38 36 39 0d 0a 53 45 4c 45 43  label-869..SELEC
1d3c0 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 43 41 53  T - - col1 * CAS
1d3d0 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45  T( col1 AS SIGNE
1d3e0 44 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  D ) + col0 FROM 
1d3f0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1d400 2d 2d 0d 0a 31 36 34 0d 0a 32 34 39 0d 0a 36 37  --..164..249..67
1d410 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
1d420 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1d430 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1d440 6f 72 74 20 6c 61 62 65 6c 2d 38 36 39 0d 0a 53  ort label-869..S
1d450 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a  ELECT - - col1 *
1d460 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20   CAST ( col1 AS 
1d470 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 30  INTEGER ) + col0
1d480 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1d490 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32  r0..----..164..2
1d4a0 34 39 0d 0a 36 37 39 0d 0a 0d 0a 71 75 65 72 79  49..679....query
1d4b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d4c0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1d4d0 6c 30 20 2a 20 2d 20 35 39 20 41 53 20 63 6f 6c  l0 * - 59 AS col
1d4e0 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
1d4f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 31 36 0d 0a 2d  ..----..-1416..-
1d500 32 30 36 35 0d 0a 2d 35 32 35 31 0d 0a 0d 0a 6f  2065..-5251....o
1d510 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1d520 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1d530 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1d540 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1d550 73 6f 72 74 20 6c 61 62 65 6c 2d 38 37 31 0d 0a  sort label-871..
1d560 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49  SELECT - col1 DI
1d570 56 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  V - col2 AS col1
1d580 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1d590 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
1d5a0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
1d5b0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1d5c0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1d5d0 6f 72 74 20 6c 61 62 65 6c 2d 38 37 31 0d 0a 53  ort label-871..S
1d5e0 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 2d  ELECT - col1 / -
1d5f0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
1d600 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1d610 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
1d620 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d630 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
1d640 20 2a 20 36 30 20 2a 20 2d 20 31 34 20 2b 20 2d   * 60 * - 14 + -
1d650 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
1d660 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1d670 0a 2d 2d 2d 2d 0d 0a 32 37 36 39 36 0d 0a 36 38  .----..27696..68
1d680 37 39 31 0d 0a 38 30 35 0d 0a 0d 0a 6f 6e 6c 79  791..805....only
1d690 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1d6a0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1d6b0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1d6c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d6d0 74 20 6c 61 62 65 6c 2d 38 37 33 0d 0a 53 45 4c  t label-873..SEL
1d6e0 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 63  ECT - + col0 + c
1d6f0 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 63 6f 6c  or0.col0 DIV col
1d700 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
1d710 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 35 38 0d  ..----..-3..-58.
1d720 0a 2d 37 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-74....skipif m
1d730 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1d740 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1d750 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 37 33  owsort label-873
1d760 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
1d770 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20  0 + cor0.col0 / 
1d780 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
1d790 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d  or0..----..-3..-
1d7a0 35 38 0d 0a 2d 37 34 0d 0a 0d 0a 71 75 65 72 79  58..-74....query
1d7b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d7c0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20  CT ALL - col0 + 
1d7d0 2b 20 31 34 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 14 AS col1 FRO
1d7e0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  M tab1..----..-5
1d7f0 30 0d 0a 2d 36 36 0d 0a 31 31 0d 0a 0d 0a 71 75  0..-66..11....qu
1d800 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d810 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 38  ELECT DISTINCT 8
1d820 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  4 AS col1 FROM t
1d830 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 38 34 0d 0a 0d  ab2..----..84...
1d840 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d850 0d 0a 53 45 4c 45 43 54 20 32 39 20 2d 20 2d 20  ..SELECT 29 - - 
1d860 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col1 * cor0.col2
1d870 20 2a 20 2d 20 39 38 20 41 53 20 63 6f 6c 31 20   * - 98 AS col1 
1d880 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1d890 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 38 30 39 35  0..----..-278095
1d8a0 0d 0a 2d 37 33 31 32 34 37 0d 0a 2d 39 34 37 37  ..-731247..-9477
1d8b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d8c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1d8d0 2d 20 63 6f 6c 30 20 2a 20 35 39 20 2b 20 2d 20  - col0 * 59 + - 
1d8e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1d8f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
1d900 34 34 0d 0a 2d 34 36 36 31 0d 0a 2d 34 36 37 38  44..-4661..-4678
1d910 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d920 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1d930 49 4e 43 54 20 36 20 2a 20 36 38 20 41 53 20 63  INCT 6 * 68 AS c
1d940 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1d950 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 38   cor0..----..408
1d960 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d970 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1d980 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 36 36  INCT + col2 + 66
1d990 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1d9a0 0d 0a 31 32 30 0d 0a 31 32 33 0d 0a 31 36 32 0d  ..120..123..162.
1d9b0 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
1d9c0 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
1d9d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1d9e0 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  T * FROM tab1, t
1d9f0 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20 4a  ab1 cor0 CROSS J
1da00 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 30 20 41  OIN tab2, tab0 A
1da10 53 20 63 6f 72 31 2c 20 74 61 62 32 20 63 6f 72  S cor1, tab2 cor
1da20 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61  2..----..3645 va
1da30 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1da40 62 30 35 30 66 39 38 62 32 64 30 37 63 31 62 30  b050f98b2d07c1b0
1da50 39 32 62 37 33 65 63 66 36 62 35 62 33 34 37 63  92b73ecf6b5b347c
1da60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1da70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1da80 63 6f 6c 30 20 2b 20 31 38 20 2a 20 74 61 62 31  col0 + 18 * tab1
1da90 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
1daa0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
1dab0 34 34 0d 0a 33 31 34 0d 0a 34 37 31 0d 0a 0d 0a  44..314..471....
1dac0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1dad0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
1dae0 6c 30 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f  l0 + col2 - - co
1daf0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
1db00 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1db10 0a 31 38 32 0d 0a 31 39 36 0d 0a 34 31 0d 0a 0d  .182..196..41...
1db20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1db30 0d 0a 53 45 4c 45 43 54 20 31 34 20 2b 20 28 20  ..SELECT 14 + ( 
1db40 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46  col1 ) AS col1 F
1db50 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1db60 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 30 35  ..----..100..105
1db70 0d 0a 31 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..111....query I
1db80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1db90 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
1dba0 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l0 + col0 * - co
1dbb0 6c 32 20 2a 20 2d 20 33 38 20 46 52 4f 4d 20 74  l2 * - 38 FROM t
1dbc0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1dbd0 2d 0d 0a 31 31 33 39 39 37 0d 0a 37 31 37 35 0d  -..113997..7175.
1dbe0 0a 37 36 39 38 36 0d 0a 0d 0a 71 75 65 72 79 20  .76986....query 
1dbf0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1dc00 54 20 41 4c 4c 20 2b 20 38 39 20 2a 20 2b 20 63  T ALL + 89 * + c
1dc10 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1dc20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31   cor0..----..151
1dc30 33 0d 0a 32 37 35 39 0d 0a 35 32 35 31 0d 0a 0d  3..2759..5251...
1dc40 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1dc50 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1dc60 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1dc70 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1dc80 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1dc90 6f 72 74 20 6c 61 62 65 6c 2d 38 38 36 0d 0a 53  ort label-886..S
1dca0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
1dcb0 28 20 34 32 20 41 53 20 53 49 47 4e 45 44 20 29  ( 42 AS SIGNED )
1dcc0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1dcd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a 2d  r0..----..-42..-
1dce0 34 32 0d 0a 2d 34 32 0d 0a 0d 0a 73 6b 69 70 69  42..-42....skipi
1dcf0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1dd00 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1dd10 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1dd20 38 38 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  886..SELECT ALL 
1dd30 2d 20 43 41 53 54 20 28 20 34 32 20 41 53 20 49  - CAST ( 42 AS I
1dd40 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
1dd50 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1dd60 0d 0a 2d 34 32 0d 0a 2d 34 32 0d 0a 2d 34 32 0d  ..-42..-42..-42.
1dd70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1dd80 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
1dd90 2d 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  - - col2 * col1 
1dda0 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
1ddb0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1ddc0 0d 0a 32 34 34 31 35 34 0d 0a 36 37 39 31 33 33  ..244154..679133
1ddd0 0d 0a 39 35 30 36 0d 0a 0d 0a 73 6b 69 70 69 66  ..9506....skipif
1dde0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1ddf0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1de00 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1de10 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1de20 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
1de30 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
1de40 32 20 2d 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52  2 - col2 col1 FR
1de50 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
1de60 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
1de70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1de80 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1de90 2d 20 39 31 20 2b 20 2d 20 28 20 63 6f 6c 32 20  - 91 + - ( col2 
1dea0 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
1deb0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1dec0 2d 0d 0a 2d 31 32 34 0d 0a 2d 31 37 33 0d 0a 2d  -..-124..-173..-
1ded0 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
1dee0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1def0 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f  STINCT col1 * co
1df00 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 34 34  l2 + col1 * + 44
1df10 20 2d 20 31 20 2a 20 2b 20 63 6f 6c 32 20 46 52   - 1 * + col2 FR
1df20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1df30 0a 2d 2d 2d 2d 0d 0a 31 31 33 38 34 0d 0a 34 33  .----..11384..43
1df40 36 34 0d 0a 36 35 38 39 0d 0a 0d 0a 71 75 65 72  64..6589....quer
1df50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1df60 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  ECT + col0 + + c
1df70 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  or0.col2 * + col
1df80 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1df90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a  or0..----..196..
1dfa0 32 31 30 36 0d 0a 33 30 38 31 0d 0a 0d 0a 71 75  2106..3081....qu
1dfb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1dfc0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b 20  ELECT ALL + ( + 
1dfd0 31 36 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  16 ) FROM tab0 A
1dfe0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
1dff0 0d 0a 31 36 0d 0a 31 36 0d 0a 0d 0a 71 75 65 72  ..16..16....quer
1e000 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e010 45 43 54 20 2b 20 63 6f 6c 31 20 2d 20 37 30 20  ECT + col1 - 70 
1e020 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1e030 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 33  0..----..-11..-3
1e040 39 0d 0a 2d 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  9..-53....onlyif
1e050 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1e060 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1e070 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1e080 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1e090 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1e0a0 65 6c 2d 38 39 34 0d 0a 53 45 4c 45 43 54 20 44  el-894..SELECT D
1e0b0 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 63 6f  ISTINCT CAST( co
1e0c0 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l1 AS SIGNED ) *
1e0d0 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
1e0e0 30 20 2b 20 33 38 20 41 53 20 63 6f 6c 30 20 46  0 + 38 AS col0 F
1e0f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1e100 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32 0d 0a 34 30 39  ..----..272..409
1e110 39 38 0d 0a 38 33 32 33 38 0d 0a 0d 0a 73 6b 69  98..83238....ski
1e120 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1e130 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1e140 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1e150 6c 2d 38 39 34 0d 0a 53 45 4c 45 43 54 20 44 49  l-894..SELECT DI
1e160 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 63 6f  STINCT CAST ( co
1e170 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
1e180 2a 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  * col0 * cor0.co
1e190 6c 30 20 2b 20 33 38 20 41 53 20 63 6f 6c 30 20  l0 + 38 AS col0 
1e1a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1e1b0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32 0d 0a 34 30  0..----..272..40
1e1c0 39 39 38 0d 0a 38 33 32 33 38 0d 0a 0d 0a 71 75  998..83238....qu
1e1d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e1e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1e1f0 20 2b 20 35 39 20 2b 20 2d 20 36 32 20 46 52 4f   + 59 + - 62 FRO
1e200 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1e210 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 0d 0a 71 75  ----..-121....qu
1e220 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e230 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d  ELECT + col2 * -
1e240 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46   col2 + - col1 F
1e250 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1e260 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 35 0d 0a 2d  ..----..-1175..-
1e270 36 38 31 35 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65  6815..-98....que
1e280 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e290 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  LECT - col2 + co
1e2a0 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l0 * - col0 FROM
1e2b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1e2c0 2d 2d 2d 0d 0a 2d 36 31 31 30 0d 0a 2d 36 32 37  ---..-6110..-627
1e2d0 39 0d 0a 2d 37 36 0d 0a 0d 0a 71 75 65 72 79 20  9..-76....query 
1e2e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e2f0 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b  T ALL + col2 * +
1e300 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20   col0 * col2 AS 
1e310 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1e320 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
1e330 31 33 36 0d 0a 33 35 0d 0a 35 39 38 34 33 36 0d  136..35..598436.
1e340 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e350 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1e360 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  NCT - col1 + + c
1e370 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
1e380 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1e390 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ---..0....query 
1e3a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e3b0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 34  T DISTINCT + + 4
1e3c0 32 20 2d 20 35 37 20 2a 20 2b 20 63 6f 72 30 2e  2 - 57 * + cor0.
1e3d0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
1e3e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1e3f0 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d 31 38 33 39  ----..-15..-1839
1e400 0d 0a 2d 34 36 33 32 0d 0a 0d 0a 71 75 65 72 79  ..-4632....query
1e410 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e420 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 63 6f  CT + + col2 - co
1e430 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 * col1 AS col
1e440 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1e450 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 31 0d  or0..----..-251.
1e460 0a 2d 33 34 35 35 0d 0a 2d 39 33 34 0d 0a 0d 0a  .-3455..-934....
1e470 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
1e480 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
1e490 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
1e4a0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
1e4b0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
1e4c0 72 74 20 6c 61 62 65 6c 2d 39 30 32 0d 0a 53 45  rt label-902..SE
1e4d0 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  LECT - - cor0.co
1e4e0 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  l0 + - col0 * - 
1e4f0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
1e500 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46  GNED ) AS col1 F
1e510 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1e520 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1e530 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
1e540 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1e550 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1e560 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1e570 2d 39 30 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -902..SELECT - -
1e580 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
1e590 6f 6c 30 20 2a 20 2d 20 43 41 53 54 20 28 20 4e  ol0 * - CAST ( N
1e5a0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
1e5b0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1e5c0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1e5d0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
1e5e0 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
1e5f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1e600 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  L - col2 * + cor
1e610 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20  0.col0 + col0 * 
1e620 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1e630 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1e640 32 38 30 0d 0a 2d 31 35 33 0d 0a 34 34 38 0d 0a  280..-153..448..
1e650 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e660 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 32 20 2a  t..SELECT - 42 *
1e670 20 63 6f 6c 32 20 2b 20 28 20 2d 20 38 38 20 2a   col2 + ( - 88 *
1e680 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   + col0 ) FROM t
1e690 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1e6a0 2d 0d 0a 2d 31 31 32 37 36 0d 0a 2d 33 31 32 32  -..-11276..-3122
1e6b0 0d 0a 2d 33 34 39 38 0d 0a 0d 0a 71 75 65 72 79  ..-3498....query
1e6c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e6d0 43 54 20 2b 20 2d 20 39 31 20 2b 20 2b 20 63 6f  CT + - 91 + + co
1e6e0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1e6f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d  cor0..----..-32.
1e700 0a 2d 36 30 0d 0a 2d 37 34 0d 0a 0d 0a 71 75 65  .-60..-74....que
1e710 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e720 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  LECT + col0 * co
1e730 6c 31 20 2b 20 2b 20 28 20 63 6f 72 30 2e 63 6f  l1 + + ( cor0.co
1e740 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l1 ) AS col2 FRO
1e750 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1e760 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32 34 38 0d  ----..1360..248.
1e770 0a 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .4661....query I
1e780 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e790 20 28 20 63 6f 6c 30 20 29 20 2a 20 33 32 20 2b   ( col0 ) * 32 +
1e7a0 20 2d 20 33 34 20 2a 20 2b 20 63 6f 72 30 2e 63   - 34 * + cor0.c
1e7b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1e7c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 39   cor0..----..-69
1e7d0 34 0d 0a 31 32 33 36 0d 0a 31 36 31 32 0d 0a 0d  4..1236..1612...
1e7e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e7f0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
1e800 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  + col2 + - col1 
1e810 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  * - col2 * col2 
1e820 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1e830 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a 36 31 39 33 34  ----..194..61934
1e840 36 0d 0a 39 36 34 39 32 0d 0a 0d 0a 73 6b 69 70  6..96492....skip
1e850 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1e860 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1e870 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1e880 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1e890 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1e8a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
1e8b0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2d   col0 * + col1 -
1e8c0 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20   col1 col0 FROM 
1e8d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1e8e0 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 30 35 33 0d  --..-104..-1053.
1e8f0 0a 2d 36 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-650....query I
1e900 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e910 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 2a   + col1 - col1 *
1e920 20 37 38 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f   78 * - col2 FRO
1e930 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1e940 2d 2d 2d 2d 0d 0a 31 31 39 37 31 31 0d 0a 35 30  ----..119711..50
1e950 34 30 35 0d 0a 36 35 33 31 37 0d 0a 0d 0a 6f 6e  405..65317....on
1e960 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1e970 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1e980 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1e990 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1e9a0 6f 72 74 20 6c 61 62 65 6c 2d 39 31 31 0d 0a 53  ort label-911..S
1e9b0 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d  ELECT - col1 + -
1e9c0 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 46   col2 DIV col0 F
1e9d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1e9e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 37 0d 0a 2d 39 31  ..----..-87..-91
1e9f0 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-97....skipif 
1ea00 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1ea10 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1ea20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31  rowsort label-91
1ea30 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  1..SELECT - col1
1ea40 20 2b 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 30   + - col2 / col0
1ea50 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1ea60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 37 0d 0a 2d  r0..----..-87..-
1ea70 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79  91..-97....query
1ea80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ea90 43 54 20 39 30 20 2b 20 2b 20 63 6f 6c 32 20 46  CT 90 + + col2 F
1eaa0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1eab0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 0d 0a 31 37 32  ..----..123..172
1eac0 0d 0a 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..91....onlyif m
1ead0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
1eae0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
1eaf0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
1eb00 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
1eb10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1eb20 2d 39 31 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -913..SELECT DIS
1eb30 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b  TINCT - + col1 +
1eb40 20 2d 20 43 41 53 54 28 20 33 31 20 41 53 20 53   - CAST( 31 AS S
1eb50 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20  IGNED ) AS col2 
1eb60 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1eb70 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 0d 0a 2d 36  0..----..-48..-6
1eb80 32 0d 0a 2d 39 30 0d 0a 0d 0a 73 6b 69 70 69 66  2..-90....skipif
1eb90 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1eba0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1ebb0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
1ebc0 31 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  13..SELECT DISTI
1ebd0 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2d  NCT - + col1 + -
1ebe0 20 43 41 53 54 20 28 20 33 31 20 41 53 20 49 4e   CAST ( 31 AS IN
1ebf0 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20  TEGER ) AS col2 
1ec00 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1ec10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 0d 0a 2d 36  0..----..-48..-6
1ec20 32 0d 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72 79 20  2..-90....query 
1ec30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ec40 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 31 36 20  T ALL col1 + 16 
1ec50 2a 20 32 38 20 46 52 4f 4d 20 74 61 62 32 20 41  * 28 FROM tab2 A
1ec60 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 36  S cor0..----..46
1ec70 35 0d 0a 34 37 39 0d 0a 35 30 37 0d 0a 0d 0a 6f  5..479..507....o
1ec80 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1ec90 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1eca0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1ecb0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1ecc0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 35 0d 0a  sort label-915..
1ecd0 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20  SELECT col2 DIV 
1ece0 28 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20  ( cor0.col1 * + 
1ecf0 63 6f 6c 30 20 29 20 2b 20 33 35 20 46 52 4f 4d  col0 ) + 35 FROM
1ed00 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1ed10 2d 2d 2d 0d 0a 33 35 0d 0a 33 35 0d 0a 33 35 0d  ---..35..35..35.
1ed20 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1ed30 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1ed40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ed50 74 20 6c 61 62 65 6c 2d 39 31 35 0d 0a 53 45 4c  t label-915..SEL
1ed60 45 43 54 20 63 6f 6c 32 20 2f 20 28 20 63 6f 72  ECT col2 / ( cor
1ed70 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  0.col1 * + col0 
1ed80 29 20 2b 20 33 35 20 46 52 4f 4d 20 74 61 62 32  ) + 35 FROM tab2
1ed90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1eda0 33 35 0d 0a 33 35 0d 0a 33 35 0d 0a 0d 0a 73 6b  35..35..35....sk
1edb0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1edc0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1edd0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1ede0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1edf0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1ee00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1ee10 20 38 36 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c   86 * - col0 col
1ee20 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
1ee30 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 30 31 30 0d  -..-2064..-3010.
1ee40 0a 2d 37 36 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-7654....onlyif
1ee50 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1ee60 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1ee70 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1ee80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1ee90 6c 61 62 65 6c 2d 39 31 37 0d 0a 53 45 4c 45 43  label-917..SELEC
1eea0 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
1eeb0 30 20 44 49 56 20 39 39 20 46 52 4f 4d 20 74 61  0 DIV 99 FROM ta
1eec0 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b2, tab2 AS cor0
1eed0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
1eee0 20 68 61 73 68 69 6e 67 20 74 6f 20 38 62 37 35   hashing to 8b75
1eef0 31 33 36 62 32 62 35 31 63 37 37 33 34 35 63 30  136b2b51c77345c0
1ef00 33 38 30 34 65 63 31 63 64 61 35 63 0d 0a 0d 0a  3804ec1cda5c....
1ef10 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1ef20 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1ef30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ef40 61 62 65 6c 2d 39 31 37 0d 0a 53 45 4c 45 43 54  abel-917..SELECT
1ef50 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30   ALL - cor0.col0
1ef60 20 2f 20 39 39 20 46 52 4f 4d 20 74 61 62 32 2c   / 99 FROM tab2,
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 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
1ef90 73 68 69 6e 67 20 74 6f 20 38 62 37 35 31 33 36  shing to 8b75136
1efa0 62 32 62 35 31 63 37 37 33 34 35 63 30 33 38 30  b2b51c77345c0380
1efb0 34 65 63 31 63 64 61 35 63 0d 0a 0d 0a 71 75 65  4ec1cda5c....que
1efc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1efd0 4c 45 43 54 20 2d 20 2b 20 33 39 20 41 53 20 63  LECT - + 39 AS c
1efe0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1eff0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
1f000 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab0 cor1..----
1f010 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
1f020 6e 67 20 74 6f 20 35 30 34 64 31 34 39 33 39 64  ng to 504d14939d
1f030 35 38 61 65 62 34 61 31 34 66 33 31 63 38 30 64  58aeb4a14f31c80d
1f040 65 35 62 35 33 65 0d 0a 0d 0a 71 75 65 72 79 20  e5b53e....query 
1f050 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f060 54 20 2d 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c  T - - ( cor0.col
1f070 30 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  0 ) * col1 FROM 
1f080 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1f090 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a  .1040..640..78..
1f0a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f0b0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
1f0c0 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + - col0 AS col
1f0d0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
1f0e0 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 31 37 0d 0a 2d  -..-104..-117..-
1f0f0 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
1f100 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1f110 53 54 49 4e 43 54 20 28 20 63 6f 6c 31 20 29 20  STINCT ( col1 ) 
1f120 2a 20 63 6f 6c 30 20 2b 20 2d 20 38 36 20 2a 20  * col0 + - 86 * 
1f130 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
1f140 2d 2d 2d 2d 0d 0a 2d 37 37 34 0d 0a 31 30 34 37  ----..-774..1047
1f150 0d 0a 33 33 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..3309....onlyif
1f160 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1f170 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1f180 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1f190 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1f1a0 6c 61 62 65 6c 2d 39 32 32 0d 0a 53 45 4c 45 43  label-922..SELEC
1f1b0 54 20 63 6f 6c 32 20 44 49 56 20 28 20 63 6f 6c  T col2 DIV ( col
1f1c0 30 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  0 ) FROM tab1..-
1f1d0 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d  ---..0..1..18...
1f1e0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1f1f0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1f200 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1f210 6c 61 62 65 6c 2d 39 32 32 0d 0a 53 45 4c 45 43  label-922..SELEC
1f220 54 20 63 6f 6c 32 20 2f 20 28 20 63 6f 6c 30 20  T col2 / ( col0 
1f230 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
1f240 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 71  -..0..1..18....q
1f250 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f260 53 45 4c 45 43 54 20 2d 20 35 20 41 53 20 63 6f  SELECT - 5 AS co
1f270 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
1f280 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a  cor0..----..-5..
1f290 2d 35 0d 0a 2d 35 0d 0a 0d 0a 71 75 65 72 79 20  -5..-5....query 
1f2a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f2b0 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2a  T ALL - - col1 *
1f2c0 20 34 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   47 AS col1 FROM
1f2d0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1f2e0 0d 0a 34 30 34 32 0d 0a 34 32 37 37 0d 0a 34 35  ..4042..4277..45
1f2f0 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  59....onlyif mys
1f300 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
1f310 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
1f320 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
1f330 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
1f340 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
1f350 32 35 0d 0a 53 45 4c 45 43 54 20 2b 20 38 31 20  25..SELECT + 81 
1f360 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 43 41  * cor0.col1 + CA
1f370 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
1f380 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30 2c  MAL ) FROM tab0,
1f390 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1f3a0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
1f3b0 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30  shing to cd7a790
1f3c0 31 65 34 37 63 31 35 31 35 35 34 30 34 61 66 66  1e47c15155404aff
1f3d0 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73 6b 69  0d216fe0b....ski
1f3e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1f3f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1f400 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1f410 6c 2d 39 32 35 0d 0a 53 45 4c 45 43 54 20 2b 20  l-925..SELECT + 
1f420 38 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  81 * cor0.col1 +
1f430 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
1f440 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30  REAL ) FROM tab0
1f450 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
1f460 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
1f470 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39  ashing to cd7a79
1f480 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61 66  01e47c15155404af
1f490 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 71 75  f0d216fe0b....qu
1f4a0 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
1f4b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1f4c0 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d   DISTINCT * FROM
1f4d0 20 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30   tab1, tab1 cor0
1f4e0 2c 20 74 61 62 30 20 63 6f 72 31 2c 20 74 61 62  , tab0 cor1, tab
1f4f0 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  2 AS cor2..----.
1f500 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68  .972 values hash
1f510 69 6e 67 20 74 6f 20 35 39 31 61 39 61 39 33 35  ing to 591a9a935
1f520 36 30 38 33 39 32 33 31 63 30 33 38 61 31 65 31  60839231c038a1e1
1f530 30 62 64 32 34 30 61 0d 0a 0d 0a 71 75 65 72 79  0bd240a....query
1f540 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f550 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63  CT cor0.col0 + c
1f560 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or0.col0 AS col1
1f570 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
1f580 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f590 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
1f5a0 20 74 6f 20 31 30 39 37 37 33 32 35 32 36 31 36   to 109773252616
1f5b0 38 31 64 64 63 61 39 36 32 65 30 61 35 64 32 62  81ddca962e0a5d2b
1f5c0 33 34 38 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20  348b....query I 
1f5d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f5e0 44 49 53 54 49 4e 43 54 20 39 30 20 46 52 4f 4d  DISTINCT 90 FROM
1f5f0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 39 30 0d   tab0..----..90.
1f600 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1f610 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1f620 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1f630 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1f640 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1f650 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f660 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 39 33 20  ECT - col2 * 93 
1f670 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1f680 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
1f690 30 36 39 0d 0a 2d 37 36 32 36 0d 0a 2d 39 33 0d  069..-7626..-93.
1f6a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f6b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1f6c0 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  NCT + + cor0.col
1f6d0 32 20 2a 20 2b 20 38 39 20 46 52 4f 4d 20 74 61  2 * + 89 FROM ta
1f6e0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1f6f0 0d 0a 32 39 33 37 0d 0a 37 32 39 38 0d 0a 38 39  ..2937..7298..89
1f700 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f710 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
1f720 20 2a 20 33 36 20 41 53 20 63 6f 6c 32 20 46 52   * 36 AS col2 FR
1f730 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1f740 0a 2d 2d 2d 2d 0d 0a 33 30 39 36 0d 0a 33 32 37  .----..3096..327
1f750 36 0d 0a 33 34 39 32 0d 0a 0d 0a 71 75 65 72 79  6..3492....query
1f760 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f770 43 54 20 36 31 20 2a 20 2b 20 33 33 20 41 53 20  CT 61 * + 33 AS 
1f780 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20  col1 FROM tab0, 
1f790 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
1f7a0 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
1f7b0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
1f7c0 69 6e 67 20 74 6f 20 65 32 33 63 66 36 39 35 63  ing to e23cf695c
1f7d0 65 37 64 36 63 33 38 34 38 64 39 37 65 37 36 36  e7d6c3848d97e766
1f7e0 35 65 37 30 61 66 38 0d 0a 0d 0a 71 75 65 72 79  5e70af8....query
1f7f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f800 43 54 20 37 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  CT 7 - cor0.col0
1f810 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
1f820 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f830 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
1f840 20 74 6f 20 33 65 30 65 64 33 63 65 39 38 32 34   to 3e0ed3ce9824
1f850 32 35 35 39 32 39 31 66 64 39 31 37 32 37 34 30  2559291fd9172740
1f860 36 36 30 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20  660b....query I 
1f870 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f880 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2d 20 36  DISTINCT + ( - 6
1f890 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41   ) * cor0.col1 A
1f8a0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1f8b0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
1f8c0 2d 2d 2d 2d 0d 0a 2d 35 31 36 0d 0a 2d 35 34 36  ----..-516..-546
1f8d0 0d 0a 2d 35 38 32 0d 0a 0d 0a 71 75 65 72 79 20  ..-582....query 
1f8e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f8f0 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 38  T ALL col2 * + 8
1f900 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  8 AS col2 FROM t
1f910 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38 38 0d  ab2..----..2288.
1f920 0a 32 33 37 36 0d 0a 33 33 34 34 0d 0a 0d 0a 6f  .2376..3344....o
1f930 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1f940 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1f950 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1f960 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1f970 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33 36 0d 0a  sort label-936..
1f980 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1f990 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c  - col1 DIV - col
1f9a0 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  2 col0 FROM tab0
1f9b0 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 39 37  ..----..1..2..97
1f9c0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1f9d0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1f9e0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1f9f0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1fa00 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
1fa10 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1fa20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1fa30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1fa40 6c 2d 39 33 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-936..SELECT DI
1fa50 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2f 20  STINCT - col1 / 
1fa60 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d  - col2 col0 FROM
1fa70 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
1fa80 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  2..97....query I
1fa90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1faa0 20 2b 20 33 20 41 53 20 63 6f 6c 31 20 46 52 4f   + 3 AS col1 FRO
1fab0 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72  M tab0, tab1 cor
1fac0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
1fad0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 63 66  s hashing to 3cf
1fae0 31 65 33 37 37 61 39 34 33 35 38 39 38 39 37 62  1e377a943589897b
1faf0 38 64 34 33 31 61 38 33 34 66 31 62 61 0d 0a 0d  8d431a834f1ba...
1fb00 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1fb10 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1fb20 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1fb30 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1fb40 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1fb50 6f 72 74 20 6c 61 62 65 6c 2d 39 33 38 0d 0a 53  ort label-938..S
1fb60 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 43 41 53  ELECT col0 + CAS
1fb70 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
1fb80 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  D ) AS col0 FROM
1fb90 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab1..----..NUL
1fba0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1fbb0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1fbc0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1fbd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1fbe0 6c 61 62 65 6c 2d 39 33 38 0d 0a 53 45 4c 45 43  label-938..SELEC
1fbf0 54 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20  T col0 + CAST ( 
1fc00 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
1fc10 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
1fc20 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
1fc30 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
1fc40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1fc50 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2d 20  SELECT + col0 - 
1fc60 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
1fc70 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d  ----..-9..34..7.
1fc80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1fc90 72 74 0d 0a 53 45 4c 45 43 54 20 36 30 20 41 53  rt..SELECT 60 AS
1fca0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
1fcb0 0a 2d 2d 2d 2d 0d 0a 36 30 0d 0a 36 30 0d 0a 36  .----..60..60..6
1fcc0 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
1fcd0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1fce0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1fcf0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1fd00 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1fd10 2d 39 34 31 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  -941..SELECT + +
1fd20 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 72 30   col0 DIV - cor0
1fd30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20  .col1 FROM tab0 
1fd40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
1fd50 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
1fd60 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1fd70 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1fd80 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34 31 0d  wsort label-941.
1fd90 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30  .SELECT + + col0
1fda0 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46   / - cor0.col1 F
1fdb0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
1fdc0 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
1fdd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1fde0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
1fdf0 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  l2 * - col2 AS c
1fe00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
1fe10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34   cor0..----..144
1fe20 34 0d 0a 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71  4..676..729....q
1fe30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1fe40 53 45 4c 45 43 54 20 2b 20 2d 20 39 39 20 2b 20  SELECT + - 99 + 
1fe50 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
1fe60 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1fe70 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 36 34 0d 0a 2d  ---..-10..-64..-
1fe80 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  75....query I ro
1fe90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1fea0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
1feb0 2b 20 63 6f 6c 30 20 2a 20 31 36 20 46 52 4f 4d  + col0 * 16 FROM
1fec0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1fed0 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 33 32 36 0d 0a  ---..119..1326..
1fee0 31 33 34 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  1343....onlyif m
1fef0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
1ff00 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
1ff10 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
1ff20 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
1ff30 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1ff40 2d 39 34 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  -945..SELECT DIS
1ff50 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 63 6f  TINCT - CAST( co
1ff60 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d  l1 AS SIGNED ) -
1ff70 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
1ff80 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39  2..----..-24..19
1ff90 0d 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..62....skipif m
1ffa0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1ffb0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1ffc0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34 35  owsort label-945
1ffd0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1ffe0 54 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 31 20  T - CAST ( col1 
1fff0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 2d  AS INTEGER ) - -
20000 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
20010 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a  .----..-24..19..
20020 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  62....onlyif mys
20030 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
20040 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
20050 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
20060 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
20070 6c 2d 39 34 36 0d 0a 53 45 4c 45 43 54 20 28 20  l-946..SELECT ( 
20080 74 61 62 31 2e 63 6f 6c 31 20 29 20 44 49 56 20  tab1.col1 ) DIV 
20090 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 2b 20  + tab1.col0 + + 
200a0 63 6f 6c 31 20 2d 20 2d 20 74 61 62 31 2e 63 6f  col1 - - tab1.co
200b0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
200c0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d  tab1..----..109.
200d0 0a 36 37 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69  .67..88....skipi
200e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
200f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
20100 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
20110 39 34 36 0d 0a 53 45 4c 45 43 54 20 28 20 74 61  946..SELECT ( ta
20120 62 31 2e 63 6f 6c 31 20 29 20 2f 20 2b 20 74 61  b1.col1 ) / + ta
20130 62 31 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31  b1.col0 + + col1
20140 20 2d 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 41   - - tab1.col2 A
20150 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
20160 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d  ..----..109..67.
20170 0a 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .88....query I r
20180 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
20190 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( - cor0.col0 )
201a0 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * + col1 + + co
201b0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
201c0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
201d0 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34 34 0d 0a 34  --..1381..244..4
201e0 36 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  628....query I r
201f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
20200 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62 32 2e 63   col0 * + tab2.c
20210 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
20220 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39   tab2..----..189
20230 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a  ..2028..3002....
20240 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20250 0a 53 45 4c 45 43 54 20 2b 20 39 38 20 46 52 4f  .SELECT + 98 FRO
20260 4d 20 74 61 62 32 2c 20 74 61 62 30 2c 20 74 61  M tab2, tab0, ta
20270 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b2 AS cor0, tab1
20280 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
20290 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36 36 32  s hashing to 662
202a0 34 62 31 66 30 39 63 30 35 39 34 66 35 35 37 36  4b1f09c0594f5576
202b0 38 30 33 61 63 32 39 66 34 34 39 39 64 0d 0a 0d  803ac29f4499d...
202c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
202d0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
202e0 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  2 * + col0 FROM 
202f0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
20300 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30  .162..3648..7680
20310 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20320 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
20330 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 28 20  l0 + col2 * - ( 
20340 63 6f 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f 4d  cor0.col2 ) FROM
20350 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
20360 2d 2d 2d 0d 0a 2d 31 30 36 35 0d 0a 2d 36 36 33  ---..-1065..-663
20370 35 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  5..34....query I
20380 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20390 20 44 49 53 54 49 4e 43 54 20 2d 20 32 34 20 2b   DISTINCT - 24 +
203a0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
203b0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 33 35 0d  2..----..-7..35.
203c0 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .7....query I ro
203d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
203e0 53 54 49 4e 43 54 20 2b 20 37 38 20 2b 20 2b 20  STINCT + 78 + + 
203f0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20  col0 * + col0 * 
20400 2b 20 34 37 20 2b 20 74 61 62 32 2e 63 6f 6c 32  + 47 + tab2.col2
20410 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
20420 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 34 30 38 0d 0a  b2..----..2408..
20430 32 38 36 30 35 32 0d 0a 32 39 33 34 34 33 0d 0a  286052..293443..
20440 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20450 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
20460 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  l0 + - col2 * - 
20470 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
20480 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
20490 2d 2d 2d 2d 0d 0a 31 33 36 35 0d 0a 35 39 38 0d  ----..1365..598.
204a0 0a 37 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .722....query I 
204b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
204c0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  + cor0.col1 + + 
204d0 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
204e0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
204f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a  or0..----..137..
20500 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  38..96....query 
20510 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
20520 54 20 41 4c 4c 20 2b 20 2b 20 33 37 20 46 52 4f  T ALL + + 37 FRO
20530 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
20540 2d 2d 2d 2d 0d 0a 33 37 0d 0a 33 37 0d 0a 33 37  ----..37..37..37
20550 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
20560 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
20570 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
20580 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
20590 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
205a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35 37  owsort label-957
205b0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
205c0 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 2d  col1 * + CAST( -
205d0 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20   col0 AS SIGNED 
205e0 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
205f0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
20600 2d 35 37 36 0d 0a 2d 37 35 0d 0a 2d 39 36 30 0d  -576..-75..-960.
20610 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
20620 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
20630 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20640 74 20 6c 61 62 65 6c 2d 39 35 37 0d 0a 53 45 4c  t label-957..SEL
20650 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  ECT col0 + col1 
20660 2a 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c  * + CAST ( - col
20670 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  0 AS INTEGER ) A
20680 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
20690 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37   cor0..----..-57
206a0 36 0d 0a 2d 37 35 0d 0a 2d 39 36 30 0d 0a 0d 0a  6..-75..-960....
206b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
206c0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31  .SELECT + - col1
206d0 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 28 20 2d 20   * col1 + - ( - 
206e0 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 29 20  col1 * - col0 ) 
206f0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
20700 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 30 34 0d  0..----..-12804.
20710 0a 2d 31 36 33 38 30 0d 0a 2d 39 34 36 30 0d 0a  .-16380..-9460..
20720 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20730 74 0d 0a 53 45 4c 45 43 54 20 35 31 20 41 53 20  t..SELECT 51 AS 
20740 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
20750 2d 2d 2d 2d 0d 0a 35 31 0d 0a 35 31 0d 0a 35 31  ----..51..51..51
20760 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20770 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
20780 33 36 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  36 * col2 + + co
20790 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l2 * - col0 AS c
207a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
207b0 2d 2d 2d 0d 0a 2d 31 35 39 36 0d 0a 2d 34 32 32  ---..-1596..-422
207c0 34 0d 0a 31 37 38 32 0d 0a 0d 0a 71 75 65 72 79  4..1782....query
207d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
207e0 43 54 20 44 49 53 54 49 4e 43 54 20 31 35 20 2a  CT DISTINCT 15 *
207f0 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2b   col1 * col2 + +
20800 20 36 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 28   61 * - col1 * (
20810 20 32 36 20 29 20 46 52 4f 4d 20 74 61 62 31 0d   26 ) FROM tab1.
20820 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 38 0d 0a 2d 32  .----..-1898..-2
20830 30 31 37 36 0d 0a 2d 37 33 31 30 0d 0a 0d 0a 71  0176..-7310....q
20840 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20850 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
20860 2a 20 2d 20 63 6f 6c 30 20 2b 20 38 20 41 53 20  * - col0 + 8 AS 
20870 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
20880 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 36 30 37 36  ----..-41..-6076
20890 0d 0a 2d 36 32 33 33 0d 0a 0d 0a 71 75 65 72 79  ..-6233....query
208a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
208b0 43 54 20 34 39 20 2b 20 2d 20 63 6f 6c 32 20 46  CT 49 + - col2 F
208c0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
208d0 2d 2d 2d 0d 0a 2d 34 37 0d 0a 2d 35 0d 0a 2d 38  ---..-47..-5..-8
208e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
208f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
20900 2d 20 2d 20 28 20 63 6f 6c 31 20 29 20 41 53 20  - - ( col1 ) AS 
20910 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
20920 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
20930 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72  ..31..59....quer
20940 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20950 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b  ECT + - col2 * +
20960 20 63 6f 6c 30 20 2b 20 2d 20 35 32 20 2a 20 34   col0 + - 52 * 4
20970 35 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  5 FROM tab0 AS c
20980 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 37 35  or0..----..-2375
20990 0d 0a 2d 33 31 33 32 0d 0a 2d 39 36 33 38 0d 0a  ..-3132..-9638..
209a0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
209b0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
209c0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
209d0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
209e0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
209f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20a00 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
20a10 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 28  .col0 + col2 * (
20a20 20 2d 20 63 6f 6c 32 20 29 20 63 6f 6c 32 20 46   - col2 ) col2 F
20a30 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
20a40 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 35 0d 0a 2d  ..----..-1365..-
20a50 35 39 38 0d 0a 2d 37 32 32 0d 0a 0d 0a 71 75 65  598..-722....que
20a60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20a70 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  LECT + + col2 + 
20a80 2b 20 35 30 20 2a 20 2d 20 38 34 20 41 53 20 63  + 50 * - 84 AS c
20a90 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
20aa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31   cor0..----..-41
20ab0 30 34 0d 0a 2d 34 31 34 33 0d 0a 2d 34 31 34 36  04..-4143..-4146
20ac0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
20ad0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
20ae0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
20af0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
20b00 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
20b10 39 36 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  968..SELECT col0
20b20 20 44 49 56 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   DIV col0 + + co
20b30 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l1 * - col0 AS c
20b40 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
20b50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
20b60 33 39 0d 0a 2d 36 33 39 0d 0a 2d 37 37 0d 0a 0d  39..-639..-77...
20b70 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
20b80 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
20b90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
20ba0 6c 61 62 65 6c 2d 39 36 38 0d 0a 53 45 4c 45 43  label-968..SELEC
20bb0 54 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2b 20  T col0 / col0 + 
20bc0 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  + col1 * - col0 
20bd0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
20be0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20bf0 0a 2d 31 30 33 39 0d 0a 2d 36 33 39 0d 0a 2d 37  .-1039..-639..-7
20c00 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
20c10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
20c20 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  or0.col1 + cor0.
20c30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
20c40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
20c50 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71  0..132..180....q
20c60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20c70 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
20c80 30 20 2a 20 2d 20 31 37 20 2b 20 2b 20 35 31 20  0 * - 17 + + 51 
20c90 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
20ca0 2d 2d 2d 2d 0d 0a 2d 31 34 36 32 0d 0a 2d 33 35  ----..-1462..-35
20cb0 37 0d 0a 2d 35 34 34 0d 0a 0d 0a 6f 6e 6c 79 69  7..-544....onlyi
20cc0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
20cd0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
20ce0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
20cf0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
20d00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
20d10 62 65 6c 2d 39 37 31 0d 0a 53 45 4c 45 43 54 20  bel-971..SELECT 
20d20 63 6f 6c 30 20 2f 20 2b 20 43 41 53 54 28 20 4e  col0 / + CAST( N
20d30 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
20d40 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
20d50 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20d60 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
20d70 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
20d80 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
20d90 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
20da0 6f 72 74 20 6c 61 62 65 6c 2d 39 37 31 0d 0a 53  ort label-971..S
20db0 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20 2b 20 43  ELECT col0 / + C
20dc0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
20dd0 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20  TEGER ) AS col1 
20de0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
20df0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
20e00 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
20e10 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
20e20 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
20e30 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
20e40 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
20e50 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
20e60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
20e70 4c 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  L - col1 * + col
20e80 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  2 col0 FROM tab1
20e90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20ea0 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35  -1248..-1404..-5
20eb0 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
20ec0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
20ed0 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2d 20 63  + col0 * - ( - c
20ee0 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol1 ) FROM tab0 
20ef0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
20f00 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
20f10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20f20 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
20f30 20 63 6f 6c 31 20 2a 20 33 35 20 2b 20 2d 20 63   col1 * 35 + - c
20f40 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
20f50 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
20f60 2d 2d 2d 0d 0a 2d 33 36 30 0d 0a 2d 34 36 38 0d  ---..-360..-468.
20f70 0a 2d 39 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .-936....query I
20f80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20f90 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 39   + cor0.col0 + 9
20fa0 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  9 AS col1 FROM t
20fb0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
20fc0 2d 0d 0a 31 32 33 0d 0a 31 33 34 0d 0a 31 38 38  -..123..134..188
20fd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20fe0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 35  ort..SELECT - 35
20ff0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
21000 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 30 0d  0..----..-11..0.
21010 0a 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .54....query I r
21020 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
21030 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  LL - + col0 * + 
21040 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63  col0 * col2 AS c
21050 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
21060 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 33 34 37  r0..----..-23347
21070 32 0d 0a 2d 34 38 36 0d 0a 2d 36 31 34 34 30 30  2..-486..-614400
21080 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
21090 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
210a0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
210b0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
210c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
210d0 39 37 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  978..SELECT DIST
210e0 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  INCT + col2 + co
210f0 72 30 2e 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31  r0.col1 DIV col1
21100 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
21110 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d  r0..----..2..34.
21120 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .83....skipif my
21130 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
21140 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
21150 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 38 0d  wsort label-978.
21160 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
21170 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63   + col2 + cor0.c
21180 6f 6c 31 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 / col1 FROM 
21190 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
211a0 2d 2d 0d 0a 32 0d 0a 33 34 0d 0a 38 33 0d 0a 0d  --..2..34..83...
211b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
211c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
211d0 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20  T cor0.col0 + - 
211e0 36 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  69 AS col0 FROM 
211f0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
21200 2d 2d 0d 0a 2d 36 32 0d 0a 31 30 0d 0a 39 0d 0a  --..-62..10..9..
21210 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21220 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
21230 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b  .col0 * + col2 +
21240 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
21250 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
21260 38 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d 0a  88..3658..7693..
21270 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21280 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
21290 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 33 32  CT + col2 * - 32
212a0 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   + + col0 * - co
212b0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
212c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
212d0 2d 2d 0d 0a 2d 31 30 35 34 35 0d 0a 2d 31 32 35  --..-10545..-125
212e0 37 0d 0a 2d 31 36 33 32 0d 0a 0d 0a 6f 6e 6c 79  7..-1632....only
212f0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
21300 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
21310 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
21320 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21330 74 20 6c 61 62 65 6c 2d 39 38 32 0d 0a 53 45 4c  t label-982..SEL
21340 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
21350 6f 6c 30 20 2a 20 2b 20 34 34 20 2b 20 2d 20 63  ol0 * + 44 + - c
21360 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 63 6f 6c  ol2 DIV col1 col
21370 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
21380 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 36 0d  or0..----..1056.
21390 0a 31 35 34 30 0d 0a 33 39 31 36 0d 0a 0d 0a 73  .1540..3916....s
213a0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
213b0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
213c0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
213d0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
213e0 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
213f0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
21400 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
21410 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38 32  owsort label-982
21420 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
21430 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 34 34 20  T + col0 * + 44 
21440 2b 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20  + - col2 / col1 
21450 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
21460 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
21470 35 36 0d 0a 31 35 34 30 0d 0a 33 39 31 36 0d 0a  56..1540..3916..
21480 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21490 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 38 20 2b  t..SELECT - 38 +
214a0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
214b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
214c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 32 36  0..----..-35..26
214d0 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..42....query I 
214e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
214f0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20  + cor0.col2 * - 
21500 36 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  65 AS col1 FROM 
21510 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
21520 2d 2d 0d 0a 2d 32 31 34 35 0d 0a 2d 35 33 33 30  --..-2145..-5330
21530 0d 0a 2d 36 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-65....skipif 
21540 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
21550 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
21560 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
21570 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
21580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21590 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
215a0 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31  CT col0 * + col1
215b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
215c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
215d0 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a  343..217..4602..
215e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
215f0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
21600 20 2a 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29   * ( cor0.col0 )
21610 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
21620 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a  r0..----..1040..
21630 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79  640..78....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 6c 32 20 2b 20  CT ALL + col2 + 
21660 2d 20 31 36 20 2a 20 2b 20 63 6f 6c 31 20 46 52  - 16 * + col1 FR
21670 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
21680 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 31  .----..-1343..-1
21690 33 37 34 0d 0a 2d 31 35 35 31 0d 0a 0d 0a 71 75  374..-1551....qu
216a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
216b0 45 4c 45 43 54 20 2b 20 28 20 2d 20 63 6f 6c 31  ELECT + ( - col1
216c0 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63   ) * + col1 AS c
216d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
216e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
216f0 39 0d 0a 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a  9..-3481..-961..
21700 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
21710 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
21720 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
21730 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
21740 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38  rowsort label-98
21750 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
21760 43 54 20 2b 20 2b 20 36 32 20 2b 20 2b 20 34 34  CT + + 62 + + 44
21770 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c   DIV col2 AS col
21780 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
21790 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 32 0d 0a 0d  or0..----..62...
217a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
217b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
217c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
217d0 6c 61 62 65 6c 2d 39 38 39 0d 0a 53 45 4c 45 43  label-989..SELEC
217e0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 36  T DISTINCT + + 6
217f0 32 20 2b 20 2b 20 34 34 20 2f 20 63 6f 6c 32 20  2 + + 44 / col2 
21800 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
21810 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
21820 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .62....query I r
21830 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
21840 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 36 36  LL - col1 + - 66
21850 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
21860 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
21870 37 36 0d 0a 2d 37 39 0d 0a 2d 39 32 0d 0a 0d 0a  76..-79..-92....
21880 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21890 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
218a0 35 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  50 AS col2 FROM 
218b0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
218c0 2d 2d 0d 0a 2d 35 30 0d 0a 2d 35 30 0d 0a 2d 35  --..-50..-50..-5
218d0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
218e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34  sort..SELECT + 4
218f0 34 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  4 FROM tab2 AS c
21900 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34 0d 0a 34  or0..----..44..4
21910 34 0d 0a 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  4..44....query I
21920 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21930 20 44 49 53 54 49 4e 43 54 20 2d 20 32 39 20 2a   DISTINCT - 29 *
21940 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 46 52 4f   col0 - col1 FRO
21950 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
21960 2d 2d 2d 2d 0d 0a 2d 31 31 31 32 0d 0a 2d 32 36  ----..-1112..-26
21970 37 32 0d 0a 2d 37 38 32 0d 0a 0d 0a 71 75 65 72  72..-782....quer
21980 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21990 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
219a0 6f 6c 32 20 2a 20 2b 20 39 33 20 46 52 4f 4d 20  ol2 * + 93 FROM 
219b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
219c0 2d 2d 0d 0a 2d 35 30 32 32 0d 0a 2d 35 33 30 31  --..-5022..-5301
219d0 0d 0a 2d 38 39 32 38 0d 0a 0d 0a 71 75 65 72 79  ..-8928....query
219e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
219f0 43 54 20 2b 20 2b 20 38 20 41 53 20 63 6f 6c 31  CT + + 8 AS col1
21a00 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
21a10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 0d 0a 38 0d 0a  r0..----..8..8..
21a20 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
21a30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31  sort..SELECT + 1
21a40 39 20 2a 20 2d 20 36 38 20 46 52 4f 4d 20 74 61  9 * - 68 FROM ta
21a50 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
21a60 0d 0a 2d 31 32 39 32 0d 0a 2d 31 32 39 32 0d 0a  ..-1292..-1292..
21a70 2d 31 32 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -1292....query I
21a80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21a90 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 38 34   DISTINCT + - 84
21aa0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
21ab0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a 0d  r0..----..-84...
21ac0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21ad0 0d 0a 53 45 4c 45 43 54 20 2d 20 37 30 20 2a 20  ..SELECT - 70 * 
21ae0 2d 20 28 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  - ( col2 * - col
21af0 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  0 ) FROM tab1 co
21b00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 34 30  r0..----..-11340
21b10 0d 0a 2d 32 35 35 33 36 30 0d 0a 2d 35 33 37 36  ..-255360..-5376
21b20 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
21b30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
21b40 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
21b50 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  - col0 * - col0 
21b60 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
21b70 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  0 cor0..----..12
21b80 36 30 0d 0a 36 30 30 0d 0a 38 30 31 30 0d 0a 0d  60..600..8010...
21b90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21ba0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
21bb0 54 20 2b 20 28 20 28 20 2b 20 63 6f 72 30 2e 63  T + ( ( + cor0.c
21bc0 6f 6c 32 20 29 20 29 20 2b 20 63 6f 6c 31 20 46  ol2 ) ) + col1 F
21bd0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
21be0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d  ..----..109..67.
21bf0 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
21c00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
21c10 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20  LL - ( + col1 ) 
21c20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  + - col1 AS col1
21c30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
21c40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d  r0..----..-20..-
21c50 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72 79  26..-52....query
21c60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
21c70 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20  CT ALL + col1 + 
21c80 2b 20 63 6f 6c 31 20 2a 20 34 38 20 41 53 20 63  + col1 * 48 AS c
21c90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
21ca0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37   cor0..----..127
21cb0 34 0d 0a 34 39 30 0d 0a 36 33 37 0d 0a 0d 0a 71  4..490..637....q
21cc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21cd0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
21ce0 32 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  2 - + col2 AS co
21cf0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
21d00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34  cor0..----..-164
21d10 0d 0a 2d 32 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65  ..-2..-66....que
21d20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21d30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 35  LECT DISTINCT 95
21d40 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   - - col2 FROM t
21d50 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
21d60 31 32 38 0d 0a 31 37 37 0d 0a 39 36 0d 0a 0d 0a  128..177..96....
21d70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21d80 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
21d90 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
21da0 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53  OM tab2, tab2 AS
21db0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
21dc0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
21dd0 20 35 39 31 31 62 61 63 35 31 34 34 31 66 34 66   5911bac51441f4f
21de0 66 36 34 30 62 32 61 32 62 37 32 31 65 61 38 65  f640b2a2b721ea8e
21df0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
21e00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
21e10 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20  TINCT cor0.col2 
21e20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  * col2 + col2 * 
21e30 31 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  10 AS col0 FROM 
21e40 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
21e50 2d 2d 0d 0a 31 38 32 34 0d 0a 39 33 36 0d 0a 39  --..1824..936..9
21e60 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
21e70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
21e80 4c 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 41 53  L col2 - col0 AS
21e90 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
21ea0 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a 35  .----..-7..16..5
21eb0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
21ec0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
21ed0 6f 6c 30 20 2d 20 2d 20 37 33 20 41 53 20 63 6f  ol0 - - 73 AS co
21ee0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
21ef0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d  cor0..----..108.
21f00 0a 31 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  .162..97....quer
21f10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21f20 45 43 54 20 63 6f 6c 30 20 2a 20 28 20 2b 20 63  ECT col0 * ( + c
21f30 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20 63 6f 6c  or0.col1 ) + col
21f40 32 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  2 + - col1 AS co
21f50 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
21f60 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 0d 0a 31 31  0..----..106..11
21f70 32 33 0d 0a 36 38 37 0d 0a 0d 0a 71 75 65 72 79  23..687....query
21f80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
21f90 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 32 38  CT ALL col2 + 28
21fa0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
21fb0 0d 0a 31 31 30 0d 0a 32 39 0d 0a 36 31 0d 0a 0d  ..110..29..61...
21fc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21fd0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
21fe0 2b 20 2b 20 36 31 20 46 52 4f 4d 20 74 61 62 30  + + 61 FROM tab0
21ff0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22000 31 35 30 0d 0a 38 35 0d 0a 39 36 0d 0a 0d 0a 71  150..85..96....q
22010 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22020 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20  SELECT + col1 + 
22030 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30  cor0.col1 + col0
22040 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
22050 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
22060 0d 0a 31 30 36 0d 0a 35 35 0d 0a 38 34 0d 0a 0d  ..106..55..84...
22070 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22080 0d 0a 53 45 4c 45 43 54 20 32 39 20 41 53 20 63  ..SELECT 29 AS c
22090 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
220a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
220b0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
220c0 69 6e 67 20 74 6f 20 31 65 37 31 32 30 62 61 38  ing to 1e7120ba8
220d0 65 39 31 39 31 30 38 34 31 37 32 64 64 63 65 64  e9191084172ddced
220e0 31 37 65 35 65 62 32 0d 0a 0d 0a 73 6b 69 70 69  17e5eb2....skipi
220f0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
22100 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
22110 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22120 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
22130 32 20 2b 20 2b 20 43 41 53 54 20 28 20 35 37 20  2 + + CAST ( 57 
22140 41 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c  AS REAL ) AS col
22150 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
22160 2d 0d 0a 31 33 39 0d 0a 35 38 0d 0a 39 30 0d 0a  -..139..58..90..
22170 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
22180 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
22190 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
221a0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
221b0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
221c0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31 35 0d  sort label-1015.
221d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
221e0 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   + + CAST( NULL 
221f0 41 53 20 44 45 43 49 4d 41 4c 20 29 20 46 52 4f  AS DECIMAL ) FRO
22200 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab1..----..NU
22210 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
22220 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
22230 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
22240 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22250 20 6c 61 62 65 6c 2d 31 30 31 35 0d 0a 53 45 4c   label-1015..SEL
22260 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 2b  ECT ALL col1 + +
22270 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
22280 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 31  REAL ) FROM tab1
22290 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
222a0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
222b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
222c0 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  ECT cor0.col2 FR
222d0 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20 74  OM tab1, tab0, t
222e0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
222f0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
22300 67 20 74 6f 20 37 37 38 36 37 31 38 62 64 38 30  g to 7786718bd80
22310 34 32 30 32 32 35 33 37 33 37 38 64 34 30 65 63  42022537378d40ec
22320 38 37 34 37 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  87475....onlyif 
22330 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
22340 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
22350 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
22360 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
22370 61 62 65 6c 2d 31 30 31 37 0d 0a 53 45 4c 45 43  abel-1017..SELEC
22380 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20 63  T + col0 DIV + c
22390 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
223a0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab0..----..0..
223b0 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
223c0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
223d0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
223e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31  owsort label-101
223f0 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  7..SELECT + col0
22400 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   / + col1 AS col
22410 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
22420 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
22430 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22440 45 4c 45 43 54 20 28 20 2d 20 32 37 20 29 20 2b  ELECT ( - 27 ) +
22450 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
22460 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
22470 32 34 0d 0a 33 37 0d 0a 35 33 0d 0a 0d 0a 71 75  24..37..53....qu
22480 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22490 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20  ELECT ALL - ( - 
224a0 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2b 20 35 33  tab0.col2 + + 53
224b0 20 29 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61   ) FROM tab0, ta
224c0 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b1 AS cor0, tab1
224d0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
224e0 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20  ----..81 values 
224f0 68 61 73 68 69 6e 67 20 74 6f 20 32 66 32 63 66  hashing to 2f2cf
22500 64 62 31 36 63 34 63 36 33 37 34 35 61 61 35 65  db16c4c63745aa5e
22510 39 35 31 35 30 63 31 36 39 31 33 0d 0a 0d 0a 71  95150c16913....q
22520 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22530 53 45 4c 45 43 54 20 39 32 20 46 52 4f 4d 20 74  SELECT 92 FROM t
22540 61 62 32 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a  ab2, tab2 cor0..
22550 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
22560 61 73 68 69 6e 67 20 74 6f 20 35 31 36 66 61 34  ashing to 516fa4
22570 35 63 38 62 30 36 66 39 66 36 37 64 36 65 35 30  5c8b06f9f67d6e50
22580 30 62 66 64 34 33 35 63 31 61 0d 0a 0d 0a 6f 6e  0bfd435c1a....on
22590 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
225a0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
225b0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
225c0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
225d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
225e0 20 6c 61 62 65 6c 2d 31 30 32 31 0d 0a 53 45 4c   label-1021..SEL
225f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43  ECT DISTINCT - C
22600 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
22610 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52  NED ) AS col0 FR
22620 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
22630 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
22640 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
22650 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
22660 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
22670 2d 31 30 32 31 0d 0a 53 45 4c 45 43 54 20 44 49  -1021..SELECT DI
22680 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20  STINCT - CAST ( 
22690 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
226a0 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
226b0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
226c0 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  NULL....onlyif m
226d0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
226e0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
226f0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
22700 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22710 62 65 6c 2d 31 30 32 32 0d 0a 53 45 4c 45 43 54  bel-1022..SELECT
22720 20 2d 20 35 38 20 44 49 56 20 2d 20 38 39 20 46   - 58 DIV - 89 F
22730 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
22740 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
22750 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
22760 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
22770 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22780 74 20 6c 61 62 65 6c 2d 31 30 32 32 0d 0a 53 45  t label-1022..SE
22790 4c 45 43 54 20 2d 20 35 38 20 2f 20 2d 20 38 39  LECT - 58 / - 89
227a0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
227b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
227c0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
227d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
227e0 20 63 6f 6c 30 20 2d 20 38 31 20 41 53 20 63 6f   col0 - 81 AS co
227f0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
22800 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36 0d  cor0..----..-46.
22810 0a 2d 35 37 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79  .-57..8....query
22820 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22830 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 38  CT DISTINCT + 58
22840 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 41 53   + ( - col0 ) AS
22850 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
22860 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
22870 32 32 0d 0a 2d 36 0d 0a 35 35 0d 0a 0d 0a 71 75  22..-6..55....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 41 4c 4c 20 2d 20 2b 20 28 20  ELECT ALL - + ( 
228a0 28 20 63 6f 6c 32 20 29 20 29 20 2a 20 63 6f 6c  ( col2 ) ) * col
228b0 31 20 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  1 - + col0 FROM 
228c0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
228d0 0a 2d 31 33 32 38 0d 0a 2d 31 34 30 37 0d 0a 2d  .-1328..-1407..-
228e0 36 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  634....query I r
228f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
22900 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31  ISTINCT - - col1
22910 20 2b 20 2d 20 32 33 20 46 52 4f 4d 20 74 61 62   + - 23 FROM tab
22920 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
22930 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 33 0d 0a 0d 0a  .-10..-13..3....
22940 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22950 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20  .SELECT ALL ( - 
22960 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53 20 63  cor0.col0 ) AS c
22970 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
22980 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d   cor0..----..-7.
22990 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65  .-78..-79....que
229a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
229b0 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 38  LECT ALL - ( - 8
229c0 30 20 29 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  0 ) + + col2 AS 
229d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
229e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
229f0 36 0d 0a 31 30 37 0d 0a 31 31 38 0d 0a 0d 0a 71  6..107..118....q
22a00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22a10 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
22a20 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  or0.col2 * - col
22a30 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
22a40 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
22a50 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a  -..-1534..-646..
22a60 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -837....query I 
22a70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22a80 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
22a90 2b 20 2b 20 63 6f 6c 32 20 2a 20 36 37 20 46 52  + + col2 * 67 FR
22aa0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
22ab0 0a 2d 2d 2d 2d 0d 0a 31 38 31 36 0d 0a 31 38 32  .----..1816..182
22ac0 30 0d 0a 32 36 32 35 0d 0a 0d 0a 71 75 65 72 79  0..2625....query
22ad0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22ae0 43 54 20 44 49 53 54 49 4e 43 54 20 36 34 20 2a  CT DISTINCT 64 *
22af0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
22b00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 35 36  cor0..----..3456
22b10 0d 0a 33 36 34 38 0d 0a 36 31 34 34 0d 0a 0d 0a  ..3648..6144....
22b20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22b30 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
22b40 20 63 6f 6c 30 20 2a 20 2d 20 38 20 46 52 4f 4d   col0 * - 8 FROM
22b50 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
22b60 2d 2d 2d 0d 0a 34 36 30 38 0d 0a 36 33 33 36 38  ---..4608..63368
22b70 0d 0a 39 38 30 30 0d 0a 0d 0a 71 75 65 72 79 20  ..9800....query 
22b80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22b90 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2a  T ALL + - col0 *
22ba0 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
22bb0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
22bc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d  cor0..----..-49.
22bd0 0a 2d 36 30 38 34 0d 0a 2d 36 32 34 31 0d 0a 0d  .-6084..-6241...
22be0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22bf0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
22c00 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  T + cor0.col2 AS
22c10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
22c20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33  cor0..----..1..3
22c30 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  3..82....query I
22c40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22c50 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
22c60 20 2b 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20   + + ( col0 ) * 
22c70 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
22c80 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
22c90 2d 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34 34 0d  ----..1381..244.
22ca0 0a 34 36 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .4628....query I
22cb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22cc0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   + cor0.col1 * c
22cd0 6f 6c 31 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol1 + col2 + col
22ce0 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
22cf0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
22d00 0d 0a 31 34 30 36 0d 0a 32 35 37 0d 0a 34 33 34  ..1406..257..434
22d10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22d20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
22d30 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  l2 + - col0 * co
22d40 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
22d50 2d 2d 0d 0a 2d 31 32 32 34 0d 0a 2d 35 34 33 0d  --..-1224..-543.
22d60 0a 2d 37 38 33 39 0d 0a 0d 0a 71 75 65 72 79 20  .-7839....query 
22d70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22d80 54 20 41 4c 4c 20 33 39 20 41 53 20 63 6f 6c 30  T ALL 39 AS col0
22d90 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
22da0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22db0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
22dc0 20 74 6f 20 35 65 63 63 34 64 33 64 65 36 38 61   to 5ecc4d3de68a
22dd0 65 38 32 38 61 32 64 35 32 32 64 66 66 38 35 37  e828a2d522dff857
22de0 31 63 62 66 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  1cbf....onlyif m
22df0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
22e00 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
22e10 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
22e20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22e30 62 65 6c 2d 31 30 33 39 0d 0a 53 45 4c 45 43 54  bel-1039..SELECT
22e40 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 44 49 56   + tab0.col2 DIV
22e50 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab0.col0 FROM 
22e60 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
22e70 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
22e80 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
22e90 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
22ea0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 39  wsort label-1039
22eb0 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e  ..SELECT + tab0.
22ec0 63 6f 6c 32 20 2f 20 74 61 62 30 2e 63 6f 6c 30  col2 / tab0.col0
22ed0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
22ee0 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65  ..0..0..1....que
22ef0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22f00 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
22f10 32 20 2a 20 2b 20 37 39 20 46 52 4f 4d 20 74 61  2 * + 79 FROM ta
22f20 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
22f30 0d 0a 34 32 36 36 0d 0a 34 35 30 33 0d 0a 37 35  ..4266..4503..75
22f40 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  84....query I ro
22f50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
22f60 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20  STINCT + - col2 
22f70 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  * col1 AS col0 F
22f80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
22f90 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d  ..----..-2838..-
22fa0 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65  7462..-97....que
22fb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22fc0 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c  LECT ALL - + col
22fd0 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63  0 * - col0 + + c
22fe0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
22ff0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
23000 2d 2d 2d 0d 0a 31 32 32 36 0d 0a 36 30 39 0d 0a  ---..1226..609..
23010 38 30 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8003....query I 
23020 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23030 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  col0 + + col1 + 
23040 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  + col0 * + col0 
23050 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  * col1 FROM tab2
23060 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23070 31 30 36 31 39 33 0d 0a 31 35 35 37 0d 0a 33 35  106193..1557..35
23080 39 30 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9093....query I 
23090 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
230a0 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20  - col2 * col2 + 
230b0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
230c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
230d0 2d 2d 2d 2d 0d 0a 2d 31 30 36 35 0d 0a 2d 36 36  ----..-1065..-66
230e0 33 35 0d 0a 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  35..34....onlyif
230f0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
23100 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
23110 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
23120 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
23130 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
23140 65 6c 2d 31 30 34 35 0d 0a 53 45 4c 45 43 54 20  el-1045..SELECT 
23150 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 28  ALL + + col1 * (
23160 20 2b 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f   + col0 ) + - co
23170 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c  l1 * + CAST( NUL
23180 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
23190 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
231a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
231b0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
231c0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
231d0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
231e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
231f0 74 20 6c 61 62 65 6c 2d 31 30 34 35 0d 0a 53 45  t label-1045..SE
23200 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
23210 31 20 2a 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b  1 * ( + col0 ) +
23220 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54   - col1 * + CAST
23230 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
23240 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ER ) AS col0 FRO
23250 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
23260 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
23270 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
23280 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23290 54 20 63 6f 6c 31 20 2b 20 2b 20 31 32 20 46 52  T col1 + + 12 FR
232a0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
232b0 2d 2d 0d 0a 32 39 0d 0a 34 33 0d 0a 37 31 0d 0a  --..29..43..71..
232c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
232d0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
232e0 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  CT - - col2 + co
232f0 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 + col0 FROM t
23300 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
23310 2d 0d 0a 31 38 32 0d 0a 31 39 36 0d 0a 34 31 0d  -..182..196..41.
23320 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
23330 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
23340 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
23350 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
23360 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
23370 30 34 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  048..SELECT ALL 
23380 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c  - col1 DIV - col
23390 30 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 - col1 FROM ta
233a0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
233b0 0d 0a 2d 31 37 0d 0a 2d 32 37 0d 0a 2d 35 39 0d  ..-17..-27..-59.
233c0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
233d0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
233e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
233f0 74 20 6c 61 62 65 6c 2d 31 30 34 38 0d 0a 53 45  t label-1048..SE
23400 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
23410 2f 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20  / - col0 - col1 
23420 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
23430 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 32  0..----..-17..-2
23440 37 0d 0a 2d 35 39 0d 0a 0d 0a 73 6b 69 70 69 66  7..-59....skipif
23450 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
23460 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
23470 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
23480 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
23490 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
234a0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
234b0 30 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  0.col0 * cor0.co
234c0 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
234d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
234e0 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39  .-35..-7298..-79
234f0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
23500 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
23510 31 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  1 * - col2 * - c
23520 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
23530 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
23540 2d 2d 2d 0d 0a 31 31 39 38 30 38 0d 0a 33 32 34  ---..119808..324
23550 39 30 0d 0a 37 35 38 31 36 0d 0a 0d 0a 71 75 65  90..75816....que
23560 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23570 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 34 38  LECT col2 + - 48
23580 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t
23590 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
235a0 2d 0d 0a 2d 34 38 0d 0a 2d 34 38 0d 0a 2d 34 38  -..-48..-48..-48
235b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
235c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 39 20 2b  ort..SELECT 49 +
235d0 20 2b 20 39 36 20 41 53 20 63 6f 6c 31 20 46 52   + 96 AS col1 FR
235e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
235f0 0a 2d 2d 2d 2d 0d 0a 31 34 35 0d 0a 31 34 35 0d  .----..145..145.
23600 0a 31 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .145....query I 
23610 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23620 2d 20 37 34 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 74 AS col1 FRO
23630 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
23640 2d 2d 2d 2d 0d 0a 2d 37 34 0d 0a 2d 37 34 0d 0a  ----..-74..-74..
23650 2d 37 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -74....onlyif my
23660 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
23670 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
23680 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
23690 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
236a0 65 6c 2d 31 30 35 34 0d 0a 53 45 4c 45 43 54 20  el-1054..SELECT 
236b0 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 44 49  - col2 * col2 DI
236c0 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  V col2 AS col1 F
236d0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
236e0 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d  -54..-57..-96...
236f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
23700 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
23710 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
23720 6c 61 62 65 6c 2d 31 30 35 34 0d 0a 53 45 4c 45  label-1054..SELE
23730 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  CT - col2 * col2
23740 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   / col2 AS col1 
23750 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
23760 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a  .-54..-57..-96..
23770 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23780 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d  t..SELECT col0 -
23790 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f   col1 * col0 FRO
237a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
237b0 2d 2d 2d 2d 0d 0a 2d 32 30 34 30 0d 0a 2d 33 33  ----..-2040..-33
237c0 36 30 0d 0a 2d 38 30 31 30 0d 0a 0d 0a 71 75 65  60..-8010....que
237d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
237e0 4c 45 43 54 20 28 20 35 36 20 29 20 2b 20 2d 20  LECT ( 56 ) + - 
237f0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
23800 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
23810 2d 2d 2d 2d 0d 0a 33 30 0d 0a 34 33 0d 0a 34 36  ----..30..43..46
23820 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23830 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
23840 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 34 39 20 2b  r0.col1 * + 49 +
23850 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
23860 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
23870 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 39 32 0d 0a  0..----..-1492..
23880 2d 32 38 36 35 0d 0a 2d 37 39 35 0d 0a 0d 0a 71  -2865..-795....q
23890 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
238a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
238b0 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  - col2 * + col0 
238c0 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  - - col1 AS col2
238d0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
238e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 0d 0a  r0..----..-158..
238f0 2d 31 39 36 39 0d 0a 2d 32 39 38 35 0d 0a 0d 0a  -1969..-2985....
23900 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23910 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31 33 20 41  .SELECT ALL 13 A
23920 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
23930 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 31 33 0d 0a  ..----..13..13..
23940 31 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  13....onlyif mys
23950 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
23960 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
23970 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
23980 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
23990 6c 2d 31 30 36 30 0d 0a 53 45 4c 45 43 54 20 2d  l-1060..SELECT -
239a0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b   col0 * - col2 +
239b0 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 30   col0 DIV - col0
239c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
239d0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
239e0 0d 0a 31 38 38 0d 0a 32 30 32 37 0d 0a 33 30 30  ..188..2027..300
239f0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
23a00 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
23a10 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
23a20 6f 72 74 20 6c 61 62 65 6c 2d 31 30 36 30 0d 0a  ort label-1060..
23a30 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
23a40 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2f 20  - col2 + col0 / 
23a50 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
23a60 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
23a70 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 0d 0a 32 30 32  ..----..188..202
23a80 37 0d 0a 33 30 30 31 0d 0a 0d 0a 6f 6e 6c 79 69  7..3001....onlyi
23a90 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
23aa0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
23ab0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
23ac0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23ad0 20 6c 61 62 65 6c 2d 31 30 36 31 0d 0a 53 45 4c   label-1061..SEL
23ae0 45 43 54 20 2b 20 39 39 20 44 49 56 20 2d 20 63  ECT + 99 DIV - c
23af0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
23b00 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
23b10 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 33 33  ---..-1..-1..-33
23b20 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
23b30 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
23b40 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
23b50 72 74 20 6c 61 62 65 6c 2d 31 30 36 31 0d 0a 53  rt label-1061..S
23b60 45 4c 45 43 54 20 2b 20 39 39 20 2f 20 2d 20 63  ELECT + 99 / - c
23b70 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
23b80 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
23b90 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 33 33  ---..-1..-1..-33
23ba0 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
23bb0 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
23bc0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
23bd0 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  * FROM tab1, tab
23be0 30 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  0 cor0, tab0 AS 
23bf0 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63 6f  cor1, tab0 AS co
23c00 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61  r2..----..972 va
23c10 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
23c20 33 34 30 36 34 39 37 33 35 31 65 34 37 38 39 63  3406497351e4789c
23c30 38 39 61 32 39 35 65 65 39 62 36 34 62 32 30 31  89a295ee9b64b201
23c40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23c50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
23c60 49 4e 43 54 20 2d 20 34 38 20 2a 20 37 33 20 46  INCT - 48 * 73 F
23c70 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41  ROM tab2, tab2 A
23c80 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  S cor0, tab2 AS 
23c90 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 30  cor1..----..-350
23ca0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
23cb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74  sort..SELECT + t
23cc0 61 62 32 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  ab2.col1 + + col
23cd0 31 20 2a 20 2b 20 34 31 20 46 52 4f 4d 20 74 61  1 * + 41 FROM ta
23ce0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 32 0d 0a  b2..----..1302..
23cf0 32 34 37 38 0d 0a 37 31 34 0d 0a 0d 0a 71 75 65  2478..714....que
23d00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23d10 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20  LECT - - col2 + 
23d20 2b 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  + ( col0 ) FROM 
23d30 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
23d40 2d 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34  --..104..117..34
23d50 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
23d60 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
23d70 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
23d80 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
23d90 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
23da0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23db0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
23dc0 33 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  30 col1 FROM tab
23dd0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a 0d 0a  0..----..-30....
23de0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
23df0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
23e00 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
23e10 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
23e20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
23e30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23e40 20 44 49 53 54 49 4e 43 54 20 39 35 20 2a 20 2b   DISTINCT 95 * +
23e50 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20   col1 col1 FROM 
23e60 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 35  tab2..----..1615
23e70 0d 0a 32 39 34 35 0d 0a 35 36 30 35 0d 0a 0d 0a  ..2945..5605....
23e80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23e90 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
23ea0 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   - col1 + - col0
23eb0 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
23ec0 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
23ed0 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 30 35 33 0d 0a  -..-104..-1053..
23ee0 2d 36 35 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -650....skipif p
23ef0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
23f00 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
23f10 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
23f20 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
23f30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23f40 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
23f50 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20  + col2 * - col1 
23f60 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
23f70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
23f80 33 32 0d 0a 2d 32 38 36 32 0d 0a 2d 37 35 35 31  32..-2862..-7551
23f90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23fa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
23fb0 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  INCT + col2 + + 
23fc0 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
23fd0 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
23fe0 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a  ..----..55..58..
23ff0 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
24000 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
24010 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31  STINCT cor0.col1
24020 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31   + col0 * - col1
24030 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46   + col0 * col1 F
24040 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
24050 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a  ..----..86..91..
24060 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
24070 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
24080 4c 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  L - col2 * - col
24090 30 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  0 - + cor0.col2 
240a0 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  * - col0 AS col2
240b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
240c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 39 36 0d  r0..----..14596.
240d0 0a 31 35 38 34 0d 0a 37 30 0d 0a 0d 0a 71 75 65  .1584..70....que
240e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
240f0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
24100 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53  col1 * - col1 AS
24110 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
24120 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
24130 33 39 36 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d  396..8281..9409.
24140 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24150 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
24160 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 41 53  col2 - + col2 AS
24170 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
24180 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
24190 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
241a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
241b0 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  T col1 * + col0 
241c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
241d0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  1 cor0..----..10
241e0 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 73  40..640..78....s
241f0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
24200 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
24210 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
24220 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
24230 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
24240 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24250 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e  - col0 * - cor0.
24260 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 63 6f 6c 30  col2 - col1 col0
24270 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
24280 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 0d 0a 33  r0..----..136..3
24290 36 33 38 0d 0a 37 36 36 37 0d 0a 0d 0a 71 75 65  638..7667....que
242a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
242b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
242c0 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col1 * cor0.col2
242d0 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + + col2 AS col
242e0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
242f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 35  or0..----..-2805
24300 0d 0a 2d 37 33 38 30 0d 0a 2d 39 36 0d 0a 0d 0a  ..-7380..-96....
24310 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24320 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
24330 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 31 20 46   col1 - - col1 F
24340 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
24350 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32  ..----..172..182
24360 0d 0a 31 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..194....query I
24370 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24380 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b   - - cor0.col1 +
24390 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
243a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
243b0 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d 0a 0d  .-19..-62..24...
243c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
243d0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
243e0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
243f0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
24400 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38  owsort label-108
24410 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
24420 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44  CT + cor0.col2 D
24430 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41  IV - cor0.col2 A
24440 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
24450 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24460 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  -1....skipif mys
24470 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
24480 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
24490 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 30 0d  sort label-1080.
244a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
244b0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2d   + cor0.col2 / -
244c0 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
244d0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
244e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
244f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24500 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
24510 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30  cor0.col0 * col0
24520 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
24530 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
24540 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 30 0d 0a  0..----..-1190..
24550 2d 35 35 32 0d 0a 2d 37 38 33 32 0d 0a 0d 0a 6f  -552..-7832....o
24560 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
24570 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
24580 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
24590 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
245a0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 32 0d  sort label-1082.
245b0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 41 53 20  .SELECT col2 AS 
245c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 57  col2 FROM tab1 W
245d0 48 45 52 45 20 63 6f 6c 30 20 49 4e 20 28 20 2d  HERE col0 IN ( -
245e0 20 63 6f 6c 30 20 44 49 56 20 74 61 62 31 2e 63   col0 DIV tab1.c
245f0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 29 0d 0a  ol1 + + col0 )..
24600 2d 2d 2d 2d 0d 0a 35 34 0d 0a 0d 0a 73 6b 69 70  ----..54....skip
24610 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
24620 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
24630 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
24640 2d 31 30 38 32 0d 0a 53 45 4c 45 43 54 20 63 6f  -1082..SELECT co
24650 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
24660 74 61 62 31 20 57 48 45 52 45 20 63 6f 6c 30 20  tab1 WHERE col0 
24670 49 4e 20 28 20 2d 20 63 6f 6c 30 20 2f 20 74 61  IN ( - col0 / ta
24680 62 31 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30  b1.col1 + + col0
24690 20 29 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 0d 0a   )..----..54....
246a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
246b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
246c0 6c 30 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 31  l0 + + tab1.col1
246d0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
246e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34  b1..----..29..74
246f0 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..93....query I 
24700 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24710 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20  DISTINCT col0 + 
24720 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 63 6f  - cor0.col0 / co
24730 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
24740 74 61 62 30 20 41 53 20 63 6f 72 30 20 57 48 45  tab0 AS cor0 WHE
24750 52 45 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28  RE NULL NOT IN (
24760 20 63 6f 72 30 2e 63 6f 6c 32 20 29 0d 0a 2d 2d   cor0.col2 )..--
24770 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
24780 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
24790 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  - col0 + cor0.co
247a0 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l0 * + cor0.col1
247b0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
247c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 32 0d 0a  r0..----..1422..
247d0 32 32 34 0d 0a 34 36 38 30 0d 0a 0d 0a 71 75 65  224..4680....que
247e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
247f0 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
24800 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l0 + + col2 FROM
24810 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
24820 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37  ---..171..36..57
24830 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24840 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
24850 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  l1 * + col1 + - 
24860 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63  col0 * col2 AS c
24870 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
24880 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
24890 35 37 39 0d 0a 2d 38 31 38 38 0d 0a 2d 39 34 34  579..-8188..-944
248a0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
248b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
248c0 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63  TINCT - col0 * c
248d0 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 * col1 FROM 
248e0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37  tab0..----..-177
248f0 35 30 34 0d 0a 2d 33 32 39 33 31 35 0d 0a 2d 37  504..-329315..-7
24900 33 37 30 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49  37009....query I
24910 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24920 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   ALL col2 * + co
24930 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 + col2 FROM t
24940 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
24950 2d 0d 0a 32 30 35 34 0d 0a 32 31 36 0d 0a 33 30  -..2054..216..30
24960 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  40....query I ro
24970 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
24980 4c 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c  L - col2 - - col
24990 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
249a0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
249b0 2d 32 31 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a 6f 6e  -21..33..4....on
249c0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
249d0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
249e0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
249f0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
24a00 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39 31 0d 0a  ort label-1091..
24a10 53 45 4c 45 43 54 20 2d 20 74 61 62 30 2e 63 6f  SELECT - tab0.co
24a20 6c 30 20 44 49 56 20 2b 20 74 61 62 30 2e 63 6f  l0 DIV + tab0.co
24a30 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
24a40 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
24a50 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
24a60 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
24a70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
24a80 62 65 6c 2d 31 30 39 31 0d 0a 53 45 4c 45 43 54  bel-1091..SELECT
24a90 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2f 20 2b   - tab0.col0 / +
24aa0 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab0.col1 FROM 
24ab0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
24ac0 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
24ad0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
24ae0 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63  ISTINCT col0 * c
24af0 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  or0.col2 + col1 
24b00 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
24b10 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
24b20 0a 31 38 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33  .188..3658..7693
24b30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24b40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
24b50 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  INCT - col2 * + 
24b60 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63  col1 + col1 AS c
24b70 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
24b80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37   cor0..----..-27
24b90 35 32 0d 0a 2d 37 33 37 31 0d 0a 30 0d 0a 0d 0a  52..-7371..0....
24ba0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24bb0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
24bc0 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   + col1 * - col0
24bd0 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   - + col1 FROM t
24be0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 38  ab2..----..-1398
24bf0 0d 0a 2d 32 37 35 0d 0a 2d 34 36 38 37 0d 0a 0d  ..-275..-4687...
24c00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24c10 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
24c20 54 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 46 52  T col0 - col2 FR
24c30 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
24c40 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 71 75 65 72  9..34..7....quer
24c50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24c60 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
24c70 32 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  2 * + col1 * col
24c80 30 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  0 - + col2 AS co
24c90 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
24ca0 2d 2d 0d 0a 33 36 34 32 33 0d 0a 34 31 35 38 0d  --..36423..4158.
24cb0 0a 39 39 37 34 34 0d 0a 0d 0a 71 75 65 72 79 20  .99744....query 
24cc0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24cd0 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 32 2e  T DISTINCT tab2.
24ce0 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  col2 - col2 FROM
24cf0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
24d00 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
24d10 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
24d20 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
24d30 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
24d40 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
24d50 39 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  98..SELECT DISTI
24d60 4e 43 54 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d  NCT - col1 DIV -
24d70 20 74 61 62 31 2e 63 6f 6c 31 20 2d 20 2d 20 63   tab1.col1 - - c
24d80 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol2 col0 FROM ta
24d90 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38  b1..----..55..58
24da0 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..97....skipif p
24db0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
24dc0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
24dd0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
24de0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
24df0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
24e00 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
24e10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
24e20 6c 61 62 65 6c 2d 31 30 39 38 0d 0a 53 45 4c 45  label-1098..SELE
24e30 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
24e40 6c 31 20 2f 20 2d 20 74 61 62 31 2e 63 6f 6c 31  l1 / - tab1.col1
24e50 20 2d 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46   - - col2 col0 F
24e60 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
24e70 35 35 0d 0a 35 38 0d 0a 39 37 0d 0a 0d 0a 71 75  55..58..97....qu
24e80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24e90 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b  ELECT + col2 * +
24ea0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
24eb0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
24ec0 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d  534..646..837...
24ed0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24ee0 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 32 2e  ..SELECT + tab2.
24ef0 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 46 52  col2 - + col0 FR
24f00 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
24f10 34 31 0d 0a 2d 35 32 0d 0a 32 30 0d 0a 0d 0a 71  41..-52..20....q
24f20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24f30 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20  SELECT col1 * - 
24f40 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 41 53 20 63  col1 - col2 AS c
24f50 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
24f60 2d 2d 2d 0d 0a 2d 37 34 32 39 0d 0a 2d 38 33 36  ---..-7429..-836
24f70 33 0d 0a 2d 39 34 31 30 0d 0a 0d 0a 71 75 65 72  3..-9410....quer
24f80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24f90 45 43 54 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20  ECT tab0.col2 + 
24fa0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
24fb0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  M tab0..----..16
24fc0 34 0d 0a 32 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72  4..2..66....quer
24fd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24fe0 45 43 54 20 41 4c 4c 20 2b 20 35 39 20 2a 20 2b  ECT ALL + 59 * +
24ff0 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f   col2 * col1 FRO
25000 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
25010 2d 2d 2d 2d 0d 0a 33 38 31 31 34 0d 0a 34 39 33  ----..38114..493
25020 38 33 0d 0a 39 30 35 30 36 0d 0a 0d 0a 71 75 65  83..90506....que
25030 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
25040 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  LECT + col2 + co
25050 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
25060 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
25070 0a 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a  .108..114..192..
25080 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25090 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
250a0 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  CT - + col2 + + 
250b0 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col2 * + cor0.co
250c0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
250d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
250e0 2d 2d 0d 0a 32 38 36 32 0d 0a 33 31 39 32 0d 0a  --..2862..3192..
250f0 39 31 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9120....query I 
25100 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25110 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2d 20  - col2 * col1 - 
25120 2b 20 34 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 40 AS col0 FRO
25130 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
25140 2d 2d 2d 2d 0d 0a 2d 31 32 38 38 0d 0a 2d 31 34  ----..-1288..-14
25150 34 34 0d 0a 2d 36 31 30 0d 0a 0d 0a 71 75 65 72  44..-610....quer
25160 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25170 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2d 20 2d  ECT - - col0 - -
25180 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
25190 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
251a0 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a  .----..14..156..
251b0 31 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  158....query I r
251c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
251d0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b  ISTINCT + col1 +
251e0 20 63 6f 6c 30 20 2a 20 2d 20 31 36 20 46 52 4f   col0 * - 16 FRO
251f0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
25200 2d 2d 2d 2d 0d 0a 2d 31 30 31 34 0d 0a 2d 31 32  ----..-1014..-12
25210 36 37 0d 0a 2d 32 32 0d 0a 0d 0a 71 75 65 72 79  67..-22....query
25220 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25230 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  CT - col0 + - co
25240 6c 32 20 2a 20 2d 20 35 30 20 2a 20 63 6f 6c 30  l2 * - 50 * col0
25250 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
25260 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
25270 0d 0a 31 30 31 33 32 32 0d 0a 31 35 30 30 32 31  ..101322..150021
25280 0d 0a 39 34 34 33 0d 0a 0d 0a 71 75 65 72 79 20  ..9443....query 
25290 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
252a0 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  T - col0 + col2 
252b0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
252c0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
252d0 2d 33 34 0d 0a 31 30 36 35 0d 0a 36 36 33 35 0d  -34..1065..6635.
252e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
252f0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
25300 4e 43 54 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  NCT col2 FROM ta
25310 62 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 3e 3d  b0 WHERE NULL >=
25320 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   col1..----....q
25330 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25340 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
25350 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f  col2 * col2 + co
25360 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
25370 2d 2d 0d 0a 31 31 37 35 0d 0a 36 38 31 35 0d 0a  --..1175..6815..
25380 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
25390 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
253a0 4c 20 74 61 62 30 2e 63 6f 6c 32 20 2d 20 74 61  L tab0.col2 - ta
253b0 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  b0.col0 AS col1 
253c0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
253d0 0a 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 6f  .-34..-7..9....o
253e0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
253f0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
25400 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
25410 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
25420 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31 34 0d  sort label-1114.
25430 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
25440 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f   - col0 DIV + co
25450 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
25460 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  tab2..----..-1..
25470 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
25480 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
25490 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
254a0 20 6c 61 62 65 6c 2d 31 31 31 34 0d 0a 53 45 4c   label-1114..SEL
254b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
254c0 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20  ol0 / + col0 AS 
254d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
254e0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72  ----..-1....quer
254f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25500 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 74  ECT - col1 * - t
25510 61 62 31 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  ab1.col0 + col1 
25520 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * + col0 FROM ta
25530 62 31 20 57 48 45 52 45 20 2d 20 63 6f 6c 32 20  b1 WHERE - col2 
25540 2d 20 63 6f 6c 30 20 3c 3e 20 2d 20 63 6f 6c 32  - col0 <> - col2
25550 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 30 0d 0a 31 35  ..----..1280..15
25560 36 0d 0a 32 30 38 30 0d 0a 0d 0a 71 75 65 72 79  6..2080....query
25570 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25580 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20  CT ALL col0 + + 
25590 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  tab0.col0 FROM t
255a0 61 62 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 49  ab0 WHERE NULL I
255b0 4e 20 28 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20  N ( tab0.col1 * 
255c0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 29 0d  col0 * + col0 ).
255d0 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
255e0 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
255f0 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52  CT DISTINCT * FR
25600 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f  OM tab1 WHERE NO
25610 54 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28 20  T NULL NOT IN ( 
25620 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 29 0d  col1 + - col1 ).
25630 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
25640 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25650 20 63 6f 6c 30 20 2b 20 2b 20 74 61 62 32 2e 63   col0 + + tab2.c
25660 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
25670 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d   tab2..----..14.
25680 0a 31 35 36 0d 0a 31 35 38 0d 0a 0d 0a 71 75 65  .156..158....que
25690 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
256a0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d 20  LECT ALL col0 - 
256b0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
256c0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  M tab0..----..-9
256d0 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79  ..34..7....query
256e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
256f0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
25700 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
25710 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d 32  ..----..-164..-2
25720 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-66....query I
25730 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25740 20 44 49 53 54 49 4e 43 54 20 2b 20 31 35 20 2b   DISTINCT + 15 +
25750 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2d   + tab0.col0 * -
25760 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
25770 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a  ab0..----..-20..
25780 2d 37 32 38 33 0d 0a 2d 37 37 37 0d 0a 0d 0a 71  -7283..-777....q
25790 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
257a0 53 45 4c 45 43 54 20 37 38 20 41 53 20 63 6f 6c  SELECT 78 AS col
257b0 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
257c0 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
257d0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
257e0 20 68 61 73 68 69 6e 67 20 74 6f 20 64 38 65 35   hashing to d8e5
257f0 65 66 34 64 62 33 34 31 39 66 63 32 35 31 65 38  ef4db3419fc251e8
25800 32 63 35 30 62 61 30 34 65 30 34 38 0d 0a 0d 0a  2c50ba04e048....
25810 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25820 0a 53 45 4c 45 43 54 20 32 33 20 2b 20 2b 20 63  .SELECT 23 + + c
25830 6f 6c 31 20 2b 20 2b 20 36 33 20 41 53 20 63 6f  ol1 + + 63 AS co
25840 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
25850 2d 2d 0d 0a 31 30 33 0d 0a 31 31 37 0d 0a 31 34  --..103..117..14
25860 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
25870 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
25880 20 2d 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20   - ( col0 ) * + 
25890 74 61 62 31 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32  tab1.col2 + col2
258a0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
258b0 0d 0a 2d 31 30 38 0d 0a 2d 33 35 39 31 0d 0a 2d  ..-108..-3591..-
258c0 37 35 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7584....onlyif m
258d0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
258e0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
258f0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
25900 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25910 62 65 6c 2d 31 31 32 35 0d 0a 53 45 4c 45 43 54  bel-1125..SELECT
25920 20 44 49 53 54 49 4e 43 54 20 2b 20 32 34 20 44   DISTINCT + 24 D
25930 49 56 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31  IV col1 + + col1
25940 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
25950 0d 0a 31 32 0d 0a 31 34 0d 0a 32 36 0d 0a 0d 0a  ..12..14..26....
25960 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
25970 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
25980 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
25990 61 62 65 6c 2d 31 31 32 35 0d 0a 53 45 4c 45 43  abel-1125..SELEC
259a0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32 34 20  T DISTINCT + 24 
259b0 2f 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20  / col1 + + col1 
259c0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
259d0 0a 31 32 0d 0a 31 34 0d 0a 32 36 0d 0a 0d 0a 71  .12..14..26....q
259e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
259f0 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
25a00 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  + - col2 * cor0.
25a10 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
25a20 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
25a30 2d 2d 2d 2d 0d 0a 2d 31 34 38 32 0d 0a 2d 37 30  ----..-1482..-70
25a40 32 0d 0a 2d 37 35 36 0d 0a 0d 0a 71 75 65 72 79  2..-756....query
25a50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25a60 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f  CT ALL col1 * co
25a70 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  r0.col2 AS col0 
25a80 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
25a90 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31  0..----..1248..1
25aa0 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 6f 6e 6c 79  404..570....only
25ab0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
25ac0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
25ad0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
25ae0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25af0 74 20 6c 61 62 65 6c 2d 31 31 32 38 0d 0a 53 45  t label-1128..SE
25b00 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
25b10 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  + col2 + + col0 
25b20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  DIV - cor0.col1 
25b30 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
25b40 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 2d 34  0..----..-27..-4
25b50 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
25b60 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
25b70 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
25b80 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 38 0d 0a  ort label-1128..
25b90 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
25ba0 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  - + col2 + + col
25bb0 30 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  0 / - cor0.col1 
25bc0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
25bd0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 2d 34  0..----..-27..-4
25be0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
25bf0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
25c00 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
25c10 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
25c20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
25c30 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
25c40 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
25c50 37 38 62 35 30 35 37 35 61 39 62 39 31 34 34 38  78b50575a9b91448
25c60 31 31 39 65 65 30 65 65 31 61 39 63 34 34 66 0d  119ee0ee1a9c44f.
25c70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25c80 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
25c90 20 34 39 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b   49 + - col1 * +
25ca0 20 39 33 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20   93 * - col2 AS 
25cb0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
25cc0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
25cd0 32 37 31 31 0d 0a 36 30 31 32 37 0d 0a 37 37 38  2711..60127..778
25ce0 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
25cf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
25d00 4c 20 2d 20 38 20 2b 20 2d 20 63 6f 6c 32 20 41  L - 8 + - col2 A
25d10 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
25d20 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 33 35  ..----..-34..-35
25d30 0d 0a 2d 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-46....query I
25d40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25d50 20 41 4c 4c 20 37 20 2b 20 63 6f 6c 31 20 46 52   ALL 7 + col1 FR
25d60 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab2..----..2
25d70 34 0d 0a 33 38 0d 0a 36 36 0d 0a 0d 0a 71 75 65  4..38..66....que
25d80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
25d90 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f  LECT ALL tab1.co
25da0 6c 30 20 2a 20 2d 20 28 20 36 31 20 29 20 46 52  l0 * - ( 61 ) FR
25db0 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 63 6f  OM tab1, tab1 co
25dc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
25dd0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 37  es hashing to c7
25de0 39 32 62 64 39 36 62 36 36 36 35 30 35 30 66 30  92bd96b6665050f0
25df0 64 35 36 39 61 36 61 32 62 38 32 35 63 32 0d 0a  d569a6a2b825c2..
25e00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25e10 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
25e20 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
25e30 32 20 57 48 45 52 45 20 4e 4f 54 20 2b 20 63 6f  2 WHERE NOT + co
25e40 6c 30 20 2f 20 63 6f 6c 30 20 49 4e 20 28 20 2d  l0 / col0 IN ( -
25e50 20 63 6f 6c 31 20 2b 20 74 61 62 32 2e 63 6f 6c   col1 + tab2.col
25e60 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35  2 )..----..55..5
25e70 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  8..85....query I
25e80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25e90 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   + col0 * - col2
25ea0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
25eb0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a  b1..----..-162..
25ec0 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a  -3648..-7680....
25ed0 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
25ee0 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
25ef0 20 74 61 62 30 20 57 48 45 52 45 20 63 6f 6c 31   tab0 WHERE col1
25f00 20 49 4e 20 28 20 2d 20 74 61 62 30 2e 63 6f 6c   IN ( - tab0.col
25f10 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  2 * col0 + col0 
25f20 2a 20 2b 20 63 6f 6c 31 20 2a 20 74 61 62 30 2e  * + col1 * tab0.
25f30 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col0 )..----....
25f40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25f50 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d  .SELECT col2 + -
25f60 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f   col1 + col0 FRO
25f70 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab2..----..10
25f80 30 0d 0a 33 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72  0..3..45....quer
25f90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25fa0 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  ECT col1 + + col
25fb0 31 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 46 52  1 - tab2.col0 FR
25fc0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
25fd0 34 35 0d 0a 34 30 0d 0a 35 35 0d 0a 0d 0a 71 75  45..40..55....qu
25fe0 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
25ff0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
26000 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 28 20  OM tab2 WHERE ( 
26010 4e 55 4c 4c 20 29 20 3e 20 4e 55 4c 4c 0d 0a 2d  NULL ) > NULL..-
26020 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
26030 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74  owsort..SELECT t
26040 61 62 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  ab0.col1 + - col
26050 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
26060 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32  ab0..----..2..62
26070 0d 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..62....skipif p
26080 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
26090 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
260a0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
260b0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
260c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
260d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
260e0 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  1 + + col0 * - c
260f0 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
26100 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 36 0d  b2..----..-1326.
26110 0a 2d 31 38 36 0d 0a 2d 34 35 34 33 0d 0a 0d 0a  .-186..-4543....
26120 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26130 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
26140 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
26150 57 48 45 52 45 20 4e 55 4c 4c 20 3d 20 4e 55 4c  WHERE NULL = NUL
26160 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  L..----....query
26170 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26180 43 54 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 63  CT tab0.col0 * c
26190 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
261a0 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d  ---..2064..3395.
261b0 0a 38 30 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  .8099....skipif 
261c0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
261d0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
261e0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
261f0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
26200 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26210 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d  t..SELECT col0 -
26220 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
26230 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d  tab2..----..-24.
26240 0a 31 39 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79  .19..62....query
26250 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26260 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  CT + col1 + + co
26270 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  l0 * + col2 AS c
26280 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
26290 2d 2d 2d 0d 0a 31 38 38 0d 0a 33 36 35 38 0d 0a  ---..188..3658..
262a0 37 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7693....query I 
262b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
262c0 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ALL col2 * - col
262d0 31 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  1 + + col1 AS co
262e0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45  l1 FROM tab0 WHE
262f0 52 45 20 28 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  RE ( - col1 * - 
26300 63 6f 6c 31 20 29 20 4e 4f 54 20 49 4e 20 28 20  col1 ) NOT IN ( 
26310 2d 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a  - col2 )..----..
26320 2d 32 37 35 32 0d 0a 2d 37 33 37 31 0d 0a 30 0d  -2752..-7371..0.
26330 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
26340 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
26350 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45   * FROM tab2 WHE
26360 52 45 20 4e 4f 54 20 28 20 4e 55 4c 4c 20 29 20  RE NOT ( NULL ) 
26370 3e 3d 20 2b 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d  >= + col1..----.
26380 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26390 72 74 0d 0a 53 45 4c 45 43 54 20 32 20 46 52 4f  rt..SELECT 2 FRO
263a0 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
263b0 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f  cor0, tab1 AS co
263c0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
263d0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
263e0 33 35 33 34 35 63 35 30 61 31 39 66 64 61 62 39  35345c50a19fdab9
263f0 37 63 65 30 35 64 31 38 33 37 62 31 66 30 39 0d  7ce05d1837b1f09.
26400 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26410 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
26420 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
26430 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
26440 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
26450 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d  -..-1248..-1404.
26460 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-570....query I
26470 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26480 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30   - col1 * - cor0
26490 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63  .col1 + + cor0.c
264a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
264b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 32   cor0..----..742
264c0 30 0d 0a 38 33 37 30 0d 0a 39 34 34 34 0d 0a 0d  0..8370..9444...
264d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
264e0 0d 0a 53 45 4c 45 43 54 20 31 30 20 41 53 20 63  ..SELECT 10 AS c
264f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
26500 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
26510 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  0..----..27 valu
26520 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 66  es hashing to 0f
26530 65 33 65 34 35 61 39 65 63 64 34 39 35 38 34 63  e3e45a9ecd49584c
26540 32 61 62 34 34 32 31 30 30 64 35 31 37 36 0d 0a  2ab442100d5176..
26550 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26560 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
26570 6c 30 20 2d 20 28 20 2b 20 28 20 2d 20 63 6f 72  l0 - ( + ( - cor
26580 30 2e 63 6f 6c 30 20 29 20 29 20 2a 20 2d 20 63  0.col0 ) ) * - c
26590 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 * col2 AS co
265a0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
265b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34  cor0..----..-364
265c0 31 36 0d 0a 2d 34 32 30 39 0d 0a 2d 39 39 37 36  16..-4209..-9976
265d0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
265e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
265f0 31 20 2b 20 39 34 20 41 53 20 63 6f 6c 30 20 46  1 + 94 AS col0 F
26600 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
26610 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a 31 32 35  ..----..111..125
26620 0d 0a 31 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..153....query I
26630 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26640 20 44 49 53 54 49 4e 43 54 20 35 39 20 2b 20 2b   DISTINCT 59 + +
26650 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
26660 0a 2d 2d 2d 2d 0d 0a 31 34 35 0d 0a 31 35 30 0d  .----..145..150.
26670 0a 31 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .156....query I 
26680 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26690 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
266a0 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  col1 + - col2 * 
266b0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
266c0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
266d0 2d 37 39 38 0d 0a 31 30 38 0d 0a 38 35 38 0d 0a  -798..108..858..
266e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
266f0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
26700 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  col2 + - col2 * 
26710 2b 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  + ( col1 ) AS co
26720 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
26730 2d 2d 0d 0a 2d 32 38 37 31 0d 0a 2d 37 35 34 34  --..-2871..-7544
26740 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-98....query I
26750 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26760 20 2b 20 2d 20 31 32 20 2b 20 2d 20 63 6f 6c 31   + - 12 + - col1
26770 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * - cor0.col1 F
26780 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
26790 0d 0a 2d 2d 2d 2d 0d 0a 37 33 38 34 0d 0a 38 32  ..----..7384..82
267a0 36 39 0d 0a 39 33 39 37 0d 0a 0d 0a 71 75 65 72  69..9397....quer
267b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
267c0 45 43 54 20 39 34 20 2b 20 2b 20 63 6f 72 30 2e  ECT 94 + + cor0.
267d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
267e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
267f0 31 0d 0a 31 32 35 0d 0a 31 35 33 0d 0a 0d 0a 71  1..125..153....q
26800 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26810 53 45 4c 45 43 54 20 2d 20 2b 20 28 20 2b 20 63  SELECT - + ( + c
26820 6f 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20  or0.col2 ) FROM 
26830 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
26840 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33  --..-26..-27..-3
26850 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
26860 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
26870 20 63 6f 6c 30 20 2b 20 37 30 20 46 52 4f 4d 20   col0 + 70 FROM 
26880 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
26890 2d 2d 0d 0a 31 30 35 0d 0a 31 35 39 0d 0a 39 34  --..105..159..94
268a0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
268b0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
268c0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
268d0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
268e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
268f0 31 31 36 31 0d 0a 53 45 4c 45 43 54 20 44 49 53  1161..SELECT DIS
26900 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b  TINCT + - col2 +
26910 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2d   cor0.col2 DIV -
26920 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
26930 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
26940 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
26950 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 73 6b 69 70  -33..-82....skip
26960 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
26970 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
26980 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
26990 2d 31 31 36 31 0d 0a 53 45 4c 45 43 54 20 44 49  -1161..SELECT DI
269a0 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20  STINCT + - col2 
269b0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2d 20  + cor0.col2 / - 
269c0 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
269d0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
269e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
269f0 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79  33..-82....query
26a00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26a10 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20  CT ALL + col2 + 
26a20 28 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  ( + col0 + cor0.
26a30 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 32 20 46 52  col0 ) * col2 FR
26a40 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
26a50 0a 2d 2d 2d 2d 0d 0a 34 30 35 0d 0a 34 30 38 32  .----..405..4082
26a60 0d 0a 36 30 34 32 0d 0a 0d 0a 71 75 65 72 79 20  ..6042....query 
26a70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26a80 54 20 2d 20 2b 20 37 39 20 41 53 20 63 6f 6c 31  T - + 79 AS col1
26a90 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
26aa0 0a 2d 2d 2d 2d 0d 0a 2d 37 39 0d 0a 2d 37 39 0d  .----..-79..-79.
26ab0 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-79....query I 
26ac0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26ad0 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72  DISTINCT - - cor
26ae0 30 2e 63 6f 6c 32 20 2b 20 28 20 63 6f 72 30 2e  0.col2 + ( cor0.
26af0 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32  col0 ) FROM tab2
26b00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26b10 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a  104..117..34....
26b20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26b30 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
26b40 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   - - cor0.col2 *
26b50 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2b   col0 + + col1 +
26b60 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
26b70 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
26b80 2d 2d 2d 2d 0d 0a 32 30 30 39 0d 0a 32 31 33 0d  ----..2009..213.
26b90 0a 32 39 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .2940....onlyif 
26ba0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
26bb0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
26bc0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
26bd0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
26be0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
26bf0 6c 2d 31 31 36 36 0d 0a 53 45 4c 45 43 54 20 43  l-1166..SELECT C
26c00 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
26c10 49 4d 41 4c 20 29 20 2a 20 74 61 62 30 2e 63 6f  IMAL ) * tab0.co
26c20 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
26c30 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30 0d  tab0, tab0 cor0.
26c40 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
26c50 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37  hashing to cd7a7
26c60 39 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61  901e47c15155404a
26c70 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73  ff0d216fe0b....s
26c80 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
26c90 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
26ca0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
26cb0 62 65 6c 2d 31 31 36 36 0d 0a 53 45 4c 45 43 54  bel-1166..SELECT
26cc0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
26cd0 52 45 41 4c 20 29 20 2a 20 74 61 62 30 2e 63 6f  REAL ) * tab0.co
26ce0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
26cf0 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30 0d  tab0, tab0 cor0.
26d00 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
26d10 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37  hashing to cd7a7
26d20 39 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61  901e47c15155404a
26d30 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 71  ff0d216fe0b....q
26d40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26d50 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20  SELECT col1 + - 
26d60 38 35 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  85 FROM tab1..--
26d70 2d 2d 0d 0a 2d 35 39 0d 0a 2d 37 32 0d 0a 2d 37  --..-59..-72..-7
26d80 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
26d90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
26da0 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 30 20 29   col2 * ( col0 )
26db0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
26dc0 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38  ..162..3648..768
26dd0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  0....query IIIII
26de0 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
26df0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
26e00 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c  NCT * FROM tab0,
26e10 20 74 61 62 30 20 63 6f 72 30 20 43 52 4f 53 53   tab0 cor0 CROSS
26e20 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61 62 31   JOIN tab1, tab1
26e30 20 63 6f 72 31 2c 20 74 61 62 32 20 41 53 20 63   cor1, tab2 AS c
26e40 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20  or2..----..3645 
26e50 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
26e60 6f 20 62 36 65 66 65 36 66 37 65 63 31 61 33 64  o b6efe6f7ec1a3d
26e70 61 61 33 63 63 36 65 61 39 64 64 37 64 31 33 34  aa3cc6ea9dd7d134
26e80 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  55....query I ro
26e90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
26ea0 53 54 49 4e 43 54 20 2d 20 2b 20 28 20 63 6f 72  STINCT - + ( cor
26eb0 30 2e 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32  0.col0 ) AS col2
26ec0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
26ed0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36  r0..----..-3..-6
26ee0 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20  4..-80....query 
26ef0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26f00 54 20 2b 20 28 20 2d 20 31 39 20 29 20 2a 20 2b  T + ( - 19 ) * +
26f10 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
26f20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
26f30 0a 2d 2d 2d 2d 0d 0a 2d 31 36 39 31 0d 0a 2d 34  .----..-1691..-4
26f40 35 36 0d 0a 2d 36 36 35 0d 0a 0d 0a 73 6b 69 70  56..-665....skip
26f50 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
26f60 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
26f70 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
26f80 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
26f90 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
26fa0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
26fb0 20 2b 20 39 39 20 63 6f 6c 31 20 46 52 4f 4d 20   + 99 col1 FROM 
26fc0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
26fd0 2d 2d 0d 0a 39 39 0d 0a 39 39 0d 0a 39 39 0d 0a  --..99..99..99..
26fe0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
26ff0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
27000 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
27010 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
27020 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
27030 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27040 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 32 38  CT DISTINCT ( 28
27050 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   ) col0 FROM tab
27060 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
27070 0a 32 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .28....skipif po
27080 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
27090 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
270a0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
270b0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
270c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
270d0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
270e0 20 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46   * - col1 col0 F
270f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
27100 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d  ..----..-1343..-
27110 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75  217..-4602....qu
27120 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27130 45 4c 45 43 54 20 41 4c 4c 20 33 36 20 2a 20 38  ELECT ALL 36 * 8
27140 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  4 FROM tab0 AS c
27150 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 32 34 0d  or0..----..3024.
27160 0a 33 30 32 34 0d 0a 33 30 32 34 0d 0a 0d 0a 71  .3024..3024....q
27170 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27180 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
27190 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  1 * + col2 * col
271a0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
271b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36  or0..----..-1196
271c0 35 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35 38 35  52..-51034..-585
271d0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  9....query IIIII
271e0 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
271f0 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
27200 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
27210 30 2c 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f  0, tab1, tab2 co
27220 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61  r1..----..972 va
27230 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
27240 62 63 66 34 33 30 66 37 39 33 38 36 62 34 33 62  bcf430f79386b43b
27250 63 34 30 37 37 32 37 31 66 63 64 31 35 63 66 30  c4077271fcd15cf0
27260 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
27270 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
27280 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
27290 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
272a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
272b0 31 31 37 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1178..SELECT ALL
272c0 20 34 35 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20   45 + cor0.col1 
272d0 2a 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20  * col0 DIV col0 
272e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
272f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
27300 31 0d 0a 31 33 36 0d 0a 31 34 32 0d 0a 0d 0a 73  1..136..142....s
27310 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
27320 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
27330 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
27340 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
27350 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
27360 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
27370 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
27380 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37  owsort label-117
27390 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 35  8..SELECT ALL 45
273a0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   + cor0.col1 * c
273b0 6f 6c 30 20 2f 20 63 6f 6c 30 20 63 6f 6c 31 20  ol0 / col0 col1 
273c0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
273d0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 31 33  0..----..131..13
273e0 36 0d 0a 31 34 32 0d 0a 0d 0a 71 75 65 72 79 20  6..142....query 
273f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27400 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 63  T DISTINCT + ( c
27410 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol0 ) AS col1 FR
27420 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
27430 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39  .----..7..78..79
27440 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27450 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
27460 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  INCT + - col0 + 
27470 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53  col1 * - col1 AS
27480 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
27490 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
274a0 33 35 35 39 0d 0a 2d 33 36 38 0d 0a 2d 39 36 38  3559..-368..-968
274b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
274c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
274d0 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  INCT col2 * + co
274e0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
274f0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  tab0..----..1..1
27500 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a 71 75 65  089..6724....que
27510 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27520 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  LECT + - cor0.co
27530 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 * col1 FROM t
27540 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
27550 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36  -1343..-217..-46
27560 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
27570 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
27580 53 54 49 4e 43 54 20 2d 20 28 20 2d 20 63 6f 6c  STINCT - ( - col
27590 31 20 29 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  1 ) * + col2 AS 
275a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
275b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
275c0 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d  48..1404..570...
275d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
275e0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 31  ..SELECT ALL - 1
275f0 32 20 2a 20 36 31 20 41 53 20 63 6f 6c 32 20 46  2 * 61 AS col2 F
27600 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
27610 2d 37 33 32 0d 0a 2d 37 33 32 0d 0a 2d 37 33 32  -732..-732..-732
27620 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
27630 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
27640 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
27650 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
27660 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
27670 31 31 38 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1185..SELECT ALL
27680 20 2b 20 28 20 34 38 20 2b 20 63 6f 6c 30 20 29   + ( 48 + col0 )
27690 20 44 49 56 20 2d 20 63 6f 6c 30 20 63 6f 6c 32   DIV - col0 col2
276a0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
276b0 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 33 0d 0a 0d 0a  ..-1..-2..-3....
276c0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
276d0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
276e0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
276f0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
27700 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
27710 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
27720 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
27730 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
27740 38 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  85..SELECT ALL +
27750 20 28 20 34 38 20 2b 20 63 6f 6c 30 20 29 20 2f   ( 48 + col0 ) /
27760 20 2d 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f   - col0 col2 FRO
27770 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
27780 0d 0a 2d 32 0d 0a 2d 33 0d 0a 0d 0a 71 75 65 72  ..-2..-3....quer
27790 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
277a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32  ECT DISTINCT + 2
277b0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
277c0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 0d 0a 71  b0..----..2....q
277d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
277e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
277f0 2b 20 39 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  + 90 FROM tab1..
27800 2d 2d 2d 2d 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70  ----..90....skip
27810 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
27820 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
27830 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
27840 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
27850 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
27860 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
27870 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c   - cor0.col0 col
27880 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
27890 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
278a0 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
278b0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
278c0 69 6e 67 20 74 6f 20 33 30 30 30 33 33 37 64 64  ing to 3000337dd
278d0 33 66 31 31 65 39 63 66 64 35 61 33 31 32 62 30  3f11e9cfd5a312b0
278e0 31 65 66 33 66 38 62 0d 0a 0d 0a 71 75 65 72 79  1ef3f8b....query
278f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27900 43 54 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63  CT col0 + cor0.c
27910 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol1 * cor0.col0 
27920 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
27930 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
27940 0a 31 34 32 32 0d 0a 32 32 34 0d 0a 34 36 38 30  .1422..224..4680
27950 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
27960 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
27970 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
27980 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
27990 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
279a0 31 31 39 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1190..SELECT - c
279b0 6f 6c 30 20 44 49 56 20 2d 20 28 20 39 32 20 2a  ol0 DIV - ( 92 *
279c0 20 2b 20 63 6f 6c 30 20 29 20 2b 20 63 6f 72 30   + col0 ) + cor0
279d0 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20  .col0 FROM tab2 
279e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
279f0 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70  ..78..79....skip
27a00 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
27a10 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
27a20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
27a30 2d 31 31 39 30 0d 0a 53 45 4c 45 43 54 20 2d 20  -1190..SELECT - 
27a40 63 6f 6c 30 20 2f 20 2d 20 28 20 39 32 20 2a 20  col0 / - ( 92 * 
27a50 2b 20 63 6f 6c 30 20 29 20 2b 20 63 6f 72 30 2e  + col0 ) + cor0.
27a60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
27a70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d  S cor0..----..7.
27a80 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70 69  .78..79....skipi
27a90 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
27aa0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
27ab0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
27ac0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
27ad0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
27ae0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
27af0 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * + col1 + + co
27b00 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
27b10 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
27b20 0a 31 35 37 0d 0a 32 36 35 0d 0a 37 33 30 0d 0a  .157..265..730..
27b30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27b40 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
27b50 6f 6c 30 20 2b 20 2b 20 36 39 20 2a 20 2b 20 63  ol0 + + 69 * + c
27b60 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  or0.col2 AS col1
27b70 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
27b80 0a 2d 2d 2d 2d 0d 0a 33 37 32 39 0d 0a 33 39 39  .----..3729..399
27b90 37 0d 0a 36 37 30 34 0d 0a 0d 0a 6f 6e 6c 79 69  7..6704....onlyi
27ba0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
27bb0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
27bc0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
27bd0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
27be0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
27bf0 62 65 6c 2d 31 31 39 33 0d 0a 53 45 4c 45 43 54  bel-1193..SELECT
27c00 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
27c10 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 72 30   SIGNED ) * cor0
27c20 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63  .col2 + - cor0.c
27c30 6f 6c 32 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 / col1 FROM 
27c40 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
27c50 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
27c60 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....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 31 39  owsort label-119
27ca0 33 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  3..SELECT - CAST
27cb0 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
27cc0 45 52 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  ER ) * cor0.col2
27cd0 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2f   + - cor0.col2 /
27ce0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
27cf0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
27d00 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
27d10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27d20 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63  rt..SELECT - ( c
27d30 6f 6c 31 20 29 20 2a 20 63 6f 6c 31 20 2a 20 63  ol1 ) * col1 * c
27d40 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
27d50 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
27d60 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 30 0d 0a 2d 31  .----..-1000..-1
27d70 37 35 37 36 0d 0a 2d 32 31 39 37 0d 0a 0d 0a 71  7576..-2197....q
27d80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27d90 53 45 4c 45 43 54 20 37 35 20 41 53 20 63 6f 6c  SELECT 75 AS col
27da0 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
27db0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  0 cor0..----..9 
27dc0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
27dd0 6f 20 32 32 30 34 32 62 66 64 34 64 37 38 37 34  o 22042bfd4d7874
27de0 31 35 34 35 37 61 34 32 62 62 39 33 64 34 38 65  15457a42bb93d48e
27df0 65 61 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  ea....onlyif mys
27e00 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
27e10 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
27e20 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
27e30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
27e40 6c 2d 31 31 39 36 0d 0a 53 45 4c 45 43 54 20 41  l-1196..SELECT A
27e50 4c 4c 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20  LL - ( - col0 ) 
27e60 44 49 56 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  DIV col0 + - col
27e70 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  2 * col2 + col0 
27e80 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  DIV col0 FROM ta
27e90 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 34 0d  b1..----..-2914.
27ea0 0a 2d 33 32 34 37 0d 0a 2d 39 32 31 34 0d 0a 0d  .-3247..-9214...
27eb0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
27ec0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
27ed0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
27ee0 6c 61 62 65 6c 2d 31 31 39 36 0d 0a 53 45 4c 45  label-1196..SELE
27ef0 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 63 6f 6c  CT ALL - ( - col
27f00 30 20 29 20 2f 20 63 6f 6c 30 20 2b 20 2d 20 63  0 ) / col0 + - c
27f10 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol2 * col2 + col
27f20 30 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 / col0 FROM ta
27f30 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 34 0d  b1..----..-2914.
27f40 0a 2d 33 32 34 37 0d 0a 2d 39 32 31 34 0d 0a 0d  .-3247..-9214...
27f50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27f60 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 38  ..SELECT ALL ( 8
27f70 35 20 29 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c  5 ) * col1 * col
27f80 30 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20  0 + + tab1.col1 
27f90 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
27fa0 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 34 31 30 0d 0a  1..----..54410..
27fb0 36 36 35 36 0d 0a 38 38 34 31 33 0d 0a 0d 0a 71  6656..88413....q
27fc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27fd0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
27fe0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
27ff0 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
28000 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
28010 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d  1..----..24..35.
28020 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .89....query I r
28030 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
28040 20 33 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   31 AS col2 FROM
28050 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
28060 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
28070 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66  ues hashing to f
28080 34 62 30 35 32 30 36 65 65 32 66 63 30 63 66 38  4b05206ee2fc0cf8
28090 30 30 37 64 39 63 33 35 31 34 38 38 35 66 61 0d  007d9c3514885fa.
280a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
280b0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
280c0 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  or0.col1 + - col
280d0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
280e0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
280f0 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d 39  -..-137..-38..-9
28100 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
28110 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
28120 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
28130 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
28140 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
28150 2d 31 32 30 31 0d 0a 53 45 4c 45 43 54 20 2b 20  -1201..SELECT + 
28160 63 6f 6c 32 20 44 49 56 20 38 39 20 2d 20 63 6f  col2 DIV 89 - co
28170 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
28180 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d  cor0..----..-86.
28190 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69  .-91..-97....ski
281a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
281b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
281c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
281d0 6c 2d 31 32 30 31 0d 0a 53 45 4c 45 43 54 20 2b  l-1201..SELECT +
281e0 20 63 6f 6c 32 20 2f 20 38 39 20 2d 20 63 6f 6c   col2 / 89 - col
281f0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
28200 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a  or0..----..-86..
28210 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72  -91..-97....quer
28220 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28230 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d  ECT + - col1 + -
28240 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 63 6f   ( + col2 ) * co
28250 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
28260 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32  cor0..----..-132
28270 0d 0a 2d 37 33 38 39 0d 0a 2d 38 37 38 0d 0a 0d  ..-7389..-878...
28280 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
28290 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
282a0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
282b0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
282c0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
282d0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 30 33 0d 0a  ort label-1203..
282e0 53 45 4c 45 43 54 20 2d 20 2b 20 43 41 53 54 28  SELECT - + CAST(
282f0 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20   col0 AS SIGNED 
28300 29 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72  ) + + col2 * cor
28310 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  0.col1 + - col0 
28320 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
28330 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
28340 0a 32 37 0d 0a 32 37 39 30 0d 0a 37 32 38 34 0d  .27..2790..7284.
28350 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
28360 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
28370 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28380 74 20 6c 61 62 65 6c 2d 31 32 30 33 0d 0a 53 45  t label-1203..SE
28390 4c 45 43 54 20 2d 20 2b 20 43 41 53 54 20 28 20  LECT - + CAST ( 
283a0 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20  col0 AS INTEGER 
283b0 29 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72  ) + + col2 * cor
283c0 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  0.col1 + - col0 
283d0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
283e0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
283f0 0a 32 37 0d 0a 32 37 39 30 0d 0a 37 32 38 34 0d  .27..2790..7284.
28400 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28410 72 74 0d 0a 53 45 4c 45 43 54 20 32 20 2b 20 63  rt..SELECT 2 + c
28420 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 35  ol2 - - col2 * 5
28430 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
28440 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 38 0d  or0..----..1328.
28450 0a 31 33 37 39 0d 0a 31 39 34 30 0d 0a 0d 0a 71  .1379..1940....q
28460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28470 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28480 2d 20 2b 20 32 30 20 2a 20 63 6f 6c 31 20 2b 20  - + 20 * col1 + 
28490 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
284a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
284b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 38 37 0d 0a 2d  ..----..-1687..-
284c0 31 37 33 38 0d 0a 2d 31 39 33 39 0d 0a 0d 0a 71  1738..-1939....q
284d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
284e0 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 38 31 20  SELECT + ( - 81 
284f0 29 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 34  ) + + col2 * - 4
28500 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  8 AS col0 FROM t
28510 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
28520 2d 0d 0a 2d 32 36 37 33 0d 0a 2d 32 38 31 37 0d  -..-2673..-2817.
28530 0a 2d 34 36 38 39 0d 0a 0d 0a 71 75 65 72 79 20  .-4689....query 
28540 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28550 54 20 41 4c 4c 20 35 36 20 2b 20 2b 20 63 6f 72  T ALL 56 + + cor
28560 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  0.col0 + - col1 
28570 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
28580 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28590 2d 32 37 35 38 0d 0a 2d 36 0d 0a 2d 37 33 31 37  -2758..-6..-7317
285a0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
285b0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
285c0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
285d0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
285e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
285f0 31 32 30 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1208..SELECT ALL
28600 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 31 37   + - col0 DIV 17
28610 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
28620 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
28630 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 35 0d 0a 0d 0a  ..-1..-2..-5....
28640 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
28650 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
28660 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28670 61 62 65 6c 2d 31 32 30 38 0d 0a 53 45 4c 45 43  abel-1208..SELEC
28680 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2f  T ALL + - col0 /
28690 20 31 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   17 AS col1 FROM
286a0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
286b0 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 35 0d  ---..-1..-2..-5.
286c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
286d0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
286e0 6f 6c 30 20 2b 20 2b 20 31 36 20 41 53 20 63 6f  ol0 + + 16 AS co
286f0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
28700 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 0d 0a 2d 36  0..----..-48..-6
28710 34 0d 0a 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49  4..13....query I
28720 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28730 20 44 49 53 54 49 4e 43 54 20 28 20 63 6f 6c 30   DISTINCT ( col0
28740 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74   ) * col0 FROM t
28750 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
28760 2d 0d 0a 34 30 39 36 0d 0a 36 34 30 30 0d 0a 39  -..4096..6400..9
28770 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28780 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
28790 2d 20 37 35 20 2a 20 63 6f 6c 30 20 2b 20 2b 20  - 75 * col0 + + 
287a0 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 34 20 46 52  cor0.col0 + 4 FR
287b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
287c0 0a 2d 2d 2d 2d 0d 0a 2d 32 31 38 0d 0a 2d 34 37  .----..-218..-47
287d0 33 32 0d 0a 2d 35 39 31 36 0d 0a 0d 0a 71 75 65  32..-5916....que
287e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
287f0 4c 45 43 54 20 2b 20 33 39 20 2a 20 63 6f 6c 31  LECT + 39 * col1
28800 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   + col1 + + col1
28810 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
28820 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
28830 2d 0d 0a 31 31 37 33 39 0d 0a 35 35 30 34 0d 0a  -..11739..5504..
28840 37 32 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7275....query I 
28850 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28860 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL + cor0.col0 
28870 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52  + col0 * col1 FR
28880 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28890 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a 37 30 34  .----..1120..704
288a0 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..81....query I 
288b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
288c0 2d 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30 20  - col0 - - col0 
288d0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
288e0 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  2..----..0..0..0
288f0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
28900 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
28910 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
28920 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
28930 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
28940 31 32 31 35 0d 0a 53 45 4c 45 43 54 20 28 20 2d  1215..SELECT ( -
28950 20 63 6f 6c 30 20 29 20 2a 20 2d 20 43 41 53 54   col0 ) * - CAST
28960 28 20 2d 20 28 20 2d 20 74 61 62 32 2e 63 6f 6c  ( - ( - tab2.col
28970 32 20 29 20 41 53 20 53 49 47 4e 45 44 20 29 20  2 ) AS SIGNED ) 
28980 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  * + col1 + col2 
28990 44 49 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  DIV - col1 FROM 
289a0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36  tab2..----..1196
289b0 35 32 0d 0a 35 31 30 33 32 0d 0a 35 38 35 39 0d  52..51032..5859.
289c0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
289d0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
289e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
289f0 74 20 6c 61 62 65 6c 2d 31 32 31 35 0d 0a 53 45  t label-1215..SE
28a00 4c 45 43 54 20 28 20 2d 20 63 6f 6c 30 20 29 20  LECT ( - col0 ) 
28a10 2a 20 2d 20 43 41 53 54 20 28 20 2d 20 28 20 2d  * - CAST ( - ( -
28a20 20 74 61 62 32 2e 63 6f 6c 32 20 29 20 41 53 20   tab2.col2 ) AS 
28a30 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f  INTEGER ) * + co
28a40 6c 31 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 63 6f  l1 + col2 / - co
28a50 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
28a60 2d 2d 0d 0a 31 31 39 36 35 32 0d 0a 35 31 30 33  --..119652..5103
28a70 32 0d 0a 35 38 35 39 0d 0a 0d 0a 73 6b 69 70 69  2..5859....skipi
28a80 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
28a90 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
28aa0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
28ab0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
28ac0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
28ad0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
28ae0 49 4e 43 54 20 28 20 2d 20 63 6f 6c 31 20 2a 20  INCT ( - col1 * 
28af0 39 35 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74  95 ) col0 FROM t
28b00 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 31 37 30  ab0..----..-8170
28b10 0d 0a 2d 38 36 34 35 0d 0a 2d 39 32 31 35 0d 0a  ..-8645..-9215..
28b20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28b30 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
28b40 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   * col2 AS col2 
28b50 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
28b60 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39 0d 0a 36  ----..1..1089..6
28b70 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  724....query I r
28b80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38  owsort..SELECT 8
28b90 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * + cor0.col1 F
28ba0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
28bb0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 0d 0a 32 34 38  ..----..136..248
28bc0 0d 0a 34 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..472....query I
28bd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28be0 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
28bf0 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  l2 * + col0 * - 
28c00 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
28c10 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
28c20 2d 2d 2d 2d 0d 0a 2d 32 36 31 33 36 0d 0a 2d 33  ----..-26136..-3
28c30 35 0d 0a 2d 35 39 38 34 33 36 0d 0a 0d 0a 71 75  5..-598436....qu
28c40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28c50 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 35  ELECT DISTINCT 5
28c60 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
28c70 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
28c80 30 2c 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d  0, tab0 cor1..--
28c90 2d 2d 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20  --..52....query 
28ca0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28cb0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 35  T DISTINCT - - 5
28cc0 34 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  4 * - cor0.col1 
28cd0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
28ce0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36 34 34 0d 0a  0..----..-4644..
28cf0 2d 34 39 31 34 0d 0a 2d 35 32 33 38 0d 0a 0d 0a  -4914..-5238....
28d00 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
28d10 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
28d20 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
28d30 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
28d40 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
28d50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28d60 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
28d70 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  1 col1 FROM tab2
28d80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28d90 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d  1343..217..4602.
28da0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28db0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 31 20  rt..SELECT - 51 
28dc0 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  + + col0 AS col0
28dd0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
28de0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 0d 0a 32  r0..----..-44..2
28df0 37 0d 0a 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  7..28....query I
28e00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28e10 20 2b 20 34 20 41 53 20 63 6f 6c 31 20 46 52 4f   + 4 AS col1 FRO
28e20 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
28e30 2d 0d 0a 34 0d 0a 34 0d 0a 34 0d 0a 0d 0a 71 75  -..4..4..4....qu
28e40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28e50 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
28e60 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   - cor0.col1 * c
28e70 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 + col1 FROM 
28e80 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
28e90 2d 2d 0d 0a 31 30 34 0d 0a 31 30 35 33 0d 0a 36  --..104..1053..6
28ea0 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  50....query I ro
28eb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
28ec0 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  L - - cor0.col1 
28ed0 2b 20 38 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  + 8 * + col2 FRO
28ee0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
28ef0 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 33 35 30 0d 0a  ----..105..350..
28f00 37 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  747....query I r
28f10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
28f20 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b  ISTINCT + col0 +
28f30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
28f40 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
28f50 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39  ----..137..38..9
28f60 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
28f70 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
28f80 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
28f90 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
28fa0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
28fb0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
28fc0 32 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  28..SELECT DISTI
28fd0 4e 43 54 20 63 6f 6c 31 20 2a 20 43 41 53 54 28  NCT col1 * CAST(
28fe0 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20   col1 AS SIGNED 
28ff0 29 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ) + + col0 AS co
29000 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
29010 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d  cor0..----..164.
29020 0a 32 34 39 0d 0a 36 37 39 0d 0a 0d 0a 73 6b 69  .249..679....ski
29030 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
29040 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
29050 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
29060 6c 2d 31 32 32 38 0d 0a 53 45 4c 45 43 54 20 44  l-1228..SELECT D
29070 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 43  ISTINCT col1 * C
29080 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e  AST ( col1 AS IN
29090 54 45 47 45 52 20 29 20 2b 20 2b 20 63 6f 6c 30  TEGER ) + + col0
290a0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
290b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
290c0 0d 0a 31 36 34 0d 0a 32 34 39 0d 0a 36 37 39 0d  ..164..249..679.
290d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
290e0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
290f0 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 34 36 20  or0.col2 * - 46 
29100 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
29110 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
29120 0a 31 35 31 38 0d 0a 33 37 37 32 0d 0a 34 36 0d  .1518..3772..46.
29130 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29140 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
29150 6f 6c 30 20 2b 20 2d 20 32 31 20 2a 20 2b 20 63  ol0 + - 21 * + c
29160 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
29170 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
29180 38 30 0d 0a 2d 34 38 30 0d 0a 2d 37 30 30 0d 0a  80..-480..-700..
29190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
291a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
291b0 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20  - col0 + col1 * 
291c0 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
291d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
291e0 2d 0d 0a 31 34 35 36 0d 0a 35 36 37 0d 0a 38 33  -..1456..567..83
291f0 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
29200 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
29210 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
29220 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
29230 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
29240 2d 31 32 33 32 0d 0a 53 45 4c 45 43 54 20 44 49  -1232..SELECT DI
29250 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20  STINCT + - col1 
29260 44 49 56 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20  DIV ( cor0.col0 
29270 29 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  ) + col2 * cor0.
29280 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
29290 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  S cor0..----..28
292a0 33 35 0d 0a 37 34 36 31 0d 0a 39 35 0d 0a 0d 0a  35..7461..95....
292b0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
292c0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
292d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
292e0 61 62 65 6c 2d 31 32 33 32 0d 0a 53 45 4c 45 43  abel-1232..SELEC
292f0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
29300 6f 6c 31 20 2f 20 28 20 63 6f 72 30 2e 63 6f 6c  ol1 / ( cor0.col
29310 30 20 29 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72  0 ) + col2 * cor
29320 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
29330 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29340 32 38 33 35 0d 0a 37 34 36 31 0d 0a 39 35 0d 0a  2835..7461..95..
29350 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29360 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  t..SELECT - cor0
29370 2e 63 6f 6c 31 20 2a 20 2d 20 31 36 20 41 53 20  .col1 * - 16 AS 
29380 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
29390 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32 0d 0a  or0..----..272..
293a0 34 39 36 0d 0a 39 34 34 0d 0a 0d 0a 71 75 65 72  496..944....quer
293b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
293c0 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63  ECT ALL + tab1.c
293d0 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 * col0 FROM 
293e0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 36  tab1..----..4096
293f0 0d 0a 36 34 30 30 0d 0a 39 0d 0a 0d 0a 71 75 65  ..6400..9....que
29400 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29410 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2a  LECT tab1.col2 *
29420 20 2b 20 36 39 20 46 52 4f 4d 20 74 61 62 31 2c   + 69 FROM tab1,
29430 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
29440 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
29450 73 68 69 6e 67 20 74 6f 20 62 33 63 61 30 37 33  shing to b3ca073
29460 66 37 64 66 63 37 30 33 33 63 63 62 62 32 65 32  f7dfc7033ccbb2e2
29470 63 66 36 61 63 37 65 63 36 0d 0a 0d 0a 71 75 65  cf6ac7ec6....que
29480 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29490 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
294a0 31 37 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  17 * + col2 * + 
294b0 28 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  ( + col1 + - col
294c0 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  2 ) AS col1 FROM
294d0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35   tab1..----..135
294e0 34 35 36 0d 0a 32 35 37 30 34 0d 0a 34 35 35 34  456..25704..4554
294f0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
29500 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
29510 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a  TINCT - - col1 *
29520 20 39 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   93 AS col1 FROM
29530 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
29540 0d 0a 37 39 39 38 0d 0a 38 34 36 33 0d 0a 39 30  ..7998..8463..90
29550 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  21....onlyif mys
29560 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
29570 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
29580 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
29590 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
295a0 6c 2d 31 32 33 38 0d 0a 53 45 4c 45 43 54 20 41  l-1238..SELECT A
295b0 4c 4c 20 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f  LL + col1 DIV co
295c0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
295d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
295e0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 38 0d 0a 0d 0a 73  --..0..0..8....s
295f0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
29600 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
29610 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
29620 62 65 6c 2d 31 32 33 38 0d 0a 53 45 4c 45 43 54  bel-1238..SELECT
29630 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2f 20 63 6f   ALL + col1 / co
29640 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
29650 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
29660 2d 2d 0d 0a 30 0d 0a 30 0d 0a 38 0d 0a 0d 0a 71  --..0..0..8....q
29670 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29680 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
29690 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  0.col0 * - col0 
296a0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
296b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a  0..----..-1225..
296c0 2d 35 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71  -576..-7921....q
296d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
296e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
296f0 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  - + col1 * - col
29700 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  0 * + col1 FROM 
29710 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
29720 0a 31 37 37 35 30 34 0d 0a 33 32 39 33 31 35 0d  .177504..329315.
29730 0a 37 33 37 30 30 39 0d 0a 0d 0a 73 6b 69 70 69  .737009....skipi
29740 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
29750 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
29760 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
29770 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
29780 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
29790 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 35 20 63  ort..SELECT 95 c
297a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol1 FROM tab0, t
297b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
297c0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
297d0 69 6e 67 20 74 6f 20 65 35 37 64 38 65 64 38 37  ing to e57d8ed87
297e0 39 64 66 64 30 34 64 30 34 61 61 65 38 37 37 32  9dfd04d04aae8772
297f0 35 63 39 37 30 64 33 0d 0a 0d 0a 71 75 65 72 79  5c970d3....query
29800 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29810 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b  CT cor0.col1 + +
29820 20 37 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   72 FROM tab1, t
29830 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
29840 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
29850 69 6e 67 20 74 6f 20 35 62 61 38 33 38 30 33 30  ing to 5ba838030
29860 61 63 37 62 35 66 65 35 37 66 37 33 61 39 34 39  ac7b5fe57f73a949
29870 34 35 65 34 38 37 33 0d 0a 0d 0a 71 75 65 72 79  45e4873....query
29880 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29890 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30  CT + col1 * cor0
298a0 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20  .col2 FROM tab1 
298b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38  cor0..----..1248
298c0 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71  ..1404..570....q
298d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
298e0 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20  SELECT + - col0 
298f0 2a 20 2d 20 37 39 20 46 52 4f 4d 20 74 61 62 32  * - 79 FROM tab2
29900 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29910 35 35 33 0d 0a 36 31 36 32 0d 0a 36 32 34 31 0d  553..6162..6241.
29920 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29930 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 34  rt..SELECT + + 4
29940 35 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  5 + col1 * - col
29950 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
29960 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 0d  or0..----..-124.
29970 0a 2d 35 35 0d 0a 2d 36 33 31 0d 0a 0d 0a 6f 6e  .-55..-631....on
29980 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
29990 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
299a0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
299b0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
299c0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34 36 0d 0a  ort label-1246..
299d0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44 49  SELECT - col2 DI
299e0 56 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  V - col0 + + col
299f0 30 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f  0 DIV - col0 FRO
29a00 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
29a10 0d 0a 2d 31 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69  ..-1..2....skipi
29a20 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
29a30 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
29a40 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29a50 31 32 34 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1246..SELECT - c
29a60 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 2b  ol2 / - col0 + +
29a70 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20 46   col0 / - col0 F
29a80 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
29a90 2d 31 0d 0a 2d 31 0d 0a 32 0d 0a 0d 0a 71 75 65  -1..-1..2....que
29aa0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29ab0 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  LECT + col2 * - 
29ac0 28 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c  ( col1 ) + + col
29ad0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
29ae0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 36  ab2..----..-1456
29af0 0d 0a 2d 35 36 37 0d 0a 2d 38 33 30 0d 0a 0d 0a  ..-567..-830....
29b00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29b10 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
29b20 20 31 37 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   17 FROM tab1..-
29b30 2d 2d 2d 0d 0a 2d 33 37 0d 0a 2d 34 30 0d 0a 2d  ---..-37..-40..-
29b40 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
29b50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
29b60 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20  - col1 * col1 + 
29b70 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
29b80 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
29b90 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 36 37 33 0d 0a  ---..-36..-673..
29ba0 2d 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -89....onlyif my
29bb0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
29bc0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
29bd0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
29be0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
29bf0 65 6c 2d 31 32 35 30 0d 0a 53 45 4c 45 43 54 20  el-1250..SELECT 
29c00 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL + cor0.col0 
29c10 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  DIV - col1 AS co
29c20 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
29c30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
29c40 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
29c50 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
29c60 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
29c70 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 30  wsort label-1250
29c80 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
29c90 6f 72 30 2e 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  or0.col0 / - col
29ca0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
29cb0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
29cc0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
29cd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29ce0 45 4c 45 43 54 20 2b 20 33 39 20 46 52 4f 4d 20  ELECT + 39 FROM 
29cf0 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30 0d  tab1, tab1 cor0.
29d00 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
29d10 68 61 73 68 69 6e 67 20 74 6f 20 35 65 63 63 34  hashing to 5ecc4
29d20 64 33 64 65 36 38 61 65 38 32 38 61 32 64 35 32  d3de68ae828a2d52
29d30 32 64 66 66 38 35 37 31 63 62 66 0d 0a 0d 0a 71  2dff8571cbf....q
29d40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29d50 53 45 4c 45 43 54 20 2b 20 36 39 20 41 53 20 63  SELECT + 69 AS c
29d60 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
29d70 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a  ab0, tab1 cor0..
29d80 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
29d90 68 61 73 68 69 6e 67 20 74 6f 20 32 38 31 30 63  hashing to 2810c
29da0 33 30 39 37 66 65 34 37 37 31 65 32 37 33 63 66  3097fe4771e273cf
29db0 66 66 39 30 33 33 35 37 62 34 30 0d 0a 0d 0a 71  ff903357b40....q
29dc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29dd0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
29de0 2d 20 35 30 20 2b 20 2d 20 63 6f 6c 30 20 41 53  - 50 + - col0 AS
29df0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
29e00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
29e10 31 31 34 0d 0a 2d 31 33 30 0d 0a 2d 35 33 0d 0a  114..-130..-53..
29e20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29e30 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20  t..SELECT + ( + 
29e40 63 6f 6c 30 20 29 20 2a 20 2d 20 31 34 20 41 53  col0 ) * - 14 AS
29e50 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
29e60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
29e70 31 30 39 32 0d 0a 2d 31 31 30 36 0d 0a 2d 39 38  1092..-1106..-98
29e80 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
29e90 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
29ea0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
29eb0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
29ec0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29ed0 31 32 35 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  1255..SELECT DIS
29ee0 54 49 4e 43 54 20 2d 20 35 31 20 44 49 56 20 2d  TINCT - 51 DIV -
29ef0 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
29f00 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
29f10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
29f20 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  7....skipif mysq
29f30 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
29f40 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
29f50 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 35 0d 0a  ort label-1255..
29f60 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
29f70 2d 20 35 31 20 2f 20 2d 20 63 6f 72 30 2e 63 6f  - 51 / - cor0.co
29f80 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
29f90 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
29fa0 2d 2d 0d 0a 30 0d 0a 31 37 0d 0a 0d 0a 71 75 65  --..0..17....que
29fb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29fc0 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  LECT - - cor0.co
29fd0 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  l1 + - col1 * co
29fe0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
29ff0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36  cor0..----..-156
2a000 0d 0a 2d 36 35 30 0d 0a 2d 39 30 0d 0a 0d 0a 71  ..-650..-90....q
2a010 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2a020 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20  SELECT - col2 * 
2a030 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col2 * cor0.col0
2a040 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2a050 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 30 37  r0..----..-11407
2a060 36 0d 0a 2d 35 31 30 33 0d 0a 2d 35 32 37 32 38  6..-5103..-52728
2a070 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2a080 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2a090 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2a0a0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2a0b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2a0c0 31 32 35 38 0d 0a 53 45 4c 45 43 54 20 34 39 20  1258..SELECT 49 
2a0d0 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 44 49  + + tab1.col0 DI
2a0e0 56 20 63 6f 6c 31 20 2b 20 2b 20 37 30 20 44 49  V col1 + + 70 DI
2a0f0 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  V + col1 FROM ta
2a100 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 31 0d 0a 36 30  b1..----..51..60
2a110 0d 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..62....skipif m
2a120 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2a130 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2a140 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35  owsort label-125
2a150 38 0d 0a 53 45 4c 45 43 54 20 34 39 20 2b 20 2b  8..SELECT 49 + +
2a160 20 74 61 62 31 2e 63 6f 6c 30 20 2f 20 63 6f 6c   tab1.col0 / col
2a170 31 20 2b 20 2b 20 37 30 20 2f 20 2b 20 63 6f 6c  1 + + 70 / + col
2a180 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
2a190 2d 0d 0a 35 31 0d 0a 36 30 0d 0a 36 32 0d 0a 0d  -..51..60..62...
2a1a0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2a1b0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2a1c0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2a1d0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2a1e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35  owsort label-125
2a1f0 39 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 74 61  9..SELECT ( + ta
2a200 62 30 2e 63 6f 6c 31 20 29 20 44 49 56 20 2b 20  b0.col1 ) DIV + 
2a210 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col2 + col1 * + 
2a220 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab0.col2 AS col
2a230 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
2a240 2d 0d 0a 31 39 34 0d 0a 32 38 34 30 0d 0a 37 34  -..194..2840..74
2a250 36 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  63....skipif mys
2a260 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2a270 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2a280 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 39 0d  sort label-1259.
2a290 0a 53 45 4c 45 43 54 20 28 20 2b 20 74 61 62 30  .SELECT ( + tab0
2a2a0 2e 63 6f 6c 31 20 29 20 2f 20 2b 20 63 6f 6c 32  .col1 ) / + col2
2a2b0 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 74 61 62 30   + col1 * + tab0
2a2c0 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
2a2d0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
2a2e0 39 34 0d 0a 32 38 34 30 0d 0a 37 34 36 33 0d 0a  94..2840..7463..
2a2f0 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49  ..query IIIIIIII
2a300 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
2a310 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20  LECT ALL * FROM 
2a320 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62 31  tab1, tab2, tab1
2a330 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
2a340 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37  S cor1..----..97
2a350 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  2 values hashing
2a360 20 74 6f 20 39 62 39 31 63 66 39 66 63 63 30 36   to 9b91cf9fcc06
2a370 34 65 65 31 63 31 33 30 37 34 61 36 37 38 62 37  4ee1c13074a678b7
2a380 32 61 63 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2ac7....query I 
2a390 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a3a0 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 32 37 20  DISTINCT + - 27 
2a3b0 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  + - col2 AS col2
2a3c0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2a3d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 0d 0a  r0..----..-123..
2a3e0 2d 38 31 0d 0a 2d 38 34 0d 0a 0d 0a 71 75 65 72  -81..-84....quer
2a3f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a400 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72  ECT DISTINCT cor
2a410 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  0.col1 * - col2 
2a420 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2a430 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
2a440 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d  534..-646..-837.
2a450 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a460 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2a470 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 63   col2 + col2 * c
2a480 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  or0.col2 * col2 
2a490 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2a4a0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 35 31 38 0d  0..----..157518.
2a4b0 0a 31 38 35 32 35 30 0d 0a 38 38 34 38 33 32 0d  .185250..884832.
2a4c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a4d0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
2a4e0 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53  0.col0 + col1 AS
2a4f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2a500 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2a510 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a  10..132..180....
2a520 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2a530 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2a540 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2a550 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2a560 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2a570 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a580 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
2a590 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   + + cor0.col1 *
2a5a0 20 34 35 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   45 col2 FROM ta
2a5b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2a5c0 0d 0a 31 31 31 36 0d 0a 33 39 33 0d 0a 34 38 39  ..1116..393..489
2a5d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2a5e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2a5f0 28 20 63 6f 6c 32 20 29 20 2a 20 37 33 20 41 53  ( col2 ) * 73 AS
2a600 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2a610 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
2a620 34 30 39 0d 0a 35 39 38 36 0d 0a 37 33 0d 0a 0d  409..5986..73...
2a630 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a640 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
2a650 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 2d  ol2 * + col0 - -
2a660 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
2a670 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2a680 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 32 30  .----..-162..-20
2a690 30 32 0d 0a 2d 32 39 36 34 0d 0a 0d 0a 71 75 65  02..-2964....que
2a6a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a6b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2a6c0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
2a6d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2a6e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d   cor0..----..-7.
2a6f0 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65  .-78..-79....que
2a700 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a710 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  LECT - col1 * + 
2a720 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
2a730 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
2a740 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36  -100..-169..-676
2a750 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2a760 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2a770 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2a780 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2a790 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2a7a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a7b0 4c 45 43 54 20 34 20 63 6f 6c 32 20 46 52 4f 4d  LECT 4 col2 FROM
2a7c0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a   tab1..----..4..
2a7d0 34 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4..4....query I 
2a7e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a7f0 41 4c 4c 20 2d 20 32 32 20 2d 20 63 6f 72 30 2e  ALL - 22 - cor0.
2a800 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20  col2 FROM tab2, 
2a810 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2a820 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2a830 68 69 6e 67 20 74 6f 20 37 35 33 38 30 35 65 65  hing to 753805ee
2a840 36 66 63 32 33 62 31 61 39 62 63 66 31 39 64 38  6fc23b1a9bcf19d8
2a850 34 33 65 35 65 61 61 63 0d 0a 0d 0a 6f 6e 6c 79  43e5eaac....only
2a860 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2a870 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2a880 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2a890 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a8a0 74 20 6c 61 62 65 6c 2d 31 32 37 32 0d 0a 53 45  t label-1272..SE
2a8b0 4c 45 43 54 20 2d 20 39 20 44 49 56 20 28 20 2b  LECT - 9 DIV ( +
2a8c0 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20   col0 ) AS col1 
2a8d0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2a8e0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
2a8f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2a900 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2a910 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2a920 72 74 20 6c 61 62 65 6c 2d 31 32 37 32 0d 0a 53  rt label-1272..S
2a930 45 4c 45 43 54 20 2d 20 39 20 2f 20 28 20 2b 20  ELECT - 9 / ( + 
2a940 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46  col0 ) AS col1 F
2a950 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2a960 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
2a970 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a980 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2a990 20 63 6f 6c 30 20 2b 20 2b 20 35 32 20 2a 20 2d   col0 + + 52 * -
2a9a0 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
2a9b0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2a9c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 39  cor0..----..-169
2a9d0 32 0d 0a 2d 31 37 0d 0a 2d 34 31 37 35 0d 0a 0d  2..-17..-4175...
2a9e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a9f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2aa00 54 20 39 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  T 90 AS col0 FRO
2aa10 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61  M tab1, tab2, ta
2aa20 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b0 AS cor0, tab0
2aa30 0d 0a 2d 2d 2d 2d 0d 0a 39 30 0d 0a 0d 0a 71 75  ..----..90....qu
2aa40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2aa50 45 4c 45 43 54 20 28 20 2d 20 63 6f 6c 30 20 29  ELECT ( - col0 )
2aa60 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
2aa70 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2aa80 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36 0d  0..----..-7..16.
2aa90 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .51....query I r
2aaa0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2aab0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
2aac0 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32   + col2 * - col2
2aad0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2aae0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 32 0d  r0..----..-1122.
2aaf0 0a 2d 32 0d 0a 2d 36 38 30 36 0d 0a 0d 0a 6f 6e  .-2..-6806....on
2ab00 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2ab10 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2ab20 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2ab30 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2ab40 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 37 0d 0a  ort label-1277..
2ab50 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2ab60 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  + col2 + + col2 
2ab70 44 49 56 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  DIV + col1 AS co
2ab80 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2ab90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33  cor0..----..1..3
2aba0 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..82....skipif 
2abb0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2abc0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2abd0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2abe0 37 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  77..SELECT DISTI
2abf0 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63  NCT + col2 + + c
2ac00 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20  ol2 / + col1 AS 
2ac10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
2ac20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
2ac30 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 6f 6e 6c 79 69  .33..82....onlyi
2ac40 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2ac50 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2ac60 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2ac70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ac80 20 6c 61 62 65 6c 2d 31 32 37 38 0d 0a 53 45 4c   label-1278..SEL
2ac90 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  ECT col1 + col1 
2aca0 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  DIV col1 AS col2
2acb0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
2acc0 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 32  .----..11..14..2
2acd0 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  7....skipif mysq
2ace0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2acf0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2ad00 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 38 0d 0a  ort label-1278..
2ad10 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f  SELECT col1 + co
2ad20 6c 31 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 / col1 AS col
2ad30 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
2ad40 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a  ..----..11..14..
2ad50 32 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  27....skipif pos
2ad60 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2ad70 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2ad80 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2ad90 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2ada0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2adb0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 32 33 20  SELECT ALL + 23 
2adc0 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52  * - col1 col1 FR
2add0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2ade0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 37 0d 0a 2d 33  .----..-1357..-3
2adf0 39 31 0d 0a 2d 37 31 33 0d 0a 0d 0a 71 75 65 72  91..-713....quer
2ae00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ae10 45 43 54 20 2b 20 33 30 20 2b 20 63 6f 6c 30 20  ECT + 30 + col0 
2ae20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
2ae30 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2ae40 0d 0a 2d 31 35 39 0d 0a 2d 31 39 39 38 0d 0a 2d  ..-159..-1998..-
2ae50 32 39 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2972....query I 
2ae60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ae70 2b 20 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63 6f  + col0 + tab2.co
2ae80 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l0 * + col0 FROM
2ae90 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d   tab2..----..56.
2aea0 0a 36 31 36 32 0d 0a 36 33 32 30 0d 0a 0d 0a 71  .6162..6320....q
2aeb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2aec0 53 45 4c 45 43 54 20 35 35 20 2b 20 2b 20 63 6f  SELECT 55 + + co
2aed0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
2aee0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 0d  cor0..----..144.
2aef0 0a 37 39 0d 0a 39 30 0d 0a 0d 0a 6f 6e 6c 79 69  .79..90....onlyi
2af00 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
2af10 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
2af20 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
2af30 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
2af40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2af50 62 65 6c 2d 31 32 38 33 0d 0a 53 45 4c 45 43 54  bel-1283..SELECT
2af60 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2d 20 2d 20   ALL - col1 - - 
2af70 43 41 53 54 28 20 63 6f 72 30 2e 63 6f 6c 30 20  CAST( cor0.col0 
2af80 41 53 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 30  AS SIGNED ) col0
2af90 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2afa0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36  r0..----..-2..-6
2afb0 32 0d 0a 2d 36 32 0d 0a 0d 0a 73 6b 69 70 69 66  2..-62....skipif
2afc0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2afd0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2afe0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2aff0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2b000 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
2b010 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2b020 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b030 74 20 6c 61 62 65 6c 2d 31 32 38 33 0d 0a 53 45  t label-1283..SE
2b040 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
2b050 2d 20 2d 20 43 41 53 54 20 28 20 63 6f 72 30 2e  - - CAST ( cor0.
2b060 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20  col0 AS INTEGER 
2b070 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  ) col0 FROM tab0
2b080 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b090 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a  -2..-62..-62....
2b0a0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2b0b0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2b0c0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2b0d0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2b0e0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2b0f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b100 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
2b110 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2b   * col1 + col2 +
2b120 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f   + col1 col2 FRO
2b130 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2b140 2d 2d 2d 2d 0d 0a 31 33 39 38 0d 0a 32 37 35 0d  ----..1398..275.
2b150 0a 34 36 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .4687....query I
2b160 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b170 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30   DISTINCT + cor0
2b180 2e 63 6f 6c 31 20 2b 20 2d 20 28 20 2b 20 28 20  .col1 + - ( + ( 
2b190 2d 20 63 6f 6c 31 20 29 20 29 20 46 52 4f 4d 20  - col1 ) ) FROM 
2b1a0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2b1b0 2d 2d 0d 0a 32 30 0d 0a 32 36 0d 0a 35 32 0d 0a  --..20..26..52..
2b1c0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2b1d0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
2b1e0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
2b1f0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
2b200 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
2b210 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 36 0d  sort label-1286.
2b220 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
2b230 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
2b240 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
2b250 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2b260 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2b270 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
2b280 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2b290 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2b2a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 36  wsort label-1286
2b2b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
2b2c0 30 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  0 + CAST ( NULL 
2b2d0 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
2b2e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2b2f0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
2b300 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
2b310 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b320 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
2b330 2a 20 2b 20 32 32 20 2b 20 2b 20 63 6f 6c 31 20  * + 22 + + col1 
2b340 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2b350 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 37 0d 0a 33  0..----..1357..3
2b360 39 31 0d 0a 37 31 33 0d 0a 0d 0a 71 75 65 72 79  91..713....query
2b370 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b380 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
2b390 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  col1 + col2 * co
2b3a0 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l2 * col0 FROM t
2b3b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2b3c0 2d 0d 0a 32 30 37 39 32 36 0d 0a 37 33 37 32 36  -..207926..73726
2b3d0 37 0d 0a 38 37 32 32 0d 0a 0d 0a 6f 6e 6c 79 69  7..8722....onlyi
2b3e0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
2b3f0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
2b400 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
2b410 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
2b420 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2b430 62 65 6c 2d 31 32 38 39 0d 0a 53 45 4c 45 43 54  bel-1289..SELECT
2b440 20 2d 20 63 6f 6c 30 20 2b 20 43 41 53 54 28 20   - col0 + CAST( 
2b450 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29  col0 AS SIGNED )
2b460 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2b470 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
2b480 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
2b490 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2b4a0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2b4b0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 39 0d 0a  ort label-1289..
2b4c0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
2b4d0 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49  CAST ( col0 AS I
2b4e0 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
2b4f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2b500 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
2b510 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2b520 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2b530 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2b540 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2b550 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2b560 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2b570 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 63 6f  col2 * col0 * co
2b580 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 31  l1 + + col1 col1
2b590 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2b5a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 39 38 0d  r0..----..-3298.
2b5b0 0a 2d 36 36 34 30 32 37 0d 0a 2d 36 38 30 32 36  .-664027..-68026
2b5c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b5d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2b5e0 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20  INCT - - col1 + 
2b5f0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
2b600 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2b610 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a 36  ----..118..34..6
2b620 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2b630 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2b640 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63  TINCT - + cor0.c
2b650 6f 6c 32 20 2b 20 32 34 20 41 53 20 63 6f 6c 32  ol2 + 24 AS col2
2b660 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2b670 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d  r0..----..-14..-
2b680 32 0d 0a 2d 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  2..-3....onlyif 
2b690 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2b6a0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2b6b0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2b6c0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2b6d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2b6e0 6c 2d 31 32 39 33 0d 0a 53 45 4c 45 43 54 20 2b  l-1293..SELECT +
2b6f0 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20   col1 * + CAST( 
2b700 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
2b710 20 2b 20 35 35 20 46 52 4f 4d 20 74 61 62 31 20   + 55 FROM tab1 
2b720 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
2b730 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
2b740 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2b750 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2b760 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b770 74 20 6c 61 62 65 6c 2d 31 32 39 33 0d 0a 53 45  t label-1293..SE
2b780 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  LECT + col1 * + 
2b790 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
2b7a0 4e 54 45 47 45 52 20 29 20 2b 20 35 35 20 46 52  NTEGER ) + 55 FR
2b7b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2b7c0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
2b7d0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
2b7e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b7f0 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  CT - + col1 + co
2b800 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 * col1 AS col
2b810 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
2b820 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32 0d 0a  or0..----..272..
2b830 33 34 32 32 0d 0a 39 33 30 0d 0a 0d 0a 71 75 65  3422..930....que
2b840 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2b850 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  LECT + - col0 * 
2b860 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 32 20 2a 20  col0 + ( col2 * 
2b870 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32  col1 ) FROM tab2
2b880 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b890 2d 34 35 35 30 0d 0a 2d 35 35 39 35 0d 0a 37 38  -4550..-5595..78
2b8a0 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
2b8b0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2b8c0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2b8d0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2b8e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2b8f0 2d 31 32 39 36 0d 0a 53 45 4c 45 43 54 20 44 49  -1296..SELECT DI
2b900 53 54 49 4e 43 54 20 63 6f 6c 32 20 44 49 56 20  STINCT col2 DIV 
2b910 2d 20 63 6f 6c 32 20 2b 20 32 38 20 2a 20 2b 20  - col2 + 28 * + 
2b920 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
2b930 2d 2d 2d 2d 0d 0a 32 34 39 31 0d 0a 36 37 31 0d  ----..2491..671.
2b940 0a 39 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .979....skipif m
2b950 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2b960 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2b970 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39  owsort label-129
2b980 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
2b990 43 54 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 32  CT col2 / - col2
2b9a0 20 2b 20 32 38 20 2a 20 2b 20 63 6f 6c 30 20 46   + 28 * + col0 F
2b9b0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2b9c0 32 34 39 31 0d 0a 36 37 31 0d 0a 39 37 39 0d 0a  2491..671..979..
2b9d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b9e0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
2b9f0 72 30 2e 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 46  r0.col1 - col1 F
2ba00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2ba10 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
2ba20 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2ba30 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
2ba40 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
2ba50 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
2ba60 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
2ba70 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 38  wsort label-1298
2ba80 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
2ba90 31 20 2b 20 2d 20 43 41 53 54 28 20 2b 20 38 36  1 + - CAST( + 86
2baa0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
2bab0 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or0.col0 AS col1
2bac0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2bad0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 34 0d 0a  r0..----..-284..
2bae0 2d 35 35 31 34 0d 0a 2d 36 38 39 33 0d 0a 0d 0a  -5514..-6893....
2baf0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2bb00 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2bb10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2bb20 61 62 65 6c 2d 31 32 39 38 0d 0a 53 45 4c 45 43  abel-1298..SELEC
2bb30 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 43  T - + col1 + - C
2bb40 41 53 54 20 28 20 2b 20 38 36 20 41 53 20 49 4e  AST ( + 86 AS IN
2bb50 54 45 47 45 52 20 29 20 2a 20 63 6f 72 30 2e 63  TEGER ) * cor0.c
2bb60 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
2bb70 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2bb80 2d 2d 2d 0d 0a 2d 32 38 34 0d 0a 2d 35 35 31 34  ---..-284..-5514
2bb90 0d 0a 2d 36 38 39 33 0d 0a 0d 0a 71 75 65 72 79  ..-6893....query
2bba0 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49   IIIIIIIIIIIIIII
2bbb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2bbc0 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d   DISTINCT * FROM
2bbd0 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63   tab2, tab2 AS c
2bbe0 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 2c 20  or0, tab2 cor1, 
2bbf0 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
2bc00 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76  r2..----..3645 v
2bc10 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2bc20 20 38 65 38 38 62 33 61 36 39 63 32 34 66 63 30   8e88b3a69c24fc0
2bc30 31 35 35 33 62 30 63 33 32 62 66 37 37 34 38 64  1553b0c32bf7748d
2bc40 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
2bc50 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2bc60 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2bc70 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2bc80 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2bc90 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2bca0 30 30 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  00..SELECT - CAS
2bcb0 54 28 20 33 20 41 53 20 53 49 47 4e 45 44 20 29  T( 3 AS SIGNED )
2bcc0 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 38 37 20 41   + col0 * + 87 A
2bcd0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2bce0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2bcf0 36 30 36 0d 0a 36 37 38 33 0d 0a 36 38 37 30 0d  606..6783..6870.
2bd00 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2bd10 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2bd20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2bd30 74 20 6c 61 62 65 6c 2d 31 33 30 30 0d 0a 53 45  t label-1300..SE
2bd40 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 33 20  LECT - CAST ( 3 
2bd50 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63  AS INTEGER ) + c
2bd60 6f 6c 30 20 2a 20 2b 20 38 37 20 41 53 20 63 6f  ol0 * + 87 AS co
2bd70 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
2bd80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 36 0d  cor0..----..606.
2bd90 0a 36 37 38 33 0d 0a 36 38 37 30 0d 0a 0d 0a 71  .6783..6870....q
2bda0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2bdb0 53 45 4c 45 43 54 20 2b 20 31 37 20 2a 20 63 6f  SELECT + 17 * co
2bdc0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
2bdd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34 32 0d  cor0..----..442.
2bde0 0a 34 35 39 0d 0a 36 34 36 0d 0a 0d 0a 71 75 65  .459..646....que
2bdf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2be00 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  LECT cor0.col1 +
2be10 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20   col0 * col2 AS 
2be20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
2be30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
2be40 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d 0a 0d  8..3658..7693...
2be50 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2be60 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2be70 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2be80 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2be90 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2bea0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2beb0 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  T - col1 + col1 
2bec0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2bed0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
2bee0 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
2bef0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2bf00 20 2d 20 2d 20 37 30 20 46 52 4f 4d 20 74 61 62   - - 70 FROM tab
2bf10 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2bf20 0a 37 30 0d 0a 37 30 0d 0a 37 30 0d 0a 0d 0a 71  .70..70..70....q
2bf30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2bf40 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 30  SELECT tab0.col0
2bf50 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f   * tab0.col0 FRO
2bf60 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab0..----..12
2bf70 32 35 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d  25..576..7921...
2bf80 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2bf90 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2bfa0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2bfb0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2bfc0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2bfd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bfe0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37 34 20  T DISTINCT - 74 
2bff0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
2c000 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2c010 2d 2d 0d 0a 2d 37 34 0d 0a 0d 0a 71 75 65 72 79  --..-74....query
2c020 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c030 43 54 20 2b 20 2d 20 36 35 20 41 53 20 63 6f 6c  CT + - 65 AS col
2c040 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2c050 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 35 0d 0a  or0..----..-65..
2c060 2d 36 35 0d 0a 2d 36 35 0d 0a 0d 0a 71 75 65 72  -65..-65....quer
2c070 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c080 45 43 54 20 2b 20 39 38 20 2b 20 2b 20 63 6f 6c  ECT + 98 + + col
2c090 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2c0a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a  or0..----..108..
2c0b0 31 31 31 0d 0a 31 32 34 0d 0a 0d 0a 71 75 65 72  111..124....quer
2c0c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c0d0 45 43 54 20 2b 20 2d 20 36 37 20 46 52 4f 4d 20  ECT + - 67 FROM 
2c0e0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2c0f0 2d 2d 0d 0a 2d 36 37 0d 0a 2d 36 37 0d 0a 2d 36  --..-67..-67..-6
2c100 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2c110 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
2c120 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41   col0 * - col0 A
2c130 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2c140 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c150 34 39 0d 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a  49..6084..6241..
2c160 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c170 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61  t..SELECT ALL ta
2c180 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  b0.col0 FROM tab
2c190 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  0, tab0 AS cor0,
2c1a0 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
2c1b0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
2c1c0 61 73 68 69 6e 67 20 74 6f 20 39 66 63 31 64 63  ashing to 9fc1dc
2c1d0 64 37 36 66 65 61 66 34 33 65 35 63 35 64 63 30  d76feaf43e5c5dc0
2c1e0 36 30 61 30 32 30 31 34 63 64 0d 0a 0d 0a 71 75  60a02014cd....qu
2c1f0 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
2c200 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c210 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31   ALL * FROM tab1
2c220 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20  , tab1 AS cor0, 
2c230 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61  tab1 AS cor1, ta
2c240 62 32 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39  b2 cor2..----..9
2c250 37 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  72 values hashin
2c260 67 20 74 6f 20 37 32 65 62 33 64 34 64 35 32 33  g to 72eb3d4d523
2c270 66 35 64 30 63 36 39 64 31 62 38 35 35 65 64 64  f5d0c69d1b855edd
2c280 31 38 66 34 61 0d 0a 0d 0a 73 6b 69 70 69 66 20  18f4a....skipif 
2c290 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2c2a0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2c2b0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2c2c0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2c2d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c2e0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
2c2f0 20 2a 20 32 33 20 63 6f 6c 31 20 46 52 4f 4d 20   * 23 col1 FROM 
2c300 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2c310 2d 2d 0d 0a 2d 35 39 38 0d 0a 2d 36 32 31 0d 0a  --..-598..-621..
2c320 2d 38 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -874....query I 
2c330 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c340 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  + cor0.col0 * co
2c350 72 30 2e 63 6f 6c 32 20 2d 20 2d 20 38 34 20 41  r0.col2 - - 84 A
2c360 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2c370 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c380 32 34 36 0d 0a 33 37 33 32 0d 0a 37 37 36 34 0d  246..3732..7764.
2c390 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c3a0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
2c3b0 30 2e 63 6f 6c 32 20 2a 20 2d 20 32 37 20 2b 20  0.col2 * - 27 + 
2c3c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
2c3d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
2c3e0 38 34 0d 0a 31 35 34 39 0d 0a 32 36 30 35 0d 0a  84..1549..2605..
2c3f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c400 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2c410 43 54 20 2d 20 2d 20 33 31 20 2b 20 63 6f 6c 30  CT - - 31 + col0
2c420 20 2a 20 31 30 20 2a 20 2b 20 32 20 2b 20 63 6f   * 10 * + 2 + co
2c430 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
2c440 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2c450 2d 2d 0d 0a 31 36 32 38 0d 0a 31 36 35 30 0d 0a  --..1628..1650..
2c460 32 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  202....query I r
2c470 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2c480 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   cor0.col2 * + c
2c490 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol0 * + col1 FRO
2c4a0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2c4b0 2d 2d 2d 2d 0d 0a 31 31 39 36 35 32 0d 0a 35 31  ----..119652..51
2c4c0 30 33 34 0d 0a 35 38 35 39 0d 0a 0d 0a 71 75 65  034..5859....que
2c4d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c4e0 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c  LECT ALL + ( col
2c4f0 31 20 29 20 2b 20 2b 20 33 35 20 41 53 20 63 6f  1 ) + + 35 AS co
2c500 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
2c510 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d  cor0..----..121.
2c520 0a 31 32 36 0d 0a 31 33 32 0d 0a 0d 0a 6f 6e 6c  .126..132....onl
2c530 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2c540 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2c550 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2c560 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2c570 72 74 20 6c 61 62 65 6c 2d 31 33 31 39 0d 0a 53  rt label-1319..S
2c580 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
2c590 20 2a 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 72 30   * col2 - - cor0
2c5a0 2e 63 6f 6c 30 20 44 49 56 20 38 36 20 46 52 4f  .col0 DIV 86 FRO
2c5b0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2c5c0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d  ----..-1..-1089.
2c5d0 0a 2d 36 37 32 33 0d 0a 0d 0a 73 6b 69 70 69 66  .-6723....skipif
2c5e0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2c5f0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2c600 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2c610 33 31 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  319..SELECT ALL 
2c620 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2d 20  - col2 * col2 - 
2c630 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 38 36  - cor0.col0 / 86
2c640 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2c650 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
2c660 30 38 39 0d 0a 2d 36 37 32 33 0d 0a 0d 0a 73 6b  089..-6723....sk
2c670 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2c680 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2c690 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2c6a0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2c6b0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2c6c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2c6d0 49 53 54 49 4e 43 54 20 39 33 20 2b 20 63 6f 6c  ISTINCT 93 + col
2c6e0 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  1 col1 FROM tab2
2c6f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30   cor0..----..110
2c700 0d 0a 31 32 34 0d 0a 31 35 32 0d 0a 0d 0a 71 75  ..124..152....qu
2c710 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c720 45 4c 45 43 54 20 41 4c 4c 20 2b 20 36 39 20 2b  ELECT ALL + 69 +
2c730 20 63 6f 6c 31 20 2d 20 33 32 20 46 52 4f 4d 20   col1 - 32 FROM 
2c740 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2c750 2d 2d 0d 0a 35 34 0d 0a 36 38 0d 0a 39 36 0d 0a  --..54..68..96..
2c760 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c770 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
2c780 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  l2 + + col2 AS c
2c790 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
2c7a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32  r0..----..164..2
2c7b0 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..66....query I 
2c7c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c7d0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
2c7e0 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  + + col1 AS col0
2c7f0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
2c800 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32 0d  .----..-19..-62.
2c810 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .24....query I r
2c820 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2c830 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  LL - col0 + col2
2c840 20 2b 20 35 36 20 46 52 4f 4d 20 74 61 62 30 20   + 56 FROM tab0 
2c850 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
2c860 32 0d 0a 34 39 0d 0a 36 35 0d 0a 0d 0a 71 75 65  2..49..65....que
2c870 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c880 4c 45 43 54 20 2b 20 39 37 20 2a 20 2b 20 63 6f  LECT + 97 * + co
2c890 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
2c8a0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2c8b0 0a 38 33 34 32 0d 0a 38 38 32 37 0d 0a 39 34 30  .8342..8827..940
2c8c0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2c8d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2c8e0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63  ol1 + - col2 * c
2c8f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2c900 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
2c910 36 31 0d 0a 2d 37 33 35 0d 0a 2d 37 36 30 0d 0a  61..-735..-760..
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 41 4c 4c 20 2b 20  t..SELECT ALL + 
2c940 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f  cor0.col1 * - co
2c950 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
2c960 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2c970 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d  .-7396..-8281..-
2c980 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9409....query I 
2c990 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c9a0 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  - col0 * + col0 
2c9b0 2a 20 35 39 20 2b 20 2b 20 63 6f 6c 32 20 41 53  * 59 + + col2 AS
2c9c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
2c9d0 0a 2d 2d 2d 2d 0d 0a 2d 33 33 39 35 31 0d 0a 2d  .----..-33951..-
2c9e0 34 36 37 32 35 37 0d 0a 2d 37 32 32 37 34 0d 0a  467257..-72274..
2c9f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ca00 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61  t..SELECT ALL ta
2ca10 62 32 2e 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30  b2.col2 - + col0
2ca20 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2ca30 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d  b2..----..-41..-
2ca40 35 32 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20  52..20....query 
2ca50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ca60 54 20 33 33 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  T 33 + col1 * co
2ca70 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
2ca80 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2ca90 0a 37 34 32 39 0d 0a 38 33 31 34 0d 0a 39 34 34  .7429..8314..944
2caa0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2cab0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2cac0 54 49 4e 43 54 20 2d 20 38 36 20 2a 20 2b 20 63  TINCT - 86 * + c
2cad0 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  or0.col0 AS col0
2cae0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2caf0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d  r0..----..-2064.
2cb00 0a 2d 33 30 31 30 0d 0a 2d 37 36 35 34 0d 0a 0d  .-3010..-7654...
2cb10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2cb20 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2cb30 54 20 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a  T + - ( col2 ) *
2cb40 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
2cb50 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2cb60 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38  ----..-35..-7298
2cb70 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20  ..-792....query 
2cb80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2cb90 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c  T ALL + cor0.col
2cba0 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  0 * col1 AS col2
2cbb0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2cbc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a  r0..----..1343..
2cbd0 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65  217..4602....que
2cbe0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2cbf0 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20  LECT - + col1 * 
2cc00 33 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  38 AS col2 FROM 
2cc10 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2cc20 2d 2d 0d 0a 2d 31 31 37 38 0d 0a 2d 32 32 34 32  --..-1178..-2242
2cc30 0d 0a 2d 36 34 36 0d 0a 0d 0a 71 75 65 72 79 20  ..-646....query 
2cc40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2cc50 54 20 2d 20 34 34 20 41 53 20 63 6f 6c 31 20 46  T - 44 AS col1 F
2cc60 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
2cc70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
2cc80 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2cc90 6f 20 30 37 34 35 37 64 39 65 35 37 31 65 30 33  o 07457d9e571e03
2cca0 36 61 39 61 33 61 30 66 35 61 35 61 32 65 31 65  6a9a3a0f5a5a2e1e
2ccb0 66 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  f2....query I ro
2ccc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2ccd0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f  col0 * col1 + co
2cce0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
2ccf0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 34 0d 0a  0..----..-1264..
2cd00 2d 32 31 30 0d 0a 2d 34 35 32 34 0d 0a 0d 0a 6f  -210..-4524....o
2cd10 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2cd20 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2cd30 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2cd40 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2cd50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cd60 74 20 6c 61 62 65 6c 2d 31 33 33 37 0d 0a 53 45  t label-1337..SE
2cd70 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
2cd80 2b 20 43 41 53 54 28 20 2b 20 36 35 20 41 53 20  + CAST( + 65 AS 
2cd90 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 31 20  SIGNED ) * col1 
2cda0 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  * - col1 + - col
2cdb0 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  2 col2 FROM tab0
2cdc0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 30 37 34 30 0d  ..----..-480740.
2cdd0 0a 2d 35 33 38 32 36 35 0d 0a 2d 36 31 31 35 38  .-538265..-61158
2cde0 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  5....skipif post
2cdf0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2ce00 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2ce10 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2ce20 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
2ce30 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2ce40 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2ce50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2ce60 65 6c 2d 31 33 33 37 0d 0a 53 45 4c 45 43 54 20  el-1337..SELECT 
2ce70 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 43 41 53  ALL + col2 + CAS
2ce80 54 20 28 20 2b 20 36 35 20 41 53 20 49 4e 54 45  T ( + 65 AS INTE
2ce90 47 45 52 20 29 20 2a 20 63 6f 6c 31 20 2a 20 2d  GER ) * col1 * -
2cea0 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 63   col1 + - col2 c
2ceb0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
2cec0 2d 2d 2d 0d 0a 2d 34 38 30 37 34 30 0d 0a 2d 35  ---..-480740..-5
2ced0 33 38 32 36 35 0d 0a 2d 36 31 31 35 38 35 0d 0a  38265..-611585..
2cee0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cef0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2cf00 35 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  51 FROM tab2, ta
2cf10 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2cf20 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2cf30 6e 67 20 74 6f 20 30 38 64 33 38 35 33 65 33 39  ng to 08d3853e39
2cf40 39 32 34 64 33 63 36 33 36 32 36 30 61 36 64 64  924d3c636260a6dd
2cf50 38 35 36 38 33 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  856837....onlyif
2cf60 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2cf70 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2cf80 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2cf90 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2cfa0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2cfb0 65 6c 2d 31 33 33 39 0d 0a 53 45 4c 45 43 54 20  el-1339..SELECT 
2cfc0 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20  ALL tab2.col0 + 
2cfd0 2d 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20  - CAST( col0 AS 
2cfe0 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32  SIGNED ) AS col2
2cff0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2d000 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
2d010 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2d020 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2d030 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2d040 6c 2d 31 33 33 39 0d 0a 53 45 4c 45 43 54 20 41  l-1339..SELECT A
2d050 4c 4c 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20 2d  LL tab2.col0 + -
2d060 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20   CAST ( col0 AS 
2d070 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
2d080 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
2d090 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
2d0a0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2d0b0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2d0c0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2d0d0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2d0e0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2d0f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2d100 4c 4c 20 28 20 2b 20 28 20 63 6f 6c 31 20 29 20  LL ( + ( col1 ) 
2d110 29 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20  ) * + tab2.col0 
2d120 2a 20 2d 20 28 20 63 6f 6c 30 20 2b 20 63 6f 6c  * - ( col0 + col
2d130 32 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 ) col2 FROM ta
2d140 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 37 31 33  b2..----..-15713
2d150 31 0d 0a 2d 34 37 38 36 30 38 0d 0a 2d 37 33 37  1..-478608..-737
2d160 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2d170 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
2d180 20 63 6f 6c 31 20 29 20 2a 20 74 61 62 30 2e 63   col1 ) * tab0.c
2d190 6f 6c 30 20 2b 20 28 20 36 31 20 29 20 46 52 4f  ol0 + ( 61 ) FRO
2d1a0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
2d1b0 30 30 33 0d 0a 2d 33 33 33 34 0d 0a 2d 38 30 33  003..-3334..-803
2d1c0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2d1d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2d1e0 20 28 20 2b 20 39 35 20 29 20 41 53 20 63 6f 6c   ( + 95 ) AS col
2d1f0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
2d200 2d 0d 0a 39 35 0d 0a 39 35 0d 0a 39 35 0d 0a 0d  -..95..95..95...
2d210 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d220 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
2d230 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20   col1 + col1 AS 
2d240 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
2d250 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
2d260 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
2d270 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d280 20 44 49 53 54 49 4e 43 54 20 2d 20 32 36 20 2b   DISTINCT - 26 +
2d290 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c   cor0.col1 * col
2d2a0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2d2b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38 0d  or0..----..1508.
2d2c0 0a 36 32 30 0d 0a 38 31 31 0d 0a 0d 0a 71 75 65  .620..811....que
2d2d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2d2e0 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  LECT col2 + + co
2d2f0 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46  r0.col1 * col2 F
2d300 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2d310 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 34 0d 0a 31 34  ..----..1344..14
2d320 35 38 0d 0a 36 32 37 0d 0a 0d 0a 71 75 65 72 79  58..627....query
2d330 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d340 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 37 20  CT + - col0 + 7 
2d350 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
2d360 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2d370 2d 32 38 0d 0a 32 30 37 0d 0a 34 38 35 0d 0a 0d  -28..207..485...
2d380 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d390 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28  ..SELECT ALL - (
2d3a0 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 32 20 46   col0 ) * col2 F
2d3b0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2d3c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32  ..----..-189..-2
2d3d0 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75  028..-3002....qu
2d3e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d3f0 45 4c 45 43 54 20 2d 20 34 35 20 2a 20 2b 20 63  ELECT - 45 * + c
2d400 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
2d410 2d 2d 2d 0d 0a 2d 32 34 33 30 0d 0a 2d 32 35 36  ---..-2430..-256
2d420 35 0d 0a 2d 34 33 32 30 0d 0a 0d 0a 71 75 65 72  5..-4320....quer
2d430 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d440 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
2d450 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
2d460 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
2d470 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
2d480 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2d490 6e 67 20 74 6f 20 33 30 30 30 33 33 37 64 64 33  ng to 3000337dd3
2d4a0 66 31 31 65 39 63 66 64 35 61 33 31 32 62 30 31  f11e9cfd5a312b01
2d4b0 65 66 33 66 38 62 0d 0a 0d 0a 71 75 65 72 79 20  ef3f8b....query 
2d4c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d4d0 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20 63  T DISTINCT ( - c
2d4e0 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 32 20 41  ol1 ) * - col2 A
2d4f0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
2d500 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34  ..----..1534..64
2d510 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20  6..837....query 
2d520 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d530 54 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 63  T + ( col1 ) + c
2d540 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 * + col2 FRO
2d550 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38  M tab1..----..18
2d560 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d 0a 0d  8..3658..7693...
2d570 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d580 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 31 20  ..SELECT ALL 61 
2d590 2a 20 33 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52  * 30 * - col2 FR
2d5a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2d5b0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 33 31 30 0d 0a  .----..-104310..
2d5c0 2d 31 37 35 36 38 30 0d 0a 2d 39 38 38 32 30 0d  -175680..-98820.
2d5d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d5e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2d5f0 20 63 6f 6c 31 20 2a 20 2b 20 32 31 20 2b 20 2b   col1 * + 21 + +
2d600 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2d610 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2d620 31 37 32 30 0d 0a 2d 31 38 32 30 0d 0a 2d 31 39  1720..-1820..-19
2d630 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  40....query I ro
2d640 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2d650 63 6f 6c 31 20 2a 20 31 36 20 2b 20 2b 20 63 6f  col1 * 16 + + co
2d660 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
2d670 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2d680 0a 2d 31 32 38 0d 0a 2d 34 31 33 0d 0a 2d 39 36  .-128..-413..-96
2d690 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d6a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2d6b0 49 4e 43 54 20 2b 20 32 39 20 2a 20 63 6f 6c 30  INCT + 29 * col0
2d6c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2d6d0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
2d6e0 38 35 36 0d 0a 32 33 32 30 0d 0a 38 37 0d 0a 0d  856..2320..87...
2d6f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d700 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 30 20  ..SELECT ALL 70 
2d710 2a 20 2d 20 36 33 20 2b 20 2b 20 63 6f 6c 32 20  * - 63 + + col2 
2d720 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2d730 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33 31 34 0d 0a  0..----..-4314..
2d740 2d 34 33 35 33 0d 0a 2d 34 33 35 36 0d 0a 0d 0a  -4353..-4356....
2d750 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d760 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63  .SELECT col2 + c
2d770 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
2d780 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
2d790 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a  ..119..173..98..
2d7a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d7b0 74 0d 0a 53 45 4c 45 43 54 20 34 38 20 41 53 20  t..SELECT 48 AS 
2d7c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2d7d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 38  S cor0..----..48
2d7e0 0d 0a 34 38 0d 0a 34 38 0d 0a 0d 0a 71 75 65 72  ..48..48....quer
2d7f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d800 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2d810 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63  ol2 + + col1 + c
2d820 6f 6c 30 20 2a 20 2b 20 28 20 63 6f 6c 32 20 2a  ol0 * + ( col2 *
2d830 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   - col1 ) AS col
2d840 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
2d850 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 35  or0..----..-1195
2d860 36 37 0d 0a 2d 35 30 39 37 39 0d 0a 2d 35 38 30  67..-50979..-580
2d870 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2d880 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2d890 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a   + col1 * col1 *
2d8a0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
2d8b0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2d8c0 0a 2d 2d 2d 2d 0d 0a 31 30 39 38 32 0d 0a 32 35  .----..10982..25
2d8d0 39 34 37 0d 0a 39 30 35 30 36 0d 0a 0d 0a 6f 6e  947..90506....on
2d8e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2d8f0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2d900 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2d910 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2d920 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36 31 0d 0a  ort label-1361..
2d930 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2d940 2d 20 2d 20 63 6f 6c 30 20 44 49 56 20 35 20 41  - - col0 DIV 5 A
2d950 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
2d960 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2d970 31 32 0d 0a 31 36 0d 0a 0d 0a 73 6b 69 70 69 66  12..16....skipif
2d980 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2d990 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2d9a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2d9b0 33 36 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  361..SELECT DIST
2d9c0 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2f 20  INCT - - col0 / 
2d9d0 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  5 AS col2 FROM t
2d9e0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
2d9f0 30 0d 0a 31 32 0d 0a 31 36 0d 0a 0d 0a 71 75 65  0..12..16....que
2da00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2da10 4c 45 43 54 20 41 4c 4c 20 2d 20 32 31 20 2a 20  LECT ALL - 21 * 
2da20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
2da30 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2da40 2d 2d 2d 2d 0d 0a 2d 31 33 34 34 0d 0a 2d 31 36  ----..-1344..-16
2da50 38 30 0d 0a 2d 36 33 0d 0a 0d 0a 73 6b 69 70 69  80..-63....skipi
2da60 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2da70 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2da80 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2da90 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2daa0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2dab0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
2dac0 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   + col1 col1 FRO
2dad0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
2dae0 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65  7..38..96....que
2daf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2db00 4c 45 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c 30  LECT - cor1.col0
2db10 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
2db20 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
2db30 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
2db40 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2db50 37 32 39 63 31 65 64 64 61 39 33 33 32 33 39 38  729c1edda9332398
2db60 32 39 39 66 33 39 63 64 31 37 34 65 64 38 34 30  299f39cd174ed840
2db70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2db80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2db90 2d 20 63 6f 6c 32 20 2b 20 32 32 20 46 52 4f 4d  - col2 + 22 FROM
2dba0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
2dbb0 0d 0a 2d 31 36 0d 0a 2d 34 0d 0a 2d 35 0d 0a 0d  ..-16..-4..-5...
2dbc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2dbd0 0d 0a 53 45 4c 45 43 54 20 35 32 20 2a 20 37 31  ..SELECT 52 * 71
2dbe0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2dbf0 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
2dc00 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
2dc10 20 68 61 73 68 69 6e 67 20 74 6f 20 61 31 33 63   hashing to a13c
2dc20 32 63 63 32 39 35 30 35 30 31 37 64 37 31 34 62  2cc29505017d714b
2dc30 63 34 63 62 39 61 31 65 64 38 65 31 0d 0a 0d 0a  c4cb9a1ed8e1....
2dc40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2dc50 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2dc60 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   - + cor0.col1 *
2dc70 20 63 6f 6c 31 20 2b 20 38 39 20 2a 20 63 6f 6c   col1 + 89 * col
2dc80 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2dc90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 38 0d  or0..----..1638.
2dca0 0a 37 39 30 0d 0a 39 38 38 0d 0a 0d 0a 71 75 65  .790..988....que
2dcb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2dcc0 4c 45 43 54 20 41 4c 4c 20 33 30 20 46 52 4f 4d  LECT ALL 30 FROM
2dcd0 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
2dce0 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
2dcf0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
2dd00 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36 63  es hashing to 6c
2dd10 39 38 38 34 30 65 64 31 33 34 63 37 36 35 64 35  98840ed134c765d5
2dd20 36 33 38 39 66 34 31 35 30 30 37 35 66 30 0d 0a  6389f4150075f0..
2dd30 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2dd40 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2dd50 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2dd60 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2dd70 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2dd80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2dd90 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20  CT ALL + col0 * 
2dda0 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  col1 + col2 * - 
2ddb0 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col0 col1 FROM t
2ddc0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 32 0d  ab0..----..1272.
2ddd0 0a 33 33 36 30 0d 0a 38 30 31 0d 0a 0d 0a 6f 6e  .3360..801....on
2dde0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2ddf0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2de00 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2de10 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2de20 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 30 0d 0a  ort label-1370..
2de30 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49  SELECT - col1 DI
2de40 56 20 2b 20 38 32 20 2b 20 63 6f 6c 32 20 63 6f  V + 82 + col2 co
2de50 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2de60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a  cor0..----..54..
2de70 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  57..96....skipif
2de80 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2de90 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2dea0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2deb0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2dec0 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
2ded0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2dee0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2def0 74 20 6c 61 62 65 6c 2d 31 33 37 30 0d 0a 53 45  t label-1370..SE
2df00 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 2b 20  LECT - col1 / + 
2df10 38 32 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46  82 + col2 col1 F
2df20 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2df30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a  ..----..54..57..
2df40 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
2df50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2df60 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col0 * + cor0.co
2df70 6c 30 20 2d 20 32 30 20 2a 20 63 6f 6c 30 20 46  l0 - 20 * col0 F
2df80 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2df90 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 37  ..----..-189..-7
2dfa0 36 34 34 0d 0a 2d 37 38 32 31 0d 0a 0d 0a 6f 6e  644..-7821....on
2dfb0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2dfc0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2dfd0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2dfe0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2dff0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 32 0d 0a  ort label-1372..
2e000 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2e010 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2d 20  - col2 * col0 - 
2e020 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20  - cor0.col1 DIV 
2e030 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 31  - cor0.col1 col1
2e040 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2e050 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d  r0..----..-36..-
2e060 37 32 39 39 0d 0a 2d 37 39 33 0d 0a 0d 0a 73 6b  7299..-793....sk
2e070 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2e080 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2e090 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2e0a0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2e0b0 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
2e0c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2e0d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2e0e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 32  wsort label-1372
2e0f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2e100 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  T - col2 * col0 
2e110 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20  - - cor0.col1 / 
2e120 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 31  - cor0.col1 col1
2e130 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2e140 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d  r0..----..-36..-
2e150 37 32 39 39 0d 0a 2d 37 39 33 0d 0a 0d 0a 71 75  7299..-793....qu
2e160 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e170 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
2e180 72 30 2e 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 46  r0.col1 - col0 F
2e190 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
2e1a0 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37 34 0d 0a 2d  ---..-29..-74..-
2e1b0 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  93....query I ro
2e1c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2e1d0 6c 31 20 2b 20 2d 20 28 20 63 6f 6c 31 20 29 20  l1 + - ( col1 ) 
2e1e0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2e1f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2e200 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .0..0..0....only
2e210 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2e220 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2e230 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2e240 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e250 74 20 6c 61 62 65 6c 2d 31 33 37 35 0d 0a 53 45  t label-1375..SE
2e260 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
2e270 2b 20 2d 20 39 32 20 44 49 56 20 2d 20 63 6f 6c  + - 92 DIV - col
2e280 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0 col1 FROM tab0
2e290 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e2a0 2d 32 31 0d 0a 2d 33 33 0d 0a 2d 38 38 0d 0a 0d  -21..-33..-88...
2e2b0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2e2c0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2e2d0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2e2e0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2e2f0 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
2e300 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2e310 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2e320 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2e330 33 37 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  375..SELECT ALL 
2e340 2d 20 63 6f 6c 30 20 2b 20 2d 20 39 32 20 2f 20  - col0 + - 92 / 
2e350 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  - col0 col1 FROM
2e360 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2e370 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 33 33 0d 0a 2d  ---..-21..-33..-
2e380 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
2e390 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2e3a0 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  L - cor0.col2 + 
2e3b0 2d 20 37 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 70 AS col2 FRO
2e3c0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2e3d0 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 39 36 0d  ----..-108..-96.
2e3e0 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-97....query I 
2e3f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e400 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
2e410 32 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  2 - cor0.col2 * 
2e420 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
2e430 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e440 2d 31 31 32 32 0d 0a 2d 32 0d 0a 2d 36 38 30 36  -1122..-2..-6806
2e450 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2e460 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2e470 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 28 20  INCT col1 + - ( 
2e480 2b 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20  + col0 ) * col1 
2e490 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2e4a0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 37 0d 0a  0..----..-1027..
2e4b0 2d 35 32 0d 0a 2d 36 33 30 0d 0a 0d 0a 71 75 65  -52..-630....que
2e4c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e4d0 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 39 35  LECT + col0 + 95
2e4e0 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   * cor0.col2 AS 
2e4f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
2e500 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
2e510 30 0d 0a 33 31 35 39 0d 0a 37 38 37 39 0d 0a 0d  0..3159..7879...
2e520 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e530 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
2e540 31 20 2a 20 32 20 46 52 4f 4d 20 74 61 62 32 20  1 * 2 FROM tab2 
2e550 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2e560 31 38 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71 75  18..34..62....qu
2e570 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e580 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
2e590 6f 6c 31 20 2a 20 2b 20 38 39 20 2a 20 74 61 62  ol1 * + 89 * tab
2e5a0 32 2e 63 6f 6c 31 20 2b 20 2b 20 74 61 62 32 2e  2.col1 + + tab2.
2e5b0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
2e5c0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 35  M tab2..----..25
2e5d0 38 30 30 0d 0a 33 30 39 38 38 37 0d 0a 38 35 35  800..309887..855
2e5e0 33 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  36....onlyif mys
2e5f0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2e600 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2e610 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2e620 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2e630 6c 2d 31 33 38 32 0d 0a 53 45 4c 45 43 54 20 44  l-1382..SELECT D
2e640 49 53 54 49 4e 43 54 20 2d 20 28 20 28 20 2d 20  ISTINCT - ( ( - 
2e650 63 6f 72 30 2e 63 6f 6c 32 20 29 20 29 20 2b 20  cor0.col2 ) ) + 
2e660 2d 20 34 38 20 44 49 56 20 2b 20 74 61 62 31 2e  - 48 DIV + tab1.
2e670 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
2e680 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2e690 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2e6a0 68 69 6e 67 20 74 6f 20 39 31 31 35 62 30 33 37  hing to 9115b037
2e6b0 63 39 35 66 66 31 61 36 32 37 32 39 61 32 32 32  c95ff1a62729a222
2e6c0 61 34 35 39 65 37 39 32 0d 0a 0d 0a 73 6b 69 70  a459e792....skip
2e6d0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2e6e0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2e6f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2e700 2d 31 33 38 32 0d 0a 53 45 4c 45 43 54 20 44 49  -1382..SELECT DI
2e710 53 54 49 4e 43 54 20 2d 20 28 20 28 20 2d 20 63  STINCT - ( ( - c
2e720 6f 72 30 2e 63 6f 6c 32 20 29 20 29 20 2b 20 2d  or0.col2 ) ) + -
2e730 20 34 38 20 2f 20 2b 20 74 61 62 31 2e 63 6f 6c   48 / + tab1.col
2e740 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
2e750 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2e760 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
2e770 67 20 74 6f 20 39 31 31 35 62 30 33 37 63 39 35  g to 9115b037c95
2e780 66 66 31 61 36 32 37 32 39 61 32 32 32 61 34 35  ff1a62729a222a45
2e790 39 65 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  9e792....query I
2e7a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e7b0 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2d   + col0 + col0 -
2e7c0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
2e7d0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
2e7e0 35 0d 0a 36 39 0d 0a 39 36 0d 0a 0d 0a 71 75 65  5..69..96....que
2e7f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e800 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 72  LECT ALL + ( cor
2e810 30 2e 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20  0.col0 ) + col0 
2e820 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  * cor0.col1 FROM
2e830 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2e840 2d 2d 2d 0d 0a 31 31 32 30 0d 0a 37 30 34 0d 0a  ---..1120..704..
2e850 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  81....onlyif mys
2e860 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2e870 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2e880 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2e890 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2e8a0 6c 2d 31 33 38 35 0d 0a 53 45 4c 45 43 54 20 2d  l-1385..SELECT -
2e8b0 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 44 49 56   col2 * col2 DIV
2e8c0 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31   - col2 + - col1
2e8d0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2e8e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d  r0..----..-53..-
2e8f0 39 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  9..-96....skipif
2e900 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2e910 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2e920 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2e930 33 38 35 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  385..SELECT - co
2e940 6c 32 20 2a 20 63 6f 6c 32 20 2f 20 2d 20 63 6f  l2 * col2 / - co
2e950 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l2 + - col1 FROM
2e960 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2e970 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39  ---..-53..-9..-9
2e980 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
2e990 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2e9a0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2e9b0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2e9c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2e9d0 2d 31 33 38 36 0d 0a 53 45 4c 45 43 54 20 2d 20  -1386..SELECT - 
2e9e0 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f 72 30 2e  - col1 DIV cor0.
2e9f0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
2ea00 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2ea10 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 38 0d 0a 0d  ----..0..0..8...
2ea20 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2ea30 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2ea40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2ea50 6c 61 62 65 6c 2d 31 33 38 36 0d 0a 53 45 4c 45  label-1386..SELE
2ea60 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2f 20 63 6f  CT - - col1 / co
2ea70 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
2ea80 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2ea90 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 38  0..----..0..0..8
2eaa0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2eab0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2eac0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2ead0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2eae0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2eaf0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 38  owsort label-138
2eb00 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  7..SELECT ALL - 
2eb10 43 41 53 54 28 20 2d 20 63 6f 6c 32 20 41 53 20  CAST( - col2 AS 
2eb20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20  SIGNED ) * col0 
2eb30 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2eb40 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2eb50 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a  .35..7298..792..
2eb60 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2eb70 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2eb80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2eb90 20 6c 61 62 65 6c 2d 31 33 38 37 0d 0a 53 45 4c   label-1387..SEL
2eba0 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28  ECT ALL - CAST (
2ebb0 20 2d 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   - col2 AS INTEG
2ebc0 45 52 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63  ER ) * col0 AS c
2ebd0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2ebe0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d   cor0..----..35.
2ebf0 0a 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75  .7298..792....qu
2ec00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ec10 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 32 20 29  ELECT + ( col2 )
2ec20 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46   * + cor0.col2 F
2ec30 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2ec40 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37  ..----..1444..67
2ec50 36 0d 0a 37 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  6..729....onlyif
2ec60 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2ec70 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2ec80 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2ec90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2eca0 6c 61 62 65 6c 2d 31 33 38 39 0d 0a 53 45 4c 45  label-1389..SELE
2ecb0 43 54 20 44 49 53 54 49 4e 43 54 20 31 36 20 44  CT DISTINCT 16 D
2ecc0 49 56 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c  IV - col0 AS col
2ecd0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2ece0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
2ecf0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2ed00 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2ed10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2ed20 61 62 65 6c 2d 31 33 38 39 0d 0a 53 45 4c 45 43  abel-1389..SELEC
2ed30 54 20 44 49 53 54 49 4e 43 54 20 31 36 20 2f 20  T DISTINCT 16 / 
2ed40 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
2ed50 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2ed60 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
2ed70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ed80 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 37 37 20  LECT ALL + - 77 
2ed90 2b 20 38 39 20 46 52 4f 4d 20 74 61 62 31 20 41  + 89 FROM tab1 A
2eda0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
2edb0 0d 0a 31 32 0d 0a 31 32 0d 0a 0d 0a 71 75 65 72  ..12..12....quer
2edc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2edd0 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63  ECT - - col2 * c
2ede0 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  ol2 + col1 * + c
2edf0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
2ee00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30   cor0..----..150
2ee10 30 35 0d 0a 38 34 38 35 0d 0a 39 34 31 30 0d 0a  05..8485..9410..
2ee20 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2ee30 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2ee40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ee50 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2ee60 54 20 2b 20 2d 20 43 41 53 54 20 28 20 2d 20 63  T + - CAST ( - c
2ee70 6f 6c 30 20 41 53 20 52 45 41 4c 20 29 20 41 53  ol0 AS REAL ) AS
2ee80 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2ee90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
2eea0 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79  ..64..80....only
2eeb0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2eec0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2eed0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2eee0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2eef0 74 20 6c 61 62 65 6c 2d 31 33 39 33 0d 0a 53 45  t label-1393..SE
2ef00 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2ef10 63 6f 6c 32 20 2a 20 38 20 2b 20 2b 20 63 6f 6c  col2 * 8 + + col
2ef20 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20  0 DIV - col1 AS 
2ef30 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
2ef40 2d 2d 2d 2d 0d 0a 32 30 37 0d 0a 32 31 36 0d 0a  ----..207..216..
2ef50 33 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  300....skipif my
2ef60 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2ef70 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2ef80 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39 33  wsort label-1393
2ef90 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2efa0 54 20 2b 20 63 6f 6c 32 20 2a 20 38 20 2b 20 2b  T + col2 * 8 + +
2efb0 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 41   col0 / - col1 A
2efc0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
2efd0 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 0d 0a 32 31 36  ..----..207..216
2efe0 0d 0a 33 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..300....onlyif 
2eff0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2f000 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2f010 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2f020 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2f030 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2f040 6c 2d 31 33 39 34 0d 0a 53 45 4c 45 43 54 20 63  l-1394..SELECT c
2f050 6f 6c 31 20 2b 20 2b 20 43 41 53 54 28 20 63 6f  ol1 + + CAST( co
2f060 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  l0 AS SIGNED ) +
2f070 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
2f080 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2f090 0a 31 33 31 0d 0a 31 38 39 0d 0a 38 33 0d 0a 0d  .131..189..83...
2f0a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2f0b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2f0c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2f0d0 6c 61 62 65 6c 2d 31 33 39 34 0d 0a 53 45 4c 45  label-1394..SELE
2f0e0 43 54 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54  CT col1 + + CAST
2f0f0 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   ( col0 AS INTEG
2f100 45 52 20 29 20 2b 20 2b 20 63 6f 6c 32 20 41 53  ER ) + + col2 AS
2f110 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2f120 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 31 38 39 0d  .----..131..189.
2f130 0a 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .83....onlyif my
2f140 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2f150 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2f160 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2f170 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2f180 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2f190 31 33 39 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1395..SELECT col
2f1a0 30 20 2b 20 43 41 53 54 28 20 63 6f 6c 30 20 41  0 + CAST( col0 A
2f1b0 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
2f1c0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d  tab0..----..178.
2f1d0 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 73 6b 69 70 69  .48..70....skipi
2f1e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2f1f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2f200 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2f210 31 33 39 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1395..SELECT col
2f220 30 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 30 20  0 + CAST ( col0 
2f230 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
2f240 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  M tab0..----..17
2f250 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65  8..48..70....que
2f260 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f270 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 28 20  LECT + col0 * ( 
2f280 2b 20 33 33 20 29 20 41 53 20 63 6f 6c 32 20 46  + 33 ) AS col2 F
2f290 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2f2a0 0d 0a 2d 2d 2d 2d 0d 0a 32 33 31 0d 0a 32 35 37  ..----..231..257
2f2b0 34 0d 0a 32 36 30 37 0d 0a 0d 0a 71 75 65 72 79  4..2607....query
2f2c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f2d0 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b  CT col0 * col2 +
2f2e0 20 2b 20 63 6f 6c 30 20 2a 20 33 38 20 46 52 4f   + col0 * 38 FRO
2f2f0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
2f300 37 32 30 0d 0a 32 37 36 0d 0a 36 30 38 30 0d 0a  720..276..6080..
2f310 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f320 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
2f330 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
2f340 61 62 32 20 63 6f 72 30 2c 20 74 61 62 32 20 41  ab2 cor0, tab2 A
2f350 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
2f360 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2f370 74 6f 20 31 65 31 66 31 30 39 35 33 65 62 38 65  to 1e1f10953eb8e
2f380 66 66 65 39 62 32 30 65 37 34 36 66 38 61 37 66  ffe9b20e746f8a7f
2f390 64 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  d83....query I r
2f3a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2f3b0 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 63   tab1.col1 * - c
2f3c0 6f 6c 30 20 2b 20 33 36 20 46 52 4f 4d 20 74 61  ol0 + 36 FROM ta
2f3d0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 36 0d 0a  b1..----..1076..
2f3e0 31 31 34 0d 0a 36 37 36 0d 0a 0d 0a 73 6b 69 70  114..676....skip
2f3f0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2f400 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2f410 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2f420 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2f430 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2f440 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2f450 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  ol1 + col1 * + c
2f460 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol2 col0 FROM ta
2f470 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2f480 0d 0a 31 32 33 35 0d 0a 31 33 37 38 0d 0a 35 36  ..1235..1378..56
2f490 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2f4a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2f4b0 20 2b 20 2d 20 37 30 20 46 52 4f 4d 20 74 61 62   + - 70 FROM tab
2f4c0 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  0 AS cor0 CROSS 
2f4d0 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72  JOIN tab1 AS cor
2f4e0 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
2f4f0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 35 37  s hashing to 357
2f500 30 37 61 35 64 39 39 63 39 38 62 32 36 35 37 63  07a5d99c98b2657c
2f510 30 38 34 61 35 30 66 66 31 62 30 37 33 0d 0a 0d  084a50ff1b073...
2f520 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f530 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
2f540 2b 20 38 37 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 87 AS col2 FRO
2f550 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2f560 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a 31 32 32 0d 0a  ----..111..122..
2f570 31 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  176....query I r
2f580 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2f590 20 63 6f 6c 30 20 2b 20 28 20 2d 20 28 20 2b 20   col0 + ( - ( + 
2f5a0 63 6f 72 30 2e 63 6f 6c 30 20 29 20 29 20 2a 20  cor0.col0 ) ) * 
2f5b0 28 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20  ( cor0.col1 + - 
2f5c0 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53 20 63  cor0.col2 ) AS c
2f5d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
2f5e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 35 32 0d  r0..----..-2652.
2f5f0 0a 2d 33 35 0d 0a 31 35 38 30 0d 0a 0d 0a 71 75  .-35..1580....qu
2f600 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f610 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2f620 20 38 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   80 AS col0 FROM
2f630 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
2f640 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
2f650 31 2c 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f  1, tab2, tab1 co
2f660 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 30 0d 0a 0d 0a  r2..----..80....
2f670 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f680 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 33 20 41  .SELECT ALL 43 A
2f690 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
2f6a0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
2f6b0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
2f6c0 61 73 68 69 6e 67 20 74 6f 20 31 39 39 31 30 35  ashing to 199105
2f6d0 36 31 39 30 34 39 32 37 31 31 34 37 39 35 36 64  619049271147956d
2f6e0 65 35 32 65 37 66 35 65 64 34 0d 0a 0d 0a 71 75  e52e7f5ed4....qu
2f6f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f700 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2d  ELECT ALL col2 -
2f710 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
2f720 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2f730 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 6f 6e  33..-4..21....on
2f740 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2f750 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2f760 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2f770 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2f780 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f790 20 6c 61 62 65 6c 2d 31 34 30 37 0d 0a 53 45 4c   label-1407..SEL
2f7a0 45 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 31  ECT ALL ( + col1
2f7b0 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 29   + + tab0.col2 )
2f7c0 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20   * - CAST( NULL 
2f7d0 41 53 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 30  AS SIGNED ) col0
2f7e0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2f7f0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
2f800 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  LL....skipif pos
2f810 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2f820 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2f830 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2f840 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
2f850 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2f860 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2f870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f880 62 65 6c 2d 31 34 30 37 0d 0a 53 45 4c 45 43 54  bel-1407..SELECT
2f890 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 31 20 2b 20   ALL ( + col1 + 
2f8a0 2b 20 74 61 62 30 2e 63 6f 6c 32 20 29 20 2a 20  + tab0.col2 ) * 
2f8b0 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
2f8c0 20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 30 20   INTEGER ) col0 
2f8d0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2f8e0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
2f8f0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
2f900 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2f910 20 2d 20 28 20 30 20 29 20 2b 20 63 6f 6c 32 20   - ( 0 ) + col2 
2f920 2a 20 2b 20 34 37 20 46 52 4f 4d 20 74 61 62 31  * + 47 FROM tab1
2f930 0d 0a 2d 2d 2d 2d 0d 0a 32 35 33 38 0d 0a 32 36  ..----..2538..26
2f940 37 39 0d 0a 34 35 31 32 0d 0a 0d 0a 71 75 65 72  79..4512....quer
2f950 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2f960 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 35 35 20  ECT + col2 * 55 
2f970 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 28 20  + tab2.col1 * ( 
2f980 37 34 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  74 ) * col1 FROM
2f990 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34   tab2..----..234
2f9a0 37 36 0d 0a 32 35 39 30 32 34 0d 0a 37 32 35 39  76..259024..7259
2f9b0 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
2f9c0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2f9d0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2f9e0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2f9f0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2fa00 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
2fa10 31 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  10..SELECT ALL -
2fa20 20 2d 20 28 20 34 39 20 29 20 2a 20 2b 20 63 6f   - ( 49 ) * + co
2fa30 6c 32 20 2b 20 2d 20 43 41 53 54 28 20 63 6f 6c  l2 + - CAST( col
2fa40 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  0 AS SIGNED ) AS
2fa50 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2fa60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
2fa70 36 34 33 0d 0a 32 37 32 39 0d 0a 34 36 32 34 0d  643..2729..4624.
2fa80 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2fa90 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2faa0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fab0 74 20 6c 61 62 65 6c 2d 31 34 31 30 0d 0a 53 45  t label-1410..SE
2fac0 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20 34  LECT ALL - - ( 4
2fad0 39 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d  9 ) * + col2 + -
2fae0 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20   CAST ( col0 AS 
2faf0 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
2fb00 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2fb10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 34 33 0d  or0..----..2643.
2fb20 0a 32 37 32 39 0d 0a 34 36 32 34 0d 0a 0d 0a 71  .2729..4624....q
2fb30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2fb40 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
2fb50 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  2 * - col1 * col
2fb60 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2fb70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30  or0..----..36480
2fb80 0d 0a 34 32 31 32 0d 0a 39 39 38 34 30 0d 0a 0d  ..4212..99840...
2fb90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fba0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2fbb0 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  T + col2 * - col
2fbc0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2fbd0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2fbe0 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d 36  -..-1..-1089..-6
2fbf0 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  724....query I r
2fc00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2fc10 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 28   col2 + col1 * (
2fc20 20 34 35 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 32   45 * col0 + - 2
2fc30 37 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  7 ) AS col1 FROM
2fc40 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2fc50 2d 2d 2d 0d 0a 32 30 35 35 32 33 0d 0a 36 30 30  ---..205523..600
2fc60 31 34 0d 0a 38 39 35 35 0d 0a 0d 0a 71 75 65 72  14..8955....quer
2fc70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2fc80 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32  ECT ALL - + col2
2fc90 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   + - col1 * - co
2fca0 6c 32 20 2a 20 2b 20 38 34 20 46 52 4f 4d 20 74  l2 * + 84 FROM t
2fcb0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
2fcc0 31 32 38 38 33 30 0d 0a 35 34 32 32 36 0d 0a 37  128830..54226..7
2fcd0 30 32 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0281....query I 
2fce0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2fcf0 36 32 20 2a 20 36 39 20 46 52 4f 4d 20 74 61 62  62 * 69 FROM tab
2fd00 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  0 AS cor0 CROSS 
2fd10 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72  JOIN tab0 AS cor
2fd20 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
2fd30 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 33 63  s hashing to a3c
2fd40 64 30 63 32 32 32 37 32 31 38 37 32 32 37 31 64  d0c222721872271d
2fd50 37 65 37 31 61 63 34 66 32 66 61 30 30 0d 0a 0d  7e71ac4f2fa00...
2fd60 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2fd70 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2fd80 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2fd90 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2fda0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2fdb0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 36 0d 0a  ort label-1416..
2fdc0 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20  SELECT + + col0 
2fdd0 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53  + - col0 * - CAS
2fde0 54 28 20 2b 20 33 20 2a 20 63 6f 72 30 2e 63 6f  T( + 3 * cor0.co
2fdf0 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  l1 AS SIGNED ) F
2fe00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2fe10 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 38 34 0d 0a 34  ..----..13884..4
2fe20 31 30 38 0d 0a 36 35 38 0d 0a 0d 0a 73 6b 69 70  108..658....skip
2fe30 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2fe40 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2fe50 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2fe60 2d 31 34 31 36 0d 0a 53 45 4c 45 43 54 20 2b 20  -1416..SELECT + 
2fe70 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  + col0 + - col0 
2fe80 2a 20 2d 20 43 41 53 54 20 28 20 2b 20 33 20 2a  * - CAST ( + 3 *
2fe90 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 49 4e   cor0.col1 AS IN
2fea0 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
2feb0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2fec0 0a 31 33 38 38 34 0d 0a 34 31 30 38 0d 0a 36 35  .13884..4108..65
2fed0 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
2fee0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2fef0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2ff00 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2ff10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2ff20 2d 31 34 31 37 0d 0a 53 45 4c 45 43 54 20 2b 20  -1417..SELECT + 
2ff30 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  - col0 + + col2 
2ff40 44 49 56 20 63 6f 6c 30 20 2d 20 2d 20 28 20 63  DIV col0 - - ( c
2ff50 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol2 ) FROM tab1 
2ff60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2ff70 37 0d 0a 31 37 0d 0a 36 39 0d 0a 0d 0a 73 6b 69  7..17..69....ski
2ff80 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2ff90 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2ffa0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2ffb0 6c 2d 31 34 31 37 0d 0a 53 45 4c 45 43 54 20 2b  l-1417..SELECT +
2ffc0 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32   - col0 + + col2
2ffd0 20 2f 20 63 6f 6c 30 20 2d 20 2d 20 28 20 63 6f   / col0 - - ( co
2ffe0 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l2 ) FROM tab1 A
2fff0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
30000 0d 0a 31 37 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72  ..17..69....quer
30010 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30020 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63  ECT - col2 + - c
30030 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 + col1 AS co
30040 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
30050 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32  --..-1..-33..-82
30060 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30070 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
30080 20 2b 20 33 38 20 2b 20 2b 20 63 6f 6c 32 20 46   + 38 + + col2 F
30090 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
300a0 31 34 32 0d 0a 31 35 35 0d 0a 37 32 0d 0a 0d 0a  142..155..72....
300b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
300c0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b  .SELECT + col2 +
300d0 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31   - col1 + - col1
300e0 20 2a 20 39 34 20 41 53 20 63 6f 6c 31 20 46 52   * 94 AS col1 FR
300f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
30100 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 39 0d 0a 2d 32  .----..-1139..-2
30110 34 31 36 0d 0a 2d 38 39 33 0d 0a 0d 0a 71 75 65  416..-893....que
30120 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30130 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  LECT + col2 * + 
30140 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63  col2 + col2 AS c
30150 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
30160 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32   cor0..----..112
30170 32 0d 0a 32 0d 0a 36 38 30 36 0d 0a 0d 0a 71 75  2..2..6806....qu
30180 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30190 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 74  ELECT + col1 * t
301a0 61 62 30 2e 63 6f 6c 31 20 2d 20 2b 20 28 20 63  ab0.col1 - + ( c
301b0 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 29 20 46  ol0 + - col0 ) F
301c0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
301d0 37 33 39 36 0d 0a 38 32 38 31 0d 0a 39 34 30 39  7396..8281..9409
301e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
301f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
30200 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   * col1 + - col0
30210 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 74 61 62 31   + + col1 * tab1
30220 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d  .col0 FROM tab1.
30230 0a 2d 2d 2d 2d 0d 0a 31 31 32 39 0d 0a 36 37 36  .----..1129..676
30240 0d 0a 37 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..751....query I
30250 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30260 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62 31   DISTINCT + tab1
30270 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c  .col0 FROM tab1,
30280 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
30290 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34  or0..----..3..64
302a0 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..80....query I 
302b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
302c0 41 4c 4c 20 34 39 20 41 53 20 63 6f 6c 32 20 46  ALL 49 AS col2 F
302d0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41  ROM tab2, tab0 A
302e0 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72  S cor0, tab2 cor
302f0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
30300 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 34  es hashing to a4
30310 30 64 38 37 35 34 61 35 62 65 33 63 65 32 33 30  0d8754a5be3ce230
30320 39 63 36 31 62 66 64 33 65 30 30 31 39 37 0d 0a  9c61bfd3e00197..
30330 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
30340 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
30350 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
30360 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
30370 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
30380 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
30390 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
303a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
303b0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
303c0 2d 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 20  - col0 * + CAST 
303d0 28 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  ( + col0 + col2 
303e0 41 53 20 52 45 41 4c 20 29 20 63 6f 6c 30 20 46  AS REAL ) col0 F
303f0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
30400 2d 31 32 35 39 0d 0a 2d 31 33 33 35 0d 0a 2d 31  -1259..-1335..-1
30410 35 31 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5137....query I 
30420 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30430 2b 20 2d 20 35 30 20 2b 20 2d 20 63 6f 6c 31 20  + - 50 + - col1 
30440 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
30450 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 30 0d 0a 2d 36  0..----..-60..-6
30460 33 0d 0a 2d 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  3..-76....onlyif
30470 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
30480 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
30490 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
304a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
304b0 6c 61 62 65 6c 2d 31 34 32 38 0d 0a 53 45 4c 45  label-1428..SELE
304c0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
304d0 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 44   * + tab1.col0 D
304e0 49 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  IV + col0 FROM t
304f0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  ab1..----..54..5
30500 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  7..96....skipif 
30510 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
30520 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
30530 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
30540 32 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  28..SELECT DISTI
30550 4e 43 54 20 63 6f 6c 32 20 2a 20 2b 20 74 61 62  NCT col2 * + tab
30560 31 2e 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20  1.col0 / + col0 
30570 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
30580 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71  .54..57..96....q
30590 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
305a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
305b0 2b 20 34 33 20 2a 20 39 39 20 46 52 4f 4d 20 74  + 43 * 99 FROM t
305c0 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
305d0 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  0, tab1 AS cor1.
305e0 0a 2d 2d 2d 2d 0d 0a 34 32 35 37 0d 0a 0d 0a 6f  .----..4257....o
305f0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
30600 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
30610 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
30620 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
30630 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30640 74 20 6c 61 62 65 6c 2d 31 34 33 30 0d 0a 53 45  t label-1430..SE
30650 4c 45 43 54 20 2d 20 36 35 20 2b 20 63 6f 6c 32  LECT - 65 + col2
30660 20 2d 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20   - - CAST( NULL 
30670 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
30680 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
30690 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
306a0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
306b0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
306c0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
306d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
306e0 33 30 0d 0a 53 45 4c 45 43 54 20 2d 20 36 35 20  30..SELECT - 65 
306f0 2b 20 63 6f 6c 32 20 2d 20 2d 20 43 41 53 54 20  + col2 - - CAST 
30700 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
30710 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  R ) AS col2 FROM
30720 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab0..----..NUL
30730 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
30740 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30750 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
30760 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20  + + tab1.col0 * 
30770 36 35 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  65 FROM tab1..--
30780 2d 2d 0d 0a 31 39 38 0d 0a 34 32 32 34 0d 0a 35  --..198..4224..5
30790 32 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  280....query I r
307a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
307b0 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30   - col1 * + col0
307c0 20 2b 20 2d 20 28 20 2b 20 30 20 29 20 46 52 4f   + - ( + 0 ) FRO
307d0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
307e0 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34  ----..-1040..-64
307f0 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20  0..-78....query 
30800 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30810 54 20 2d 20 2d 20 28 20 31 32 20 29 20 46 52 4f  T - - ( 12 ) FRO
30820 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
30830 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
30840 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
30850 64 34 66 35 61 38 65 30 33 32 32 39 34 63 33 62  d4f5a8e032294c3b
30860 39 33 34 32 38 32 31 36 31 37 38 30 30 39 37 32  9342821617800972
30870 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
30880 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
30890 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
308a0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
308b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
308c0 31 34 33 34 0d 0a 53 45 4c 45 43 54 20 2d 20 37  1434..SELECT - 7
308d0 30 20 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20 2d  0 DIV + col2 + -
308e0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63   col0 * + cor0.c
308f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
30900 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
30910 33 0d 0a 2d 33 36 34 39 0d 0a 2d 37 36 38 30 0d  3..-3649..-7680.
30920 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
30930 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
30940 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30950 74 20 6c 61 62 65 6c 2d 31 34 33 34 0d 0a 53 45  t label-1434..SE
30960 4c 45 43 54 20 2d 20 37 30 20 2f 20 2b 20 63 6f  LECT - 70 / + co
30970 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  l2 + - col0 * + 
30980 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
30990 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
309a0 2d 0d 0a 2d 31 36 33 0d 0a 2d 33 36 34 39 0d 0a  -..-163..-3649..
309b0 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -7680....query I
309c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
309d0 20 2b 20 63 6f 6c 32 20 2a 20 33 20 2b 20 63 6f   + col2 * 3 + co
309e0 6c 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 + col1 FROM t
309f0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
30a00 2d 0d 0a 32 33 38 0d 0a 32 34 32 0d 0a 33 39 37  -..238..242..397
30a10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30a20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
30a30 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  INCT + col2 * co
30a40 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
30a50 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
30a60 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31  .2916..3249..921
30a70 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
30a80 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
30a90 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
30aa0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
30ab0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
30ac0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
30ad0 33 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  37..SELECT - col
30ae0 30 20 2a 20 2d 20 43 41 53 54 28 20 63 6f 6c 31  0 * - CAST( col1
30af0 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
30b00 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
30b10 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d  ----..1343..217.
30b20 0a 34 36 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .4602....skipif 
30b30 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
30b40 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
30b50 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
30b60 33 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  37..SELECT - col
30b70 30 20 2a 20 2d 20 43 41 53 54 20 28 20 63 6f 6c  0 * - CAST ( col
30b80 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  1 AS INTEGER ) F
30b90 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
30ba0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31  ..----..1343..21
30bb0 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79  7..4602....query
30bc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30bd0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20  CT ALL - col1 * 
30be0 2b 20 39 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 92 AS col0 FRO
30bf0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
30c00 2d 0d 0a 2d 31 35 36 34 0d 0a 2d 32 38 35 32 0d  -..-1564..-2852.
30c10 0a 2d 35 34 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-5428....onlyif
30c20 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
30c30 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
30c40 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
30c50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
30c60 6c 61 62 65 6c 2d 31 34 33 39 0d 0a 53 45 4c 45  label-1439..SELE
30c70 43 54 20 2d 20 2b 20 63 6f 6c 31 20 44 49 56 20  CT - + col1 DIV 
30c80 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63  col1 + col1 AS c
30c90 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
30ca0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d   cor0..----..12.
30cb0 0a 32 35 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69 66  .25..9....skipif
30cc0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
30cd0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
30ce0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
30cf0 34 33 39 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  439..SELECT - + 
30d00 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 2b 20 63 6f  col1 / col1 + co
30d10 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
30d20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
30d30 2d 2d 0d 0a 31 32 0d 0a 32 35 0d 0a 39 0d 0a 0d  --..12..25..9...
30d40 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
30d50 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
30d60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30d70 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 43  .SELECT col1 + C
30d80 41 53 54 20 28 20 2d 20 38 30 20 2a 20 63 6f 6c  AST ( - 80 * col
30d90 32 20 41 53 20 52 45 41 4c 20 29 20 41 53 20 63  2 AS REAL ) AS c
30da0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
30db0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35   cor0..----..-25
30dc0 35 34 0d 0a 2d 36 34 36 39 0d 0a 31 37 0d 0a 0d  54..-6469..17...
30dd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30de0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74  ..SELECT ALL - t
30df0 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  ab2.col1 AS col0
30e00 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
30e10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30e20 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
30e30 20 74 6f 20 63 63 61 61 35 64 64 33 33 38 38 64   to ccaa5dd3388d
30e40 39 65 65 30 66 65 61 36 37 36 66 61 33 35 32 39  9ee0fea676fa3529
30e50 39 66 65 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9fe5....query I 
30e60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30e70 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20  DISTINCT col0 + 
30e80 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  8 AS col2 FROM t
30e90 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
30ea0 2d 0d 0a 33 32 0d 0a 34 33 0d 0a 39 37 0d 0a 0d  -..32..43..97...
30eb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30ec0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
30ed0 2b 20 2b 20 35 34 20 41 53 20 63 6f 6c 30 20 46  + + 54 AS col0 F
30ee0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
30ef0 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 31 0d 0a  ..----..28..41..
30f00 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  44....onlyif mys
30f10 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
30f20 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
30f30 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
30f40 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
30f50 6c 2d 31 34 34 34 0d 0a 53 45 4c 45 43 54 20 41  l-1444..SELECT A
30f60 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a  LL col2 + col0 *
30f70 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 41   col2 DIV col0 A
30f80 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
30f90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30fa0 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d  108..114..192...
30fb0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
30fc0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
30fd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
30fe0 6c 61 62 65 6c 2d 31 34 34 34 0d 0a 53 45 4c 45  label-1444..SELE
30ff0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f  CT ALL col2 + co
31000 6c 30 20 2a 20 63 6f 6c 32 20 2f 20 63 6f 6c 30  l0 * col2 / col0
31010 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
31020 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
31030 0d 0a 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d  ..108..114..192.
31040 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31050 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
31060 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 28 20 63  NCT + col0 * ( c
31070 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
31080 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
31090 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30  .----..1040..640
310a0 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..78....query I 
310b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
310c0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 38 31  + cor0.col1 * 81
310d0 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   + + col2 * + co
310e0 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  r0.col2 AS col0 
310f0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
31100 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 36 39 0d 0a  0..----..10269..
31110 34 30 35 39 0d 0a 35 30 32 32 0d 0a 0d 0a 71 75  4059..5022....qu
31120 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31130 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d  ELECT - col2 + -
31140 20 34 37 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f   47 * + col1 FRO
31150 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
31160 2d 2d 2d 2d 0d 0a 2d 31 32 37 36 0d 0a 2d 35 32  ----..-1276..-52
31170 37 0d 0a 2d 37 30 37 0d 0a 0d 0a 73 6b 69 70 69  7..-707....skipi
31180 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
31190 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
311a0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
311b0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
311c0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
311d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
311e0 72 30 2e 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f  r0.col1 col1 FRO
311f0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31200 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37  ----..86..91..97
31210 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
31220 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
31230 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
31240 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
31250 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
31260 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34  owsort label-144
31270 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  9..SELECT + col2
31280 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20   * - ( + col0 ) 
31290 2b 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  + - CAST( NULL A
312a0 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
312b0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
312c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
312d0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
312e0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
312f0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
31300 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
31310 61 62 65 6c 2d 31 34 34 39 0d 0a 53 45 4c 45 43  abel-1449..SELEC
31320 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2b  T + col2 * - ( +
31330 20 63 6f 6c 30 20 29 20 2b 20 2d 20 43 41 53 54   col0 ) + - CAST
31340 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
31350 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ER ) AS col2 FRO
31360 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31370 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
31380 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
31390 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
313a0 54 20 2b 20 2b 20 34 20 46 52 4f 4d 20 74 61 62  T + + 4 FROM tab
313b0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
313c0 0a 34 0d 0a 34 0d 0a 34 0d 0a 0d 0a 71 75 65 72  .4..4..4....quer
313d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
313e0 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  ECT col0 * col0 
313f0 2b 20 2b 20 28 20 2d 20 63 6f 6c 32 20 2b 20 63  + + ( - col2 + c
31400 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 0d  ol0 ) FROM tab2.
31410 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 36 31 33 36 0d  .----..29..6136.
31420 0a 36 32 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .6282....query I
31430 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31440 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
31450 20 2a 20 37 32 20 46 52 4f 4d 20 74 61 62 31 0d   * 72 FROM tab1.
31460 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 34 36 30 38  .----..216..4608
31470 0d 0a 35 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20  ..5760....query 
31480 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31490 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  T - + col1 * col
314a0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
314b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
314c0 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a  -..-1534..-646..
314d0 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -837....query I 
314e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
314f0 41 4c 4c 20 32 37 20 2b 20 63 6f 6c 31 20 2a 20  ALL 27 + col1 * 
31500 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f  - ( - col2 ) FRO
31510 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
31520 2d 2d 2d 2d 0d 0a 31 35 36 31 0d 0a 36 37 33 0d  ----..1561..673.
31530 0a 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 49  .864....query II
31540 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
31550 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a  rt..SELECT ALL *
31560 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
31570 20 63 6f 72 30 2c 20 74 61 62 31 2c 20 74 61 62   cor0, tab1, tab
31580 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
31590 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68  .972 values hash
315a0 69 6e 67 20 74 6f 20 65 38 34 31 35 32 63 30 62  ing to e84152c0b
315b0 66 34 33 36 31 37 37 64 33 62 33 64 38 30 65 34  f436177d3b3d80e4
315c0 32 38 33 32 64 34 66 0d 0a 0d 0a 71 75 65 72 79  2832d4f....query
315d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
315e0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
315f0 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  l2 + col1 * - co
31600 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
31610 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 39  cor0..----..-209
31620 37 0d 0a 2d 33 33 39 36 0d 0a 2d 38 31 38 31 0d  7..-3396..-8181.
31630 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
31640 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
31650 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
31660 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
31670 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
31680 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 37  wsort label-1457
31690 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
316a0 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20   col1 * + CAST( 
316b0 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
316c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
316d0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
316e0 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a  ..-1248..-1404..
316f0 2d 35 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  -570....skipif m
31700 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
31710 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
31720 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35  owsort label-145
31730 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  7..SELECT ALL + 
31740 2d 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20  - col1 * + CAST 
31750 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45  ( col2 AS INTEGE
31760 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  R ) AS col2 FROM
31770 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
31780 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30  ---..-1248..-140
31790 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79  4..-570....query
317a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
317b0 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f  CT ALL + cor0.co
317c0 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  l1 * col2 + + co
317d0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
317e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
317f0 2d 2d 0d 0a 31 33 34 34 0d 0a 31 34 35 38 0d 0a  --..1344..1458..
31800 36 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  627....query I r
31810 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
31820 20 36 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   68 AS col2 FROM
31830 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
31840 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74  OSS JOIN tab1, t
31850 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab2 AS cor1, tab
31860 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  2 AS cor2..----.
31870 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69  .81 values hashi
31880 6e 67 20 74 6f 20 33 61 35 63 33 64 39 38 37 32  ng to 3a5c3d9872
31890 61 38 61 34 31 34 38 61 62 39 38 65 64 30 61 62  a8a4148ab98ed0ab
318a0 30 61 36 63 36 32 0d 0a 0d 0a 71 75 65 72 79 20  0a6c62....query 
318b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
318c0 54 20 2b 20 63 6f 6c 30 20 2b 20 33 37 20 41 53  T + col0 + 37 AS
318d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
318e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
318f0 32 36 0d 0a 36 31 0d 0a 37 32 0d 0a 0d 0a 6f 6e  26..61..72....on
31900 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
31910 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
31920 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
31930 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
31940 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31950 20 6c 61 62 65 6c 2d 31 34 36 31 0d 0a 53 45 4c   label-1461..SEL
31960 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 43 41 53  ECT - col1 * CAS
31970 54 28 20 2b 20 28 20 63 6f 6c 31 20 29 20 41 53  T( + ( col1 ) AS
31980 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 30 20 46   SIGNED ) col0 F
31990 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
319a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d 33  ..----..-289..-3
319b0 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a 73 6b 69  481..-961....ski
319c0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
319d0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
319e0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
319f0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
31a00 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..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 34 36 31 0d  sort label-1461.
31a40 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a  .SELECT - col1 *
31a50 20 43 41 53 54 20 28 20 2b 20 28 20 63 6f 6c 31   CAST ( + ( col1
31a60 20 29 20 41 53 20 49 4e 54 45 47 45 52 20 29 20   ) AS INTEGER ) 
31a70 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
31a80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
31a90 38 39 0d 0a 2d 33 34 38 31 0d 0a 2d 39 36 31 0d  89..-3481..-961.
31aa0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31ab0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
31ac0 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  NCT + col2 * - c
31ad0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
31ae0 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38  ---..-162..-3648
31af0 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..-7680....onlyi
31b00 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
31b10 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
31b20 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
31b30 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
31b40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
31b50 62 65 6c 2d 31 34 36 33 0d 0a 53 45 4c 45 43 54  bel-1463..SELECT
31b60 20 41 4c 4c 20 63 6f 6c 31 20 2d 20 43 41 53 54   ALL col1 - CAST
31b70 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
31b80 20 29 20 2f 20 2b 20 31 39 20 46 52 4f 4d 20 74   ) / + 19 FROM t
31b90 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
31ba0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
31bb0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
31bc0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
31bd0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
31be0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 33  wsort label-1463
31bf0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
31c00 31 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  1 - CAST ( NULL 
31c10 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2b  AS INTEGER ) / +
31c20 20 31 39 20 46 52 4f 4d 20 74 61 62 32 20 41 53   19 FROM tab2 AS
31c30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
31c40 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
31c50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31c60 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
31c70 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  T - + cor0.col0 
31c80 2a 20 36 38 20 2b 20 2b 20 39 33 20 2a 20 2d 20  * 68 + + 93 * - 
31c90 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
31ca0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31cb0 2d 2d 2d 2d 0d 0a 2d 31 33 36 37 38 0d 0a 2d 32  ----..-13678..-2
31cc0 34 37 33 0d 0a 2d 34 37 30 31 0d 0a 0d 0a 71 75  473..-4701....qu
31cd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31ce0 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 28  ELECT col1 * + (
31cf0 20 2b 20 33 36 20 2b 20 63 6f 6c 31 20 29 20 41   + 36 + col1 ) A
31d00 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
31d10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31d20 32 30 37 37 0d 0a 35 36 30 35 0d 0a 39 30 31 0d  2077..5605..901.
31d30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31d40 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
31d50 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 72 30 2e 63   col0 - + cor0.c
31d60 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
31d70 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
31d80 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
31d90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31da0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31db0 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   - + col0 + - co
31dc0 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  l0 * - col2 * - 
31dd0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
31de0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31df0 2d 2d 2d 2d 0d 0a 2d 33 34 33 30 0d 0a 2d 36 36  ----..-3430..-66
31e00 34 32 30 37 0d 0a 2d 36 38 31 33 36 0d 0a 0d 0a  4207..-68136....
31e10 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
31e20 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
31e30 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
31e40 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
31e50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 38  wsort label-1468
31e60 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
31e70 2b 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  + - ( - cor0.col
31e80 32 20 29 20 44 49 56 20 63 6f 6c 30 20 46 52 4f  2 ) DIV col0 FRO
31e90 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31ea0 2d 2d 2d 2d 0d 0a 31 0d 0a 33 34 0d 0a 38 32 0d  ----..1..34..82.
31eb0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
31ec0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
31ed0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31ee0 74 20 6c 61 62 65 6c 2d 31 34 36 38 0d 0a 53 45  t label-1468..SE
31ef0 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  LECT + col2 + - 
31f00 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  ( - cor0.col2 ) 
31f10 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  / col0 FROM tab0
31f20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31f30 31 0d 0a 33 34 0d 0a 38 32 0d 0a 0d 0a 71 75 65  1..34..82....que
31f40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31f50 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
31f60 2b 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a  + + ( + col1 ) *
31f70 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
31f80 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
31f90 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 30 0d 0a  0..----..-1360..
31fa0 2d 32 34 38 0d 0a 2d 34 36 36 31 0d 0a 0d 0a 73  -248..-4661....s
31fb0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
31fc0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
31fd0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
31fe0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
31ff0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
32000 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32010 41 4c 4c 20 36 37 20 63 6f 6c 32 20 46 52 4f 4d  ALL 67 col2 FROM
32020 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
32030 2d 2d 2d 0d 0a 36 37 0d 0a 36 37 0d 0a 36 37 0d  ---..67..67..67.
32040 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32050 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
32060 4e 43 54 20 2d 20 39 36 20 41 53 20 63 6f 6c 32  NCT - 96 AS col2
32070 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
32080 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32090 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -96....query I r
320a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
320b0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a  ISTINCT + col2 *
320c0 20 37 35 20 46 52 4f 4d 20 74 61 62 31 20 41 53   75 FROM tab1 AS
320d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 35   cor0..----..405
320e0 30 0d 0a 34 32 37 35 0d 0a 37 32 30 30 0d 0a 0d  0..4275..7200...
320f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32100 0d 0a 53 45 4c 45 43 54 20 38 32 20 41 53 20 63  ..SELECT 82 AS c
32110 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol0 FROM tab2, t
32120 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
32130 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
32140 69 6e 67 20 74 6f 20 66 33 31 38 66 64 39 64 61  ing to f318fd9da
32150 63 32 64 65 37 61 66 34 62 38 32 63 63 37 35 37  c2de7af4b82cc757
32160 34 62 62 63 61 32 63 0d 0a 0d 0a 71 75 65 72 79  4bbca2c....query
32170 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49   IIIIIIIIIIIIIII
32180 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32190 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30   ALL * FROM tab0
321a0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
321b0 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
321c0 6f 72 31 2c 20 74 61 62 31 2c 20 74 61 62 32 20  or1, tab1, tab2 
321d0 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor2..----..3
321e0 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69  645 values hashi
321f0 6e 67 20 74 6f 20 64 66 30 30 64 31 39 66 31 37  ng to df00d19f17
32200 38 61 37 30 38 66 36 33 36 62 30 33 36 64 63 62  8a708f636b036dcb
32210 36 63 36 66 38 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  6c6f87....onlyif
32220 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
32230 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
32240 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
32250 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
32260 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
32270 65 6c 2d 31 34 37 35 0d 0a 53 45 4c 45 43 54 20  el-1475..SELECT 
32280 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2b 20 28 20  tab0.col1 + + ( 
32290 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20 2b 20  cor0.col0 ) * + 
322a0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
322b0 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46  GNED ) AS col0 F
322c0 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
322d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
322e0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
322f0 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35  o cd7a7901e47c15
32300 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65  155404aff0d216fe
32310 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  0b....skipif mys
32320 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
32330 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
32340 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 35 0d  sort label-1475.
32350 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c  .SELECT tab0.col
32360 31 20 2b 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c  1 + + ( cor0.col
32370 30 20 29 20 2a 20 2b 20 43 41 53 54 20 28 20 4e  0 ) * + CAST ( N
32380 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
32390 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
323a0 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
323b0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
323c0 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61   hashing to cd7a
323d0 37 39 30 31 65 34 37 63 31 35 31 35 35 34 30 34  7901e47c15155404
323e0 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a  aff0d216fe0b....
323f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32400 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
32410 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol2 + col1 AS co
32420 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
32430 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d  cor0..----..109.
32440 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  .67..80....query
32450 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32460 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
32470 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  l1 * + col0 + co
32480 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c 32  l2 * col0 - col2
32490 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
324a0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
324b0 0d 0a 33 37 39 0d 0a 34 33 30 37 0d 0a 36 36 30  ..379..4307..660
324c0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
324d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
324e0 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  0 + + cor0.col1 
324f0 2a 20 2d 20 28 20 2b 20 63 6f 6c 30 20 2b 20 2b  * - ( + col0 + +
32500 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 41 53 20   cor0.col1 ) AS 
32510 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
32520 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
32530 31 37 31 0d 0a 2d 31 35 35 33 0d 0a 2d 38 30 30  171..-1553..-800
32540 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
32550 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
32560 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
32570 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41  ROM tab0, tab2 A
32580 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  S cor0, tab2 AS 
32590 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
325a0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
325b0 20 31 65 31 66 31 30 39 35 33 65 62 38 65 66 66   1e1f10953eb8eff
325c0 65 39 62 32 30 65 37 34 36 66 38 61 37 66 64 38  e9b20e746f8a7fd8
325d0 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
325e0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
325f0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
32600 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
32610 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
32620 2d 31 34 38 30 0d 0a 53 45 4c 45 43 54 20 44 49  -1480..SELECT DI
32630 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
32640 2d 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63 6f  - col0 - cor0.co
32650 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 63 6f  l0 DIV - col1 co
32660 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
32670 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 39 0d 0a  0..----..-1339..
32680 2d 32 31 37 0d 0a 2d 34 36 30 31 0d 0a 0d 0a 73  -217..-4601....s
32690 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
326a0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
326b0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
326c0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
326d0 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
326e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
326f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
32700 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38  owsort label-148
32710 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
32720 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  CT + col1 * - co
32730 6c 30 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2f  l0 - cor0.col0 /
32740 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f   - col1 col0 FRO
32750 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
32760 2d 0d 0a 2d 31 33 33 39 0d 0a 2d 32 31 37 0d 0a  -..-1339..-217..
32770 2d 34 36 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -4601....query I
32780 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32790 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d   + col0 * col0 -
327a0 20 2d 20 36 35 20 2a 20 2d 20 63 6f 72 30 2e 63   - 65 * - cor0.c
327b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
327c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
327d0 30 36 0d 0a 33 37 37 31 0d 0a 34 33 39 34 0d 0a  06..3771..4394..
327e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
327f0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
32800 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53  col1 + - col1 AS
32810 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
32820 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
32830 31 37 32 0d 0a 2d 31 38 32 0d 0a 2d 31 39 34 0d  172..-182..-194.
32840 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32850 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
32860 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  NCT cor0.col2 * 
32870 34 37 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  47 FROM tab2, ta
32880 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b0 AS cor0, tab1
32890 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
328a0 31 35 35 31 0d 0a 33 38 35 34 0d 0a 34 37 0d 0a  1551..3854..47..
328b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
328c0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
328d0 74 61 62 32 2e 63 6f 6c 31 20 2d 20 63 6f 6c 31  tab2.col1 - col1
328e0 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
328f0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 36  ab2..----..-1326
32900 0d 0a 2d 31 38 36 0d 0a 2d 34 35 34 33 0d 0a 0d  ..-186..-4543...
32910 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
32920 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
32930 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
32940 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
32950 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38  owsort label-148
32960 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31 20  5..SELECT ALL 1 
32970 2b 20 63 6f 6c 30 20 44 49 56 20 74 61 62 30 2e  + col0 DIV tab0.
32980 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
32990 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d  ----..1..1..1...
329a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
329b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
329c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
329d0 6c 61 62 65 6c 2d 31 34 38 35 0d 0a 53 45 4c 45  label-1485..SELE
329e0 43 54 20 41 4c 4c 20 31 20 2b 20 63 6f 6c 30 20  CT ALL 1 + col0 
329f0 2f 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d  / tab0.col1 FROM
32a00 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
32a10 31 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  1..1....onlyif m
32a20 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
32a30 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
32a40 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
32a50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
32a60 62 65 6c 2d 31 34 38 36 0d 0a 53 45 4c 45 43 54  bel-1486..SELECT
32a70 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 63 6f   ALL + col2 + co
32a80 6c 30 20 44 49 56 20 43 41 53 54 28 20 28 20 63  l0 DIV CAST( ( c
32a90 6f 6c 30 20 29 20 41 53 20 53 49 47 4e 45 44 20  ol0 ) AS SIGNED 
32aa0 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
32ab0 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37 0d 0a 0d  -..55..58..97...
32ac0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
32ad0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
32ae0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32af0 6c 61 62 65 6c 2d 31 34 38 36 0d 0a 53 45 4c 45  label-1486..SELE
32b00 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20  CT ALL + col2 + 
32b10 63 6f 6c 30 20 2f 20 43 41 53 54 20 28 20 28 20  col0 / CAST ( ( 
32b20 63 6f 6c 30 20 29 20 41 53 20 49 4e 54 45 47 45  col0 ) AS INTEGE
32b30 52 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  R ) FROM tab1..-
32b40 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37 0d  ---..55..58..97.
32b50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32b60 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
32b70 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
32b80 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20  ROM tab1, tab0, 
32b90 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
32ba0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
32bb0 73 68 69 6e 67 20 74 6f 20 37 35 39 39 62 34 38  shing to 7599b48
32bc0 30 31 32 35 64 65 35 32 31 65 66 65 64 37 31 62  0125de521efed71b
32bd0 35 62 32 34 31 33 63 37 64 0d 0a 0d 0a 71 75 65  5b2413c7d....que
32be0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32bf0 4c 45 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 31  LECT + tab2.col1
32c00 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
32c10 32 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d 0a 33 34  2..----..289..34
32c20 38 31 0d 0a 39 36 31 0d 0a 0d 0a 73 6b 69 70 69  81..961....skipi
32c30 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
32c40 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
32c50 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
32c60 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
32c70 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
32c80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
32c90 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20  .col2 col1 FROM 
32ca0 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
32cb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
32cc0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 30  es hashing to 80
32cd0 63 61 30 61 31 63 63 33 33 37 61 37 37 31 34 61  ca0a1cc337a7714a
32ce0 38 39 39 30 61 37 36 34 63 66 64 62 31 37 0d 0a  8990a764cfdb17..
32cf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32d00 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
32d10 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2b   col2 + + col2 +
32d20 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
32d30 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  0 cor0..----..1.
32d40 0a 32 37 38 35 0d 0a 37 34 35 33 0d 0a 0d 0a 71  .2785..7453....q
32d50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32d60 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
32d70 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col2 + - cor0.co
32d80 6c 30 20 2b 20 31 37 20 2a 20 2d 20 63 6f 6c 31  l0 + 17 * - col1
32d90 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
32da0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
32db0 0d 0a 2d 31 30 31 34 0d 0a 2d 31 33 37 31 0d 0a  ..-1014..-1371..
32dc0 2d 32 36 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49  -2615....query I
32dd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32de0 20 2b 20 28 20 37 37 20 2a 20 63 6f 72 30 2e 63   + ( 77 * cor0.c
32df0 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol0 ) AS col1 FR
32e00 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f  OM tab0, tab0 co
32e10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
32e20 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 38  es hashing to 78
32e30 30 66 35 62 61 35 34 31 37 36 39 63 38 66 33 65  0f5ba541769c8f3e
32e40 66 33 63 38 63 35 38 34 61 37 38 65 66 38 0d 0a  f3c8c584a78ef8..
32e50 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
32e60 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
32e70 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
32e80 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
32e90 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
32ea0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32eb0 43 54 20 2d 20 39 32 20 2a 20 2b 20 63 6f 6c 30  CT - 92 * + col0
32ec0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
32ed0 0a 2d 2d 2d 2d 0d 0a 2d 32 37 36 0d 0a 2d 35 38  .----..-276..-58
32ee0 38 38 0d 0a 2d 37 33 36 30 0d 0a 0d 0a 71 75 65  88..-7360....que
32ef0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32f00 4c 45 43 54 20 41 4c 4c 20 2b 20 36 32 20 46 52  LECT ALL + 62 FR
32f10 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
32f20 0a 2d 2d 2d 2d 0d 0a 36 32 0d 0a 36 32 0d 0a 36  .----..62..62..6
32f30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
32f40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
32f50 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a   col0 + + col0 *
32f60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
32f70 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a 37 30 34  .----..1120..704
32f80 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..81....query I 
32f90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32fa0 38 34 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  84 + col0 FROM t
32fb0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 0d 0a  ab1..----..148..
32fc0 31 36 34 0d 0a 38 37 0d 0a 0d 0a 6f 6e 6c 79 69  164..87....onlyi
32fd0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
32fe0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
32ff0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
33000 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
33010 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
33020 62 65 6c 2d 31 34 39 37 0d 0a 53 45 4c 45 43 54  bel-1497..SELECT
33030 20 2b 20 63 6f 6c 30 20 2b 20 43 41 53 54 28 20   + col0 + CAST( 
33040 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29  col0 AS SIGNED )
33050 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
33060 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 31  b1..----..128..1
33070 36 30 0d 0a 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  60..6....skipif 
33080 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
33090 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
330a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
330b0 39 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  97..SELECT + col
330c0 30 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 30 20  0 + CAST ( col0 
330d0 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
330e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
330f0 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a  ----..128..160..
33100 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
33110 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 37 20  sort..SELECT 17 
33120 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
33130 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  0, tab2 AS cor0.
33140 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
33150 68 61 73 68 69 6e 67 20 74 6f 20 34 33 32 39 38  hashing to 43298
33160 65 34 33 33 36 35 66 63 63 62 35 31 34 36 65 61  e43365fccb5146ea
33170 33 32 30 30 33 37 35 33 63 39 32 0d 0a 0d 0a 71  32003753c92....q
33180 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33190 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
331a0 2b 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 32 20  + col2 * ( col2 
331b0 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
331c0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
331d0 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d 0a 37 32  -..1444..676..72
331e0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
331f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
33200 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f   col1 + col0 FRO
33210 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
33220 2d 0d 0a 2d 32 33 0d 0a 35 34 0d 0a 36 37 0d 0a  -..-23..54..67..
33230 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33240 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
33250 20 2b 20 2d 20 28 20 63 6f 6c 31 20 29 20 2a 20   + - ( col1 ) * 
33260 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
33270 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
33280 2d 0d 0a 2d 31 33 34 34 0d 0a 2d 31 34 35 38 0d  -..-1344..-1458.
33290 0a 2d 36 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .-627....query I
332a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
332b0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
332c0 20 2a 20 28 20 2d 20 63 6f 6c 30 20 2b 20 63 6f   * ( - col0 + co
332d0 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l1 ) AS col2 FRO
332e0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  M tab0..----..18
332f0 32 0d 0a 35 33 33 32 0d 0a 36 30 31 34 0d 0a 0d  2..5332..6014...
33300 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
33310 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
33320 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
33330 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
33340 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30  owsort label-150
33350 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 44  3..SELECT col0 D
33360 49 56 20 35 33 20 2b 20 2d 20 63 6f 6c 31 20 2b  IV 53 + - col1 +
33370 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20   col0 col1 FROM 
33380 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d  tab1..----..-23.
33390 0a 35 35 0d 0a 36 38 0d 0a 0d 0a 73 6b 69 70 69  .55..68....skipi
333a0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
333b0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
333c0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
333d0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
333e0 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
333f0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
33400 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
33410 72 74 20 6c 61 62 65 6c 2d 31 35 30 33 0d 0a 53  rt label-1503..S
33420 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20 35 33 20  ELECT col0 / 53 
33430 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  + - col1 + col0 
33440 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
33450 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 35 0d 0a 36  ----..-23..55..6
33460 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
33470 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
33480 32 20 2a 20 28 20 37 30 20 2a 20 63 6f 6c 30 20  2 * ( 70 * col0 
33490 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
334a0 2d 0d 0a 31 33 32 33 30 0d 0a 31 34 31 39 36 30  -..13230..141960
334b0 0d 0a 32 31 30 31 34 30 0d 0a 0d 0a 71 75 65 72  ..210140....quer
334c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
334d0 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  ECT - col0 * col
334e0 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  0 * - col0 AS co
334f0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
33500 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 32  cor0..----..1382
33510 34 0d 0a 34 32 38 37 35 0d 0a 37 30 34 39 36 39  4..42875..704969
33520 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
33530 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
33540 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
33550 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
33560 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
33570 31 35 30 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1506..SELECT - c
33580 6f 6c 30 20 2a 20 63 6f 6c 32 20 44 49 56 20 2b  ol0 * col2 DIV +
33590 20 38 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53   87 FROM tab2 AS
335a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
335b0 0a 2d 32 33 0d 0a 2d 33 34 0d 0a 0d 0a 73 6b 69  .-23..-34....ski
335c0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
335d0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
335e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
335f0 6c 2d 31 35 30 36 0d 0a 53 45 4c 45 43 54 20 2d  l-1506..SELECT -
33600 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2f 20 2b   col0 * col2 / +
33610 20 38 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53   87 FROM tab2 AS
33620 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
33630 0a 2d 32 33 0d 0a 2d 33 34 0d 0a 0d 0a 71 75 65  .-23..-34....que
33640 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33650 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
33660 6c 31 20 2a 20 2b 20 28 20 2d 20 32 30 20 2b 20  l1 * + ( - 20 + 
33670 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46  col0 ) AS col2 F
33680 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
33690 2d 2d 2d 0d 0a 2d 34 34 32 0d 0a 34 34 30 0d 0a  ---..-442..440..
336a0 37 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  780....query I r
336b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
336c0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72   cor0.col1 + cor
336d0 30 2e 63 6f 6c 31 20 2a 20 31 31 20 2b 20 2b 20  0.col1 * 11 + + 
336e0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
336f0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
33700 2d 2d 2d 2d 0d 0a 31 30 30 31 0d 0a 31 30 36 37  ----..1001..1067
33710 0d 0a 39 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..946....query I
33720 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33730 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   + + col1 + - co
33740 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  r0.col2 AS col1 
33750 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
33760 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a  0..----..53..9..
33770 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
33780 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
33790 63 6f 6c 31 20 2a 20 34 35 20 2b 20 63 6f 6c 30  col1 * 45 + col0
337a0 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   + - col2 * col1
337b0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
337c0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
337d0 0d 0a 2d 33 32 37 38 0d 0a 31 30 35 36 0d 0a 34  ..-3278..1056..4
337e0 33 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  303....query I r
337f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
33800 20 63 6f 6c 32 20 2b 20 31 39 20 2a 20 63 6f 6c   col2 + 19 * col
33810 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
33820 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
33830 2d 0d 0a 31 35 30 38 0d 0a 31 35 33 39 0d 0a 31  -..1508..1539..1
33840 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
33850 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
33860 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20  STINCT + + col0 
33870 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  * cor0.col2 AS c
33880 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
33890 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32   cor0..----..162
338a0 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a  ..3648..7680....
338b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
338c0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
338d0 63 6f 6c 31 20 2a 20 39 35 20 41 53 20 63 6f 6c  col1 * 95 AS col
338e0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
338f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 35  or0..----..-1235
33900 0d 0a 2d 32 34 37 30 0d 0a 2d 39 35 30 0d 0a 0d  ..-2470..-950...
33910 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
33920 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
33930 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
33940 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
33950 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 31  owsort label-151
33960 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
33970 43 54 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53  CT CAST( col2 AS
33980 20 53 49 47 4e 45 44 20 29 20 44 49 56 20 74 61   SIGNED ) DIV ta
33990 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  b2.col0 AS col2 
339a0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
339b0 0a 30 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..3....skipif 
339c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
339d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
339e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
339f0 31 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  14..SELECT DISTI
33a00 4e 43 54 20 43 41 53 54 20 28 20 63 6f 6c 32 20  NCT CAST ( col2 
33a10 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20 74  AS INTEGER ) / t
33a20 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  ab2.col0 AS col2
33a30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
33a40 0d 0a 30 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79 20  ..0..3....query 
33a50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33a60 54 20 38 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  T 81 AS col1 FRO
33a70 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
33a80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
33a90 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
33aa0 37 61 38 65 61 33 30 63 36 38 30 33 61 65 64 64  7a8ea30c6803aedd
33ab0 63 35 66 63 61 35 62 35 38 32 31 64 38 32 36 37  c5fca5b5821d8267
33ac0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33ad0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 37 36  ort..SELECT ( 76
33ae0 20 29 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   ) + col2 AS col
33af0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
33b00 2d 0d 0a 31 33 30 0d 0a 31 33 33 0d 0a 31 37 32  -..130..133..172
33b10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33b20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
33b30 49 4e 43 54 20 28 20 2b 20 28 20 63 6f 6c 32 20  INCT ( + ( col2 
33b40 29 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ) ) FROM tab0..-
33b50 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a  ---..1..33..82..
33b60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33b70 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
33b80 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   + col0 * - col0
33b90 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
33ba0 0d 0a 2d 31 32 32 34 0d 0a 2d 35 34 33 0d 0a 2d  ..-1224..-543..-
33bb0 37 38 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7839....query I 
33bc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33bd0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col0 * - col1 + 
33be0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
33bf0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
33c00 2d 31 32 36 34 0d 0a 2d 32 31 30 0d 0a 2d 34 35  -1264..-210..-45
33c10 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  24....query I ro
33c20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
33c30 6c 32 20 2b 20 32 31 20 46 52 4f 4d 20 74 61 62  l2 + 21 FROM tab
33c40 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
33c50 0a 31 30 33 0d 0a 32 32 0d 0a 35 34 0d 0a 0d 0a  .103..22..54....
33c60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33c70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
33c80 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 38 39   + + col0 * + 89
33c90 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
33ca0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 37 0d 0a 35  r0..----..267..5
33cb0 36 39 36 0d 0a 37 31 32 30 0d 0a 0d 0a 71 75 65  696..7120....que
33cc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33cd0 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c  LECT ALL + - col
33ce0 31 20 2b 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c  1 + - ( cor0.col
33cf0 30 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  0 ) + col1 FROM 
33d00 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
33d10 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39  --..-7..-78..-79
33d20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33d30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
33d40 28 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c  ( col2 ) + - col
33d50 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
33d60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d  or0..----..-108.
33d70 0a 2d 31 31 34 0d 0a 2d 31 39 32 0d 0a 0d 0a 73  .-114..-192....s
33d80 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
33d90 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
33da0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
33db0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
33dc0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
33dd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33de0 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  ALL cor0.col2 * 
33df0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 63 6f 6c 30  col0 * col1 col0
33e00 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
33e10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30 0d  r0..----..36480.
33e20 0a 34 32 31 32 0d 0a 39 39 38 34 30 0d 0a 0d 0a  .4212..99840....
33e30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33e40 0a 53 45 4c 45 43 54 20 2d 20 2b 20 35 20 2b 20  .SELECT - + 5 + 
33e50 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  + col0 + - col2 
33e60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
33e70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
33e80 0a 2d 32 35 0d 0a 33 36 0d 0a 34 37 0d 0a 0d 0a  .-25..36..47....
33e90 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
33ea0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
33eb0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
33ec0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
33ed0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 32 36  wsort label-1526
33ee0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
33ef0 54 20 2d 20 32 31 20 44 49 56 20 63 6f 72 30 2e  T - 21 DIV cor0.
33f00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
33f10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
33f20 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
33f30 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
33f40 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
33f50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 32 36  wsort label-1526
33f60 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
33f70 54 20 2d 20 32 31 20 2f 20 63 6f 72 30 2e 63 6f  T - 21 / cor0.co
33f80 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
33f90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
33fa0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
33fb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
33fc0 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63  TINCT col0 * - c
33fd0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
33fe0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
33ff0 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30  ---..-1040..-640
34000 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-78....query I
34010 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34020 20 44 49 53 54 49 4e 43 54 20 33 39 20 2b 20 63   DISTINCT 39 + c
34030 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
34040 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
34050 2d 2d 2d 0d 0a 31 30 33 0d 0a 31 31 39 0d 0a 34  ---..103..119..4
34060 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
34070 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
34080 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
34090 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
340a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
340b0 2d 31 35 32 39 0d 0a 53 45 4c 45 43 54 20 41 4c  -1529..SELECT AL
340c0 4c 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  L col2 * cor0.co
340d0 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30 20 46 52  l2 DIV + col0 FR
340e0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
340f0 2d 2d 0d 0a 30 0d 0a 34 35 0d 0a 37 35 0d 0a 0d  --..0..45..75...
34100 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
34110 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
34120 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
34130 6c 61 62 65 6c 2d 31 35 32 39 0d 0a 53 45 4c 45  label-1529..SELE
34140 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f  CT ALL col2 * co
34150 72 30 2e 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 30  r0.col2 / + col0
34160 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
34170 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 34 35 0d 0a 37 35  .----..0..45..75
34180 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34190 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
341a0 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  INCT - col2 * + 
341b0 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col1 * col0 FROM
341c0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
341d0 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d 36 36 34  ---..-3395..-664
341e0 31 31 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d 0a 71  118..-68112....q
341f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34200 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 31 20  SELECT ALL + 71 
34210 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
34220 30 0d 0a 2d 2d 2d 2d 0d 0a 37 31 0d 0a 37 31 0d  0..----..71..71.
34230 0a 37 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .71....onlyif my
34240 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
34250 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
34260 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
34270 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
34280 65 6c 2d 31 35 33 32 0d 0a 53 45 4c 45 43 54 20  el-1532..SELECT 
34290 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c  - col2 DIV + col
342a0 31 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  1 - col2 * col1 
342b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
342c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35 35 0d 0a  0..----..-1255..
342d0 2d 31 34 30 36 0d 0a 2d 35 37 35 0d 0a 0d 0a 73  -1406..-575....s
342e0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
342f0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
34300 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
34310 62 65 6c 2d 31 35 33 32 0d 0a 53 45 4c 45 43 54  bel-1532..SELECT
34320 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31   - col2 / + col1
34330 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46   - col2 * col1 F
34340 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
34350 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35 35 0d 0a 2d  ..----..-1255..-
34360 31 34 30 36 0d 0a 2d 35 37 35 0d 0a 0d 0a 71 75  1406..-575....qu
34370 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34380 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2b 20  ELECT ALL - ( + 
34390 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 72 30 2e  col2 ) * + cor0.
343a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
343b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a  or0..----..-35..
343c0 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 6f  -7298..-792....o
343d0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
343e0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
343f0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
34400 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
34410 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34420 74 20 6c 61 62 65 6c 2d 31 35 33 34 0d 0a 53 45  t label-1534..SE
34430 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28  LECT ALL - CAST(
34440 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
34450 29 20 2d 20 36 39 20 46 52 4f 4d 20 74 61 62 32  ) - 69 FROM tab2
34460 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
34470 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
34480 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
34490 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
344a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
344b0 2d 31 35 33 34 0d 0a 53 45 4c 45 43 54 20 41 4c  -1534..SELECT AL
344c0 4c 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  L - CAST ( NULL 
344d0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 36  AS INTEGER ) - 6
344e0 39 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  9 FROM tab2..---
344f0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
34500 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
34510 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
34520 20 31 36 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63   16 + + col2 * c
34530 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ol1 + col2 FROM 
34540 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 0d  tab0..----..114.
34550 0a 32 38 38 37 0d 0a 37 35 36 30 0d 0a 0d 0a 71  .2887..7560....q
34560 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34570 53 45 4c 45 43 54 20 36 31 20 2a 20 2d 20 63 6f  SELECT 61 * - co
34580 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
34590 2d 2d 0d 0a 2d 31 34 36 34 0d 0a 2d 32 31 33 35  --..-1464..-2135
345a0 0d 0a 2d 35 34 32 39 0d 0a 0d 0a 71 75 65 72 79  ..-5429....query
345b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
345c0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 31 32  CT DISTINCT + 12
345d0 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63 6f   * + col0 - + co
345e0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
345f0 2d 2d 0d 0a 35 37 0d 0a 39 31 30 0d 0a 0d 0a 71  --..57..910....q
34600 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34610 53 45 4c 45 43 54 20 38 37 20 2a 20 63 6f 6c 30  SELECT 87 * col0
34620 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41   + col2 + col2 A
34630 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
34640 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35 34 0d 0a 33 30  ..----..2154..30
34650 34 37 0d 0a 37 39 30 37 0d 0a 0d 0a 71 75 65 72  47..7907....quer
34660 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34670 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72  ECT - col0 * cor
34680 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  0.col1 * cor0.co
34690 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  l0 + - col0 + co
346a0 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
346b0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
346c0 0a 2d 31 38 33 0d 0a 2d 34 30 39 36 37 0d 0a 2d  .-183..-40967..-
346d0 38 33 31 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  83184....query I
346e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
346f0 20 44 49 53 54 49 4e 43 54 20 34 39 20 2a 20 63   DISTINCT 49 * c
34700 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or0.col0 AS col1
34710 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
34720 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 36 0d 0a  r0..----..1176..
34730 31 37 31 35 0d 0a 34 33 36 31 0d 0a 0d 0a 71 75  1715..4361....qu
34740 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34750 45 4c 45 43 54 20 35 39 20 2a 20 2b 20 63 6f 72  ELECT 59 * + cor
34760 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0.col2 FROM tab1
34770 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34780 33 31 38 36 0d 0a 33 33 36 33 0d 0a 35 36 36 34  3186..3363..5664
34790 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
347a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
347b0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f  cor0.col2 + + co
347c0 6c 30 20 2b 20 2b 20 39 20 41 53 20 63 6f 6c 30  l0 + + 9 AS col0
347d0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
347e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a 31  r0..----..130..1
347f0 38 35 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20  85..66....query 
34800 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34810 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  T + col2 * + cor
34820 30 2e 63 6f 6c 30 20 2b 20 2d 20 39 33 20 41 53  0.col0 + - 93 AS
34830 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
34840 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
34850 39 33 35 0d 0a 32 39 30 39 0d 0a 39 36 0d 0a 0d  935..2909..96...
34860 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34870 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
34880 32 35 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b 20  25 + - col0 + + 
34890 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
348a0 2d 2d 2d 2d 0d 0a 31 33 35 30 0d 0a 31 34 32 35  ----..1350..1425
348b0 0d 0a 32 34 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..2400....onlyif
348c0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
348d0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
348e0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
348f0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
34900 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
34910 65 6c 2d 31 35 34 35 0d 0a 53 45 4c 45 43 54 20  el-1545..SELECT 
34920 2d 20 43 41 53 54 28 20 31 37 20 41 53 20 53 49  - CAST( 17 AS SI
34930 47 4e 45 44 20 29 20 2b 20 63 6f 6c 32 20 2b 20  GNED ) + col2 + 
34940 2b 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d  + tab0.col1 FROM
34950 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32   tab0..----..102
34960 0d 0a 31 35 36 0d 0a 38 31 0d 0a 0d 0a 73 6b 69  ..156..81....ski
34970 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
34980 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
34990 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
349a0 6c 2d 31 35 34 35 0d 0a 53 45 4c 45 43 54 20 2d  l-1545..SELECT -
349b0 20 43 41 53 54 20 28 20 31 37 20 41 53 20 49 4e   CAST ( 17 AS IN
349c0 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 32 20 2b  TEGER ) + col2 +
349d0 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f   + tab0.col1 FRO
349e0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab0..----..10
349f0 32 0d 0a 31 35 36 0d 0a 38 31 0d 0a 0d 0a 71 75  2..156..81....qu
34a00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34a10 45 4c 45 43 54 20 2b 20 2d 20 31 33 20 2b 20 2d  ELECT + - 13 + -
34a20 20 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   9 AS col0 FROM 
34a30 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
34a40 2d 2d 0d 0a 2d 32 32 0d 0a 2d 32 32 0d 0a 2d 32  --..-22..-22..-2
34a50 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  2....query IIIII
34a60 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
34a70 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
34a80 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 2c 20  ab1, tab2 cor0, 
34a90 74 61 62 32 20 63 6f 72 31 2c 20 74 61 62 32 20  tab2 cor1, tab2 
34aa0 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor2..----..9
34ab0 37 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  72 values hashin
34ac0 67 20 74 6f 20 31 36 33 64 37 37 33 32 30 39 37  g to 163d7732097
34ad0 64 37 38 66 31 63 64 61 37 66 36 35 63 32 63 65  d78f1cda7f65c2ce
34ae0 61 35 61 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  a5a08....onlyif 
34af0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
34b00 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
34b10 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
34b20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
34b30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
34b40 6c 2d 31 35 34 38 0d 0a 53 45 4c 45 43 54 20 2b  l-1548..SELECT +
34b50 20 43 41 53 54 28 20 30 20 41 53 20 53 49 47 4e   CAST( 0 AS SIGN
34b60 45 44 20 29 20 2b 20 2d 20 63 6f 6c 32 20 41 53  ED ) + - col2 AS
34b70 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
34b80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
34b90 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a  54..-57..-96....
34ba0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
34bb0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
34bc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
34bd0 61 62 65 6c 2d 31 35 34 38 0d 0a 53 45 4c 45 43  abel-1548..SELEC
34be0 54 20 2b 20 43 41 53 54 20 28 20 30 20 41 53 20  T + CAST ( 0 AS 
34bf0 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f  INTEGER ) + - co
34c00 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
34c10 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
34c20 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39  --..-54..-57..-9
34c30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
34c40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 39 20  sort..SELECT 89 
34c50 2b 20 2b 20 34 39 20 46 52 4f 4d 20 74 61 62 30  + + 49 FROM tab0
34c60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34c70 31 33 38 0d 0a 31 33 38 0d 0a 31 33 38 0d 0a 0d  138..138..138...
34c80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34c90 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
34ca0 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  T col2 * + col2 
34cb0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
34cc0 0d 0a 2d 2d 2d 2d 0d 0a 32 39 34 32 0d 0a 33 32  ..----..2942..32
34cd0 35 39 0d 0a 39 32 32 39 0d 0a 0d 0a 71 75 65 72  59..9229....quer
34ce0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34cf0 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ECT + col0 * col
34d00 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 + col2 FROM ta
34d10 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
34d20 0d 0a 32 30 35 34 0d 0a 32 31 36 0d 0a 33 30 34  ..2054..216..304
34d30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
34d40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 30 20 2b  sort..SELECT 0 +
34d50 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   - cor0.col2 AS 
34d60 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
34d70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
34d80 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 71  4..-57..-96....q
34d90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34da0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
34db0 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  - + cor0.col1 FR
34dc0 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
34dd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
34de0 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 71 75  ..-13..-26....qu
34df0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34e00 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b  ELECT + col2 + +
34e10 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a   col1 + + col0 *
34e20 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
34e30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
34e40 30 37 0d 0a 36 31 36 39 0d 0a 36 32 39 36 0d 0a  07..6169..6296..
34e50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34e60 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
34e70 43 54 20 28 20 2b 20 35 31 20 29 20 46 52 4f 4d  CT ( + 51 ) FROM
34e80 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 31 0d   tab1..----..51.
34e90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34ea0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
34eb0 32 20 2b 20 28 20 28 20 2b 20 63 6f 6c 30 20 29  2 + ( ( + col0 )
34ec0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
34ed0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
34ee0 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a  .-16..-51..7....
34ef0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34f00 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30  .SELECT + - cor0
34f10 2e 63 6f 6c 31 20 2a 20 2d 20 30 20 46 52 4f 4d  .col1 * - 0 FROM
34f20 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
34f30 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
34f40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34f50 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
34f60 6f 6c 31 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c  ol1 + + tab0.col
34f70 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
34f80 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  1, tab1 AS cor0.
34f90 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
34fa0 20 68 61 73 68 69 6e 67 20 74 6f 20 65 66 65 64   hashing to efed
34fb0 66 65 35 35 38 62 65 38 61 65 34 62 66 30 36 35  fe558be8ae4bf065
34fc0 36 36 33 30 31 39 32 38 36 66 31 66 0d 0a 0d 0a  663019286f1f....
34fd0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
34fe0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
34ff0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
35000 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
35010 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 39  wsort label-1559
35020 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
35030 44 49 56 20 63 6f 6c 31 20 2b 20 34 35 20 41 53  DIV col1 + 45 AS
35040 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
35050 0a 2d 2d 2d 2d 0d 0a 34 34 0d 0a 34 34 0d 0a 34  .----..44..44..4
35060 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
35070 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
35080 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
35090 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 39 0d 0a  ort label-1559..
350a0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20  SELECT - col1 / 
350b0 63 6f 6c 31 20 2b 20 34 35 20 41 53 20 63 6f 6c  col1 + 45 AS col
350c0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
350d0 2d 0d 0a 34 34 0d 0a 34 34 0d 0a 34 34 0d 0a 0d  -..44..44..44...
350e0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
350f0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
35100 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
35110 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
35120 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 36  owsort label-156
35130 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
35140 43 54 20 28 20 63 6f 6c 31 20 29 20 44 49 56 20  CT ( col1 ) DIV 
35150 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
35160 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  ab1..----..0....
35170 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
35180 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
35190 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
351a0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
351b0 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
351c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
351d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
351e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
351f0 36 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  60..SELECT DISTI
35200 4e 43 54 20 28 20 63 6f 6c 31 20 29 20 2f 20 63  NCT ( col1 ) / c
35210 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
35220 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71  b1..----..0....q
35230 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35240 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
35250 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
35260 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
35270 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
35280 30 2c 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  0, tab0..----..2
35290 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65  4..35..89....que
352a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
352b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
352c0 28 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 38 34 20  ( + col2 + + 84 
352d0 2a 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  * col1 ) FROM ta
352e0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 32 35 37 0d 0a  b0..----..7257..
352f0 37 37 32 36 0d 0a 38 31 34 39 0d 0a 0d 0a 71 75  7726..8149....qu
35300 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35310 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
35320 20 33 37 20 2d 20 2b 20 35 37 20 46 52 4f 4d 20   37 - + 57 FROM 
35330 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
35340 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 0d  r0..----..-20...
35350 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35360 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72  ..SELECT ALL cor
35370 30 2e 63 6f 6c 32 20 2a 20 2d 20 37 30 20 41 53  0.col2 * - 70 AS
35380 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c   col0 FROM tab0,
35390 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
353a0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
353b0 73 68 69 6e 67 20 74 6f 20 62 31 30 32 39 38 63  shing to b10298c
353c0 64 39 30 36 65 38 39 31 61 65 61 33 63 38 34 31  d906e891aea3c841
353d0 64 64 30 65 62 65 33 30 63 0d 0a 0d 0a 6f 6e 6c  dd0ebe30c....onl
353e0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
353f0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
35400 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
35410 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
35420 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
35430 6c 61 62 65 6c 2d 31 35 36 35 0d 0a 53 45 4c 45  label-1565..SELE
35440 43 54 20 41 4c 4c 20 43 41 53 54 28 20 4e 55 4c  CT ALL CAST( NUL
35450 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 41  L AS DECIMAL ) A
35460 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
35470 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
35480 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
35490 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39  ashing to cd7a79
354a0 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61 66  01e47c15155404af
354b0 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73 6b  f0d216fe0b....sk
354c0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
354d0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
354e0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
354f0 65 6c 2d 31 35 36 35 0d 0a 53 45 4c 45 43 54 20  el-1565..SELECT 
35500 41 4c 4c 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  ALL CAST ( NULL 
35510 41 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c  AS REAL ) AS col
35520 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
35530 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
35540 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
35550 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34 37  g to cd7a7901e47
35560 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32 31  c15155404aff0d21
35570 36 66 65 30 62 0d 0a 0d 0a 71 75 65 72 79 20 49  6fe0b....query I
35580 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35590 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 33 37   - + col2 + - 37
355a0 20 2a 20 37 34 20 46 52 4f 4d 20 74 61 62 32 20   * 74 FROM tab2 
355b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
355c0 32 37 36 34 0d 0a 2d 32 37 36 35 0d 0a 2d 32 37  2764..-2765..-27
355d0 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
355e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
355f0 63 6f 6c 31 20 2b 20 2d 20 28 20 63 6f 6c 30 20  col1 + - ( col0 
35600 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
35610 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a  or0..----..-54..
35620 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79  -67..23....query
35630 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35640 43 54 20 63 6f 6c 30 20 2a 20 2b 20 34 34 20 46  CT col0 * + 44 F
35650 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
35660 0d 0a 2d 2d 2d 2d 0d 0a 33 30 38 0d 0a 33 34 33  ..----..308..343
35670 32 0d 0a 33 34 37 36 0d 0a 0d 0a 71 75 65 72 79  2..3476....query
35680 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35690 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2d 20 2d 20  CT - - col2 - - 
356a0 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32  ( col2 ) AS col2
356b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
356c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32  r0..----..164..2
356d0 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..66....query I 
356e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
356f0 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e  - col1 * - cor0.
35700 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
35710 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
35720 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38  -..1040..640..78
35730 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
35740 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
35750 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
35760 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
35770 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
35780 31 35 37 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1571..SELECT ALL
35790 20 2d 20 63 6f 6c 30 20 2b 20 32 36 20 44 49 56   - col0 + 26 DIV
357a0 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
357b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
357c0 2d 2d 0d 0a 2d 32 34 0d 0a 2d 38 39 0d 0a 2d 39  --..-24..-89..-9
357d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
357e0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
357f0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
35800 72 74 20 6c 61 62 65 6c 2d 31 35 37 31 0d 0a 53  rt label-1571..S
35810 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
35820 20 2b 20 32 36 20 2f 20 63 6f 72 30 2e 63 6f 6c   + 26 / cor0.col
35830 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
35840 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a  or0..----..-24..
35850 2d 38 39 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79  -89..-9....query
35860 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35870 43 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 31  CT ALL tab0.col1
35880 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
35890 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38  0..----..7396..8
358a0 32 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a 71 75 65  281..9409....que
358b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
358c0 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  LECT - - cor0.co
358d0 6c 32 20 2b 20 28 20 63 6f 6c 32 20 29 20 41 53  l2 + ( col2 ) AS
358e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
358f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
35900 32 0d 0a 35 34 0d 0a 37 36 0d 0a 0d 0a 6f 6e 6c  2..54..76....onl
35910 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
35920 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
35930 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
35940 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
35950 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
35960 6c 61 62 65 6c 2d 31 35 37 34 0d 0a 53 45 4c 45  label-1574..SELE
35970 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53  CT CAST( NULL AS
35980 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
35990 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
359a0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  1 cor0..----..9 
359b0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
359c0 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35  o cd7a7901e47c15
359d0 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65  155404aff0d216fe
359e0 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  0b....skipif mys
359f0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
35a00 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
35a10 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37 34 0d  sort label-1574.
35a20 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e  .SELECT CAST ( N
35a30 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
35a40 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
35a50 62 31 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  b1, tab1 cor0..-
35a60 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
35a70 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30  shing to cd7a790
35a80 31 65 34 37 63 31 35 31 35 35 34 30 34 61 66 66  1e47c15155404aff
35a90 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 71 75 65  0d216fe0b....que
35aa0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35ab0 4c 45 43 54 20 2b 20 34 33 20 41 53 20 63 6f 6c  LECT + 43 AS col
35ac0 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
35ad0 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  1 AS cor0, tab0 
35ae0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
35af0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
35b00 20 65 65 35 31 30 38 66 36 32 34 38 62 65 34 38   ee5108f6248be48
35b10 63 35 34 65 30 36 39 35 34 35 66 38 31 63 35 64  c54e069545f81c5d
35b20 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
35b30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
35b40 54 49 4e 43 54 20 38 30 20 46 52 4f 4d 20 74 61  TINCT 80 FROM ta
35b50 62 30 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74  b0, tab0 cor0, t
35b60 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
35b70 2d 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -..80....query I
35b80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35b90 20 36 36 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c   66 - col1 * col
35ba0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
35bb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 36 38  or0..----..-1468
35bc0 0d 0a 2d 35 38 30 0d 0a 2d 37 37 31 0d 0a 0d 0a  ..-580..-771....
35bd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
35be0 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
35bf0 31 20 2b 20 32 37 20 2a 20 2b 20 63 6f 6c 30 20  1 + 27 * + col0 
35c00 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
35c10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
35c20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 32   cor0..----..222
35c30 39 0d 0a 32 32 34 33 0d 0a 32 32 37 0d 0a 0d 0a  9..2243..227....
35c40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
35c50 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63 6f  .SELECT + ( - co
35c60 6c 30 20 29 20 2a 20 63 6f 6c 32 20 2b 20 2d 20  l0 ) * col2 + - 
35c70 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 36 33  cor0.col2 + - 63
35c80 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
35c90 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
35ca0 0d 0a 2d 32 37 39 0d 0a 2d 33 37 36 38 0d 0a 2d  ..-279..-3768..-
35cb0 37 38 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7839....query I 
35cc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35cd0 32 34 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  24 * + col0 + - 
35ce0 63 6f 6c 31 20 2b 20 2d 20 34 35 20 46 52 4f 4d  col1 + - 45 FROM
35cf0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
35d00 2d 2d 2d 0d 0a 31 37 36 38 0d 0a 31 38 33 34 0d  ---..1768..1834.
35d10 0a 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .92....query I r
35d20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
35d30 4c 4c 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 63 6f  LL - col0 - - co
35d40 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
35d50 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d  tab2..----..-41.
35d60 0a 2d 35 32 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72  .-52..20....quer
35d70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35d80 45 43 54 20 2b 20 2b 20 28 20 63 6f 72 30 2e 63  ECT + + ( cor0.c
35d90 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2d  ol0 ) * + col0 -
35da0 20 2b 20 36 33 20 46 52 4f 4d 20 74 61 62 31 20   + 63 FROM tab1 
35db0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
35dc0 35 34 0d 0a 34 30 33 33 0d 0a 36 33 33 37 0d 0a  54..4033..6337..
35dd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35de0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
35df0 43 54 20 38 32 20 2b 20 2b 20 63 6f 6c 30 20 46  CT 82 + + col0 F
35e00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
35e10 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 0d 0a 31 36 31  ..----..160..161
35e20 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..89....query I 
35e30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35e40 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
35e50 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS c
35e60 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
35e70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35   cor0..----..-35
35e80 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d  ..-7298..-792...
35e90 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
35ea0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
35eb0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
35ec0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
35ed0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 38  owsort label-158
35ee0 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
35ef0 43 54 20 28 20 2d 20 35 38 20 29 20 2b 20 2b 20  CT ( - 58 ) + + 
35f00 63 6f 6c 30 20 2a 20 34 34 20 44 49 56 20 2d 20  col0 * 44 DIV - 
35f10 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
35f20 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
35f30 2d 2d 2d 2d 0d 0a 2d 31 30 37 0d 0a 2d 36 30 0d  ----..-107..-60.
35f40 0a 2d 39 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-94....skipif m
35f50 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
35f60 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
35f70 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 38  owsort label-158
35f80 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
35f90 43 54 20 28 20 2d 20 35 38 20 29 20 2b 20 2b 20  CT ( - 58 ) + + 
35fa0 63 6f 6c 30 20 2a 20 34 34 20 2f 20 2d 20 63 6f  col0 * 44 / - co
35fb0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
35fc0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
35fd0 2d 2d 0d 0a 2d 31 30 37 0d 0a 2d 36 30 0d 0a 2d  --..-107..-60..-
35fe0 39 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  94....skipif pos
35ff0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
36000 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
36010 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
36020 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
36030 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36040 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
36050 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2d 20 63 6f  col0 * col2 - co
36060 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
36070 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
36080 0a 31 32 39 32 0d 0a 31 35 38 31 32 35 0d 0a 32  .1292..158125..2
36090 33 37 31 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  37141....query I
360a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
360b0 20 41 4c 4c 20 2d 20 35 34 20 2b 20 2d 20 63 6f   ALL - 54 + - co
360c0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
360d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d  0..----..-108..-
360e0 31 31 31 0d 0a 2d 31 35 30 0d 0a 0d 0a 71 75 65  111..-150....que
360f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36100 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c  LECT ALL - + col
36110 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  2 * col2 * col0 
36120 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
36130 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
36140 0a 2d 31 31 34 30 37 36 0d 0a 2d 35 31 30 33 0d  .-114076..-5103.
36150 0a 2d 35 32 37 32 38 0d 0a 0d 0a 71 75 65 72 79  .-52728....query
36160 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36170 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
36180 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  l0 * + col0 + co
36190 6c 31 20 2a 20 36 36 20 46 52 4f 4d 20 74 61 62  l1 * 66 FROM tab
361a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
361b0 0a 2d 32 31 39 30 0d 0a 2d 35 31 31 39 0d 0a 31  .-2190..-5119..1
361c0 39 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  997....query I r
361d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
361e0 4c 4c 20 2d 20 35 38 20 2b 20 2d 20 63 6f 6c 31  LL - 58 + - col1
361f0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
36200 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
36210 0d 0a 2d 31 34 34 0d 0a 2d 31 34 39 0d 0a 2d 31  ..-144..-149..-1
36220 35 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  55....onlyif mys
36230 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
36240 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
36250 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
36260 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
36270 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
36280 35 39 31 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  591..SELECT - - 
36290 43 41 53 54 28 20 28 20 63 6f 6c 32 20 29 20 41  CAST( ( col2 ) A
362a0 53 20 53 49 47 4e 45 44 20 29 20 2a 20 36 37 20  S SIGNED ) * 67 
362b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
362c0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 31 38 0d 0a 33  0..----..3618..3
362d0 38 31 39 0d 0a 36 34 33 32 0d 0a 0d 0a 73 6b 69  819..6432....ski
362e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
362f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
36300 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
36310 6c 2d 31 35 39 31 0d 0a 53 45 4c 45 43 54 20 2d  l-1591..SELECT -
36320 20 2d 20 43 41 53 54 20 28 20 28 20 63 6f 6c 32   - CAST ( ( col2
36330 20 29 20 41 53 20 49 4e 54 45 47 45 52 20 29 20   ) AS INTEGER ) 
36340 2a 20 36 37 20 46 52 4f 4d 20 74 61 62 31 20 41  * 67 FROM tab1 A
36350 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36  S cor0..----..36
36360 31 38 0d 0a 33 38 31 39 0d 0a 36 34 33 32 0d 0a  18..3819..6432..
36370 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36380 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 31 20 2a  t..SELECT - 41 *
36390 20 2b 20 31 39 20 2a 20 63 6f 6c 30 20 41 53 20   + 19 * col0 AS 
363a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
363b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
363c0 34 35 33 0d 0a 2d 36 30 37 36 32 0d 0a 2d 36 31  453..-60762..-61
363d0 35 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  541....skipif po
363e0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
363f0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
36400 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
36410 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
36420 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36430 0a 53 45 4c 45 43 54 20 2d 20 2d 20 28 20 2d 20  .SELECT - - ( - 
36440 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2d 20 63 6f  cor0.col2 ) - co
36450 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
36460 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
36470 0a 2d 31 36 34 0d 0a 2d 32 0d 0a 2d 36 36 0d 0a  .-164..-2..-66..
36480 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
36490 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
364a0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
364b0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
364c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
364d0 39 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43  94..SELECT ALL C
364e0 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47  AST( col0 AS SIG
364f0 4e 45 44 20 29 20 44 49 56 20 63 6f 6c 31 20 41  NED ) DIV col1 A
36500 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
36510 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
36520 31 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1..4....skipif m
36530 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
36540 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
36550 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 39  owsort label-159
36560 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41  4..SELECT ALL CA
36570 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54  ST ( col0 AS INT
36580 45 47 45 52 20 29 20 2f 20 63 6f 6c 31 20 41 53  EGER ) / col1 AS
36590 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
365a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
365b0 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..4....query I r
365c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
365d0 49 53 54 49 4e 43 54 20 2b 20 37 31 20 2a 20 63  ISTINCT + 71 * c
365e0 6f 6c 30 20 2b 20 2b 20 37 33 20 41 53 20 63 6f  ol0 + + 73 AS co
365f0 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
36600 2d 2d 0d 0a 35 36 31 31 0d 0a 35 36 38 32 0d 0a  --..5611..5682..
36610 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  570....query I r
36620 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
36630 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b   col2 + col1 * +
36640 20 63 6f 6c 32 20 2a 20 28 20 2b 20 63 6f 6c 32   col2 * ( + col2
36650 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   + col1 ) FROM t
36660 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
36670 2d 0d 0a 31 31 32 32 36 36 0d 0a 31 33 35 39 33  -..112266..13593
36680 36 0d 0a 33 38 31 33 33 0d 0a 0d 0a 71 75 65 72  6..38133....quer
36690 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
366a0 45 43 54 20 2b 20 2b 20 36 34 20 2b 20 2d 20 63  ECT + + 64 + - c
366b0 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
366c0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
366d0 0d 0a 2d 32 32 0d 0a 2d 32 37 0d 0a 2d 33 33 0d  ..-22..-27..-33.
366e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
366f0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
36700 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20  * cor0.col1 + - 
36710 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
36720 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
36730 2d 0d 0a 31 39 37 38 0d 0a 33 32 39 38 0d 0a 38  -..1978..3298..8
36740 30 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  008....onlyif my
36750 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
36760 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
36770 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
36780 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
36790 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
367a0 31 35 39 39 0d 0a 53 45 4c 45 43 54 20 2d 20 32  1599..SELECT - 2
367b0 33 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  3 + cor0.col1 * 
367c0 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49  CAST( col1 AS SI
367d0 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46  GNED ) AS col0 F
367e0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
367f0 2d 2d 2d 0d 0a 37 33 37 33 0d 0a 38 32 35 38 0d  ---..7373..8258.
36800 0a 39 33 38 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  .9386....skipif 
36810 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
36820 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
36830 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
36840 39 39 0d 0a 53 45 4c 45 43 54 20 2d 20 32 33 20  99..SELECT - 23 
36850 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 43 41  + cor0.col1 * CA
36860 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54  ST ( col1 AS INT
36870 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46  EGER ) AS col0 F
36880 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
36890 2d 2d 2d 0d 0a 37 33 37 33 0d 0a 38 32 35 38 0d  ---..7373..8258.
368a0 0a 39 33 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .9386....query I
368b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
368c0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 35   + cor0.col1 + 5
368d0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
368e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 31 38  r0..----..15..18
368f0 0d 0a 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..31....query I 
36900 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36910 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 39 38 20  - + col1 + + 98 
36920 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
36930 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
36940 0a 33 39 0d 0a 36 37 0d 0a 38 31 0d 0a 0d 0a 71  .39..67..81....q
36950 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36960 53 45 4c 45 43 54 20 2b 20 2b 20 32 36 20 41 53  SELECT + + 26 AS
36970 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
36980 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
36990 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  IN tab0 AS cor1.
369a0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
369b0 68 61 73 68 69 6e 67 20 74 6f 20 32 64 31 63 33  hashing to 2d1c3
369c0 31 32 39 65 64 31 37 66 64 37 32 31 64 34 38 37  129ed17fd721d487
369d0 36 62 32 31 63 30 33 35 35 38 34 0d 0a 0d 0a 71  6b21c035584....q
369e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
369f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
36a00 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20  - col0 + col2 + 
36a10 2d 20 63 6f 6c 32 20 2a 20 2d 20 36 31 20 46 52  - col2 * - 61 FR
36a20 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
36a30 35 33 34 0d 0a 31 36 36 37 0d 0a 32 32 37 37 0d  534..1667..2277.
36a40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
36a50 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
36a60 4e 43 54 20 37 36 20 2b 20 2d 20 74 61 62 32 2e  NCT 76 + - tab2.
36a70 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
36a80 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 38  M tab2..----..38
36a90 0d 0a 34 39 0d 0a 35 30 0d 0a 0d 0a 6f 6e 6c 79  ..49..50....only
36aa0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
36ab0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
36ac0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
36ad0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
36ae0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
36af0 61 62 65 6c 2d 31 36 30 35 0d 0a 53 45 4c 45 43  abel-1605..SELEC
36b00 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  T - col2 + + col
36b10 30 20 2f 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  0 / CAST( NULL A
36b20 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
36b30 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab2..----..NULL
36b40 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
36b50 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
36b60 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
36b70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
36b80 61 62 65 6c 2d 31 36 30 35 0d 0a 53 45 4c 45 43  abel-1605..SELEC
36b90 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  T - col2 + + col
36ba0 30 20 2f 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  0 / CAST ( NULL 
36bb0 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
36bc0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab2..----..NU
36bd0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
36be0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36bf0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
36c00 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col0 + - col1 * 
36c10 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
36c20 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
36c30 2d 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a 2d 33 34 30  ----..-210..-340
36c40 33 0d 0a 2d 39 35 34 0d 0a 0d 0a 73 6b 69 70 69  3..-954....skipi
36c50 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
36c60 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
36c70 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
36c80 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
36c90 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
36ca0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
36cb0 2d 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e  - + col2 + cor0.
36cc0 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 63 6f 6c 30  col2 * col0 col0
36cd0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
36ce0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 32  r0..----..162..2
36cf0 30 30 32 0d 0a 32 39 36 34 0d 0a 0d 0a 71 75 65  002..2964....que
36d00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36d10 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20  LECT ALL col0 + 
36d20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  + col0 * col0 + 
36d30 31 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  13 AS col0 FROM 
36d40 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 33  tab0..----..1273
36d50 0d 0a 36 31 33 0d 0a 38 30 32 33 0d 0a 0d 0a 71  ..613..8023....q
36d60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36d70 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
36d80 6f 6c 32 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 30  ol2 + - ( + col0
36d90 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
36da0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
36db0 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31 37 36 0d 0a  --..-121..-176..
36dc0 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -57....query I r
36dd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
36de0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63   - cor0.col2 * c
36df0 6f 6c 30 20 2b 20 34 33 20 46 52 4f 4d 20 74 61  ol0 + 43 FROM ta
36e00 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
36e10 0d 0a 2d 31 31 39 0d 0a 2d 33 36 30 35 0d 0a 2d  ..-119..-3605..-
36e20 37 36 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7637....query I 
36e30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36e40 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 38  ALL - - col1 * 8
36e50 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
36e60 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 36 0d 0a 32 31  ..----..1066..21
36e70 33 32 0d 0a 38 32 30 0d 0a 0d 0a 71 75 65 72 79  32..820....query
36e80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36e90 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
36ea0 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * - cor0.col1 F
36eb0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
36ec0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d  ..----..-2838..-
36ed0 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65  7462..-97....que
36ee0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36ef0 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 28 20  LECT col2 + + ( 
36f00 2d 20 33 30 20 29 20 2a 20 2d 20 63 6f 6c 32 20  - 30 ) * - col2 
36f10 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
36f20 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 37 34 0d 0a 31  0..----..1674..1
36f30 37 36 37 0d 0a 32 39 37 36 0d 0a 0d 0a 71 75 65  767..2976....que
36f40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36f50 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
36f60 2b 20 37 31 20 2a 20 2b 20 28 20 2d 20 63 6f 6c  + 71 * + ( - col
36f70 30 20 29 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  0 ) * - col1 FRO
36f80 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
36f90 2d 2d 2d 2d 0d 0a 34 35 35 30 34 0d 0a 35 35 34  ----..45504..554
36fa0 31 0d 0a 37 33 39 32 30 0d 0a 0d 0a 71 75 65 72  1..73920....quer
36fb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36fc0 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 28  ECT + col1 + + (
36fd0 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   - col2 * + col0
36fe0 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
36ff0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
37000 2d 2d 0d 0a 2d 37 30 36 0d 0a 2d 37 32 30 37 0d  --..-706..-7207.
37010 0a 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .62....onlyif my
37020 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
37030 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
37040 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
37050 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
37060 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
37070 31 36 31 36 0d 0a 53 45 4c 45 43 54 20 43 41 53  1616..SELECT CAS
37080 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
37090 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  D ) AS col2 FROM
370a0 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
370b0 6f 72 30 2c 20 74 61 62 32 2c 20 74 61 62 32 20  or0, tab2, tab2 
370c0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor1..----..8
370d0 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
370e0 20 74 6f 20 63 62 33 33 63 33 30 64 36 66 35 32   to cb33c30d6f52
370f0 62 62 62 32 34 33 33 38 61 32 39 33 63 37 34 30  bbb24338a293c740
37100 66 32 39 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  f29c....skipif m
37110 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
37120 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
37130 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 31  owsort label-161
37140 36 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  6..SELECT CAST (
37150 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
37160 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
37170 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
37180 72 30 2c 20 74 61 62 32 2c 20 74 61 62 32 20 41  r0, tab2, tab2 A
37190 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor1..----..81
371a0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
371b0 74 6f 20 63 62 33 33 63 33 30 64 36 66 35 32 62  to cb33c30d6f52b
371c0 62 62 32 34 33 33 38 61 32 39 33 63 37 34 30 66  bb24338a293c740f
371d0 32 39 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  29c....query I r
371e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
371f0 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31  ISTINCT - + col1
37200 20 2a 20 34 32 20 41 53 20 63 6f 6c 30 20 46 52   * 42 AS col0 FR
37210 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
37220 2d 2d 0d 0a 2d 31 33 30 32 0d 0a 2d 32 34 37 38  --..-1302..-2478
37230 0d 0a 2d 37 31 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-714....onlyif
37240 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
37250 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
37260 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
37270 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
37280 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
37290 65 6c 2d 31 36 31 38 0d 0a 53 45 4c 45 43 54 20  el-1618..SELECT 
372a0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
372b0 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  * CAST( NULL AS 
372c0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
372d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
372e0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
372f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
37300 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
37310 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
37320 36 31 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  618..SELECT DIST
37330 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 43 41  INCT - col0 * CA
37340 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
37350 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30  EGER ) FROM tab0
37360 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37370 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
37380 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37390 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b  ALL - - col2 * +
373a0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 41   col2 + + col2 A
373b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
373c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
373d0 31 31 32 32 0d 0a 32 0d 0a 36 38 30 36 0d 0a 0d  1122..2..6806...
373e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
373f0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
37400 32 20 2a 20 36 35 20 41 53 20 63 6f 6c 31 20 46  2 * 65 AS col1 F
37410 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
37420 0d 0a 2d 2d 2d 2d 0d 0a 33 35 31 30 0d 0a 33 37  ..----..3510..37
37430 30 35 0d 0a 36 32 34 30 0d 0a 0d 0a 71 75 65 72  05..6240....quer
37440 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37450 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63  ECT - + col1 * c
37460 6f 6c 32 20 2b 20 2d 20 31 39 20 41 53 20 63 6f  ol2 + - 19 AS co
37470 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
37480 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 35 33 0d 0a  0..----..-1553..
37490 2d 36 36 35 0d 0a 2d 38 35 36 0d 0a 0d 0a 71 75  -665..-856....qu
374a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
374b0 45 4c 45 43 54 20 2b 20 28 20 2b 20 74 61 62 32  ELECT + ( + tab2
374c0 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62  .col1 ) FROM tab
374d0 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d  2..----..17..31.
374e0 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .59....query I r
374f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
37500 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30  ISTINCT - + cor0
37510 2e 63 6f 6c 30 20 2a 20 2b 20 32 30 20 41 53 20  .col0 * + 20 AS 
37520 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
37530 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
37540 37 38 30 0d 0a 2d 34 38 30 0d 0a 2d 37 30 30 0d  780..-480..-700.
37550 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37560 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
37570 6f 6c 32 20 2b 20 2d 20 32 35 20 2d 20 2d 20 63  ol2 + - 25 - - c
37580 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
37590 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
375a0 2d 2d 2d 0d 0a 33 30 0d 0a 33 33 0d 0a 36 30 0d  ---..30..33..60.
375b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
375c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
375d0 4e 43 54 20 32 32 20 41 53 20 63 6f 6c 30 20 46  NCT 22 AS col0 F
375e0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
375f0 2d 2d 2d 0d 0a 32 32 0d 0a 0d 0a 71 75 65 72 79  ---..22....query
37600 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37610 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d 20 63 6f  CT ALL col0 - co
37620 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  l0 * + col1 AS c
37630 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
37640 2d 2d 2d 0d 0a 2d 31 32 36 34 0d 0a 2d 32 31 30  ---..-1264..-210
37650 0d 0a 2d 34 35 32 34 0d 0a 0d 0a 71 75 65 72 79  ..-4524....query
37660 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37670 43 54 20 41 4c 4c 20 2d 20 28 20 38 31 20 29 20  CT ALL - ( 81 ) 
37680 2b 20 2b 20 63 6f 6c 30 20 2b 20 28 20 2b 20 63  + + col0 + ( + c
37690 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  or0.col2 + + col
376a0 31 20 2a 20 2d 20 38 30 20 29 20 41 53 20 63 6f  1 * - 80 ) AS co
376b0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
376c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30 34 0d 0a  0..----..-2104..
376d0 2d 37 36 30 0d 0a 2d 39 34 35 0d 0a 0d 0a 6f 6e  -760..-945....on
376e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
376f0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
37700 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
37710 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
37720 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37730 20 6c 61 62 65 6c 2d 31 36 32 38 0d 0a 53 45 4c   label-1628..SEL
37740 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  ECT CAST( NULL A
37750 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 72  S SIGNED ) * cor
37760 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  0.col2 + + col2 
37770 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
37780 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
37790 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
377a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
377b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
377c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
377d0 6c 2d 31 36 32 38 0d 0a 53 45 4c 45 43 54 20 43  l-1628..SELECT C
377e0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
377f0 54 45 47 45 52 20 29 20 2a 20 63 6f 72 30 2e 63  TEGER ) * cor0.c
37800 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f  ol2 + + col2 FRO
37810 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37820 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
37830 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
37840 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37850 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 28  T DISTINCT - - (
37860 20 2d 20 36 35 20 29 20 2b 20 63 6f 6c 32 20 2a   - 65 ) + col2 *
37870 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 46 52   - ( + col2 ) FR
37880 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
37890 0a 2d 2d 2d 2d 0d 0a 2d 32 39 38 31 0d 0a 2d 33  .----..-2981..-3
378a0 33 31 34 0d 0a 2d 39 32 38 31 0d 0a 0d 0a 6f 6e  314..-9281....on
378b0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
378c0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
378d0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
378e0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
378f0 6f 72 74 20 6c 61 62 65 6c 2d 31 36 33 30 0d 0a  ort label-1630..
37900 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 28  SELECT ALL + + (
37910 20 37 33 20 29 20 2b 20 2d 20 63 6f 6c 32 20 2b   73 ) + - col2 +
37920 20 2b 20 63 6f 6c 30 20 44 49 56 20 31 38 20 41   + col0 DIV 18 A
37930 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
37940 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37950 33 39 0d 0a 34 36 0d 0a 35 31 0d 0a 0d 0a 73 6b  39..46..51....sk
37960 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
37970 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
37980 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
37990 65 6c 2d 31 36 33 30 0d 0a 53 45 4c 45 43 54 20  el-1630..SELECT 
379a0 41 4c 4c 20 2b 20 2b 20 28 20 37 33 20 29 20 2b  ALL + + ( 73 ) +
379b0 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30   - col2 + + col0
379c0 20 2f 20 31 38 20 41 53 20 63 6f 6c 30 20 46 52   / 18 AS col0 FR
379d0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
379e0 0a 2d 2d 2d 2d 0d 0a 33 39 0d 0a 34 36 0d 0a 35  .----..39..46..5
379f0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
37a00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37 30 20  sort..SELECT 70 
37a10 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
37a20 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
37a30 0a 37 30 0d 0a 37 30 0d 0a 37 30 0d 0a 0d 0a 6f  .70..70..70....o
37a40 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
37a50 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
37a60 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
37a70 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
37a80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37a90 74 20 6c 61 62 65 6c 2d 31 36 33 32 0d 0a 53 45  t label-1632..SE
37aa0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
37ab0 2b 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 31 20  + col0 / + col1 
37ac0 2d 20 63 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e  - col0 * CAST( N
37ad0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
37ae0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
37af0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
37b00 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
37b10 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
37b20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
37b30 6c 61 62 65 6c 2d 31 36 33 32 0d 0a 53 45 4c 45  label-1632..SELE
37b40 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
37b50 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 31 20 2d 20  col0 / + col1 - 
37b60 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 4e 55  col0 * CAST ( NU
37b70 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
37b80 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
37b90 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
37ba0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37bb0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
37bc0 54 20 2b 20 2b 20 33 30 20 2a 20 63 6f 6c 31 20  T + + 30 * col1 
37bd0 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 32 36 20  - + col2 * + 26 
37be0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
37bf0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 32 0d 0a  0..----..-1182..
37c00 2d 32 31 30 36 0d 0a 2d 36 32 34 0d 0a 0d 0a 71  -2106..-624....q
37c10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37c20 53 45 4c 45 43 54 20 2d 20 2d 20 28 20 2b 20 31  SELECT - - ( + 1
37c30 38 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  8 ) + col1 FROM 
37c40 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
37c50 2d 2d 0d 0a 33 35 0d 0a 34 39 0d 0a 37 37 0d 0a  --..35..49..77..
37c60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37c70 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
37c80 2d 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  - ( col2 ) FROM 
37c90 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
37ca0 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a  --..26..27..38..
37cb0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
37cc0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
37cd0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
37ce0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
37cf0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
37d00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37d10 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37 37  CT DISTINCT - 77
37d20 20 2a 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f   * col1 col0 FRO
37d30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
37d40 2d 2d 2d 2d 0d 0a 2d 36 36 32 32 0d 0a 2d 37 30  ----..-6622..-70
37d50 30 37 0d 0a 2d 37 34 36 39 0d 0a 0d 0a 71 75 65  07..-7469....que
37d60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37d70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
37d80 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20 2a 20  col2 ) + col1 * 
37d90 2b 20 38 36 20 2b 20 28 20 63 6f 72 30 2e 63 6f  + 86 + ( cor0.co
37da0 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l0 ) FROM tab1 A
37db0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
37dc0 39 34 0d 0a 32 32 39 33 0d 0a 39 38 31 0d 0a 0d  94..2293..981...
37dd0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
37de0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
37df0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
37e00 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
37e10 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
37e20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37e30 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
37e40 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  0 + - col0 * col
37e50 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  2 col2 FROM tab1
37e60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
37e70 35 0d 0a 2d 33 37 31 32 0d 0a 2d 37 37 36 30 0d  5..-3712..-7760.
37e80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37e90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
37ea0 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41   + col0 + col1 A
37eb0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
37ec0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37ed0 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75  29..74..93....qu
37ee0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37ef0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
37f00 20 2b 20 39 38 20 41 53 20 63 6f 6c 31 20 46 52   + 98 AS col1 FR
37f10 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
37f20 0a 2d 2d 2d 2d 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c  .----..98....onl
37f30 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
37f40 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
37f50 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
37f60 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
37f70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
37f80 6c 61 62 65 6c 2d 31 36 34 31 0d 0a 53 45 4c 45  label-1641..SELE
37f90 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41  CT DISTINCT - CA
37fa0 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  ST( col0 AS SIGN
37fb0 45 44 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  ED ) * - cor0.co
37fc0 6c 30 20 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20  l0 + - ( col2 ) 
37fd0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
37fe0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  S cor0..----..22
37ff0 0d 0a 36 30 35 38 0d 0a 36 32 30 33 0d 0a 0d 0a  ..6058..6203....
38000 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
38010 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
38020 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
38030 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
38040 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
38050 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
38060 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
38070 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36  rowsort label-16
38080 34 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  41..SELECT DISTI
38090 4e 43 54 20 2d 20 43 41 53 54 20 28 20 63 6f 6c  NCT - CAST ( col
380a0 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  0 AS INTEGER ) *
380b0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d   - cor0.col0 + -
380c0 20 28 20 63 6f 6c 32 20 29 20 63 6f 6c 32 20 46   ( col2 ) col2 F
380d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
380e0 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 36 30 35 38  ..----..22..6058
380f0 0d 0a 36 32 30 33 0d 0a 0d 0a 71 75 65 72 79 20  ..6203....query 
38100 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38110 54 20 2d 20 39 32 20 41 53 20 63 6f 6c 30 20 46  T - 92 AS col0 F
38120 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
38130 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 32 0d 0a 2d 39 32  ..----..-92..-92
38140 0d 0a 2d 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-92....query I
38150 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38160 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2a 20   ALL - + col2 * 
38170 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col1 * + col0 FR
38180 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
38190 0a 2d 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d 36  .----..-3395..-6
381a0 36 34 31 31 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d  64118..-68112...
381b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
381c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
381d0 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T + cor0.col2 * 
381e0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
381f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
38200 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33 32  ..----..2916..32
38210 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a 71 75 65 72  49..9216....quer
38220 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
38230 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT - cor0.col0 
38240 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20  + + cor0.col1 - 
38250 28 20 2b 20 39 39 20 29 20 41 53 20 63 6f 6c 31  ( + 99 ) AS col1
38260 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
38270 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 0d 0a  r0..----..-153..
38280 2d 31 36 36 0d 0a 2d 37 36 0d 0a 0d 0a 6f 6e 6c  -166..-76....onl
38290 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
382a0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
382b0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
382c0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
382d0 72 74 20 6c 61 62 65 6c 2d 31 36 34 36 0d 0a 53  rt label-1646..S
382e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
382f0 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 63   cor0.col2 DIV c
38300 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
38310 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
38320 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
38330 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
38340 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
38350 6f 72 74 20 6c 61 62 65 6c 2d 31 36 34 36 0d 0a  ort label-1646..
38360 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
38370 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f  + cor0.col2 / co
38380 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
38390 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32  cor0..----..0..2
383a0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
383b0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
383c0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
383d0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
383e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
383f0 31 36 34 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1647..SELECT col
38400 30 20 44 49 56 20 34 30 20 46 52 4f 4d 20 74 61  0 DIV 40 FROM ta
38410 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  b1..----..0..1..
38420 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
38430 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
38440 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
38450 6f 72 74 20 6c 61 62 65 6c 2d 31 36 34 37 0d 0a  ort label-1647..
38460 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20 34 30  SELECT col0 / 40
38470 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
38480 0d 0a 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a 6f 6e 6c  ..0..1..2....onl
38490 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
384a0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
384b0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
384c0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
384d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
384e0 6c 61 62 65 6c 2d 31 36 34 38 0d 0a 53 45 4c 45  label-1648..SELE
384f0 43 54 20 2d 20 2b 20 28 20 63 6f 72 30 2e 63 6f  CT - + ( cor0.co
38500 6c 32 20 29 20 2a 20 43 41 53 54 28 20 2b 20 63  l2 ) * CAST( + c
38510 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol1 AS SIGNED ) 
38520 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d  + col2 col0 FROM
38530 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
38540 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 36 30 38  ---..-1508..-608
38550 0d 0a 2d 38 31 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..-810....skipif
38560 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
38570 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
38580 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
38590 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
385a0 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
385b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
385c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
385d0 74 20 6c 61 62 65 6c 2d 31 36 34 38 0d 0a 53 45  t label-1648..SE
385e0 4c 45 43 54 20 2d 20 2b 20 28 20 63 6f 72 30 2e  LECT - + ( cor0.
385f0 63 6f 6c 32 20 29 20 2a 20 43 41 53 54 20 28 20  col2 ) * CAST ( 
38600 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  + col1 AS INTEGE
38610 52 20 29 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20  R ) + col2 col0 
38620 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
38630 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a  0..----..-1508..
38640 2d 36 30 38 0d 0a 2d 38 31 30 0d 0a 0d 0a 71 75  -608..-810....qu
38650 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38660 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
38670 20 32 33 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c   23 + - cor0.col
38680 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
38690 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 37  ..----..-41..-57
386a0 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..20....query I 
386b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
386c0 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  ALL - col2 * + c
386d0 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 + col0 AS co
386e0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
386f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36  cor0..----..-136
38700 35 0d 0a 2d 35 39 38 0d 0a 2d 37 32 32 0d 0a 0d  5..-598..-722...
38710 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38720 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
38730 54 20 2d 20 37 39 20 2b 20 2d 20 63 6f 6c 30 20  T - 79 + - col0 
38740 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
38750 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
38760 0a 2d 31 35 37 0d 0a 2d 31 35 38 0d 0a 2d 38 36  .-157..-158..-86
38770 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
38780 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
38790 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
387a0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
387b0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
387c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
387d0 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  LECT + cor0.col2
387e0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   * + cor0.col0 +
387f0 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20   + ( - col0 ) * 
38800 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 63 6f 6c 31  col0 - col2 col1
38810 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
38820 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 30 35 0d 0a  r0..----..-505..
38830 31 31 38 34 0d 0a 39 39 0d 0a 0d 0a 6f 6e 6c 79  1184..99....only
38840 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
38850 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
38860 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
38870 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
38880 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
38890 61 62 65 6c 2d 31 36 35 33 0d 0a 53 45 4c 45 43  abel-1653..SELEC
388a0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53  T DISTINCT - CAS
388b0 54 28 20 33 36 20 41 53 20 53 49 47 4e 45 44 20  T( 36 AS SIGNED 
388c0 29 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  ) - col2 AS col2
388d0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
388e0 0d 0a 2d 31 31 38 0d 0a 2d 33 37 0d 0a 2d 36 39  ..-118..-37..-69
388f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
38900 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
38910 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
38920 72 74 20 6c 61 62 65 6c 2d 31 36 35 33 0d 0a 53  rt label-1653..S
38930 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
38940 20 43 41 53 54 20 28 20 33 36 20 41 53 20 49 4e   CAST ( 36 AS IN
38950 54 45 47 45 52 20 29 20 2d 20 63 6f 6c 32 20 41  TEGER ) - col2 A
38960 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
38970 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 0d 0a 2d 33  ..----..-118..-3
38980 37 0d 0a 2d 36 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  7..-69....onlyif
38990 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
389a0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
389b0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
389c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
389d0 6c 61 62 65 6c 2d 31 36 35 34 0d 0a 53 45 4c 45  label-1654..SELE
389e0 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20  CT ALL - + col1 
389f0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20  + cor0.col2 DIV 
38a00 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
38a10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
38a20 35 0d 0a 2d 39 30 0d 0a 2d 39 36 0d 0a 0d 0a 73  5..-90..-96....s
38a30 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
38a40 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
38a50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
38a60 62 65 6c 2d 31 36 35 34 0d 0a 53 45 4c 45 43 54  bel-1654..SELECT
38a70 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b 20   ALL - + col1 + 
38a80 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f 6c 32  cor0.col2 / col2
38a90 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
38aa0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d  r0..----..-85..-
38ab0 39 30 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e 6c 79 69  90..-96....onlyi
38ac0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
38ad0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
38ae0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
38af0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38b00 20 6c 61 62 65 6c 2d 31 36 35 35 0d 0a 53 45 4c   label-1655..SEL
38b10 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30  ECT ALL + + col0
38b20 20 44 49 56 20 2d 20 63 6f 6c 31 20 2d 20 63 6f   DIV - col1 - co
38b30 6c 31 20 2a 20 2b 20 31 31 20 46 52 4f 4d 20 74  l1 * + 11 FROM t
38b40 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
38b50 2d 0d 0a 2d 31 39 31 0d 0a 2d 33 34 31 0d 0a 2d  -..-191..-341..-
38b60 36 35 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  650....skipif my
38b70 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
38b80 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
38b90 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 35 35  wsort label-1655
38ba0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
38bb0 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 2d   col0 / - col1 -
38bc0 20 63 6f 6c 31 20 2a 20 2b 20 31 31 20 46 52 4f   col1 * + 11 FRO
38bd0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
38be0 2d 2d 2d 2d 0d 0a 2d 31 39 31 0d 0a 2d 33 34 31  ----..-191..-341
38bf0 0d 0a 2d 36 35 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-650....query 
38c00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38c10 54 20 41 4c 4c 20 2b 20 39 35 20 2b 20 63 6f 6c  T ALL + 95 + col
38c20 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
38c30 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
38c40 2d 0d 0a 31 38 31 0d 0a 31 38 36 0d 0a 31 39 32  -..181..186..192
38c50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73