sqllogictest
Hex Artifact Content
Not logged in

Artifact 17ef7316beca9f1beccf653bd85b11baecfd657e:


0000: 68 61 73 68 2d 74 68 72 65 73 68 6f 6c 64 20 38  hash-threshold 8
0010: 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b  ....statement ok
0020: 0d 0a 43 52 45 41 54 45 20 54 41 42 4c 45 20 74  ..CREATE TABLE t
0030: 61 62 30 28 63 6f 6c 30 20 49 4e 54 45 47 45 52  ab0(col0 INTEGER
0040: 2c 20 63 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20  , col1 INTEGER, 
0050: 63 6f 6c 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d  col2 INTEGER)...
0060: 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43  .statement ok..C
0070: 52 45 41 54 45 20 54 41 42 4c 45 20 74 61 62 31  REATE TABLE tab1
0080: 28 63 6f 6c 30 20 49 4e 54 45 47 45 52 2c 20 63  (col0 INTEGER, c
0090: 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c  ol1 INTEGER, col
00a0: 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74  2 INTEGER)....st
00b0: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43 52 45 41  atement ok..CREA
00c0: 54 45 20 54 41 42 4c 45 20 74 61 62 32 28 63 6f  TE TABLE tab2(co
00d0: 6c 30 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 31  l0 INTEGER, col1
00e0: 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 32 20 49   INTEGER, col2 I
00f0: 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74 61 74 65  NTEGER)....state
0100: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0110: 49 4e 54 4f 20 74 61 62 30 20 56 41 4c 55 45 53  INTO tab0 VALUES
0120: 28 38 39 2c 39 31 2c 38 32 29 0d 0a 0d 0a 73 74  (89,91,82)....st
0130: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45  atement ok..INSE
0140: 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56 41 4c  RT INTO tab0 VAL
0150: 55 45 53 28 33 35 2c 39 37 2c 31 29 0d 0a 0d 0a  UES(35,97,1)....
0160: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
0170: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56  SERT INTO tab0 V
0180: 41 4c 55 45 53 28 32 34 2c 38 36 2c 33 33 29 0d  ALUES(24,86,33).
0190: 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d  ...statement ok.
01a0: 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 61 62  .INSERT INTO tab
01b0: 31 20 56 41 4c 55 45 53 28 36 34 2c 31 30 2c 35  1 VALUES(64,10,5
01c0: 37 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20  7)....statement 
01d0: 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20  ok..INSERT INTO 
01e0: 74 61 62 31 20 56 41 4c 55 45 53 28 33 2c 32 36  tab1 VALUES(3,26
01f0: 2c 35 34 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e  ,54)....statemen
0200: 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54  t ok..INSERT INT
0210: 4f 20 74 61 62 31 20 56 41 4c 55 45 53 28 38 30  O tab1 VALUES(80
0220: 2c 31 33 2c 39 36 29 0d 0a 0d 0a 73 74 61 74 65  ,13,96)....state
0230: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0240: 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55 45 53  INTO tab2 VALUES
0250: 28 37 2c 33 31 2c 32 37 29 0d 0a 0d 0a 73 74 61  (7,31,27)....sta
0260: 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52  tement ok..INSER
0270: 54 20 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55  T INTO tab2 VALU
0280: 45 53 28 37 39 2c 31 37 2c 33 38 29 0d 0a 0d 0a  ES(79,17,38)....
0290: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
02a0: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 32 20 56  SERT INTO tab2 V
02b0: 41 4c 55 45 53 28 37 38 2c 35 39 2c 32 36 29 0d  ALUES(78,59,26).
02c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
02d0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
02e0: 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  2 * - cor0.col2 
02f0: 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  + + col0 AS col2
0300: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
0310: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32 33 0d 0a  r0..----..1523..
0320: 37 33 36 0d 0a 37 35 34 0d 0a 0d 0a 71 75 65 72  736..754....quer
0330: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0340: 45 43 54 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c  ECT col0 * ( col
0350: 31 20 29 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f  1 ) + - col1 FRO
0360: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
0370: 32 37 0d 0a 35 32 0d 0a 36 33 30 0d 0a 0d 0a 71  27..52..630....q
0380: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0390: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
03a0: 63 6f 6c 32 20 2a 20 32 36 20 2b 20 63 6f 6c 30  col2 * 26 + col0
03b0: 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41   + col0 * col0 A
03c0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
03d0: 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 36 0d 0a 35 36  ..----..1416..56
03e0: 34 32 0d 0a 38 39 37 36 0d 0a 0d 0a 73 6b 69 70  42..8976....skip
03f0: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
0400: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
0410: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
0420: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
0430: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
0440: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
0450: 54 49 4e 43 54 20 2d 20 38 37 20 2a 20 63 6f 6c  TINCT - 87 * col
0460: 30 20 2d 20 2d 20 33 30 20 63 6f 6c 31 20 46 52  0 - - 30 col1 FR
0470: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
0480: 2d 2d 0d 0a 2d 32 30 35 38 0d 0a 2d 33 30 31 35  --..-2058..-3015
0490: 0d 0a 2d 37 37 31 33 0d 0a 0d 0a 6f 6e 6c 79 69  ..-7713....onlyi
04a0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
04b0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
04c0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
04d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
04e0: 20 6c 61 62 65 6c 2d 34 0d 0a 53 45 4c 45 43 54   label-4..SELECT
04f0: 20 44 49 53 54 49 4e 43 54 20 2d 20 35 39 20 44   DISTINCT - 59 D
0500: 49 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  IV col2 AS col0 
0510: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
0520: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a  0..----..-1..0..
0530: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
0540: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
0550: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0560: 20 6c 61 62 65 6c 2d 34 0d 0a 53 45 4c 45 43 54   label-4..SELECT
0570: 20 44 49 53 54 49 4e 43 54 20 2d 20 35 39 20 2f   DISTINCT - 59 /
0580: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
0590: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
05a0: 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a  .----..-1..0....
05b0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
05c0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
05d0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
05e0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
05f0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
0600: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0610: 20 2d 20 35 30 20 2a 20 2b 20 63 6f 6c 32 20 63   - 50 * + col2 c
0620: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
0630: 2d 2d 2d 0d 0a 2d 32 37 30 30 0d 0a 2d 32 38 35  ---..-2700..-285
0640: 30 0d 0a 2d 34 38 30 30 0d 0a 0d 0a 71 75 65 72  0..-4800....quer
0650: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0660: 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d  ECT + - col0 + -
0670: 20 36 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53   60 FROM tab0 AS
0680: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
0690: 39 0d 0a 2d 38 34 0d 0a 2d 39 35 0d 0a 0d 0a 73  9..-84..-95....s
06a0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
06b0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
06c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
06d0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
06e0: 72 30 2e 63 6f 6c 31 20 2a 20 43 41 53 54 20 28  r0.col1 * CAST (
06f0: 20 2d 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20   - col2 AS REAL 
0700: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
0710: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
0720: 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a  -..-1534..-646..
0730: 2d 38 33 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -837....onlyif m
0740: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
0750: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
0760: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
0770: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
0780: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
0790: 2d 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  -8..SELECT DISTI
07a0: 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b  NCT - + col1 + +
07b0: 20 43 41 53 54 28 20 34 31 20 41 53 20 53 49 47   CAST( 41 AS SIG
07c0: 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20  NED ) FROM tab2 
07d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
07e0: 31 38 0d 0a 31 30 0d 0a 32 34 0d 0a 0d 0a 73 6b  18..10..24....sk
07f0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
0800: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
0810: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
0820: 65 6c 2d 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  el-8..SELECT DIS
0830: 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b  TINCT - + col1 +
0840: 20 2b 20 43 41 53 54 20 28 20 34 31 20 41 53 20   + CAST ( 41 AS 
0850: 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
0860: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
0870: 2d 0d 0a 2d 31 38 0d 0a 31 30 0d 0a 32 34 0d 0a  -..-18..10..24..
0880: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
0890: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
08a0: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
08b0: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
08c0: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
08d0: 73 6f 72 74 20 6c 61 62 65 6c 2d 39 0d 0a 53 45  sort label-9..SE
08e0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
08f0: 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
0900: 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 32 20  SIGNED ) * col2 
0910: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
0920: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
0930: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
0940: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
0950: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
0960: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
0970: 6f 72 74 20 6c 61 62 65 6c 2d 39 0d 0a 53 45 4c  ort label-9..SEL
0980: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b  ECT ALL - col0 +
0990: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
09a0: 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 32  INTEGER ) * col2
09b0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
09c0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
09d0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
09e0: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
09f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
0a00: 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 28 20 63 6f  r0.col0 + - ( co
0a10: 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  l1 ) FROM tab2 A
0a20: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
0a30: 34 0d 0a 31 39 0d 0a 36 32 0d 0a 0d 0a 6f 6e 6c  4..19..62....onl
0a40: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
0a50: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
0a60: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
0a70: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
0a80: 72 74 20 6c 61 62 65 6c 2d 31 31 0d 0a 53 45 4c  rt label-11..SEL
0a90: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
0aa0: 6f 6c 30 20 2a 20 63 6f 6c 32 20 44 49 56 20 63  ol0 * col2 DIV c
0ab0: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
0ac0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
0ad0: 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a  ..54..57..96....
0ae0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
0af0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
0b00: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
0b10: 61 62 65 6c 2d 31 31 0d 0a 53 45 4c 45 43 54 20  abel-11..SELECT 
0b20: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
0b30: 2a 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 41 53  * col2 / col0 AS
0b40: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
0b50: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a  cor0..----..54..
0b60: 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  57..96....query 
0b70: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
0b80: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
0b90: 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol2 * col2 + col
0ba0: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
0bb0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32 37  or0..----..-1427
0bc0: 0d 0a 2d 36 31 37 0d 0a 2d 36 39 38 0d 0a 0d 0a  ..-617..-698....
0bd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0be0: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63  .SELECT col2 * c
0bf0: 6f 6c 30 20 2b 20 35 33 20 2a 20 63 6f 6c 32 20  ol0 + 53 * col2 
0c00: 2a 20 31 34 20 46 52 4f 4d 20 74 61 62 30 20 41  * 14 FROM tab0 A
0c10: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35  S cor0..----..25
0c20: 32 37 38 0d 0a 36 38 31 34 32 0d 0a 37 37 37 0d  278..68142..777.
0c30: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
0c40: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
0c50: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
0c60: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
0c70: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
0c80: 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  4..SELECT - col1
0c90: 20 44 49 56 20 28 20 63 6f 6c 31 20 29 20 41 53   DIV ( col1 ) AS
0ca0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
0cb0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
0cc0: 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66  -1..-1....skipif
0cd0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
0ce0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
0cf0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
0d00: 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  4..SELECT - col1
0d10: 20 2f 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63   / ( col1 ) AS c
0d20: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
0d30: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
0d40: 0d 0a 2d 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..-1....onlyif m
0d50: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
0d60: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
0d70: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
0d80: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
0d90: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
0da0: 2d 31 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  -15..SELECT col0
0db0: 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   * CAST( NULL AS
0dc0: 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
0dd0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
0de0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
0df0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
0e00: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
0e10: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
0e20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
0e30: 62 65 6c 2d 31 35 0d 0a 53 45 4c 45 43 54 20 63  bel-15..SELECT c
0e40: 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 4e 55 4c  ol0 * CAST ( NUL
0e50: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  L AS INTEGER ) A
0e60: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
0e70: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
0e80: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
0e90: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
0ea0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
0eb0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
0ec0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
0ed0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
0ee0: 31 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  16..SELECT DISTI
0ef0: 4e 43 54 20 2b 20 38 20 2d 20 28 20 2b 20 63 6f  NCT + 8 - ( + co
0f00: 72 30 2e 63 6f 6c 31 20 29 20 44 49 56 20 33 36  r0.col1 ) DIV 36
0f10: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
0f20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 0d 0a 0d 0a 73  r0..----..8....s
0f30: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
0f40: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
0f50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
0f60: 62 65 6c 2d 31 36 0d 0a 53 45 4c 45 43 54 20 44  bel-16..SELECT D
0f70: 49 53 54 49 4e 43 54 20 2b 20 38 20 2d 20 28 20  ISTINCT + 8 - ( 
0f80: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2f 20  + cor0.col1 ) / 
0f90: 33 36 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  36 FROM tab1 AS 
0fa0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 0d 0a 0d  cor0..----..8...
0fb0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0fc0: 0d 0a 53 45 4c 45 43 54 20 38 38 20 2d 20 2b 20  ..SELECT 88 - + 
0fd0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
0fe0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
0ff0: 0d 0a 2d 39 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69  ..-9..2....skipi
1000: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1010: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1020: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1030: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1040: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1050: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1060: 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  - ( - cor0.col1 
1070: 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  ) col2 FROM tab0
1080: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1090: 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75  86..91..97....qu
10a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10b0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
10c0: 6c 30 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 31  l0 + col1 - col1
10d0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
10e0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
10f0: 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d  ..-24..-35..-89.
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 2b 20 2d 20 28  rt..SELECT + - (
1120: 20 35 36 20 29 20 46 52 4f 4d 20 74 61 62 30 20   56 ) FROM tab0 
1130: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1140: 35 36 0d 0a 2d 35 36 0d 0a 2d 35 36 0d 0a 0d 0a  56..-56..-56....
1150: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
1160: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
1170: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
1180: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
1190: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
11a0: 72 74 20 6c 61 62 65 6c 2d 32 31 0d 0a 53 45 4c  rt label-21..SEL
11b0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53  ECT DISTINCT CAS
11c0: 54 28 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20  T( cor0.col2 AS 
11d0: 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 63 6f 6c  SIGNED ) + + col
11e0: 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0 col0 FROM tab1
11f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1200: 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a  121..176..57....
1210: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1220: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1230: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1240: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1250: 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
1260: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1270: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1280: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31  rowsort label-21
1290: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
12a0: 54 20 43 41 53 54 20 28 20 63 6f 72 30 2e 63 6f  T CAST ( cor0.co
12b0: 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l2 AS INTEGER ) 
12c0: 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52  + + col0 col0 FR
12d0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
12e0: 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d  .----..121..176.
12f0: 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .57....query I r
1300: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1310: 49 53 54 49 4e 43 54 20 2b 20 32 38 20 2b 20 2d  ISTINCT + 28 + -
1320: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
1330: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1340: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d  cor0..----..-10.
1350: 0a 31 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .1..2....query I
1360: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1370: 20 41 4c 4c 20 28 20 2b 20 38 31 20 29 20 41 53   ALL ( + 81 ) AS
1380: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
1390: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
13a0: 31 0d 0a 38 31 0d 0a 38 31 0d 0a 0d 0a 71 75 65  1..81..81....que
13b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13c0: 4c 45 43 54 20 2d 20 35 37 20 2a 20 63 6f 72 30  LECT - 57 * cor0
13d0: 2e 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 46 52 4f  .col1 - col2 FRO
13e0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
13f0: 2d 2d 2d 2d 0d 0a 2d 34 39 33 35 0d 0a 2d 35 32  ----..-4935..-52
1400: 36 39 0d 0a 2d 35 35 33 30 0d 0a 0d 0a 71 75 65  69..-5530....que
1410: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1420: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1430: 2d 20 33 34 20 2b 20 39 34 20 2d 20 63 6f 6c 31  - 34 + 94 - col1
1440: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1450: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1460: 0d 0a 31 30 32 0d 0a 31 31 35 0d 0a 31 31 38 0d  ..102..115..118.
1470: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1480: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1490: 4e 43 54 20 28 20 63 6f 6c 30 20 29 20 2a 20 63  NCT ( col0 ) * c
14a0: 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d  ol0 * - col1 + -
14b0: 20 28 20 63 6f 6c 31 20 2b 20 2d 20 35 37 20 29   ( col1 + - 57 )
14c0: 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   * - col1 * - co
14d0: 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
14e0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
14f0: 0a 2d 31 30 30 32 33 36 35 0d 0a 2d 32 36 34 30  .-1002365..-2640
1500: 32 30 0d 0a 2d 34 39 35 31 38 35 0d 0a 0d 0a 71  20..-495185....q
1510: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1520: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
1530: 6f 6c 31 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 - - cor0.col
1540: 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
1550: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32  ..----..110..132
1560: 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..180....query I
1570: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1580: 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 35 20 41 53   - col1 + - 5 AS
1590: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
15a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
15b0: 31 35 0d 0a 2d 31 38 0d 0a 2d 33 31 0d 0a 0d 0a  15..-18..-31....
15c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15d0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
15e0: 6c 31 20 2a 20 36 39 20 2b 20 63 6f 6c 32 20 46  l1 * 69 + col2 F
15f0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1600: 0d 0a 2d 2d 2d 2d 0d 0a 31 38 34 38 0d 0a 37 34  ..----..1848..74
1610: 37 0d 0a 39 39 33 0d 0a 0d 0a 71 75 65 72 79 20  7..993....query 
1620: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1630: 54 20 2d 20 2d 20 31 31 20 2a 20 63 6f 6c 32 20  T - - 11 * col2 
1640: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1650: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1660: 0a 31 30 35 36 0d 0a 35 39 34 0d 0a 36 32 37 0d  .1056..594..627.
1670: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1680: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1690: 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2d 20 2d  NCT + + col0 - -
16a0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
16b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
16c0: 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a  10..132..180....
16d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16e0: 0a 53 45 4c 45 43 54 20 2d 20 31 34 20 46 52 4f  .SELECT - 14 FRO
16f0: 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  M tab1, tab1 AS 
1700: 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d  cor0, tab2 cor1.
1710: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
1720: 20 68 61 73 68 69 6e 67 20 74 6f 20 63 32 62 66   hashing to c2bf
1730: 30 65 32 34 32 30 64 32 32 63 64 35 38 64 37 65  0e2420d22cd58d7e
1740: 65 33 62 33 30 38 32 37 61 66 63 63 0d 0a 0d 0a  e3b30827afcc....
1750: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1760: 0a 53 45 4c 45 43 54 20 2d 20 31 38 20 2b 20 63  .SELECT - 18 + c
1770: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
1780: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1790: 2d 2d 2d 0d 0a 2d 31 31 0d 0a 36 30 0d 0a 36 31  ---..-11..60..61
17a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
17c0: 49 4e 43 54 20 2d 20 32 20 2a 20 63 6f 6c 32 20  INCT - 2 * col2 
17d0: 2d 20 2b 20 32 35 20 2a 20 63 6f 6c 32 20 41 53  - + 25 * col2 AS
17e0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
17f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1800: 31 34 35 38 0d 0a 2d 31 35 33 39 0d 0a 2d 32 35  1458..-1539..-25
1810: 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
1820: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1830: 53 54 49 4e 43 54 20 2b 20 28 20 2d 20 63 6f 6c  STINCT + ( - col
1840: 32 20 29 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  2 ) + - col0 AS 
1850: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1860: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1870: 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d  21..-176..-57...
1880: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1890: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
18a0: 20 33 33 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   33 FROM tab0, t
18b0: 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab2 AS cor0 CROS
18c0: 53 20 4a 4f 49 4e 20 74 61 62 32 20 63 6f 72 31  S JOIN tab2 cor1
18d0: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
18e0: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 62 63  s hashing to bbc
18f0: 30 35 61 66 65 37 65 62 36 66 65 64 31 36 65 39  05afe7eb6fed16e9
1900: 64 37 35 66 37 66 37 34 64 31 39 34 38 0d 0a 0d  d75f7f74d1948...
1910: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1920: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72  ..SELECT + + cor
1930: 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  0.col1 + col0 * 
1940: 33 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  32 FROM tab2 AS 
1950: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 34 35  cor0..----..2545
1960: 0d 0a 32 35 35 0d 0a 32 35 35 35 0d 0a 0d 0a 71  ..255..2555....q
1970: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1980: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20  SELECT - col2 * 
1990: 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f  cor0.col0 - - co
19a0: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
19b0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
19c0: 2d 2d 0d 0a 2d 37 32 30 39 0d 0a 2d 37 36 38 0d  --..-7209..-768.
19d0: 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
19e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
19f0: 32 35 20 2d 20 63 6f 6c 32 20 2a 20 39 31 20 46  25 - col2 * 91 F
1a00: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1a10: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 39 31 0d 0a 2d  ..----..-2391..-
1a20: 32 34 38 32 0d 0a 2d 33 34 38 33 0d 0a 0d 0a 71  2482..-3483....q
1a30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a40: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20  SELECT + + col0 
1a50: 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2d 20  * cor0.col1 - - 
1a60: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1a70: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
1a80: 39 37 0d 0a 33 33 39 36 0d 0a 38 31 38 31 0d 0a  97..3396..8181..
1a90: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1aa0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1ab0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1ac0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1ad0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31  rowsort label-41
1ae0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49  ..SELECT col2 DI
1af0: 56 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  V + col1 + - col
1b00: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1b10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a  or0..----..-26..
1b20: 2d 32 37 0d 0a 2d 33 36 0d 0a 0d 0a 73 6b 69 70  -27..-36....skip
1b30: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1b40: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1b50: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1b60: 2d 34 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  -41..SELECT col2
1b70: 20 2f 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   / + col1 + - co
1b80: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1b90: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  cor0..----..-26.
1ba0: 0a 2d 32 37 0d 0a 2d 33 36 0d 0a 0d 0a 71 75 65  .-27..-36....que
1bb0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1bc0: 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 31 20 46  LECT tab1.col1 F
1bd0: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
1be0: 53 20 63 6f 72 30 2c 20 74 61 62 32 2c 20 74 61  S cor0, tab2, ta
1bf0: 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
1c00: 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68  ..81 values hash
1c10: 69 6e 67 20 74 6f 20 64 37 64 33 66 61 62 63 61  ing to d7d3fabca
1c20: 66 62 65 64 31 34 66 30 64 36 66 66 64 33 37 31  fbed14f0d6ffd371
1c30: 39 35 63 39 37 31 63 0d 0a 0d 0a 71 75 65 72 79  95c971c....query
1c40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c50: 43 54 20 2b 20 2d 20 36 31 20 46 52 4f 4d 20 74  CT + - 61 FROM t
1c60: 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab1 AS cor0 CROS
1c70: 53 20 4a 4f 49 4e 20 74 61 62 30 20 63 6f 72 31  S JOIN tab0 cor1
1c80: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
1c90: 20 68 61 73 68 69 6e 67 20 74 6f 20 35 31 66 35   hashing to 51f5
1ca0: 33 36 39 37 39 36 36 61 37 39 64 33 30 36 61 34  3697966a79d306a4
1cb0: 35 37 30 35 33 37 63 64 39 31 61 31 0d 0a 0d 0a  570537cd91a1....
1cc0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1cd0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
1ce0: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
1cf0: 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
1d00: 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
1d10: 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 32 0d  1, tab1 AS cor2.
1d20: 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73  .----..81 values
1d30: 20 68 61 73 68 69 6e 67 20 74 6f 20 62 37 61 31   hashing to b7a1
1d40: 62 33 38 66 65 38 65 34 66 33 34 33 38 38 65 33  b38fe8e4f34388e3
1d50: 62 65 31 66 35 32 36 30 31 61 65 35 0d 0a 0d 0a  be1f52601ae5....
1d60: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d70: 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
1d80: 32 20 2b 20 36 35 20 46 52 4f 4d 20 74 61 62 30  2 + 65 FROM tab0
1d90: 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
1da0: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
1db0: 61 73 68 69 6e 67 20 74 6f 20 61 33 30 65 64 63  ashing to a30edc
1dc0: 35 30 37 36 61 38 64 34 36 35 66 35 32 64 37 64  5076a8d465f52d7d
1dd0: 62 63 33 30 64 61 39 61 33 32 0d 0a 0d 0a 73 6b  bc30da9a32....sk
1de0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1df0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1e00: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1e10: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1e20: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1e30: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1e40: 20 34 33 20 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c   43 + - col1 col
1e50: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
1e60: 2d 0d 0a 2d 34 33 0d 0a 2d 34 38 0d 0a 2d 35 34  -..-43..-48..-54
1e70: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e80: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
1e90: 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 72 30 2e  col2 ) * - cor0.
1ea0: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
1eb0: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
1ec0: 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d 0a 37 32  -..1444..676..72
1ed0: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
1ee0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1ef0: 20 33 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f   32 * + col2 FRO
1f00: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37  M tab1..----..17
1f10: 32 38 0d 0a 31 38 32 34 0d 0a 33 30 37 32 0d 0a  28..1824..3072..
1f20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f30: 74 0d 0a 53 45 4c 45 43 54 20 38 32 20 41 53 20  t..SELECT 82 AS 
1f40: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
1f50: 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
1f60: 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
1f70: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
1f80: 69 6e 67 20 74 6f 20 39 39 39 32 30 64 39 66 37  ing to 99920d9f7
1f90: 63 64 39 63 64 63 63 65 66 39 39 63 66 61 34 35  cd9cdccef99cfa45
1fa0: 39 61 65 36 39 34 34 0d 0a 0d 0a 71 75 65 72 79  9ae6944....query
1fb0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1fc0: 43 54 20 44 49 53 54 49 4e 43 54 20 35 35 20 46  CT DISTINCT 55 F
1fd0: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
1fe0: 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  S cor0, tab0 AS 
1ff0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a  cor1..----..55..
2000: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2010: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
2020: 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  l0 + col1 * col1
2030: 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
2040: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2050: 0a 31 30 39 30 33 0d 0a 32 35 39 34 30 0d 0a 39  .10903..25940..9
2060: 30 34 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0428....query I 
2070: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2080: 44 49 53 54 49 4e 43 54 20 36 32 20 46 52 4f 4d  DISTINCT 62 FROM
2090: 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
20a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 32 0d 0a 0d  or0..----..62...
20b0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
20c0: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
20d0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
20e0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
20f0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2100: 6f 72 74 20 6c 61 62 65 6c 2d 35 33 0d 0a 53 45  ort label-53..SE
2110: 4c 45 43 54 20 2d 20 43 41 53 54 28 20 63 6f 6c  LECT - CAST( col
2120: 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  2 AS SIGNED ) + 
2130: 63 6f 6c 30 20 2b 20 39 39 20 41 53 20 63 6f 6c  col0 + 99 AS col
2140: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
2150: 2d 0d 0a 31 30 36 0d 0a 34 38 0d 0a 38 33 0d 0a  -..106..48..83..
2160: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2170: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2180: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2190: 20 6c 61 62 65 6c 2d 35 33 0d 0a 53 45 4c 45 43   label-53..SELEC
21a0: 54 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 32 20  T - CAST ( col2 
21b0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63  AS INTEGER ) + c
21c0: 6f 6c 30 20 2b 20 39 39 20 41 53 20 63 6f 6c 30  ol0 + 99 AS col0
21d0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
21e0: 0d 0a 31 30 36 0d 0a 34 38 0d 0a 38 33 0d 0a 0d  ..106..48..83...
21f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2200: 0d 0a 53 45 4c 45 43 54 20 31 33 20 2b 20 63 6f  ..SELECT 13 + co
2210: 6c 32 20 2b 20 2b 20 35 34 20 2a 20 63 6f 6c 30  l2 + + 54 * col0
2220: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2230: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 32 0d 0a  r0..----..1342..
2240: 31 39 30 34 0d 0a 34 39 30 31 0d 0a 0d 0a 71 75  1904..4901....qu
2250: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2260: 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d  ELECT + col0 * -
2270: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 41   col2 + - col0 A
2280: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2290: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22a0: 2d 31 36 35 0d 0a 2d 33 37 31 32 0d 0a 2d 37 37  -165..-3712..-77
22b0: 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
22c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
22d0: 28 20 2b 20 36 20 29 20 46 52 4f 4d 20 74 61 62  ( + 6 ) FROM tab
22e0: 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  1 AS cor0 CROSS 
22f0: 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72  JOIN tab1 AS cor
2300: 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
2310: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 39 32  s hashing to e92
2320: 62 32 36 37 39 66 61 61 63 37 62 65 36 33 37 30  b2679faac7be6370
2330: 31 39 36 37 65 33 66 30 63 30 39 33 34 0d 0a 0d  1967e3f0c0934...
2340: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2350: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
2360: 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53  + col0 + col0 AS
2370: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2380: 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30  .----..3..64..80
2390: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
23b0: 49 4e 43 54 20 2b 20 38 31 20 2b 20 63 6f 72 30  INCT + 81 + cor0
23c0: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
23d0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
23e0: 0a 2d 2d 2d 2d 0d 0a 31 34 35 0d 0a 31 36 31 0d  .----..145..161.
23f0: 0a 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .84....query I r
2400: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2410: 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d  LL cor0.col1 * -
2420: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63   col0 + - cor0.c
2430: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
2440: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2450: 2d 2d 2d 0d 0a 2d 31 33 36 30 0d 0a 2d 32 34 38  ---..-1360..-248
2460: 0d 0a 2d 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79  ..-4661....query
2470: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2480: 43 54 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63  CT col1 * cor0.c
2490: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
24a0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
24b0: 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37  ..1248..1404..57
24c0: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
24d0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
24e0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
24f0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2500: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2510: 2d 36 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  -61..SELECT DIST
2520: 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20  INCT - + col0 * 
2530: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  + cor0.col1 + + 
2540: 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30 20  col2 DIV - col0 
2550: 2d 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  - - col0 FROM ta
2560: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
2570: 31 32 36 34 0d 0a 2d 32 31 33 0d 0a 2d 34 35 32  1264..-213..-452
2580: 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
2590: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
25a0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
25b0: 6f 72 74 20 6c 61 62 65 6c 2d 36 31 0d 0a 53 45  ort label-61..SE
25c0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
25d0: 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e  + col0 * + cor0.
25e0: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2f 20  col1 + + col2 / 
25f0: 2d 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30 20  - col0 - - col0 
2600: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
2610: 2d 2d 2d 2d 0d 0a 2d 31 32 36 34 0d 0a 2d 32 31  ----..-1264..-21
2620: 33 0d 0a 2d 34 35 32 34 0d 0a 0d 0a 71 75 65 72  3..-4524....quer
2630: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2640: 45 43 54 20 41 4c 4c 20 31 33 20 2b 20 2d 20 63  ECT ALL 13 + - c
2650: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
2660: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   tab2..----..-13
2670: 0d 0a 2d 31 34 0d 0a 2d 32 35 0d 0a 0d 0a 6f 6e  ..-14..-25....on
2680: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2690: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
26a0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
26b0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
26c0: 6f 72 74 20 6c 61 62 65 6c 2d 36 33 0d 0a 53 45  ort label-63..SE
26d0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
26e0: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col1 * - col1 + 
26f0: 2b 20 74 61 62 32 2e 63 6f 6c 31 20 44 49 56 20  + tab2.col1 DIV 
2700: 32 37 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  27 FROM tab2..--
2710: 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d 33 34 37 39 0d  --..-289..-3479.
2720: 0a 2d 39 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-960....skipif 
2730: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2740: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2750: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33  rowsort label-63
2760: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2770: 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  T + col1 * - col
2780: 31 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20  1 + + tab2.col1 
2790: 2f 20 32 37 20 46 52 4f 4d 20 74 61 62 32 0d 0a  / 27 FROM tab2..
27a0: 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d 33 34 37  ----..-289..-347
27b0: 39 0d 0a 2d 39 36 30 0d 0a 0d 0a 73 6b 69 70 69  9..-960....skipi
27c0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
27d0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
27e0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
27f0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2800: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2810: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  ort..SELECT - ta
2820: 62 32 2e 63 6f 6c 32 20 2d 20 2b 20 35 32 20 63  b2.col2 - + 52 c
2830: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
2840: 61 62 30 20 63 6f 72 30 2c 20 74 61 62 31 20 63  ab0 cor0, tab1 c
2850: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
2860: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2870: 38 61 31 36 34 30 63 35 37 62 31 37 33 33 64 30  8a1640c57b1733d0
2880: 30 38 37 30 39 38 37 36 63 32 30 61 63 61 63 36  08709876c20acac6
2890: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
28a0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
28b0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
28c0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
28d0: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
28e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28f0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2900: 39 36 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  96 + - cor0.col2
2910: 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20   * + ( - col1 ) 
2920: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
2930: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
2940: 33 30 0d 0a 37 34 32 0d 0a 39 33 33 0d 0a 0d 0a  30..742..933....
2950: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2960: 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 30  .SELECT - ( col0
2970: 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 34 38   ) * col1 + + 48
2980: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2990: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
29a0: 0d 0a 2d 33 30 0d 0a 2d 35 39 32 0d 0a 2d 39 39  ..-30..-592..-99
29b0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
29c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
29d0: 20 35 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   5 * col2 + + co
29e0: 6c 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l2 - - cor0.col1
29f0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2a00: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2a10: 0d 0a 31 30 33 0d 0a 32 38 34 0d 0a 35 38 33 0d  ..103..284..583.
2a20: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a30: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2a40: 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 28 20 63  NCT + col2 + ( c
2a50: 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41  ol1 ) * - col1 A
2a60: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2a70: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a80: 2d 32 35 31 0d 0a 2d 33 34 35 35 0d 0a 2d 39 33  -251..-3455..-93
2a90: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2aa0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2ab0: 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol0 * col2 + col
2ac0: 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
2ad0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2ae0: 2d 0d 0a 2d 31 35 39 0d 0a 2d 33 35 38 34 0d 0a  -..-159..-3584..
2af0: 2d 37 36 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -7600....query I
2b00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b10: 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20 33 32   ALL col1 * - 32
2b20: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2b30: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 30 0d 0a  r0..----..-320..
2b40: 2d 34 31 36 0d 0a 2d 38 33 32 0d 0a 0d 0a 71 75  -416..-832....qu
2b50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b60: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2b70: 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2d   col1 * - col0 -
2b80: 20 2b 20 33 20 41 53 20 63 6f 6c 31 20 46 52 4f   + 3 AS col1 FRO
2b90: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2ba0: 2d 2d 2d 2d 0d 0a 2d 31 33 34 36 0d 0a 2d 32 32  ----..-1346..-22
2bb0: 30 0d 0a 2d 34 36 30 35 0d 0a 0d 0a 73 6b 69 70  0..-4605....skip
2bc0: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2bd0: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2be0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2bf0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2c00: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2c10: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2c20: 6f 72 30 2e 63 6f 6c 32 20 2a 20 35 37 20 63 6f  or0.col2 * 57 co
2c30: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
2c40: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 31  cor0..----..1881
2c50: 0d 0a 34 36 37 34 0d 0a 35 37 0d 0a 0d 0a 71 75  ..4674..57....qu
2c60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c70: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
2c80: 20 2b 20 2d 20 39 33 20 41 53 20 63 6f 6c 32 20   + - 93 AS col2 
2c90: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2ca0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 37 0d 0a 2d 38  0..----..-67..-8
2cb0: 30 0d 0a 2d 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  0..-83....onlyif
2cc0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2cd0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2ce0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2cf0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2d00: 6c 61 62 65 6c 2d 37 34 0d 0a 53 45 4c 45 43 54  label-74..SELECT
2d10: 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 44   + + cor0.col1 D
2d20: 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 63  IV - cor0.col2 c
2d30: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
2d40: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32  r0..----..-1..-2
2d50: 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-97....skipif 
2d60: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2d70: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2d80: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2d90: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2da0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2db0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2dc0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2dd0: 20 6c 61 62 65 6c 2d 37 34 0d 0a 53 45 4c 45 43   label-74..SELEC
2de0: 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  T + + cor0.col1 
2df0: 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f  / - cor0.col2 co
2e00: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
2e10: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d  0..----..-1..-2.
2e20: 0a 2d 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-97....onlyif m
2e30: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2e40: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2e50: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2e60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2e70: 62 65 6c 2d 37 35 0d 0a 53 45 4c 45 43 54 20 63  bel-75..SELECT c
2e80: 6f 6c 32 20 44 49 56 20 2d 20 63 6f 72 30 2e 63  ol2 DIV - cor0.c
2e90: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
2ea0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2eb0: 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35 0d 0a 2d 37 0d  ---..-2..-5..-7.
2ec0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2ed0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2ee0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ef0: 74 20 6c 61 62 65 6c 2d 37 35 0d 0a 53 45 4c 45  t label-75..SELE
2f00: 43 54 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 72 30  CT col2 / - cor0
2f10: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
2f20: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2f30: 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35 0d 0a 2d  .----..-2..-5..-
2f40: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2f50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
2f60: 20 2d 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f   - col2 ) + - co
2f70: 6c 30 20 2b 20 38 33 20 41 53 20 63 6f 6c 31 20  l0 + 83 AS col1 
2f80: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2f90: 0a 31 33 34 0d 0a 37 36 0d 0a 39 39 0d 0a 0d 0a  .134..76..99....
2fa0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2fb0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2fc0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2fd0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2fe0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 0d 0a  wsort label-77..
2ff0: 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20  SELECT col2 DIV 
3000: 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20  + col2 + col0 * 
3010: 36 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  66 AS col0 FROM 
3020: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 35  tab0..----..1585
3030: 0d 0a 32 33 31 31 0d 0a 35 38 37 35 0d 0a 0d 0a  ..2311..5875....
3040: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
3050: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
3060: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
3070: 61 62 65 6c 2d 37 37 0d 0a 53 45 4c 45 43 54 20  abel-77..SELECT 
3080: 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 2b 20  col2 / + col2 + 
3090: 63 6f 6c 30 20 2a 20 36 36 20 41 53 20 63 6f 6c  col0 * 66 AS col
30a0: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
30b0: 2d 0d 0a 31 35 38 35 0d 0a 32 33 31 31 0d 0a 35  -..1585..2311..5
30c0: 38 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  875....query I r
30d0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
30e0: 49 53 54 49 4e 43 54 20 2d 20 32 35 20 2b 20 2b  ISTINCT - 25 + +
30f0: 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
3100: 74 61 62 32 2c 20 74 61 62 30 2c 20 74 61 62 30  tab2, tab0, tab0
3110: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3120: 2d 31 0d 0a 31 30 0d 0a 36 34 0d 0a 0d 0a 71 75  -1..10..64....qu
3130: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3140: 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 31 20  ELECT tab0.col1 
3150: 2a 20 2b 20 63 6f 6c 31 20 2d 20 38 20 41 53 20  * + col1 - 8 AS 
3160: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
3170: 2d 2d 2d 2d 0d 0a 37 33 38 38 0d 0a 38 32 37 33  ----..7388..8273
3180: 0d 0a 39 34 30 31 0d 0a 0d 0a 71 75 65 72 79 20  ..9401....query 
3190: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31a0: 54 20 63 6f 6c 32 20 2a 20 2b 20 38 30 20 2b 20  T col2 * + 80 + 
31b0: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
31c0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31d0: 2d 2d 2d 2d 0d 0a 31 37 37 0d 0a 32 37 32 36 0d  ----..177..2726.
31e0: 0a 36 36 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .6651....query I
31f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3200: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
3210: 20 2b 20 2d 20 28 20 35 36 20 29 20 46 52 4f 4d   + - ( 56 ) FROM
3220: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
3230: 2d 2d 2d 0d 0a 33 30 0d 0a 33 35 0d 0a 34 31 0d  ---..30..35..41.
3240: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3250: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
3260: 20 63 6f 6c 31 20 2a 20 2b 20 28 20 37 31 20 2a   col1 * + ( 71 *
3270: 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20   col0 ) AS col2 
3280: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
3290: 2d 2d 2d 2d 0d 0a 2d 31 34 36 35 34 34 0d 0a 2d  ----..-146544..-
32a0: 32 34 31 30 34 35 0d 0a 2d 35 37 35 30 32 39 0d  241045..-575029.
32b0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32c0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
32d0: 32 20 2b 20 2d 20 31 35 20 46 52 4f 4d 20 74 61  2 + - 15 FROM ta
32e0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
32f0: 0d 0a 2d 31 34 0d 0a 31 38 0d 0a 36 37 0d 0a 0d  ..-14..18..67...
3300: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3310: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
3320: 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53  + col2 * col2 AS
3330: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
3340: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 36 0d  cor0..----..-96.
3350: 0a 31 30 30 33 0d 0a 36 36 33 33 0d 0a 0d 0a 71  .1003..6633....q
3360: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3370: 53 45 4c 45 43 54 20 39 35 20 2a 20 38 35 20 46  SELECT 95 * 85 F
3380: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
3390: 2d 2d 2d 0d 0a 38 30 37 35 0d 0a 38 30 37 35 0d  ---..8075..8075.
33a0: 0a 38 30 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .8075....query I
33b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33c0: 20 2b 20 35 30 20 2a 20 2b 20 63 6f 6c 30 20 41   + 50 * + col0 A
33d0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
33e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33f0: 33 35 30 0d 0a 33 39 30 30 0d 0a 33 39 35 30 0d  350..3900..3950.
3400: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3410: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
3420: 20 2b 20 36 20 46 52 4f 4d 20 74 61 62 31 20 63   + 6 FROM tab1 c
3430: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d  or0..----..-6..-
3440: 36 0d 0a 2d 36 0d 0a 0d 0a 71 75 65 72 79 20 49  6..-6....query I
3450: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3460: 20 2b 20 35 34 20 2a 20 2d 20 63 6f 72 30 2e 63   + 54 * - cor0.c
3470: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  ol1 * - col1 FRO
3480: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
3490: 2d 2d 2d 2d 0d 0a 31 35 36 30 36 0d 0a 31 38 37  ----..15606..187
34a0: 39 37 34 0d 0a 35 31 38 39 34 0d 0a 0d 0a 71 75  974..51894....qu
34b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34c0: 45 4c 45 43 54 20 41 4c 4c 20 38 32 20 41 53 20  ELECT ALL 82 AS 
34d0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
34e0: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
34f0: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
3500: 67 20 74 6f 20 66 33 31 38 66 64 39 64 61 63 32  g to f318fd9dac2
3510: 64 65 37 61 66 34 62 38 32 63 63 37 35 37 34 62  de7af4b82cc7574b
3520: 62 63 61 32 63 0d 0a 0d 0a 71 75 65 72 79 20 49  bca2c....query I
3530: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3540: 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20   + + ( - col0 ) 
3550: 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  * - col0 + + col
3560: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
3570: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 34  or0..----..35..4
3580: 31 30 36 0d 0a 36 34 31 33 0d 0a 0d 0a 71 75 65  106..6413....que
3590: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35a0: 4c 45 43 54 20 41 4c 4c 20 2d 20 32 31 20 2a 20  LECT ALL - 21 * 
35b0: 2d 20 32 37 20 46 52 4f 4d 20 74 61 62 30 20 41  - 27 FROM tab0 A
35c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36  S cor0..----..56
35d0: 37 0d 0a 35 36 37 0d 0a 35 36 37 0d 0a 0d 0a 71  7..567..567....q
35e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35f0: 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
3600: 6c 31 20 2a 20 2d 20 34 32 20 2a 20 63 6f 6c 31  l1 * - 42 * col1
3610: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
3620: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 33 38 0d  r0..----..12138.
3630: 0a 31 34 36 32 30 32 0d 0a 34 30 33 36 32 0d 0a  .146202..40362..
3640: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3650: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
3660: 63 6f 6c 32 20 2a 20 2d 20 37 35 20 41 53 20 63  col2 * - 75 AS c
3670: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
3680: 2d 2d 2d 0d 0a 34 30 35 30 0d 0a 34 32 37 35 0d  ---..4050..4275.
3690: 0a 37 32 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .7200....query I
36a0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36b0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b   DISTINCT col0 +
36c0: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30   + col1 * + col0
36d0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
36e0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36f0: 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a 34 36 38  ..1422..224..468
3700: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
3710: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
3720: 20 37 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   75 AS col2 FROM
3730: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
3740: 2d 2d 2d 0d 0a 2d 37 35 0d 0a 2d 37 35 0d 0a 2d  ---..-75..-75..-
3750: 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  75....query I ro
3760: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
3770: 63 6f 6c 30 20 2a 20 39 20 46 52 4f 4d 20 74 61  col0 * 9 FROM ta
3780: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
3790: 0d 0a 2d 32 37 0d 0a 2d 35 37 36 0d 0a 2d 37 32  ..-27..-576..-72
37a0: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
37b0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
37c0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
37d0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
37e0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
37f0: 2d 39 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  -97..SELECT ALL 
3800: 2b 20 63 6f 6c 31 20 44 49 56 20 32 30 20 46 52  + col1 DIV 20 FR
3810: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
3820: 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 34 0d 0a 34 0d 0a  .----..4..4..4..
3830: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
3840: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
3850: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3860: 20 6c 61 62 65 6c 2d 39 37 0d 0a 53 45 4c 45 43   label-97..SELEC
3870: 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2f 20 32  T ALL + col1 / 2
3880: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
3890: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 34 0d  or0..----..4..4.
38a0: 0a 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .4....onlyif mys
38b0: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
38c0: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
38d0: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
38e0: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
38f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
3900: 38 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54  8..SELECT + CAST
3910: 28 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ( ( + cor0.col0 
3920: 29 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  ) AS SIGNED ) * 
3930: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
3940: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3950: 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d  1343..217..4602.
3960: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
3970: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
3980: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3990: 74 20 6c 61 62 65 6c 2d 39 38 0d 0a 53 45 4c 45  t label-98..SELE
39a0: 43 54 20 2b 20 43 41 53 54 20 28 20 28 20 2b 20  CT + CAST ( ( + 
39b0: 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53 20 49  cor0.col0 ) AS I
39c0: 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c  NTEGER ) * + col
39d0: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
39e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d  or0..----..1343.
39f0: 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75  .217..4602....qu
3a00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3a10: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
3a20: 20 2a 20 2b 20 33 32 20 41 53 20 63 6f 6c 31 20   * + 32 AS col1 
3a30: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
3a40: 2d 2d 2d 2d 0d 0a 31 37 32 38 0d 0a 31 38 32 34  ----..1728..1824
3a50: 0d 0a 33 30 37 32 0d 0a 0d 0a 71 75 65 72 79 20  ..3072....query 
3a60: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3a70: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
3a80: 2a 20 38 37 20 46 52 4f 4d 20 74 61 62 32 20 41  * 87 FROM tab2 A
3a90: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30  S cor0..----..60
3aa0: 39 0d 0a 36 37 38 36 0d 0a 36 38 37 33 0d 0a 0d  9..6786..6873...
3ab0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
3ac0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
3ad0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
3ae0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
3af0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31  owsort label-101
3b00: 0d 0a 53 45 4c 45 43 54 20 2d 20 32 37 20 44 49  ..SELECT - 27 DI
3b10: 56 20 63 6f 6c 30 20 2d 20 28 20 63 6f 72 30 2e  V col0 - ( cor0.
3b20: 63 6f 6c 32 20 29 20 2a 20 63 6f 72 30 2e 63 6f  col2 ) * cor0.co
3b30: 6c 30 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d  l0 DIV col0 FROM
3b40: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
3b50: 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 36 33 0d 0a 2d  ---..-57..-63..-
3b60: 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  96....skipif mys
3b70: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
3b80: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
3b90: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31 0d 0a  sort label-101..
3ba0: 53 45 4c 45 43 54 20 2d 20 32 37 20 2f 20 63 6f  SELECT - 27 / co
3bb0: 6c 30 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32  l0 - ( cor0.col2
3bc0: 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2f   ) * cor0.col0 /
3bd0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
3be0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
3bf0: 35 37 0d 0a 2d 36 33 0d 0a 2d 39 36 0d 0a 0d 0a  57..-63..-96....
3c00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3c10: 0a 53 45 4c 45 43 54 20 2d 20 33 36 20 2a 20 63  .SELECT - 36 * c
3c20: 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
3c30: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
3c40: 31 31 31 36 0d 0a 2d 32 31 32 34 0d 0a 2d 36 31  1116..-2124..-61
3c50: 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
3c60: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
3c70: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
3c80: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
3c90: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
3ca0: 2d 31 30 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -103..SELECT ALL
3cb0: 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c   col2 + cor0.col
3cc0: 30 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20  0 DIV cor0.col0 
3cd0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
3ce0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d  S cor0..----..2.
3cf0: 0a 33 34 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69  .34..83....skipi
3d00: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
3d10: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
3d20: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
3d30: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
3d40: 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
3d50: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
3d60: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
3d70: 72 74 20 6c 61 62 65 6c 2d 31 30 33 0d 0a 53 45  rt label-103..SE
3d80: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20  LECT ALL col2 + 
3d90: 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 63 6f 72 30  cor0.col0 / cor0
3da0: 2e 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20  .col0 col1 FROM 
3db0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
3dc0: 2d 2d 0d 0a 32 0d 0a 33 34 0d 0a 38 33 0d 0a 0d  --..2..34..83...
3dd0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
3de0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
3df0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
3e00: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
3e10: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34  owsort label-104
3e20: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
3e30: 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 72  T - col0 DIV cor
3e40: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
3e50: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3e60: 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  -1....skipif mys
3e70: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
3e80: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
3e90: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 0d 0a  sort label-104..
3ea0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
3eb0: 2d 20 63 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f  - col0 / cor0.co
3ec0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
3ed0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
3ee0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3ef0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
3f00: 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  CT - - col2 * - 
3f10: 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 31 20 46 52  col1 - - col1 FR
3f20: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
3f30: 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 35 0d 0a 2d 36  .----..-1475..-6
3f40: 32 39 0d 0a 2d 38 30 36 0d 0a 0d 0a 71 75 65 72  29..-806....quer
3f50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3f60: 45 43 54 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b  ECT ( - col0 ) +
3f70: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
3f80: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
3f90: 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d 0a 0d  .-19..-62..24...
3fa0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3fb0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
3fc0: 33 33 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  33 * col2 + col0
3fd0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
3fe0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 38 0d 0a  b1..----..1788..
3ff0: 32 30 30 39 0d 0a 33 33 32 38 0d 0a 0d 0a 6f 6e  2009..3328....on
4000: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
4010: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
4020: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
4030: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
4040: 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 0d 0a 53  ort label-108..S
4050: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 44 49 56  ELECT - col0 DIV
4060: 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32   + col0 + - col2
4070: 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 46 52   + ( - col1 ) FR
4080: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
4090: 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d 0a 2d 35 39 0d  .----..-56..-59.
40a0: 0a 2d 38 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-86....skipif m
40b0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
40c0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
40d0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38  owsort label-108
40e0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
40f0: 2f 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  / + col0 + - col
4100: 32 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 46  2 + ( - col1 ) F
4110: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
4120: 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d 0a 2d 35 39  ..----..-56..-59
4130: 0d 0a 2d 38 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-86....onlyif 
4140: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
4150: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
4160: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
4170: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
4180: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
4190: 6c 2d 31 30 39 0d 0a 53 45 4c 45 43 54 20 2b 20  l-109..SELECT + 
41a0: 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  col0 + col0 + co
41b0: 6c 30 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20  l0 * CAST( NULL 
41c0: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
41d0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
41e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
41f0: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
4200: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
4210: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
4220: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
4230: 6c 61 62 65 6c 2d 31 30 39 0d 0a 53 45 4c 45 43  label-109..SELEC
4240: 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  T + col0 + col0 
4250: 2b 20 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20  + col0 * CAST ( 
4260: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
4270: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
4280: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
4290: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
42a0: 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
42b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
42c0: 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  LL + col0 * col1
42d0: 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f   + ( col2 ) * co
42e0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
42f0: 2d 2d 0d 0a 31 30 32 35 36 0d 0a 32 39 39 34 0d  --..10256..2994.
4300: 0a 33 38 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .3889....onlyif 
4310: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
4320: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
4330: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
4340: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4350: 61 62 65 6c 2d 31 31 31 0d 0a 53 45 4c 45 43 54  abel-111..SELECT
4360: 20 41 4c 4c 20 2d 20 74 61 62 31 2e 63 6f 6c 30   ALL - tab1.col0
4370: 20 2b 20 31 20 44 49 56 20 63 6f 6c 32 20 46 52   + 1 DIV col2 FR
4380: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
4390: 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73  3..-64..-80....s
43a0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
43b0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
43c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
43d0: 62 65 6c 2d 31 31 31 0d 0a 53 45 4c 45 43 54 20  bel-111..SELECT 
43e0: 41 4c 4c 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  ALL - tab1.col0 
43f0: 2b 20 31 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20  + 1 / col2 FROM 
4400: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a  tab1..----..-3..
4410: 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c 79  -64..-80....only
4420: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
4430: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
4440: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
4450: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4460: 74 20 6c 61 62 65 6c 2d 31 31 32 0d 0a 53 45 4c  t label-112..SEL
4470: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
4480: 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b 20 34 39 20  ol2 + col0 + 49 
4490: 44 49 56 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20  DIV + tab0.col1 
44a0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
44b0: 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d  ----..-9..34..7.
44c0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
44d0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
44e0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
44f0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
4500: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
4510: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
4520: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
4530: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4540: 2d 31 31 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  -112..SELECT DIS
4550: 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63  TINCT - col2 + c
4560: 6f 6c 30 20 2b 20 34 39 20 2f 20 2b 20 74 61 62  ol0 + 49 / + tab
4570: 30 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  0.col1 col2 FROM
4580: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d   tab0..----..-9.
4590: 0a 33 34 0d 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  .34..7....onlyif
45a0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
45b0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
45c0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
45d0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
45e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
45f0: 65 6c 2d 31 31 33 0d 0a 53 45 4c 45 43 54 20 41  el-113..SELECT A
4600: 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 35 33 20 2b  LL - col2 * 53 +
4610: 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 43   col0 * col1 + C
4620: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
4630: 4e 45 44 20 29 20 2a 20 2b 20 74 61 62 31 2e 63  NED ) * + tab1.c
4640: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
4650: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab1..----..NUL
4660: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
4670: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
4680: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
4690: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
46a0: 6c 61 62 65 6c 2d 31 31 33 0d 0a 53 45 4c 45 43  label-113..SELEC
46b0: 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 35  T ALL - col2 * 5
46c0: 33 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  3 + col0 * col1 
46d0: 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
46e0: 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 74   INTEGER ) * + t
46f0: 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  ab1.col1 AS col0
4700: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
4710: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
4720: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
4730: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
4740: 63 6f 6c 30 20 2a 20 2d 20 31 32 20 2b 20 63 6f  col0 * - 12 + co
4750: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
4760: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d  cor0..----..-10.
4770: 0a 2d 37 35 38 0d 0a 2d 39 34 37 0d 0a 0d 0a 73  .-758..-947....s
4780: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
4790: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
47a0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
47b0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
47c0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
47d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
47e0: 44 49 53 54 49 4e 43 54 20 36 33 20 63 6f 6c 31  DISTINCT 63 col1
47f0: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
4800: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4810: 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  63....query I ro
4820: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
4830: 62 30 2e 63 6f 6c 30 20 2b 20 38 30 20 2a 20 2b  b0.col0 + 80 * +
4840: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
4850: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
4860: 31 35 0d 0a 32 36 36 34 0d 0a 36 36 34 39 0d 0a  15..2664..6649..
4870: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4880: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
4890: 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 39 32 20 46  r0.col0 * - 92 F
48a0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
48b0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 34 34 0d 0a 2d 37  ..----..-644..-7
48c0: 31 37 36 0d 0a 2d 37 32 36 38 0d 0a 0d 0a 6f 6e  176..-7268....on
48d0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
48e0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
48f0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
4900: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
4910: 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 0d 0a 53  ort label-118..S
4920: 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63  ELECT col1 * + c
4930: 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b  ol2 + + col0 + +
4940: 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 44 49 56   col2 * col0 DIV
4950: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
4960: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  1 cor0..----..14
4970: 31 33 0d 0a 31 39 31 38 0d 0a 39 39 38 0d 0a 0d  13..1918..998...
4980: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
4990: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
49a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
49b0: 6c 61 62 65 6c 2d 31 31 38 0d 0a 53 45 4c 45 43  label-118..SELEC
49c0: 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20  T col1 * + col2 
49d0: 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  + + col0 + + col
49e0: 32 20 2a 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c  2 * col0 / + col
49f0: 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
4a00: 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 33 0d 0a 31 39  ..----..1413..19
4a10: 31 38 0d 0a 39 39 38 0d 0a 0d 0a 71 75 65 72 79  18..998....query
4a20: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4a30: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
4a40: 63 6f 6c 31 20 2b 20 2d 20 34 37 20 2a 20 2d 20  col1 + - 47 * - 
4a50: 63 6f 6c 31 20 2b 20 28 20 63 6f 72 30 2e 63 6f  col1 + ( cor0.co
4a60: 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l2 ) AS col2 FRO
4a70: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
4a80: 2d 2d 2d 2d 0d 0a 31 33 30 32 0d 0a 35 33 37 0d  ----..1302..537.
4a90: 0a 37 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .720....onlyif m
4aa0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
4ab0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
4ac0: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
4ad0: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
4ae0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4af0: 2d 31 32 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -120..SELECT ALL
4b00: 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
4b10: 20 44 45 43 49 4d 41 4c 20 29 20 2a 20 37 35 20   DECIMAL ) * 75 
4b20: 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  * + cor0.col2 AS
4b30: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
4b40: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
4b50: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
4b60: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
4b70: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
4b80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4b90: 74 20 6c 61 62 65 6c 2d 31 32 30 0d 0a 53 45 4c  t label-120..SEL
4ba0: 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28  ECT ALL + CAST (
4bb0: 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20   NULL AS REAL ) 
4bc0: 2a 20 37 35 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  * 75 * + cor0.co
4bd0: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
4be0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
4bf0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
4c00: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
4c10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4c20: 41 4c 4c 20 35 34 20 2a 20 2b 20 37 20 46 52 4f  ALL 54 * + 7 FRO
4c30: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
4c40: 2d 2d 2d 2d 0d 0a 33 37 38 0d 0a 33 37 38 0d 0a  ----..378..378..
4c50: 33 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  378....query I r
4c60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
4c70: 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31   + col0 + - col1
4c80: 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   + - cor0.col1 *
4c90: 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
4ca0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
4cb0: 2d 2d 0d 0a 2d 31 30 32 0d 0a 2d 34 36 0d 0a 2d  --..-102..-46..-
4cc0: 36 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  699....onlyif my
4cd0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
4ce0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
4cf0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
4d00: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
4d10: 65 6c 2d 31 32 33 0d 0a 53 45 4c 45 43 54 20 41  el-123..SELECT A
4d20: 4c 4c 20 2d 20 28 20 63 6f 6c 32 20 29 20 44 49  LL - ( col2 ) DI
4d30: 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  V col1 FROM tab2
4d40: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4d50: 2d 32 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -2..0..0....skip
4d60: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
4d70: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
4d80: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4d90: 2d 31 32 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -123..SELECT ALL
4da0: 20 2d 20 28 20 63 6f 6c 32 20 29 20 2f 20 63 6f   - ( col2 ) / co
4db0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
4dc0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  cor0..----..-2..
4dd0: 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
4de0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4df0: 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 28 20 2b  DISTINCT + + ( +
4e00: 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20 2d   cor0.col0 ) + -
4e10: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
4e20: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
4e30: 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d  --..-16..-51..7.
4e40: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4e50: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
4e60: 20 39 32 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c   92 + col1 * col
4e70: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
4e80: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
4e90: 2d 0d 0a 31 31 35 36 0d 0a 31 33 31 32 0d 0a 34  -..1156..1312..4
4ea0: 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  78....query I ro
4eb0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
4ec0: 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f  STINCT + cor0.co
4ed0: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
4ee0: 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
4ef0: 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 63 6f 72  SS JOIN tab0 cor
4f00: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d  1..----..24..35.
4f10: 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .89....query I r
4f20: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
4f30: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63   col2 + + cor0.c
4f40: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
4f50: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
4f60: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
4f70: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4f80: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
4f90: 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  l1 * cor0.col2 +
4fa0: 20 33 39 20 46 52 4f 4d 20 74 61 62 32 20 41 53   39 FROM tab2 AS
4fb0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
4fc0: 39 35 0d 0a 2d 36 30 37 0d 0a 2d 37 39 38 0d 0a  95..-607..-798..
4fd0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4fe0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
4ff0: 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  CT + cor0.col2 *
5000: 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 46 52 4f   col2 - col0 FRO
5010: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
5020: 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 31 30 36 35 0d  ----..-34..1065.
5030: 0a 36 36 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .6635....query I
5040: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5050: 20 41 4c 4c 20 2d 20 35 34 20 2a 20 63 6f 6c 32   ALL - 54 * col2
5060: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
5070: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
5080: 31 37 38 32 0d 0a 2d 34 34 32 38 0d 0a 2d 35 34  1782..-4428..-54
5090: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
50a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
50b0: 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  - col2 * col1 + 
50c0: 63 6f 6c 30 20 2a 20 2d 20 31 36 20 2a 20 2b 20  col0 * - 16 * + 
50d0: 63 6f 6c 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  col2 - - cor0.co
50e0: 6c 31 20 2a 20 28 20 63 6f 72 30 2e 63 6f 6c 32  l1 * ( cor0.col2
50f0: 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
5100: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32  cor0..----..-122
5110: 38 38 30 0d 0a 2d 32 35 39 32 0d 0a 2d 35 38 33  880..-2592..-583
5120: 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  68....query I ro
5130: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
5140: 4c 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  L - - col2 * - c
5150: 6f 72 30 2e 63 6f 6c 32 20 2b 20 37 35 20 2a 20  or0.col2 + 75 * 
5160: 32 38 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  28 * col2 AS col
5170: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
5180: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 39 32 34  or0..----..53924
5190: 0d 0a 35 35 39 37 31 0d 0a 37 38 33 35 36 0d 0a  ..55971..78356..
51a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
51b0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
51c0: 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  CT - + col0 * - 
51d0: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41 53  col1 * + col1 AS
51e0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
51f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
5200: 37 37 35 30 34 0d 0a 33 32 39 33 31 35 0d 0a 37  77504..329315..7
5210: 33 37 30 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  37009....onlyif 
5220: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
5230: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
5240: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
5250: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5260: 61 62 65 6c 2d 31 33 34 0d 0a 53 45 4c 45 43 54  abel-134..SELECT
5270: 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 2b 20   ALL - col2 + + 
5280: 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 32 20  col1 DIV - col2 
5290: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
52a0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35  0..----..-54..-5
52b0: 37 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  7..-96....skipif
52c0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
52d0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
52e0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
52f0: 33 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  34..SELECT ALL -
5300: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2f   col2 + + col1 /
5310: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
5320: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
5330: 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a  .-54..-57..-96..
5340: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5350: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
5360: 6c 32 20 2b 20 28 20 2b 20 63 6f 6c 32 20 2b 20  l2 + ( + col2 + 
5370: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 29 20  col0 * - col0 ) 
5380: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
5390: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 38 32 0d 0a  0..----..-3982..
53a0: 2d 36 32 30 38 0d 0a 39 39 0d 0a 0d 0a 71 75 65  -6208..99....que
53b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
53c0: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 28 20  LECT - col1 + ( 
53d0: 2b 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c  + col1 ) * + col
53e0: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
53f0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
5400: 2d 0d 0a 31 39 37 38 0d 0a 33 32 39 38 0d 0a 38  -..1978..3298..8
5410: 30 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  008....query I r
5420: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
5430: 4c 4c 20 63 6f 6c 32 20 2b 20 2b 20 38 35 20 41  LL col2 + + 85 A
5440: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
5450: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a 31 31 32  ..----..111..112
5460: 0d 0a 31 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..123....query I
5470: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5480: 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
5490: 6c 31 20 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20  l1 + - ( col2 ) 
54a0: 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  + col1 * + col1 
54b0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
54c0: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  2 cor0..----..26
54d0: 38 0d 0a 33 35 31 34 0d 0a 39 36 35 0d 0a 0d 0a  8..3514..965....
54e0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
54f0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
5500: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
5510: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
5520: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
5530: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5540: 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   - col2 * + col0
5550: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   * - cor0.col2 +
5560: 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20   col0 col2 FROM 
5570: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
5580: 2d 2d 0d 0a 32 30 38 30 30 30 0d 0a 37 33 37 33  --..208000..7373
5590: 36 30 0d 0a 38 37 35 31 0d 0a 0d 0a 71 75 65 72  60..8751....quer
55a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
55b0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
55c0: 6f 6c 32 20 2a 20 2b 20 34 38 20 46 52 4f 4d 20  ol2 * + 48 FROM 
55d0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
55e0: 2d 2d 0d 0a 2d 31 35 38 34 0d 0a 2d 33 39 33 36  --..-1584..-3936
55f0: 0d 0a 2d 34 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-48....onlyif 
5600: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
5610: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
5620: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
5630: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
5640: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
5650: 6c 2d 31 34 31 0d 0a 53 45 4c 45 43 54 20 2b 20  l-141..SELECT + 
5660: 2b 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28  + col2 * - CAST(
5670: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
5680: 29 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63  ) + - col0 * + c
5690: 6f 6c 31 20 2b 20 2b 20 34 32 20 41 53 20 63 6f  ol1 + + 42 AS co
56a0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
56b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
56c0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
56d0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
56e0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
56f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5700: 61 62 65 6c 2d 31 34 31 0d 0a 53 45 4c 45 43 54  abel-141..SELECT
5710: 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 43 41   + + col2 * - CA
5720: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
5730: 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c 30 20  EGER ) + - col0 
5740: 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 34 32 20  * + col1 + + 42 
5750: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
5760: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
5770: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
5780: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  L....skipif post
5790: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
57a0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
57b0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
57c0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
57d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
57e0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
57f0: 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 33 30 20 2a  r0.col2 + + 30 *
5800: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c   + cor0.col2 col
5810: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
5820: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 38 0d  or0..----..1178.
5830: 0a 38 30 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65  .806..837....que
5840: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5850: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
5860: 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  + col2 * col1 + 
5870: 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  ( col1 ) FROM ta
5880: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
5890: 0d 0a 2d 31 34 37 35 0d 0a 2d 36 32 39 0d 0a 2d  ..-1475..-629..-
58a0: 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  806....query I r
58b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
58c0: 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 28 20  LL - col0 + - ( 
58d0: 37 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  71 ) AS col1 FRO
58e0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
58f0: 2d 2d 2d 2d 0d 0a 2d 31 33 35 0d 0a 2d 31 35 31  ----..-135..-151
5900: 0d 0a 2d 37 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-74....onlyif 
5910: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
5920: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
5930: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
5940: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
5950: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
5960: 6c 2d 31 34 35 0d 0a 53 45 4c 45 43 54 20 44 49  l-145..SELECT DI
5970: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20  STINCT - col2 + 
5980: 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
5990: 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31  SIGNED ) AS col1
59a0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
59b0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
59c0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
59d0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
59e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
59f0: 20 6c 61 62 65 6c 2d 31 34 35 0d 0a 53 45 4c 45   label-145..SELE
5a00: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
5a10: 6c 32 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55  l2 + - CAST ( NU
5a20: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
5a30: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
5a40: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
5a50: 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .NULL....onlyif 
5a60: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
5a70: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
5a80: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
5a90: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5aa0: 61 62 65 6c 2d 31 34 36 0d 0a 53 45 4c 45 43 54  abel-146..SELECT
5ab0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b   DISTINCT col0 +
5ac0: 20 63 6f 6c 30 20 44 49 56 20 32 37 20 63 6f 6c   col0 DIV 27 col
5ad0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
5ae0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 36  or0..----..3..66
5af0: 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..82....skipif p
5b00: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
5b10: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
5b20: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
5b30: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
5b40: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
5b50: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
5b60: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
5b70: 6c 61 62 65 6c 2d 31 34 36 0d 0a 53 45 4c 45 43  label-146..SELEC
5b80: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
5b90: 2b 20 63 6f 6c 30 20 2f 20 32 37 20 63 6f 6c 30  + col0 / 27 col0
5ba0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
5bb0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 36 0d  r0..----..3..66.
5bc0: 0a 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .82....onlyif my
5bd0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
5be0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
5bf0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
5c00: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
5c10: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
5c20: 31 34 37 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  147..SELECT cor0
5c30: 2e 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28 20  .col0 * + CAST( 
5c40: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
5c50: 20 2b 20 2b 20 37 30 20 41 53 20 63 6f 6c 31 20   + + 70 AS col1 
5c60: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
5c70: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
5c80: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
5c90: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
5ca0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
5cb0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
5cc0: 6c 2d 31 34 37 0d 0a 53 45 4c 45 43 54 20 63 6f  l-147..SELECT co
5cd0: 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54  r0.col0 * + CAST
5ce0: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
5cf0: 45 52 20 29 20 2b 20 2b 20 37 30 20 41 53 20 63  ER ) + + 70 AS c
5d00: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
5d10: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
5d20: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
5d30: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5d40: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20  ..SELECT col2 - 
5d50: 2b 20 31 31 20 2a 20 2b 20 63 6f 6c 31 20 41 53  + 11 * + col1 AS
5d60: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
5d70: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
5d80: 31 30 36 36 0d 0a 2d 39 31 33 0d 0a 2d 39 31 39  1066..-913..-919
5d90: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5da0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
5db0: 72 30 2e 63 6f 6c 31 20 2d 20 2d 20 63 6f 72 30  r0.col1 - - cor0
5dc0: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
5dd0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
5de0: 32 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 71 75  23..54..67....qu
5df0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5e00: 45 4c 45 43 54 20 2d 20 38 37 20 2d 20 2b 20 63  ELECT - 87 - + c
5e10: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
5e20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
5e30: 31 0d 0a 2d 31 32 32 0d 0a 2d 31 37 36 0d 0a 0d  1..-122..-176...
5e40: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5e50: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
5e60: 2b 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  + + ( + cor0.col
5e70: 30 20 29 20 2a 20 2b 20 39 35 20 2a 20 63 6f 6c  0 ) * + 95 * col
5e80: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
5e90: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
5ea0: 33 38 39 30 35 36 0d 0a 36 30 37 39 32 30 0d 0a  389056..607920..
5eb0: 38 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  852....query I r
5ec0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
5ed0: 20 34 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   4 + col0 * + co
5ee0: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
5ef0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
5f00: 2d 2d 0d 0a 33 31 0d 0a 37 32 39 34 0d 0a 37 38  --..31..7294..78
5f10: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
5f20: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
5f30: 20 2b 20 2b 20 31 20 2a 20 63 6f 6c 30 20 46 52   + + 1 * col0 FR
5f40: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
5f50: 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38  .----..24..35..8
5f60: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
5f70: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
5f80: 20 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab0.col2 FROM 
5f90: 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30 2c  tab0, tab1 cor0,
5fa0: 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
5fb0: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
5fc0: 61 73 68 69 6e 67 20 74 6f 20 37 37 38 36 37 31  ashing to 778671
5fd0: 38 62 64 38 30 34 32 30 32 32 35 33 37 33 37 38  8bd8042022537378
5fe0: 64 34 30 65 63 38 37 34 37 35 0d 0a 0d 0a 71 75  d40ec87475....qu
5ff0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6000: 45 4c 45 43 54 20 34 39 20 2b 20 2d 20 74 61 62  ELECT 49 + - tab
6010: 32 2e 63 6f 6c 30 20 2a 20 36 20 41 53 20 63 6f  2.col0 * 6 AS co
6020: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
6030: 2d 2d 0d 0a 2d 34 31 39 0d 0a 2d 34 32 35 0d 0a  --..-419..-425..
6040: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
6050: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
6060: 20 33 38 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20   38 * cor0.col2 
6070: 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + + col2 * - col
6080: 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
6090: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
60a0: 0d 0a 2d 32 34 39 32 31 0d 0a 2d 38 39 35 31 38  ..-24921..-89518
60b0: 0d 0a 2d 39 35 33 38 0d 0a 0d 0a 71 75 65 72 79  ..-9538....query
60c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
60d0: 43 54 20 33 39 20 2a 20 63 6f 6c 30 20 46 52 4f  CT 39 * col0 FRO
60e0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab0..----..13
60f0: 36 35 0d 0a 33 34 37 31 0d 0a 39 33 36 0d 0a 0d  65..3471..936...
6100: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6110: 0d 0a 53 45 4c 45 43 54 20 2b 20 32 34 20 2a 20  ..SELECT + 24 * 
6120: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52  + col1 + col2 FR
6130: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
6140: 2d 2d 0d 0a 32 39 37 0d 0a 34 30 38 0d 0a 36 37  --..297..408..67
6150: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
6160: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
6170: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
6180: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
6190: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
61a0: 2d 31 35 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -159..SELECT ALL
61b0: 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f   - col2 DIV - co
61c0: 6c 31 20 2d 20 63 6f 6c 30 20 2a 20 39 30 20 63  l1 - col0 * 90 c
61d0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
61e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 38 0d 0a  r0..----..-268..
61f0: 2d 35 37 35 35 0d 0a 2d 37 31 39 33 0d 0a 0d 0a  -5755..-7193....
6200: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
6210: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
6220: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
6230: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
6240: 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
6250: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
6260: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
6270: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
6280: 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  9..SELECT ALL - 
6290: 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 2d 20  col2 / - col1 - 
62a0: 63 6f 6c 30 20 2a 20 39 30 20 63 6f 6c 31 20 46  col0 * 90 col1 F
62b0: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
62c0: 2d 2d 2d 0d 0a 2d 32 36 38 0d 0a 2d 35 37 35 35  ---..-268..-5755
62d0: 0d 0a 2d 37 31 39 33 0d 0a 0d 0a 71 75 65 72 79  ..-7193....query
62e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
62f0: 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  CT + col0 * col2
6300: 20 2a 20 2b 20 34 32 20 41 53 20 63 6f 6c 30 20   * + 42 AS col0 
6310: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
6320: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 32 31 36 0d  0..----..153216.
6330: 0a 33 32 32 35 36 30 0d 0a 36 38 30 34 0d 0a 0d  .322560..6804...
6340: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6350: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
6360: 2d 20 63 6f 6c 32 20 2b 20 32 30 20 41 53 20 63  - col2 + 20 AS c
6370: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
6380: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
6390: 39 36 0d 0a 2d 33 32 32 39 0d 0a 2d 39 31 39 36  96..-3229..-9196
63a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
63b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
63c0: 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   + - cor0.col1 *
63d0: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
63e0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
63f0: 35 36 0d 0a 2d 36 35 30 0d 0a 2d 39 30 0d 0a 0d  56..-650..-90...
6400: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6410: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
6420: 54 20 2d 20 37 20 2b 20 2b 20 63 6f 6c 30 20 2a  T - 7 + + col0 *
6430: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
6440: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
6450: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 34 30 38 39  0..----..2..4089
6460: 0d 0a 36 33 39 33 0d 0a 0d 0a 71 75 65 72 79 20  ..6393....query 
6470: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6480: 54 20 41 4c 4c 20 2d 20 2d 20 37 20 2a 20 2d 20  T ALL - - 7 * - 
6490: 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 34 30 20 46  cor0.col0 - 40 F
64a0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
64b0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 38 0d 0a 2d 36  ..----..-488..-6
64c0: 30 30 0d 0a 2d 36 31 0d 0a 0d 0a 6f 6e 6c 79 69  00..-61....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 36 35 0d 0a 53 45 4c 45   label-165..SELE
6520: 43 54 20 2b 20 36 31 20 2a 20 2b 20 63 6f 72 30  CT + 61 * + cor0
6530: 2e 63 6f 6c 32 20 2d 20 2d 20 28 20 63 6f 6c 32  .col2 - - ( col2
6540: 20 29 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63   ) DIV col0 AS c
6550: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
6560: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 31   cor0..----..201
6570: 34 0d 0a 35 30 30 32 0d 0a 36 31 0d 0a 0d 0a 73  4..5002..61....s
6580: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
6590: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
65a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
65b0: 62 65 6c 2d 31 36 35 0d 0a 53 45 4c 45 43 54 20  bel-165..SELECT 
65c0: 2b 20 36 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  + 61 * + cor0.co
65d0: 6c 32 20 2d 20 2d 20 28 20 63 6f 6c 32 20 29 20  l2 - - ( col2 ) 
65e0: 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  / col0 AS col1 F
65f0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
6600: 0d 0a 2d 2d 2d 2d 0d 0a 32 30 31 34 0d 0a 35 30  ..----..2014..50
6610: 30 32 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72 79 20  02..61....query 
6620: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6630: 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2a  T ALL - - col2 *
6640: 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 46   + col0 - col1 F
6650: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
6660: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d 0a 31 39 36  ..----..158..196
6670: 39 0d 0a 32 39 38 35 0d 0a 0d 0a 71 75 65 72 79  9..2985....query
6680: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6690: 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30  CT col1 + - col0
66a0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
66b0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
66c0: 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71  54..-67..23....q
66d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
66e0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
66f0: 2d 20 63 6f 6c 31 20 2a 20 39 35 20 41 53 20 63  - col1 * 95 AS c
6700: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
6710: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
6720: 33 35 0d 0a 2d 32 34 37 30 0d 0a 2d 39 35 30 0d  35..-2470..-950.
6730: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6740: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
6750: 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 34  NCT - - col1 + 4
6760: 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  4 AS col2 FROM t
6770: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
6780: 2d 0d 0a 31 30 33 0d 0a 36 31 0d 0a 37 35 0d 0a  -..103..61..75..
6790: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
67a0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
67b0: 6c 31 20 2a 20 39 20 2b 20 2d 20 39 38 20 46 52  l1 * 9 + - 98 FR
67c0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
67d0: 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 31 33 36 0d 0a  .----..-8..136..
67e0: 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  19....query I ro
67f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
6800: 4c 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 28  L + + col1 + + (
6810: 20 2d 20 31 30 20 29 20 2a 20 2b 20 63 6f 6c 32   - 10 ) * + col2
6820: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
6830: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 31 0d 0a  r0..----..-201..
6840: 2d 32 33 39 0d 0a 2d 33 36 33 0d 0a 0d 0a 71 75  -239..-363....qu
6850: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6860: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
6870: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b   col0 + - col0 +
6880: 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
6890: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
68a0: 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d  .-3..-64..-80...
68b0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
68c0: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
68d0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
68e0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
68f0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
6900: 6f 72 74 20 6c 61 62 65 6c 2d 31 37 33 0d 0a 53  ort label-173..S
6910: 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55  ELECT + CAST( NU
6920: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  LL AS SIGNED ) F
6930: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
6940: 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32   CROSS JOIN tab2
6950: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
6960: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
6970: 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31   cd7a7901e47c151
6980: 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30  55404aff0d216fe0
6990: 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  b....skipif mysq
69a0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
69b0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
69c0: 6f 72 74 20 6c 61 62 65 6c 2d 31 37 33 0d 0a 53  ort label-173..S
69d0: 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 4e  ELECT + CAST ( N
69e0: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
69f0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
6a00: 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
6a10: 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  b2 cor1..----..9
6a20: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
6a30: 74 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31  to cd7a7901e47c1
6a40: 35 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66  5155404aff0d216f
6a50: 65 30 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  e0b....query I r
6a60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
6a70: 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2b  LL + tab1.col2 +
6a80: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
6a90: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
6aa0: 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d  .121..176..57...
6ab0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
6ac0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
6ad0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
6ae0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
6af0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 35  owsort label-175
6b00: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
6b10: 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e  T col1 + + cor0.
6b20: 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 2d 20  col1 DIV col0 - 
6b30: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
6b40: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6b50: 31 31 38 0d 0a 33 34 0d 0a 36 36 0d 0a 0d 0a 73  118..34..66....s
6b60: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
6b70: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
6b80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
6b90: 62 65 6c 2d 31 37 35 0d 0a 53 45 4c 45 43 54 20  bel-175..SELECT 
6ba0: 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20  DISTINCT col1 + 
6bb0: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f  + cor0.col1 / co
6bc0: 6c 30 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l0 - - col1 FROM
6bd0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
6be0: 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a 36 36  ---..118..34..66
6bf0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6c00: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 30  ort..SELECT + 20
6c10: 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
6c20: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
6c30: 0a 31 37 32 30 0d 0a 31 38 32 30 0d 0a 31 39 34  .1720..1820..194
6c40: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
6c50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
6c60: 54 49 4e 43 54 20 2b 20 2b 20 28 20 34 32 20 29  TINCT + + ( 42 )
6c70: 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * + col2 AS col
6c80: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
6c90: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 36 0d  or0..----..1386.
6ca0: 0a 33 34 34 34 0d 0a 34 32 0d 0a 0d 0a 71 75 65  .3444..42....que
6cb0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
6cc0: 4c 45 43 54 20 2d 20 28 20 63 6f 72 30 2e 63 6f  LECT - ( cor0.co
6cd0: 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41 53  l1 ) * + col1 AS
6ce0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
6cf0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
6d00: 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d  100..-169..-676.
6d10: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
6d20: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
6d30: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
6d40: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
6d50: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
6d60: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6d70: 45 43 54 20 2b 20 34 33 20 63 6f 6c 32 20 46 52  ECT + 43 col2 FR
6d80: 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
6d90: 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
6da0: 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or1, tab0 AS cor
6db0: 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  2..----..81 valu
6dc0: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 33  es hashing to 53
6dd0: 62 32 66 31 33 39 61 30 37 66 38 35 36 61 63 34  b2f139a07f856ac4
6de0: 34 61 31 31 35 38 65 66 64 34 65 36 33 64 0d 0a  4a1158efd4e63d..
6df0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6e00: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 28 20  t..SELECT - - ( 
6e10: 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 31 20  col0 ) * + col1 
6e20: 2a 20 35 38 20 41 53 20 63 6f 6c 32 20 46 52 4f  * 58 AS col2 FRO
6e30: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
6e40: 2d 0d 0a 31 31 39 37 31 32 0d 0a 31 39 36 39 31  -..119712..19691
6e50: 30 0d 0a 34 36 39 37 34 32 0d 0a 0d 0a 71 75 65  0..469742....que
6e60: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
6e70: 4c 45 43 54 20 2b 20 39 31 20 2b 20 63 6f 72 30  LECT + 91 + cor0
6e80: 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41  .col2 * - col0 A
6e90: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
6ea0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6eb0: 2d 33 35 35 37 0d 0a 2d 37 31 0d 0a 2d 37 35 38  -3557..-71..-758
6ec0: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
6ed0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
6ee0: 54 49 4e 43 54 20 28 20 38 31 20 29 20 46 52 4f  TINCT ( 81 ) FRO
6ef0: 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  M tab1, tab1 AS 
6f00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 31 0d 0a  cor0..----..81..
6f10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6f20: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
6f30: 43 54 20 31 30 20 2a 20 63 6f 72 30 2e 63 6f 6c  CT 10 * cor0.col
6f40: 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
6f50: 0d 0a 2d 2d 2d 2d 0d 0a 33 30 0d 0a 36 34 30 0d  ..----..30..640.
6f60: 0a 38 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .800....query I 
6f70: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6f80: 44 49 53 54 49 4e 43 54 20 2d 20 38 35 20 2d 20  DISTINCT - 85 - 
6f90: 2b 20 34 36 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 46 AS col2 FRO
6fa0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
6fb0: 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
6fc0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
6fd0: 32 38 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  28 FROM tab0, ta
6fe0: 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b2 AS cor0, tab2
6ff0: 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31 20 63   AS cor1, tab1 c
7000: 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61  or2..----..81 va
7010: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
7020: 37 30 65 39 32 63 32 31 38 34 33 33 31 36 33 39  70e92c2184331639
7030: 32 32 38 36 37 38 39 39 61 31 36 65 31 32 36 39  22867899a16e1269
7040: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7050: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
7060: 49 4e 43 54 20 2d 20 28 20 74 61 62 31 2e 63 6f  INCT - ( tab1.co
7070: 6c 30 20 29 20 2d 20 2b 20 63 6f 6c 32 20 46 52  l0 ) - + col2 FR
7080: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
7090: 31 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a  121..-176..-57..
70a0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
70b0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
70c0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
70d0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
70e0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38  rowsort label-18
70f0: 37 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63  7..SELECT tab1.c
7100: 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 63  ol2 DIV - col0 c
7110: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
7120: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 38 0d 0a 30 0d  ---..-1..-18..0.
7130: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
7140: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
7150: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
7160: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
7170: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
7180: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
7190: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
71a0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
71b0: 2d 31 38 37 0d 0a 53 45 4c 45 43 54 20 74 61 62  -187..SELECT tab
71c0: 31 2e 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20  1.col2 / - col0 
71d0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
71e0: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 38 0d 0a 30  ----..-1..-18..0
71f0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
7200: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
7210: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
7220: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
7230: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
7240: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7250: 4c 45 43 54 20 41 4c 4c 20 2d 20 37 31 20 63 6f  LECT ALL - 71 co
7260: 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
7270: 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b0 AS cor0, tab1
7280: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
7290: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
72a0: 67 20 74 6f 20 33 39 30 37 65 30 61 61 34 66 32  g to 3907e0aa4f2
72b0: 39 63 30 30 32 31 32 30 37 34 32 63 34 61 62 62  9c002120742c4abb
72c0: 33 65 32 33 61 0d 0a 0d 0a 71 75 65 72 79 20 49  3e23a....query I
72d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
72e0: 20 44 49 53 54 49 4e 43 54 20 39 30 20 46 52 4f   DISTINCT 90 FRO
72f0: 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  M tab0, tab0 AS 
7300: 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
7310: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 30 0d 0a 0d 0a  r1..----..90....
7320: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
7330: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
7340: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
7350: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
7360: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 30 0d  wsort label-190.
7370: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
7380: 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 63 6f  cor0.col0 DIV co
7390: 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  l1 + cor0.col1 *
73a0: 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   - col1 AS col1 
73b0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
73c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a  0..----..-7396..
73d0: 2d 38 32 38 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a  -8281..-9409....
73e0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
73f0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
7400: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
7410: 61 62 65 6c 2d 31 39 30 0d 0a 53 45 4c 45 43 54  abel-190..SELECT
7420: 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f   ALL - + cor0.co
7430: 6c 30 20 2f 20 63 6f 6c 31 20 2b 20 63 6f 72 30  l0 / col1 + cor0
7440: 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41  .col1 * - col1 A
7450: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
7460: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7470: 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39  -7396..-8281..-9
7480: 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  409....query I r
7490: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
74a0: 49 53 54 49 4e 43 54 20 2d 20 39 35 20 2a 20 2d  ISTINCT - 95 * -
74b0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
74c0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
74d0: 0a 2d 2d 2d 2d 0d 0a 32 34 37 30 0d 0a 32 35 36  .----..2470..256
74e0: 35 0d 0a 33 36 31 30 0d 0a 0d 0a 71 75 65 72 79  5..3610....query
74f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7500: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
7510: 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 31 20 2b 20  col1 ) * col1 + 
7520: 32 33 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  23 * + cor0.col0
7530: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
7540: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 33 34 0d  r0..----..-6234.
7550: 0a 2d 36 38 34 34 0d 0a 2d 38 36 30 34 0d 0a 0d  .-6844..-8604...
7560: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7570: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
7580: 54 20 2d 20 2b 20 33 39 20 2b 20 63 6f 6c 30 20  T - + 39 + col0 
7590: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
75a0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
75b0: 0a 2d 33 36 0d 0a 32 35 0d 0a 34 31 0d 0a 0d 0a  .-36..25..41....
75c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
75d0: 0a 53 45 4c 45 43 54 20 34 35 20 2b 20 63 6f 6c  .SELECT 45 + col
75e0: 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  2 * - col0 AS co
75f0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
7600: 2d 2d 0d 0a 2d 37 32 35 33 0d 0a 2d 37 34 37 0d  --..-7253..-747.
7610: 0a 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .10....onlyif my
7620: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
7630: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
7640: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
7650: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
7660: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7670: 31 39 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  195..SELECT DIST
7680: 49 4e 43 54 20 28 20 2b 20 63 6f 6c 31 20 29 20  INCT ( + col1 ) 
7690: 2b 20 37 20 2b 20 28 20 2b 20 63 6f 6c 32 20 2b  + 7 + ( + col2 +
76a0: 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
76b0: 20 44 45 43 49 4d 41 4c 20 29 20 29 20 41 53 20   DECIMAL ) ) AS 
76c0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
76d0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
76e0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
76f0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
7700: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
7710: 65 6c 2d 31 39 35 0d 0a 53 45 4c 45 43 54 20 44  el-195..SELECT D
7720: 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c 31  ISTINCT ( + col1
7730: 20 29 20 2b 20 37 20 2b 20 28 20 2b 20 63 6f 6c   ) + 7 + ( + col
7740: 32 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  2 + - CAST ( NUL
7750: 4c 20 41 53 20 52 45 41 4c 20 29 20 29 20 41 53  L AS REAL ) ) AS
7760: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
7770: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
7780: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7790: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
77a0: 63 6f 6c 32 20 2a 20 35 38 20 2a 20 34 38 20 46  col2 * 58 * 48 F
77b0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
77c0: 31 35 30 33 39 30 0d 0a 31 35 38 37 34 35 0d 0a  150390..158745..
77d0: 32 36 37 33 36 30 0d 0a 0d 0a 73 6b 69 70 69 66  267360....skipif
77e0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
77f0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
7800: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
7810: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
7820: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
7830: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33  rt..SELECT ALL 3
7840: 37 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  7 + - col1 * col
7850: 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  1 col0 FROM tab0
7860: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7870: 2d 37 33 35 39 0d 0a 2d 38 32 34 34 0d 0a 2d 39  -7359..-8244..-9
7880: 33 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  372....query I r
7890: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35  owsort..SELECT 5
78a0: 31 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  1 - + col0 AS co
78b0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
78c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d  cor0..----..-27.
78d0: 0a 2d 32 38 0d 0a 34 34 0d 0a 0d 0a 71 75 65 72  .-28..44....quer
78e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
78f0: 45 43 54 20 41 4c 4c 20 2d 20 35 35 20 46 52 4f  ECT ALL - 55 FRO
7900: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
7910: 2d 0d 0a 2d 35 35 0d 0a 2d 35 35 0d 0a 2d 35 35  -..-55..-55..-55
7920: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7930: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
7940: 2b 20 2b 20 31 38 20 2a 20 63 6f 6c 31 20 2b 20  + + 18 * col1 + 
7950: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
7960: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
7970: 33 34 0d 0a 31 37 32 39 0d 0a 31 38 34 33 0d 0a  34..1729..1843..
7980: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7990: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
79a0: 20 2a 20 63 6f 6c 30 20 2d 20 28 20 2d 20 63 6f   * col0 - ( - co
79b0: 6c 31 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63  l1 + col1 ) AS c
79c0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
79d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32   cor0..----..122
79e0: 35 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a  5..576..7921....
79f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7a00: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
7a10: 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 * cor0.col0 
7a20: 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52  - col2 * col1 FR
7a30: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
7a40: 0a 2d 2d 2d 2d 0d 0a 2d 37 38 38 0d 0a 34 35 35  .----..-788..455
7a50: 30 0d 0a 35 35 39 35 0d 0a 0d 0a 6f 6e 6c 79 69  0..5595....onlyi
7a60: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
7a70: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
7a80: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
7a90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7aa0: 20 6c 61 62 65 6c 2d 32 30 33 0d 0a 53 45 4c 45   label-203..SELE
7ab0: 43 54 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56 20  CT ALL col2 DIV 
7ac0: 28 20 32 30 20 29 20 41 53 20 63 6f 6c 32 20 46  ( 20 ) AS col2 F
7ad0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
7ae0: 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69  1..1..1....skipi
7af0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
7b00: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
7b10: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7b20: 32 30 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  203..SELECT ALL 
7b30: 63 6f 6c 32 20 2f 20 28 20 32 30 20 29 20 41 53  col2 / ( 20 ) AS
7b40: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
7b50: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a  .----..1..1..1..
7b60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7b70: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
7b80: 43 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2d 20  CT - ( col0 ) - 
7b90: 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
7ba0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
7bb0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32  ..----..-19..-62
7bc0: 0d 0a 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..24....onlyif m
7bd0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
7be0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
7bf0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
7c00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
7c10: 62 65 6c 2d 32 30 35 0d 0a 53 45 4c 45 43 54 20  bel-205..SELECT 
7c20: 2b 20 37 37 20 44 49 56 20 2b 20 63 6f 6c 32 20  + 77 DIV + col2 
7c30: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
7c40: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  1 cor0..----..0.
7c50: 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..1....skipif 
7c60: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
7c70: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
7c80: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30  rowsort label-20
7c90: 35 0d 0a 53 45 4c 45 43 54 20 2b 20 37 37 20 2f  5..SELECT + 77 /
7ca0: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   + col2 AS col0 
7cb0: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
7cc0: 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d  ----..0..1..1...
7cd0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7ce0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 31  ..SELECT ALL - 1
7cf0: 33 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  3 * - cor0.col0 
7d00: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  * - cor0.col1 FR
7d10: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
7d20: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 32 38 37 0d 0a  .----..-105287..
7d30: 2d 32 36 38 33 32 0d 0a 2d 34 34 31 33 35 0d 0a  -26832..-44135..
7d40: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
7d50: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
7d60: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
7d70: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
7d80: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
7d90: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7da0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
7db0: 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 36 20 63 6f  r0.col0 * + 6 co
7dc0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
7dd0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a  cor0..----..18..
7de0: 33 38 34 0d 0a 34 38 30 0d 0a 0d 0a 73 6b 69 70  384..480....skip
7df0: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
7e00: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
7e10: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
7e20: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
7e30: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
7e40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
7e50: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   - cor0.col1 + c
7e60: 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
7e70: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
7e80: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c  ..0..0..0....onl
7e90: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
7ea0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
7eb0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
7ec0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
7ed0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7ee0: 6c 61 62 65 6c 2d 32 30 39 0d 0a 53 45 4c 45 43  label-209..SELEC
7ef0: 54 20 41 4c 4c 20 2b 20 43 41 53 54 28 20 4e 55  T ALL + CAST( NU
7f00: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f  LL AS SIGNED ) /
7f10: 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b   - col2 + col2 +
7f20: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 63   - cor0.col0 / c
7f30: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
7f40: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
7f50: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
7f60: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
7f70: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
7f80: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7f90: 6c 61 62 65 6c 2d 32 30 39 0d 0a 53 45 4c 45 43  label-209..SELEC
7fa0: 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28 20 4e  T ALL + CAST ( N
7fb0: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
7fc0: 20 2f 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   / - col2 + col2
7fd0: 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2f   + - cor0.col0 /
7fe0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
7ff0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
8000: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
8010: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8020: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
8030: 20 63 6f 6c 32 20 2b 20 2b 20 35 39 20 46 52 4f   col2 + + 59 FRO
8040: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
8050: 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31 31 36 0d 0a  ----..113..116..
8060: 31 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  155....query I r
8070: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
8080: 20 38 39 20 46 52 4f 4d 20 74 61 62 30 20 63 6f   89 FROM tab0 co
8090: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 39 0d 0a 38 39  r0..----..89..89
80a0: 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..89....query I 
80b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
80c0: 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20 63  DISTINCT + ( + c
80d0: 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2b  ol2 ) * - col2 +
80e0: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
80f0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
8100: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30  cor0..----..-140
8110: 36 0d 0a 2d 36 35 30 0d 0a 2d 37 30 32 0d 0a 0d  6..-650..-702...
8120: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8130: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34  ..SELECT ALL + 4
8140: 34 20 2a 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20  4 * ( cor0.col0 
8150: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
8160: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
8170: 2d 0d 0a 33 30 38 0d 0a 33 34 33 32 0d 0a 33 34  -..308..3432..34
8180: 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
8190: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
81a0: 35 38 20 2a 20 2d 20 28 20 63 6f 6c 30 20 2b 20  58 * - ( col0 + 
81b0: 2d 20 33 33 20 29 20 46 52 4f 4d 20 74 61 62 32  - 33 ) FROM tab2
81c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
81d0: 2d 32 36 31 30 0d 0a 2d 32 36 36 38 0d 0a 31 35  -2610..-2668..15
81e0: 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  08....onlyif mys
81f0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
8200: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
8210: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
8220: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
8230: 6c 2d 32 31 35 0d 0a 53 45 4c 45 43 54 20 44 49  l-215..SELECT DI
8240: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 44 49  STINCT - col1 DI
8250: 56 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  V + col1 + col1 
8260: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
8270: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
8280: 0a 31 36 0d 0a 33 30 0d 0a 35 38 0d 0a 0d 0a 73  .16..30..58....s
8290: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
82a0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
82b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
82c0: 62 65 6c 2d 32 31 35 0d 0a 53 45 4c 45 43 54 20  bel-215..SELECT 
82d0: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
82e0: 2f 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  / + col1 + col1 
82f0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
8300: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
8310: 0a 31 36 0d 0a 33 30 0d 0a 35 38 0d 0a 0d 0a 6f  .16..30..58....o
8320: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
8330: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
8340: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
8350: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
8360: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31 36 0d 0a  sort label-216..
8370: 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20  SELECT - + col0 
8380: 44 49 56 20 33 34 20 41 53 20 63 6f 6c 31 20 46  DIV 34 AS col1 F
8390: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
83a0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a  ..----..-1..-2..
83b0: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
83c0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
83d0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
83e0: 6f 72 74 20 6c 61 62 65 6c 2d 32 31 36 0d 0a 53  ort label-216..S
83f0: 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2f  ELECT - + col0 /
8400: 20 33 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   34 AS col1 FROM
8410: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
8420: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a  ---..-1..-2..0..
8430: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8440: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
8450: 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  CT - + col2 + + 
8460: 38 34 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  84 * + col0 + + 
8470: 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col1 * col0 FROM
8480: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
8490: 2d 2d 2d 0d 0a 31 35 34 39 33 0d 0a 34 30 34 37  ---..15493..4047
84a0: 0d 0a 36 33 33 34 0d 0a 0d 0a 71 75 65 72 79 20  ..6334....query 
84b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
84c0: 54 20 28 20 63 6f 6c 32 20 29 20 2d 20 63 6f 6c  T ( col2 ) - col
84d0: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
84e0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
84f0: 2d 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d  -..28..47..83...
8500: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8510: 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 37 35 20  ..SELECT + ( 75 
8520: 29 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  ) * col2 + col0 
8530: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
8540: 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 35 33 0d 0a 34  0..----..4053..4
8550: 33 33 39 0d 0a 37 32 38 30 0d 0a 0d 0a 6f 6e 6c  339..7280....onl
8560: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
8570: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
8580: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
8590: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
85a0: 72 74 20 6c 61 62 65 6c 2d 32 32 30 0d 0a 53 45  rt label-220..SE
85b0: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20 2d 20  LECT - col1 - - 
85c0: 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 41 53  col1 DIV col1 AS
85d0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
85e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d  cor0..----..-85.
85f0: 0a 2d 39 30 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69  .-90..-96....ski
8600: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
8610: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
8620: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
8630: 6c 2d 32 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20  l-220..SELECT - 
8640: 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 31 20 2f 20  col1 - - col1 / 
8650: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
8660: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
8670: 2d 0d 0a 2d 38 35 0d 0a 2d 39 30 0d 0a 2d 39 36  -..-85..-90..-96
8680: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8690: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 32 20 46  ort..SELECT 62 F
86a0: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
86b0: 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72  S cor0, tab2 cor
86c0: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
86d0: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 39  es hashing to 49
86e0: 31 31 62 31 34 31 37 61 33 37 39 37 64 32 33 64  11b1417a3797d23d
86f0: 64 38 66 33 38 62 36 65 64 30 35 63 31 62 0d 0a  d8f38b6ed05c1b..
8700: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8710: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
8720: 6c 32 20 2b 20 28 20 63 6f 6c 30 20 29 20 41 53  l2 + ( col0 ) AS
8730: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
8740: 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d  .----..121..176.
8750: 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .57....onlyif my
8760: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
8770: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
8780: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
8790: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
87a0: 65 6c 2d 32 32 33 0d 0a 53 45 4c 45 43 54 20 63  el-223..SELECT c
87b0: 6f 6c 31 20 2a 20 63 6f 6c 30 20 44 49 56 20 31  ol1 * col0 DIV 1
87c0: 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  7 AS col2 FROM t
87d0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 37 0d 0a 34  ab1..----..37..4
87e0: 0d 0a 36 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..61....skipif m
87f0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
8800: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
8810: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 33  owsort label-223
8820: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
8830: 63 6f 6c 30 20 2f 20 31 37 20 41 53 20 63 6f 6c  col0 / 17 AS col
8840: 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
8850: 2d 0d 0a 33 37 0d 0a 34 0d 0a 36 31 0d 0a 0d 0a  -..37..4..61....
8860: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
8870: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
8880: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
8890: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
88a0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 34 0d  wsort label-224.
88b0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
88c0: 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2b   cor0.col0 DIV +
88d0: 20 34 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53   46 FROM tab0 AS
88e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36   cor0..----..-86
88f0: 0d 0a 2d 39 30 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b  ..-90..-97....sk
8900: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
8910: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
8920: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
8930: 65 6c 2d 32 32 34 0d 0a 53 45 4c 45 43 54 20 2d  el-224..SELECT -
8940: 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c   col1 + cor0.col
8950: 30 20 2f 20 2b 20 34 36 20 46 52 4f 4d 20 74 61  0 / + 46 FROM ta
8960: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
8970: 0d 0a 2d 38 36 0d 0a 2d 39 30 0d 0a 2d 39 37 0d  ..-86..-90..-97.
8980: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
8990: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
89a0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
89b0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
89c0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
89d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
89e0: 45 43 54 20 2d 20 33 34 20 2b 20 2b 20 63 6f 6c  ECT - 34 + + col
89f0: 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0 col2 FROM tab0
8a00: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8a10: 2d 31 30 0d 0a 31 0d 0a 35 35 0d 0a 0d 0a 73 6b  -10..1..55....sk
8a20: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
8a30: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
8a40: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
8a50: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
8a60: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
8a70: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
8a80: 4c 4c 20 38 38 20 2a 20 2b 20 63 6f 6c 30 20 63  LL 88 * + col0 c
8a90: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
8aa0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 31   cor0..----..211
8ab0: 32 0d 0a 33 30 38 30 0d 0a 37 38 33 32 0d 0a 0d  2..3080..7832...
8ac0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8ad0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
8ae0: 2b 20 2b 20 63 6f 6c 32 20 2a 20 38 20 46 52 4f  + + col2 * 8 FRO
8af0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
8b00: 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a 32 30 39 0d 0a  ----..130..209..
8b10: 32 32 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  225....onlyif my
8b20: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
8b30: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
8b40: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
8b50: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
8b60: 65 6c 2d 32 32 38 0d 0a 53 45 4c 45 43 54 20 41  el-228..SELECT A
8b70: 4c 4c 20 2d 20 39 35 20 44 49 56 20 2b 20 63 6f  LL - 95 DIV + co
8b80: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
8b90: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
8ba0: 2d 33 0d 0a 2d 35 0d 0a 0d 0a 73 6b 69 70 69 66  -3..-5....skipif
8bb0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
8bc0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
8bd0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
8be0: 32 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  28..SELECT ALL -
8bf0: 20 39 35 20 2f 20 2b 20 63 6f 6c 31 20 46 52 4f   95 / + col1 FRO
8c00: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
8c10: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 0d 0a 2d 35  ----..-1..-3..-5
8c20: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
8c30: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
8c40: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
8c50: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
8c60: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
8c70: 32 32 39 0d 0a 53 45 4c 45 43 54 20 2b 20 37 32  229..SELECT + 72
8c80: 20 44 49 56 20 31 37 20 2b 20 2d 20 74 61 62 30   DIV 17 + - tab0
8c90: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
8ca0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
8cb0: 32 30 0d 0a 2d 33 31 0d 0a 2d 38 35 0d 0a 0d 0a  20..-31..-85....
8cc0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
8cd0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
8ce0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
8cf0: 61 62 65 6c 2d 32 32 39 0d 0a 53 45 4c 45 43 54  abel-229..SELECT
8d00: 20 2b 20 37 32 20 2f 20 31 37 20 2b 20 2d 20 74   + 72 / 17 + - t
8d10: 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  ab0.col0 AS col0
8d20: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
8d30: 0d 0a 2d 32 30 0d 0a 2d 33 31 0d 0a 2d 38 35 0d  ..-20..-31..-85.
8d40: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8d50: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
8d60: 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 2b 20 35   tab1.col0 + + 5
8d70: 37 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  7 + + col0 AS co
8d80: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
8d90: 2d 2d 0d 0a 35 37 0d 0a 35 37 0d 0a 35 37 0d 0a  --..57..57..57..
8da0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
8db0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
8dc0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
8dd0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
8de0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33  rowsort label-23
8df0: 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  1..SELECT ALL - 
8e00: 63 6f 6c 30 20 44 49 56 20 28 20 74 61 62 30 2e  col0 DIV ( tab0.
8e10: 63 6f 6c 31 20 29 20 2b 20 35 31 20 2b 20 63 6f  col1 ) + 51 + co
8e20: 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 * col1 FROM t
8e30: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 34 37 0d  ab0..----..7447.
8e40: 0a 38 33 33 32 0d 0a 39 34 36 30 0d 0a 0d 0a 73  .8332..9460....s
8e50: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
8e60: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
8e70: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
8e80: 62 65 6c 2d 32 33 31 0d 0a 53 45 4c 45 43 54 20  bel-231..SELECT 
8e90: 41 4c 4c 20 2d 20 63 6f 6c 30 20 2f 20 28 20 74  ALL - col0 / ( t
8ea0: 61 62 30 2e 63 6f 6c 31 20 29 20 2b 20 35 31 20  ab0.col1 ) + 51 
8eb0: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52  + col1 * col1 FR
8ec0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab0..----..7
8ed0: 34 34 37 0d 0a 38 33 33 32 0d 0a 39 34 36 30 0d  447..8332..9460.
8ee0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8ef0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
8f00: 32 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 31 36 20  2 + col2 * - 16 
8f10: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
8f20: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
8f30: 0a 2d 31 32 33 30 0d 0a 2d 31 35 0d 0a 2d 34 39  .-1230..-15..-49
8f40: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
8f50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
8f60: 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   - + col1 * + co
8f70: 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  r0.col2 AS col1 
8f80: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
8f90: 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34  ----..-1534..-64
8fa0: 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 73 6b 69 70 69  6..-837....skipi
8fb0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
8fc0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
8fd0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
8fe0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
8ff0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
9000: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
9010: 38 35 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  85 col2 FROM tab
9020: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
9030: 0a 38 35 0d 0a 38 35 0d 0a 38 35 0d 0a 0d 0a 71  .85..85..85....q
9040: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9050: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
9060: 2b 20 63 6f 72 31 2e 63 6f 6c 30 20 2a 20 2d 20  + cor1.col0 * - 
9070: 34 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  40 FROM tab0 AS 
9080: 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
9090: 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
90a0: 2d 2d 0d 0a 2d 31 34 30 30 0d 0a 2d 33 35 36 30  --..-1400..-3560
90b0: 0d 0a 2d 39 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-960....onlyif
90c0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
90d0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
90e0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
90f0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
9100: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
9110: 65 6c 2d 32 33 36 0d 0a 53 45 4c 45 43 54 20 44  el-236..SELECT D
9120: 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30  ISTINCT - + col0
9130: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 43 41 53 54   + - col2 * CAST
9140: 28 20 33 31 20 41 53 20 53 49 47 4e 45 44 20 29  ( 31 AS SIGNED )
9150: 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   * cor0.col1 FRO
9160: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
9170: 2d 0d 0a 2d 32 33 31 34 31 31 0d 0a 2d 33 30 34  -..-231411..-304
9180: 32 0d 0a 2d 38 38 30 30 32 0d 0a 0d 0a 73 6b 69  2..-88002....ski
9190: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
91a0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
91b0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
91c0: 6c 2d 32 33 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-236..SELECT DI
91d0: 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20  STINCT - + col0 
91e0: 2b 20 2d 20 63 6f 6c 32 20 2a 20 43 41 53 54 20  + - col2 * CAST 
91f0: 28 20 33 31 20 41 53 20 49 4e 54 45 47 45 52 20  ( 31 AS INTEGER 
9200: 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  ) * cor0.col1 FR
9210: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
9220: 2d 2d 0d 0a 2d 32 33 31 34 31 31 0d 0a 2d 33 30  --..-231411..-30
9230: 34 32 0d 0a 2d 38 38 30 30 32 0d 0a 0d 0a 71 75  42..-88002....qu
9240: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9250: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d  ELECT - col1 * -
9260: 20 63 6f 6c 32 20 2a 20 36 35 20 46 52 4f 4d 20   col2 * 65 FROM 
9270: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
9280: 2d 2d 0d 0a 34 31 39 39 30 0d 0a 35 34 34 30 35  --..41990..54405
9290: 0d 0a 39 39 37 31 30 0d 0a 0d 0a 71 75 65 72 79  ..99710....query
92a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
92b0: 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b 20  CT + - col0 + + 
92c0: 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 28 20 2d 20  cor0.col1 * ( - 
92d0: 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46  col1 ) AS col0 F
92e0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
92f0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d 32  ..----..-164..-2
9300: 34 39 0d 0a 2d 36 37 39 0d 0a 0d 0a 71 75 65 72  49..-679....quer
9310: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9320: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
9330: 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 63   col2 + col1 * c
9340: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
9350: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 35 39 0d  r0..----..-1659.
9360: 0a 32 35 37 34 0d 0a 32 38 0d 0a 0d 0a 73 6b 69  .2574..28....ski
9370: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
9380: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
9390: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
93a0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
93b0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
93c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
93d0: 34 38 20 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 30  48 * - col1 col0
93e0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
93f0: 0d 0a 2d 31 32 34 38 0d 0a 2d 34 38 30 0d 0a 2d  ..-1248..-480..-
9400: 36 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  624....onlyif my
9410: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
9420: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
9430: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
9440: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
9450: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
9460: 32 34 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  241..SELECT ALL 
9470: 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 43 41  cor0.col1 * + CA
9480: 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
9490: 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ED ) AS col0 FRO
94a0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
94b0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
94c0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
94d0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
94e0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
94f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
9500: 34 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  41..SELECT ALL c
9510: 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 43 41 53  or0.col1 * + CAS
9520: 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
9530: 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52  GER ) AS col0 FR
9540: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
9550: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
9560: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
9570: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9580: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  CT + col2 * + co
9590: 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
95a0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
95b0: 2d 0d 0a 32 32 35 39 39 0d 0a 32 34 35 34 38 0d  -..22599..24548.
95c0: 0a 33 39 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20  .39884....query 
95d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
95e0: 54 20 2b 20 37 31 20 2b 20 63 6f 72 31 2e 63 6f  T + 71 + cor1.co
95f0: 6c 30 20 2a 20 2d 20 38 32 20 41 53 20 63 6f 6c  l0 * - 82 AS col
9600: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
9610: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
9620: 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
9630: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
9640: 69 6e 67 20 74 6f 20 64 66 62 31 33 66 32 31 30  ing to dfb13f210
9650: 64 38 66 63 39 30 66 64 39 31 61 63 39 37 64 35  d8fc90fd91ac97d5
9660: 64 64 32 38 62 65 66 0d 0a 0d 0a 71 75 65 72 79  dd28bef....query
9670: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9680: 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 32 34  CT + col1 * - 24
9690: 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
96a0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
96b0: 2d 0d 0a 2d 31 37 39 30 38 38 0d 0a 2d 32 33 32  -..-179088..-232
96c0: 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d 0a 6f 6e 6c  8..-68112....onl
96d0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
96e0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
96f0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
9700: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
9710: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
9720: 6c 61 62 65 6c 2d 32 34 35 0d 0a 53 45 4c 45 43  label-245..SELEC
9730: 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 43 41  T cor0.col1 * CA
9740: 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  ST( col0 AS SIGN
9750: 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  ED ) AS col1 FRO
9760: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
9770: 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d  ----..1343..217.
9780: 0a 34 36 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .4602....skipif 
9790: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
97a0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
97b0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34  rowsort label-24
97c0: 35 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  5..SELECT cor0.c
97d0: 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 63 6f 6c  ol1 * CAST ( col
97e0: 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  0 AS INTEGER ) A
97f0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
9800: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9810: 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d  1343..217..4602.
9820: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9830: 72 74 0d 0a 53 45 4c 45 43 54 20 38 32 20 41 53  rt..SELECT 82 AS
9840: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c   col1 FROM tab2,
9850: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
9860: 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
9870: 73 68 69 6e 67 20 74 6f 20 66 33 31 38 66 64 39  shing to f318fd9
9880: 64 61 63 32 64 65 37 61 66 34 62 38 32 63 63 37  dac2de7af4b82cc7
9890: 35 37 34 62 62 63 61 32 63 0d 0a 0d 0a 71 75 65  574bbca2c....que
98a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
98b0: 4c 45 43 54 20 2d 20 28 20 2b 20 31 20 29 20 46  LECT - ( + 1 ) F
98c0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
98d0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a  ..----..-1..-1..
98e0: 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  -1....skipif pos
98f0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
9900: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
9910: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
9920: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
9930: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9940: 53 45 4c 45 43 54 20 2b 20 31 38 20 63 6f 6c 32  SELECT + 18 col2
9950: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
9960: 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 31 38 0d 0a 31  .----..18..18..1
9970: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
9980: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
9990: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
99a0: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
99b0: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
99c0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34  rowsort label-24
99d0: 39 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20  9..SELECT CAST( 
99e0: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
99f0: 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   - - col1 FROM t
9a00: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
9a10: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
9a20: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
9a30: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
9a40: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
9a50: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 39 0d  wsort label-249.
9a60: 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e  .SELECT CAST ( N
9a70: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
9a80: 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   - - col1 FROM t
9a90: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
9aa0: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
9ab0: 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
9ac0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
9ad0: 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30  ISTINCT - - col0
9ae0: 20 2a 20 2d 20 31 35 20 2b 20 2b 20 63 6f 72 30   * - 15 + + cor0
9af0: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
9b00: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
9b10: 31 31 32 30 0d 0a 2d 34 32 0d 0a 2d 38 39 36 0d  1120..-42..-896.
9b20: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9b30: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
9b40: 20 63 6f 6c 31 20 2a 20 31 31 20 41 53 20 63 6f   col1 * 11 AS co
9b50: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
9b60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 37  cor0..----..-187
9b70: 0d 0a 2d 33 34 31 0d 0a 2d 36 34 39 0d 0a 0d 0a  ..-341..-649....
9b80: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
9b90: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
9ba0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
9bb0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
9bc0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
9bd0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9be0: 20 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 2d 20   ( - col1 ) + - 
9bf0: 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 32 20 29 20  col2 * ( col2 ) 
9c00: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
9c10: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
9c20: 39 34 32 0d 0a 2d 33 32 35 39 0d 0a 2d 39 32 32  942..-3259..-922
9c30: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
9c40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
9c50: 54 49 4e 43 54 20 2d 20 2d 20 38 35 20 46 52 4f  TINCT - - 85 FRO
9c60: 4d 20 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72  M tab1, tab1 cor
9c70: 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 0d 0a 73  0..----..85....s
9c80: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
9c90: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
9ca0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
9cb0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
9cc0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
9cd0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9ce0: 2b 20 37 30 20 2b 20 63 6f 6c 32 20 63 6f 6c 32  + 70 + col2 col2
9cf0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
9d00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 31  r0..----..103..1
9d10: 35 32 0d 0a 37 31 0d 0a 0d 0a 71 75 65 72 79 20  52..71....query 
9d20: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9d30: 54 20 28 20 63 6f 6c 30 20 29 20 2b 20 2b 20 63  T ( col0 ) + + c
9d40: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
9d50: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
9d60: 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36  ---..137..38..96
9d70: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
9d80: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
9d90: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
9da0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
9db0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
9dc0: 32 35 36 0d 0a 53 45 4c 45 43 54 20 2b 20 35 30  256..SELECT + 50
9dd0: 20 2b 20 33 39 20 44 49 56 20 63 6f 6c 31 20 41   + 39 DIV col1 A
9de0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
9df0: 0d 0a 2d 2d 2d 2d 0d 0a 35 31 0d 0a 35 33 0d 0a  ..----..51..53..
9e00: 35 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  53....skipif mys
9e10: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
9e20: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
9e30: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 36 0d 0a  sort label-256..
9e40: 53 45 4c 45 43 54 20 2b 20 35 30 20 2b 20 33 39  SELECT + 50 + 39
9e50: 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   / col1 AS col2 
9e60: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
9e70: 0a 35 31 0d 0a 35 33 0d 0a 35 33 0d 0a 0d 0a 71  .51..53..53....q
9e80: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9e90: 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 32 35  SELECT col2 * 25
9ea0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
9eb0: 0d 0a 36 35 30 0d 0a 36 37 35 0d 0a 39 35 30 0d  ..650..675..950.
9ec0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
9ed0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
9ee0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
9ef0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
9f00: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
9f10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9f20: 45 43 54 20 2d 20 37 37 20 63 6f 6c 31 20 46 52  ECT - 77 col1 FR
9f30: 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  OM tab1, tab2 AS
9f40: 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
9f50: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
9f60: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
9f70: 63 37 65 35 66 34 38 65 63 64 33 38 34 33 64 35  c7e5f48ecd3843d5
9f80: 34 61 37 36 38 30 38 65 64 31 66 34 33 66 66 36  4a76808ed1f43ff6
9f90: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
9fa0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
9fb0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
9fc0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
9fd0: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
9fe0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 39  owsort label-259
9ff0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
a000: 2a 20 2d 20 43 41 53 54 28 20 2b 20 37 20 41 53  * - CAST( + 7 AS
a010: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
a020: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
a030: 33 37 38 0d 0a 33 39 39 0d 0a 36 37 32 0d 0a 0d  378..399..672...
a040: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
a050: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
a060: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
a070: 6c 61 62 65 6c 2d 32 35 39 0d 0a 53 45 4c 45 43  label-259..SELEC
a080: 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53  T - col2 * - CAS
a090: 54 20 28 20 2b 20 37 20 41 53 20 49 4e 54 45 47  T ( + 7 AS INTEG
a0a0: 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20 63  ER ) FROM tab1 c
a0b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 38 0d 0a  or0..----..378..
a0c0: 33 39 39 0d 0a 36 37 32 0d 0a 0d 0a 71 75 65 72  399..672....quer
a0d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a0e0: 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
a0f0: 2a 20 37 39 20 46 52 4f 4d 20 74 61 62 30 20 41  * 79 FROM tab0 A
a100: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
a110: 39 36 0d 0a 32 37 36 35 0d 0a 37 30 33 31 0d 0a  96..2765..7031..
a120: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a130: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
a140: 63 6f 6c 31 20 2b 20 2d 20 37 38 20 46 52 4f 4d  col1 + - 78 FROM
a150: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
a160: 0d 0a 2d 31 36 34 0d 0a 2d 31 36 39 0d 0a 2d 31  ..-164..-169..-1
a170: 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  75....query I ro
a180: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
a190: 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f  STINCT + cor0.co
a1a0: 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l0 * - cor0.col1
a1b0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   + cor0.col1 * c
a1c0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
a1d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
a1e0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
a1f0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
a200: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
a210: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
a220: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
a230: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a240: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 33 34 20 2b  CT + col2 * 34 +
a250: 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20   col0 col1 FROM 
a260: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
a270: 2d 2d 0d 0a 31 38 33 39 0d 0a 32 30 30 32 0d 0a  --..1839..2002..
a280: 33 33 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3344....query I 
a290: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a2a0: 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  + + col0 * - col
a2b0: 30 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 63  0 + + col1 - + c
a2c0: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
a2d0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
a2e0: 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 36 31 30 33 0d  ---..-25..-6103.
a2f0: 0a 2d 36 33 30 33 0d 0a 0d 0a 71 75 65 72 79 20  .-6303....query 
a300: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a310: 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 2b  T ALL - col2 + +
a320: 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20   col0 + col1 AS 
a330: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
a340: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a  or0..----..131..
a350: 37 37 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  77..98....query 
a360: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a370: 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 28 20 63  T - + col0 * ( c
a380: 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20  or0.col1 ) FROM 
a390: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
a3a0: 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35  --..-2064..-3395
a3b0: 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79  ..-8099....query
a3c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a3d0: 43 54 20 41 4c 4c 20 2d 20 37 34 20 2a 20 63 6f  CT ALL - 74 * co
a3e0: 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l0 + - cor0.col1
a3f0: 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
a400: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
a410: 2d 0d 0a 2d 34 36 33 36 0d 0a 2d 35 37 35 31 0d  -..-4636..-5751.
a420: 0a 34 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .454....query I 
a430: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a440: 37 33 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  73 * col2 AS col
a450: 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
a460: 0d 0a 2d 2d 2d 2d 0d 0a 32 34 30 39 0d 0a 35 39  ..----..2409..59
a470: 38 36 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20  86..73....query 
a480: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a490: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
a4a0: 2b 20 38 34 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 84 AS col1 FRO
a4b0: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
a4c0: 2d 0d 0a 31 31 37 0d 0a 31 36 36 0d 0a 38 35 0d  -..117..166..85.
a4d0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a4e0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
a4f0: 30 20 2a 20 39 39 20 46 52 4f 4d 20 74 61 62 31  0 * 99 FROM tab1
a500: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 37   cor0..----..297
a510: 0d 0a 36 33 33 36 0d 0a 37 39 32 30 0d 0a 0d 0a  ..6336..7920....
a520: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a530: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
a540: 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   - col1 * - col0
a550: 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
a560: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
a570: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a  or0..----..104..
a580: 31 30 35 33 0d 0a 36 35 30 0d 0a 0d 0a 71 75 65  1053..650....que
a590: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a5a0: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20  LECT ALL col1 * 
a5b0: 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col0 * cor0.col2
a5c0: 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   - + cor0.col0 *
a5d0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
a5e0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
a5f0: 0d 0a 36 35 36 30 31 39 0d 0a 36 36 30 34 38 0d  ..656019..66048.
a600: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a610: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
a620: 4e 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 37  NCT + col0 - - 7
a630: 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  7 FROM tab1 AS c
a640: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 0d 0a  or0..----..141..
a650: 31 35 37 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  157..80....query
a660: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a670: 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  CT - + cor0.col0
a680: 20 2a 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f   * - ( + cor0.co
a690: 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41 53  l0 ) * + col0 AS
a6a0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
a6b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
a6c0: 33 38 32 34 0d 0a 34 32 38 37 35 0d 0a 37 30 34  3824..42875..704
a6d0: 39 36 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  969....onlyif my
a6e0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
a6f0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
a700: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
a710: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
a720: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
a730: 32 37 35 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  275..SELECT - - 
a740: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 43 41  cor0.col0 * - CA
a750: 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  ST( col0 AS SIGN
a760: 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  ED ) FROM tab2 A
a770: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
a780: 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32 34 31 0d  9..-6084..-6241.
a790: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
a7a0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
a7b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a7c0: 74 20 6c 61 62 65 6c 2d 32 37 35 0d 0a 53 45 4c  t label-275..SEL
a7d0: 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT - - cor0.col
a7e0: 30 20 2a 20 2d 20 43 41 53 54 20 28 20 63 6f 6c  0 * - CAST ( col
a7f0: 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  0 AS INTEGER ) F
a800: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
a810: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30  ..----..-49..-60
a820: 38 34 0d 0a 2d 36 32 34 31 0d 0a 0d 0a 71 75 65  84..-6241....que
a830: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a840: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
a850: 6c 32 20 2b 20 28 20 2d 20 36 30 20 29 20 41 53  l2 + ( - 60 ) AS
a860: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
a870: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
a880: 33 0d 0a 2d 36 0d 0a 33 36 0d 0a 0d 0a 71 75 65  3..-6..36....que
a890: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a8a0: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20  LECT ALL col2 + 
a8b0: 2d 20 32 32 20 46 52 4f 4d 20 74 61 62 32 20 41  - 22 FROM tab2 A
a8c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
a8d0: 0d 0a 34 0d 0a 35 0d 0a 0d 0a 71 75 65 72 79 20  ..4..5....query 
a8e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a8f0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
a900: 6f 6c 32 20 2b 20 37 20 2a 20 2b 20 63 6f 6c 32  ol2 + 7 * + col2
a910: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
a920: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 38 0d 0a 34  r0..----..198..4
a930: 39 32 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49  92..6....query I
a940: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a950: 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 28 20   ALL - col0 * ( 
a960: 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46  col1 ) AS col0 F
a970: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
a980: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d  ..----..-1343..-
a990: 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 6f 6e  217..-4602....on
a9a0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
a9b0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
a9c0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
a9d0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
a9e0: 6f 72 74 20 6c 61 62 65 6c 2d 32 38 30 0d 0a 53  ort label-280..S
a9f0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
aa00: 20 74 61 62 30 2e 63 6f 6c 31 20 44 49 56 20 2d   tab0.col1 DIV -
aa10: 20 31 35 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   15 FROM tab0, t
aa20: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
aa30: 2d 0d 0a 2d 35 0d 0a 2d 36 0d 0a 0d 0a 73 6b 69  -..-5..-6....ski
aa40: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
aa50: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
aa60: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
aa70: 6c 2d 32 38 30 0d 0a 53 45 4c 45 43 54 20 44 49  l-280..SELECT DI
aa80: 53 54 49 4e 43 54 20 2b 20 74 61 62 30 2e 63 6f  STINCT + tab0.co
aa90: 6c 31 20 2f 20 2d 20 31 35 20 46 52 4f 4d 20 74  l1 / - 15 FROM t
aaa0: 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
aab0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 2d 36 0d  0..----..-5..-6.
aac0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
aad0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 33 20  rt..SELECT + 53 
aae0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
aaf0: 32 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  2, tab0, tab0 AS
ab00: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
ab10: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
ab20: 6f 20 38 36 36 61 65 31 62 34 61 62 39 65 35 62  o 866ae1b4ab9e5b
ab30: 34 30 34 33 61 63 31 62 63 66 64 34 31 33 61 61  4043ac1bcfd413aa
ab40: 61 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  a6....query I ro
ab50: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
ab60: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20  STINCT + col2 + 
ab70: 2b 20 32 37 20 2b 20 2b 20 63 6f 6c 32 20 46 52  + 27 + + col2 FR
ab80: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
ab90: 2d 2d 0d 0a 31 39 31 0d 0a 32 39 0d 0a 39 33 0d  --..191..29..93.
aba0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
abb0: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
abc0: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
abd0: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
abe0: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
abf0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38 33 0d  wsort label-283.
ac00: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
ac10: 6c 31 20 2a 20 43 41 53 54 28 20 2d 20 31 37 20  l1 * CAST( - 17 
ac20: 2a 20 2d 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  * - col0 AS SIGN
ac30: 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63  ED ) FROM tab2 c
ac40: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 38 33  or0..----..-2283
ac50: 31 0d 0a 2d 33 36 38 39 0d 0a 2d 37 38 32 33 34  1..-3689..-78234
ac60: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
ac70: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
ac80: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
ac90: 72 74 20 6c 61 62 65 6c 2d 32 38 33 0d 0a 53 45  rt label-283..SE
aca0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
acb0: 2a 20 43 41 53 54 20 28 20 2d 20 31 37 20 2a 20  * CAST ( - 17 * 
acc0: 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  - col0 AS INTEGE
acd0: 52 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  R ) FROM tab2 co
ace0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 38 33 31  r0..----..-22831
acf0: 0d 0a 2d 33 36 38 39 0d 0a 2d 37 38 32 33 34 0d  ..-3689..-78234.
ad00: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
ad10: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
ad20: 20 2d 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 30   - col0 + ( col0
ad30: 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d   ) * - col2 FROM
ad40: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
ad50: 2d 2d 2d 0d 0a 2d 37 32 30 39 0d 0a 2d 37 36 38  ---..-7209..-768
ad60: 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
ad70: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
ad80: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
ad90: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
ada0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
adb0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
adc0: 32 38 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  285..SELECT + co
add0: 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54  r0.col1 * - CAST
ade0: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
adf0: 20 29 20 2a 20 34 31 20 63 6f 6c 31 20 46 52 4f   ) * 41 col1 FRO
ae00: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
ae10: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
ae20: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
ae30: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
ae40: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
ae50: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
ae60: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
ae70: 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
ae80: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
ae90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
aea0: 74 20 6c 61 62 65 6c 2d 32 38 35 0d 0a 53 45 4c  t label-285..SEL
aeb0: 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ECT + cor0.col1 
aec0: 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  * - CAST ( NULL 
aed0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 34  AS INTEGER ) * 4
aee0: 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  1 col1 FROM tab0
aef0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
af00: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
af10: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
af20: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
af30: 49 4e 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  INCT col2 * col1
af40: 20 2a 20 35 32 20 41 53 20 63 6f 6c 30 20 46 52   * 52 AS col0 FR
af50: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab2..----..3
af60: 33 35 39 32 0d 0a 34 33 35 32 34 0d 0a 37 39 37  3592..43524..797
af70: 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  68....query I ro
af80: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
af90: 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20  STINCT col2 * - 
afa0: 32 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  23 AS col1 FROM 
afb0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 39 38  tab2..----..-598
afc0: 0d 0a 2d 36 32 31 0d 0a 2d 38 37 34 0d 0a 0d 0a  ..-621..-874....
afd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
afe0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
aff0: 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   + + col1 * - co
b000: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
b010: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 37  cor0..----..-737
b020: 32 0d 0a 2d 38 31 39 32 0d 0a 2d 39 33 37 34 0d  2..-8192..-9374.
b030: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
b040: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32  rt..SELECT ALL 2
b050: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
b060: 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab1, tab0 AS cor
b070: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
b080: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 35 35  s hashing to c55
b090: 65 65 37 34 33 33 64 38 64 33 39 61 35 39 62 31  ee7433d8d39a59b1
b0a0: 64 65 32 61 61 64 64 39 35 33 38 63 39 0d 0a 0d  de2aadd9538c9...
b0b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b0c0: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72  ..SELECT - - cor
b0d0: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
b0e0: 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  , tab1, tab0 AS 
b0f0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
b100: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
b110: 20 32 64 36 64 33 30 33 31 64 66 65 39 30 65 30   2d6d3031dfe90e0
b120: 63 30 32 64 62 31 33 61 61 36 33 39 39 33 62 66  c02db13aa63993bf
b130: 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  d....query I row
b140: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
b150: 54 49 4e 43 54 20 31 39 20 2a 20 35 37 20 46 52  TINCT 19 * 57 FR
b160: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
b170: 30 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  083....query I r
b180: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
b190: 49 53 54 49 4e 43 54 20 28 20 2b 20 74 61 62 31  ISTINCT ( + tab1
b1a0: 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 29 20 2b  .col1 * col2 ) +
b1b0: 20 28 20 28 20 63 6f 6c 31 20 29 20 29 20 2b 20   ( ( col1 ) ) + 
b1c0: 2d 20 32 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  - 22 * col1 FROM
b1d0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 30   tab1..----..360
b1e0: 0d 0a 38 35 38 0d 0a 39 37 35 0d 0a 0d 0a 6f 6e  ..858..975....on
b1f0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
b200: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
b210: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
b220: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
b230: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b240: 20 6c 61 62 65 6c 2d 32 39 33 0d 0a 53 45 4c 45   label-293..SELE
b250: 43 54 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53  CT CAST( col2 AS
b260: 20 53 49 47 4e 45 44 20 29 20 2b 20 74 61 62 32   SIGNED ) + tab2
b270: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
b280: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab2..----..5
b290: 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 73 6b 69  5..58..85....ski
b2a0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
b2b0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
b2c0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
b2d0: 6c 2d 32 39 33 0d 0a 53 45 4c 45 43 54 20 43 41  l-293..SELECT CA
b2e0: 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54  ST ( col2 AS INT
b2f0: 45 47 45 52 20 29 20 2b 20 74 61 62 32 2e 63 6f  EGER ) + tab2.co
b300: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
b310: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a  tab2..----..55..
b320: 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20  58..85....query 
b330: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b340: 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72  T - + col1 + cor
b350: 30 2e 63 6f 6c 32 20 2a 20 32 35 20 46 52 4f 4d  0.col2 * 25 FROM
b360: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
b370: 2d 2d 2d 0d 0a 35 39 31 0d 0a 36 34 34 0d 0a 39  ---..591..644..9
b380: 33 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  33....onlyif mys
b390: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
b3a0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
b3b0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
b3c0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
b3d0: 6c 2d 32 39 35 0d 0a 53 45 4c 45 43 54 20 41 4c  l-295..SELECT AL
b3e0: 4c 20 2b 20 2b 20 32 34 20 44 49 56 20 63 6f 6c  L + + 24 DIV col
b3f0: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
b400: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
b410: 2d 0d 0a 30 0d 0a 30 0d 0a 33 0d 0a 0d 0a 73 6b  -..0..0..3....sk
b420: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
b430: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
b440: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b450: 65 6c 2d 32 39 35 0d 0a 53 45 4c 45 43 54 20 41  el-295..SELECT A
b460: 4c 4c 20 2b 20 2b 20 32 34 20 2f 20 63 6f 6c 30  LL + + 24 / col0
b470: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
b480: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
b490: 0d 0a 30 0d 0a 30 0d 0a 33 0d 0a 0d 0a 6f 6e 6c  ..0..0..3....onl
b4a0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
b4b0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
b4c0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
b4d0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
b4e0: 72 74 20 6c 61 62 65 6c 2d 32 39 36 0d 0a 53 45  rt label-296..SE
b4f0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 36 37  LECT DISTINCT 67
b500: 20 2b 20 63 6f 6c 32 20 44 49 56 20 28 20 2b 20   + col2 DIV ( + 
b510: 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32  col0 ) FROM tab2
b520: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
b530: 36 37 0d 0a 37 30 0d 0a 0d 0a 73 6b 69 70 69 66  67..70....skipif
b540: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
b550: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
b560: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
b570: 39 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  96..SELECT DISTI
b580: 4e 43 54 20 36 37 20 2b 20 63 6f 6c 32 20 2f 20  NCT 67 + col2 / 
b590: 28 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  ( + col0 ) FROM 
b5a0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
b5b0: 2d 2d 0d 0a 36 37 0d 0a 37 30 0d 0a 0d 0a 6f 6e  --..67..70....on
b5c0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
b5d0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
b5e0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
b5f0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
b600: 6f 72 74 20 6c 61 62 65 6c 2d 32 39 37 0d 0a 53  ort label-297..S
b610: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
b620: 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20  l2 + - col0 DIV 
b630: 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
b640: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
b650: 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d 0a 38  ..----..2..34..8
b660: 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
b670: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
b680: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
b690: 6f 72 74 20 6c 61 62 65 6c 2d 32 39 37 0d 0a 53  ort label-297..S
b6a0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
b6b0: 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 2d 20  l2 + - col0 / - 
b6c0: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
b6d0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
b6e0: 2d 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d 0a 38 33 0d  ----..2..34..83.
b6f0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
b700: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
b710: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
b720: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
b730: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
b740: 39 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  98..SELECT - - c
b750: 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2b 20 31  or0.col0 DIV + 1
b760: 37 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  7 - + cor0.col2 
b770: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
b780: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 32  0..----..-22..-2
b790: 37 0d 0a 2d 33 34 0d 0a 0d 0a 73 6b 69 70 69 66  7..-34....skipif
b7a0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
b7b0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
b7c0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
b7d0: 39 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  98..SELECT - - c
b7e0: 6f 72 30 2e 63 6f 6c 30 20 2f 20 2b 20 31 37 20  or0.col0 / + 17 
b7f0: 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  - + cor0.col2 FR
b800: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
b810: 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 32 37 0d  .----..-22..-27.
b820: 0a 2d 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-34....query I 
b830: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b840: 63 6f 6c 32 20 2b 20 35 31 20 2a 20 2b 20 63 6f  col2 + 51 * + co
b850: 6c 32 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 - col2 FROM t
b860: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 33 0d  ab0..----..1683.
b870: 0a 34 31 38 32 0d 0a 35 31 0d 0a 0d 0a 71 75 65  .4182..51....que
b880: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b890: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
b8a0: 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 74 61  l2 + col1 + + ta
b8b0: 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  b1.col0 FROM tab
b8c0: 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 31 38  1..----..131..18
b8d0: 39 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49  9..83....query I
b8e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b8f0: 20 44 49 53 54 49 4e 43 54 20 2b 20 39 20 2b 20   DISTINCT + 9 + 
b900: 74 61 62 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31  tab0.col2 + col1
b910: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
b920: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 0d 0a 31  b0..----..107..1
b930: 32 38 0d 0a 31 38 32 0d 0a 0d 0a 6f 6e 6c 79 69  28..182....onlyi
b940: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
b950: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
b960: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
b970: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b980: 20 6c 61 62 65 6c 2d 33 30 32 0d 0a 53 45 4c 45   label-302..SELE
b990: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  CT - col0 * + co
b9a0: 6c 31 20 2d 20 2b 20 63 6f 6c 31 20 44 49 56 20  l1 - + col1 DIV 
b9b0: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
b9c0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 36 0d 0a 2d  ..----..-2066..-
b9d0: 33 34 39 32 0d 0a 2d 38 31 30 30 0d 0a 0d 0a 73  3492..-8100....s
b9e0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
b9f0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
ba00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
ba10: 62 65 6c 2d 33 30 32 0d 0a 53 45 4c 45 43 54 20  bel-302..SELECT 
ba20: 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  - col0 * + col1 
ba30: 2d 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c  - + col1 / + col
ba40: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
ba50: 2d 0d 0a 2d 32 30 36 36 0d 0a 2d 33 34 39 32 0d  -..-2066..-3492.
ba60: 0a 2d 38 31 30 30 0d 0a 0d 0a 71 75 65 72 79 20  .-8100....query 
ba70: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
ba80: 54 20 2b 20 2b 20 35 33 20 41 53 20 63 6f 6c 32  T + + 53 AS col2
ba90: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
baa0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 33  r0..----..53..53
bab0: 0d 0a 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..53....onlyif m
bac0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
bad0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
bae0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
baf0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
bb00: 62 65 6c 2d 33 30 34 0d 0a 53 45 4c 45 43 54 20  bel-304..SELECT 
bb10: 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col0 + - cor0.co
bb20: 6c 30 20 44 49 56 20 2b 20 63 6f 6c 30 20 46 52  l0 DIV + col0 FR
bb30: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
bb40: 0a 2d 2d 2d 2d 0d 0a 36 0d 0a 37 37 0d 0a 37 38  .----..6..77..78
bb50: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
bb60: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
bb70: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
bb80: 72 74 20 6c 61 62 65 6c 2d 33 30 34 0d 0a 53 45  rt label-304..SE
bb90: 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  LECT col0 + - co
bba0: 72 30 2e 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30  r0.col0 / + col0
bbb0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
bbc0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 0d 0a 37 37 0d  r0..----..6..77.
bbd0: 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .78....query I r
bbe0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
bbf0: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a  ISTINCT - col2 *
bc00: 20 2d 20 63 6f 6c 31 20 2a 20 38 37 20 2b 20 63   - col1 * 87 + c
bc10: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
bc20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 36   cor0..----..246
bc30: 39 39 32 0d 0a 36 34 39 32 38 35 0d 0a 38 35 33  992..649285..853
bc40: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
bc50: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
bc60: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
bc70: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
bc80: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
bc90: 2d 33 30 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  -306..SELECT DIS
bca0: 54 49 4e 43 54 20 2d 20 38 36 20 44 49 56 20 2d  TINCT - 86 DIV -
bcb0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
bcc0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
bcd0: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 35 0d 0a  .----..1..2..5..
bce0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
bcf0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
bd00: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
bd10: 20 6c 61 62 65 6c 2d 33 30 36 0d 0a 53 45 4c 45   label-306..SELE
bd20: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38 36  CT DISTINCT - 86
bd30: 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   / - col1 AS col
bd40: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
bd50: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d  or0..----..1..2.
bd60: 0a 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .5....query I ro
bd70: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
bd80: 4c 20 39 30 20 2a 20 2d 20 63 6f 6c 32 20 2a 20  L 90 * - col2 * 
bd90: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
bda0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
bdb0: 32 39 39 36 30 0d 0a 2d 36 30 38 34 30 0d 0a 2d  29960..-60840..-
bdc0: 36 35 36 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49  65610....query I
bdd0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
bde0: 20 44 49 53 54 49 4e 43 54 20 2d 20 39 39 20 2b   DISTINCT - 99 +
bdf0: 20 2b 20 63 6f 6c 32 20 2a 20 33 35 20 41 53 20   + col2 * 35 AS 
be00: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
be10: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
be20: 33 31 0d 0a 38 31 31 0d 0a 38 34 36 0d 0a 0d 0a  31..811..846....
be30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
be40: 0a 53 45 4c 45 43 54 20 2d 20 30 20 2b 20 2d 20  .SELECT - 0 + - 
be50: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
be60: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
be70: 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71  7..-31..-59....q
be80: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
be90: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
bea0: 63 6f 6c 31 20 2b 20 39 30 20 41 53 20 63 6f 6c  col1 + 90 AS col
beb0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
bec0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 0d 0a  or0..----..176..
bed0: 31 38 31 0d 0a 31 38 37 0d 0a 0d 0a 71 75 65 72  181..187....quer
bee0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
bef0: 45 43 54 20 2b 20 28 20 36 30 20 29 20 46 52 4f  ECT + ( 60 ) FRO
bf00: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
bf10: 2d 2d 2d 2d 0d 0a 36 30 0d 0a 36 30 0d 0a 36 30  ----..60..60..60
bf20: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
bf30: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
bf40: 2d 20 38 37 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  - 87 * - cor0.co
bf50: 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  l2 + + col2 * co
bf60: 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 * col0 AS col
bf70: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
bf80: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 33 38  or0..----..11738
bf90: 32 0d 0a 35 34 39 39 30 0d 0a 37 34 35 32 0d 0a  2..54990..7452..
bfa0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
bfb0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 36 39 20 2a  t..SELECT - 69 *
bfc0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
bfd0: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
bfe0: 2d 2d 0d 0a 2d 32 30 37 0d 0a 2d 34 34 31 36 0d  --..-207..-4416.
bff0: 0a 2d 35 35 32 30 0d 0a 0d 0a 71 75 65 72 79 20  .-5520....query 
c000: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c010: 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  T - col2 + col2 
c020: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  * col2 FROM tab1
c030: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 36   cor0..----..286
c040: 32 0d 0a 33 31 39 32 0d 0a 39 31 32 30 0d 0a 0d  2..3192..9120...
c050: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c060: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
c070: 36 37 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  67 * col2 FROM t
c080: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 32 31 0d  ab1..----..3621.
c090: 0a 33 38 38 33 0d 0a 36 35 31 32 0d 0a 0d 0a 71  .3883..6512....q
c0a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c0b0: 53 45 4c 45 43 54 20 28 20 2d 20 63 6f 6c 31 20  SELECT ( - col1 
c0c0: 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) + col0 FROM ta
c0d0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31  b2..----..-24..1
c0e0: 39 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  9..62....query I
c0f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c100: 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
c110: 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  l0 * - col0 * co
c120: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
c130: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32  cor0..----..-122
c140: 35 0d 0a 2d 31 39 30 30 38 0d 0a 2d 36 34 39 35  5..-19008..-6495
c150: 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  22....query I ro
c160: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
c170: 4c 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 37 32 20  L + + col2 - 72 
c180: 2a 20 2d 20 33 30 20 41 53 20 63 6f 6c 30 20 46  * - 30 AS col0 F
c190: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
c1a0: 0d 0a 2d 2d 2d 2d 0d 0a 32 32 31 34 0d 0a 32 32  ..----..2214..22
c1b0: 31 37 0d 0a 32 32 35 36 0d 0a 0d 0a 71 75 65 72  17..2256....quer
c1c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c1d0: 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  ECT col1 * col0 
c1e0: 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  * + cor0.col2 + 
c1f0: 2b 20 63 6f 6c 30 20 2a 20 2b 20 34 39 20 41 53  + col0 * + 49 AS
c200: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
c210: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
c220: 31 31 30 0d 0a 36 36 38 34 37 39 0d 0a 36 39 32  110..668479..692
c230: 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
c240: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
c250: 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  L + cor0.col0 + 
c260: 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  - col2 + + col2 
c270: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
c280: 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39  ----..24..35..89
c290: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c2a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
c2b0: 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  INCT + + col2 + 
c2c0: 2d 20 34 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  - 42 * + cor0.co
c2d0: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
c2e0: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
c2f0: 0a 2d 31 34 36 39 0d 0a 2d 33 36 35 36 0d 0a 2d  .-1469..-3656..-
c300: 39 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  975....query I r
c310: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35  owsort..SELECT 5
c320: 35 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  5 - col1 AS col0
c330: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
c340: 0d 0a 32 39 0d 0a 34 32 0d 0a 34 35 0d 0a 0d 0a  ..29..42..45....
c350: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c360: 0a 53 45 4c 45 43 54 20 2b 20 32 20 2b 20 63 6f  .SELECT + 2 + co
c370: 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l2 + + col0 FROM
c380: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36   tab2..----..106
c390: 0d 0a 31 31 39 0d 0a 33 36 0d 0a 0d 0a 6f 6e 6c  ..119..36....onl
c3a0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
c3b0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
c3c0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
c3d0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
c3e0: 72 74 20 6c 61 62 65 6c 2d 33 32 34 0d 0a 53 45  rt label-324..SE
c3f0: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
c400: 44 49 56 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20  DIV tab0.col1 + 
c410: 2d 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2d 20 74  - col0 * - ( - t
c420: 61 62 30 2e 63 6f 6c 32 20 29 20 2b 20 2d 20 63  ab0.col2 ) + - c
c430: 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
c440: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a 2d  b0..----..-70..-
c450: 37 33 38 37 0d 0a 2d 38 31 36 0d 0a 0d 0a 73 6b  7387..-816....sk
c460: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
c470: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
c480: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
c490: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
c4a0: 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
c4b0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
c4c0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
c4d0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 34 0d  wsort label-324.
c4e0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
c4f0: 6c 32 20 2f 20 74 61 62 30 2e 63 6f 6c 31 20 2b  l2 / tab0.col1 +
c500: 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2d 20   - col0 * - ( - 
c510: 74 61 62 30 2e 63 6f 6c 32 20 29 20 2b 20 2d 20  tab0.col2 ) + - 
c520: 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
c530: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a  ab0..----..-70..
c540: 2d 37 33 38 37 0d 0a 2d 38 31 36 0d 0a 0d 0a 6f  -7387..-816....o
c550: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
c560: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
c570: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
c580: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
c590: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 35 0d 0a  sort label-325..
c5a0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
c5b0: 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 44 49 56 20  col1 + col0 DIV 
c5c0: 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
c5d0: 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 32 35 0d 0a  ..----..12..25..
c5e0: 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
c5f0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
c600: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
c610: 6f 72 74 20 6c 61 62 65 6c 2d 33 32 35 0d 0a 53  ort label-325..S
c620: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
c630: 6f 6c 31 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63  ol1 + col0 / - c
c640: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
c650: 2d 2d 2d 0d 0a 31 32 0d 0a 32 35 0d 0a 39 0d 0a  ---..12..25..9..
c660: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c670: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
c680: 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 37 38   + + col1 - - 78
c690: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
c6a0: 0d 0a 37 38 0d 0a 37 38 0d 0a 37 38 0d 0a 0d 0a  ..78..78..78....
c6b0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
c6c0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
c6d0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
c6e0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
c6f0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
c700: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c710: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
c720: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   + col1 * + col1
c730: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   + - col2 * + co
c740: 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
c750: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 35 0d 0a 31  2..----..-395..1
c760: 39 32 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79  921..97....query
c770: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c780: 43 54 20 2b 20 28 20 2b 20 63 6f 72 31 2e 63 6f  CT + ( + cor1.co
c790: 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20  l0 ) FROM tab2, 
c7a0: 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
c7b0: 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
c7c0: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
c7d0: 69 6e 67 20 74 6f 20 31 65 31 66 31 30 39 35 33  ing to 1e1f10953
c7e0: 65 62 38 65 66 66 65 39 62 32 30 65 37 34 36 66  eb8effe9b20e746f
c7f0: 38 61 37 66 64 38 33 0d 0a 0d 0a 71 75 65 72 79  8a7fd83....query
c800: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c810: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20  CT ALL - col2 * 
c820: 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  1 * col1 + col0 
c830: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
c840: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 31 34 0d 0a  0..----..-2814..
c850: 2d 36 32 0d 0a 2d 37 33 37 33 0d 0a 0d 0a 71 75  -62..-7373....qu
c860: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c870: 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b  ELECT + - col0 +
c880: 20 2d 20 28 20 2d 20 28 20 63 6f 6c 32 20 29 20   - ( - ( col2 ) 
c890: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
c8a0: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
c8b0: 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71 75  -7..16..51....qu
c8c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c8d0: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20 31  ELECT - col1 - 1
c8e0: 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  2 * + cor0.col1 
c8f0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
c900: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
c910: 0a 2d 31 31 31 38 0d 0a 2d 31 31 38 33 0d 0a 2d  .-1118..-1183..-
c920: 31 32 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1261....query I 
c930: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c940: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 35 32  - cor0.col0 * 52
c950: 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46   + + cor0.col2 F
c960: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
c970: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 37 0d 0a 2d 34  ..----..-337..-4
c980: 30 33 30 0d 0a 2d 34 30 37 30 0d 0a 0d 0a 71 75  030..-4070....qu
c990: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c9a0: 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d  ELECT + col2 * -
c9b0: 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 63   col1 + col2 * c
c9c0: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
c9d0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
c9e0: 0d 0a 2d 36 34 38 0d 0a 32 33 35 36 0d 0a 34 39  ..-648..2356..49
c9f0: 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
ca00: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
ca10: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
ca20: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
ca30: 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c 30 20 2b  l2 * tab1.col0 +
ca40: 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a   col0 + + col0 *
ca50: 20 43 41 53 54 20 28 20 63 6f 6c 30 20 2b 20 2d   CAST ( col0 + -
ca60: 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29 20   col2 AS REAL ) 
ca70: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
ca80: 0a 2d 33 31 32 0d 0a 2d 33 31 33 36 0d 0a 2d 38  .-312..-3136..-8
ca90: 38 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  880....query I r
caa0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
cab0: 49 53 54 49 4e 43 54 20 2d 20 34 32 20 46 52 4f  ISTINCT - 42 FRO
cac0: 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  M tab0, tab0 AS 
cad0: 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
cae0: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a 0d  r1..----..-42...
caf0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
cb00: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
cb10: 54 20 63 6f 6c 32 20 2a 20 2d 20 28 20 74 61 62  T col2 * - ( tab
cb20: 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  0.col0 + - col0 
cb30: 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
cb40: 2d 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -..0....onlyif m
cb50: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
cb60: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
cb70: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
cb80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
cb90: 62 65 6c 2d 33 33 37 0d 0a 53 45 4c 45 43 54 20  bel-337..SELECT 
cba0: 2d 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 72  - + col2 DIV cor
cbb0: 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20  0.col1 + col2 * 
cbc0: 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  - ( + cor0.col0 
cbd0: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
cbe0: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
cbf0: 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30  -189..-2028..-30
cc00: 30 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  04....skipif mys
cc10: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
cc20: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
cc30: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 37 0d 0a  sort label-337..
cc40: 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
cc50: 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  / cor0.col1 + co
cc60: 6c 32 20 2a 20 2d 20 28 20 2b 20 63 6f 72 30 2e  l2 * - ( + cor0.
cc70: 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46  col0 ) AS col0 F
cc80: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
cc90: 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32 38  ---..-189..-2028
cca0: 0d 0a 2d 33 30 30 34 0d 0a 0d 0a 71 75 65 72 79  ..-3004....query
ccb0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ccc0: 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63  CT cor0.col1 * c
ccd0: 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 + col0 FROM 
cce0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
ccf0: 2d 2d 0d 0a 37 34 32 30 0d 0a 38 33 37 30 0d 0a  --..7420..8370..
cd00: 39 34 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9444....query I 
cd10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
cd20: 2d 20 31 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 12 AS col0 FRO
cd30: 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
cd40: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
cd50: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
cd60: 65 36 39 38 64 64 35 37 64 33 61 61 63 33 30 61  e698dd57d3aac30a
cd70: 66 31 34 63 65 33 35 64 61 34 33 34 62 62 34 35  f14ce35da434bb45
cd80: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
cd90: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
cda0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
cdb0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
cdc0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
cdd0: 33 34 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  340..SELECT DIST
cde0: 49 4e 43 54 20 63 6f 6c 30 20 44 49 56 20 38 36  INCT col0 DIV 86
cdf0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
ce00: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73  b1..----..0....s
ce10: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
ce20: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
ce30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
ce40: 62 65 6c 2d 33 34 30 0d 0a 53 45 4c 45 43 54 20  bel-340..SELECT 
ce50: 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2f 20  DISTINCT col0 / 
ce60: 38 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  86 AS col2 FROM 
ce70: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  tab1..----..0...
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 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
cea0: 30 20 2a 20 2d 20 37 35 20 2a 20 36 38 20 41 53  0 * - 75 * 68 AS
ceb0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
cec0: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 34 30 30 0d 0a  .----..-122400..
ced0: 2d 31 37 38 35 30 30 0d 0a 2d 34 35 33 39 30 30  -178500..-453900
cee0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
cef0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  ort..SELECT - ta
cf00: 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b2.col1 FROM tab
cf10: 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  2, tab2 AS cor0,
cf20: 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
cf30: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
cf40: 61 73 68 69 6e 67 20 74 6f 20 36 65 30 62 37 64  ashing to 6e0b7d
cf50: 35 38 33 62 63 32 63 35 33 38 34 32 31 36 36 64  583bc2c53842166d
cf60: 33 65 36 62 61 32 64 36 64 32 0d 0a 0d 0a 71 75  3e6ba2d6d2....qu
cf70: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
cf80: 45 4c 45 43 54 20 2d 20 28 20 33 30 20 29 20 2a  ELECT - ( 30 ) *
cf90: 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63   col2 + col0 * c
cfa0: 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 + + cor0.col
cfb0: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
cfc0: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
cfd0: 2d 31 37 34 0d 0a 34 30 0d 0a 34 39 32 37 0d 0a  -174..40..4927..
cfe0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cff0: 74 0d 0a 53 45 4c 45 43 54 20 35 30 20 2a 20 2d  t..SELECT 50 * -
d000: 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63   col0 + + cor0.c
d010: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
d020: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
d030: 2d 2d 2d 0d 0a 2d 33 31 39 0d 0a 2d 33 38 34 31  ---..-319..-3841
d040: 0d 0a 2d 33 39 33 33 0d 0a 0d 0a 71 75 65 72 79  ..-3933....query
d050: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d060: 43 54 20 2d 20 32 37 20 2b 20 36 38 20 2b 20 63  CT - 27 + 68 + c
d070: 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  or0.col0 * - col
d080: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
d090: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
d0a0: 2d 0d 0a 2d 31 31 38 34 0d 0a 2d 35 33 35 0d 0a  -..-1184..-535..
d0b0: 2d 37 38 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -7880....query I
d0c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
d0d0: 20 41 4c 4c 20 2d 20 2b 20 33 33 20 46 52 4f 4d   ALL - + 33 FROM
d0e0: 20 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53   tab1 cor0 CROSS
d0f0: 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f   JOIN tab1 AS co
d100: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
d110: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 30  es hashing to 80
d120: 33 35 63 36 36 35 61 37 35 64 32 32 62 65 35 39  35c665a75d22be59
d130: 32 32 62 65 31 61 34 65 35 37 34 65 30 33 0d 0a  22be1a4e574e03..
d140: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d150: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
d160: 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  CT - col2 * col1
d170: 20 2b 20 34 35 20 46 52 4f 4d 20 74 61 62 30 20   + 45 FROM tab0 
d180: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 39  cor0..----..-279
d190: 33 0d 0a 2d 35 32 0d 0a 2d 37 34 31 37 0d 0a 0d  3..-52..-7417...
d1a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d1b0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
d1c0: 63 6f 6c 30 20 2a 20 2b 20 28 20 2b 20 28 20 2d  col0 * + ( + ( -
d1d0: 20 63 6f 6c 31 20 29 20 29 20 2d 20 28 20 63 6f   col1 ) ) - ( co
d1e0: 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
d1f0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
d200: 2d 2d 2d 2d 0d 0a 2d 31 33 36 30 0d 0a 2d 32 34  ----..-1360..-24
d210: 38 0d 0a 2d 34 36 36 31 0d 0a 0d 0a 71 75 65 72  8..-4661....quer
d220: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
d230: 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
d240: 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 2d  + ( + col2 ) * -
d250: 20 63 6f 6c 31 20 2b 20 2b 20 35 36 20 2a 20 2d   col1 + + 56 * -
d260: 20 36 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   60 AS col1 FROM
d270: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
d280: 2d 2d 2d 0d 0a 2d 31 30 37 34 30 0d 0a 2d 33 34  ---..-10740..-34
d290: 35 36 0d 0a 2d 36 31 36 35 0d 0a 0d 0a 71 75 65  56..-6165....que
d2a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d2b0: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2b 20  LECT + col0 - + 
d2c0: 36 38 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  68 * + col2 AS c
d2d0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
d2e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 36 39 0d  r0..----..-3669.
d2f0: 0a 2d 33 38 31 32 0d 0a 2d 36 34 34 38 0d 0a 0d  .-3812..-6448...
d300: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d310: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
d320: 2d 20 2d 20 32 20 46 52 4f 4d 20 74 61 62 32 20  - - 2 FROM tab2 
d330: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
d340: 38 0d 0a 32 39 0d 0a 34 30 0d 0a 0d 0a 73 6b 69  8..29..40....ski
d350: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
d360: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
d370: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
d380: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
d390: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
d3a0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
d3b0: 53 54 49 4e 43 54 20 2d 20 2b 20 28 20 63 6f 6c  STINCT - + ( col
d3c0: 30 20 29 20 2a 20 2d 20 37 39 20 63 6f 6c 30 20  0 ) * - 79 col0 
d3d0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
d3e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 36 0d 0a 32  0..----..1896..2
d3f0: 37 36 35 0d 0a 37 30 33 31 0d 0a 0d 0a 71 75 65  765..7031....que
d400: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d410: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e  LECT ALL + cor0.
d420: 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  col0 + col0 * + 
d430: 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
d440: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
d450: 2d 0d 0a 31 32 36 30 0d 0a 36 30 30 0d 0a 38 30  -..1260..600..80
d460: 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
d470: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
d480: 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 2b 20 37  + ( col2 ) * + 7
d490: 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  7 AS col0 FROM t
d4a0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
d4b0: 2d 0d 0a 2d 32 30 30 32 0d 0a 2d 32 30 37 39 0d  -..-2002..-2079.
d4c0: 0a 2d 32 39 32 36 0d 0a 0d 0a 71 75 65 72 79 20  .-2926....query 
d4d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d4e0: 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
d4f0: 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  2 * - cor0.col1 
d500: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
d510: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
d520: 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30  .1248..1404..570
d530: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
d540: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
d550: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
d560: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
d570: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d580: 33 35 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  356..SELECT DIST
d590: 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 44  INCT cor0.col2 D
d5a0: 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41  IV + cor0.col0 A
d5b0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
d5c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d5d0: 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 73 6b 69 70  0..1..18....skip
d5e0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
d5f0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
d600: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
d610: 2d 33 35 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  -356..SELECT DIS
d620: 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20  TINCT cor0.col2 
d630: 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  / + cor0.col0 AS
d640: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
d650: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
d660: 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 71 75 65 72 79  ..1..18....query
d670: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d680: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
d690: 36 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  61 * col0 FROM t
d6a0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
d6b0: 2d 0d 0a 2d 31 34 36 34 0d 0a 2d 32 31 33 35 0d  -..-1464..-2135.
d6c0: 0a 2d 35 34 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-5429....onlyif
d6d0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
d6e0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
d6f0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
d700: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
d710: 6c 61 62 65 6c 2d 33 35 38 0d 0a 53 45 4c 45 43  label-358..SELEC
d720: 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  T + col2 * col0 
d730: 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  DIV col0 AS col1
d740: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
d750: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37  r0..----..26..27
d760: 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..38....skipif m
d770: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
d780: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
d790: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35 38  owsort label-358
d7a0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
d7b0: 2a 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 41 53  * col0 / col0 AS
d7c0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
d7d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
d7e0: 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65  6..27..38....que
d7f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d800: 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20 28  LECT ALL + ( - (
d810: 20 74 61 62 30 2e 63 6f 6c 31 20 29 20 29 20 2b   tab0.col1 ) ) +
d820: 20 2b 20 28 20 2d 20 28 20 2d 20 74 61 62 30 2e   + ( - ( - tab0.
d830: 63 6f 6c 32 20 29 20 29 20 2a 20 63 6f 72 30 2e  col2 ) ) * cor0.
d840: 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
d850: 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61  M tab0, tab1, ta
d860: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
d870: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
d880: 69 6e 67 20 74 6f 20 33 66 37 39 65 63 31 35 36  ing to 3f79ec156
d890: 38 65 30 66 37 62 34 61 31 61 38 66 36 65 33 32  8e0f7b4a1a8f6e32
d8a0: 33 30 38 63 62 62 61 0d 0a 0d 0a 6f 6e 6c 79 69  308cbba....onlyi
d8b0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
d8c0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
d8d0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
d8e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d8f0: 20 6c 61 62 65 6c 2d 33 36 30 0d 0a 53 45 4c 45   label-360..SELE
d900: 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 30 20  CT ALL + ( col0 
d910: 2b 20 2d 20 63 6f 6c 30 20 29 20 44 49 56 20 2d  + - col0 ) DIV -
d920: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
d930: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
d940: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
d950: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
d960: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d970: 20 6c 61 62 65 6c 2d 33 36 30 0d 0a 53 45 4c 45   label-360..SELE
d980: 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 30 20  CT ALL + ( col0 
d990: 2b 20 2d 20 63 6f 6c 30 20 29 20 2f 20 2d 20 63  + - col0 ) / - c
d9a0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
d9b0: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
d9c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d9d0: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 34 31 20 2b  .SELECT + + 41 +
d9e0: 20 32 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f   20 FROM tab1 co
d9f0: 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
da00: 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
da10: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
da20: 6e 67 20 74 6f 20 30 37 31 34 39 39 30 35 61 37  ng to 07149905a7
da30: 32 62 64 38 37 35 35 33 33 38 31 66 33 34 64 31  2bd87553381f34d1
da40: 39 65 64 32 39 30 0d 0a 0d 0a 73 6b 69 70 69 66  9ed290....skipif
da50: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
da60: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
da70: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
da80: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
da90: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
daa0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
dab0: 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d  NCT - + col2 * -
dac0: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63   col0 * + cor0.c
dad0: 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol2 col0 FROM ta
dae0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
daf0: 0d 0a 31 31 34 30 37 36 0d 0a 35 31 30 33 0d 0a  ..114076..5103..
db00: 35 32 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  52728....query I
db10: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
db20: 20 44 49 53 54 49 4e 43 54 20 2b 20 39 20 2a 20   DISTINCT + 9 * 
db30: 2b 20 63 6f 6c 31 20 2b 20 33 37 20 46 52 4f 4d  + col1 + 37 FROM
db40: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
db50: 2d 2d 2d 0d 0a 31 32 37 0d 0a 31 35 34 0d 0a 32  ---..127..154..2
db60: 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  71....query I ro
db70: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
db80: 32 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  22 * col2 AS col
db90: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
dba0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 0d  or0..----..1188.
dbb0: 0a 31 32 35 34 0d 0a 32 31 31 32 0d 0a 0d 0a 71  .1254..2112....q
dbc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
dbd0: 53 45 4c 45 43 54 20 2b 20 2d 20 31 39 20 2b 20  SELECT + - 19 + 
dbe0: 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63  col1 * col1 AS c
dbf0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
dc00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 37 37 0d 0a  r0..----..7377..
dc10: 38 32 36 32 0d 0a 39 33 39 30 0d 0a 0d 0a 71 75  8262..9390....qu
dc20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
dc30: 45 4c 45 43 54 20 2b 20 39 32 20 41 53 20 63 6f  ELECT + 92 AS co
dc40: 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
dc50: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
dc60: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
dc70: 6e 67 20 74 6f 20 35 31 36 66 61 34 35 63 38 62  ng to 516fa45c8b
dc80: 30 36 66 39 66 36 37 64 36 65 35 30 30 62 66 64  06f9f67d6e500bfd
dc90: 34 33 35 63 31 61 0d 0a 0d 0a 6f 6e 6c 79 69 66  435c1a....onlyif
dca0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
dcb0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
dcc0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
dcd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
dce0: 6c 61 62 65 6c 2d 33 36 37 0d 0a 53 45 4c 45 43  label-367..SELEC
dcf0: 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  T cor0.col1 + co
dd00: 6c 31 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63  l1 DIV col0 AS c
dd10: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
dd20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 39 0d   cor0..----..89.
dd30: 0a 39 32 0d 0a 39 39 0d 0a 0d 0a 73 6b 69 70 69  .92..99....skipi
dd40: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
dd50: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
dd60: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
dd70: 33 36 37 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  367..SELECT cor0
dd80: 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2f 20 63  .col1 + col1 / c
dd90: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
dda0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
ddb0: 2d 2d 2d 0d 0a 38 39 0d 0a 39 32 0d 0a 39 39 0d  ---..89..92..99.
ddc0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
ddd0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
dde0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
ddf0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
de00: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
de10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
de20: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34  ECT DISTINCT - 4
de30: 38 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  8 * + tab1.col0 
de40: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
de50: 2d 2d 2d 2d 0d 0a 2d 31 34 34 0d 0a 2d 33 30 37  ----..-144..-307
de60: 32 0d 0a 2d 33 38 34 30 0d 0a 0d 0a 6f 6e 6c 79  2..-3840....only
de70: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
de80: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
de90: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
dea0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
deb0: 74 20 6c 61 62 65 6c 2d 33 36 39 0d 0a 53 45 4c  t label-369..SEL
dec0: 45 43 54 20 2b 20 63 6f 72 31 2e 63 6f 6c 30 20  ECT + cor1.col0 
ded0: 44 49 56 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  DIV cor0.col2 AS
dee0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c   col1 FROM tab0,
def0: 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61 62 31   tab0 cor0, tab1
df00: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
df10: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
df20: 67 20 74 6f 20 63 36 62 64 31 36 34 64 39 65 62  g to c6bd164d9eb
df30: 34 65 39 30 33 36 64 38 30 33 65 38 32 61 30 37  4e9036d803e82a07
df40: 64 33 30 37 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  d3075....skipif 
df50: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
df60: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
df70: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 36  rowsort label-36
df80: 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 31  9..SELECT + cor1
df90: 2e 63 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f 6c  .col0 / cor0.col
dfa0: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
dfb0: 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30 2c 20  ab0, tab0 cor0, 
dfc0: 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
dfd0: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
dfe0: 73 68 69 6e 67 20 74 6f 20 63 36 62 64 31 36 34  shing to c6bd164
dff0: 64 39 65 62 34 65 39 30 33 36 64 38 30 33 65 38  d9eb4e9036d803e8
e000: 32 61 30 37 64 33 30 37 35 0d 0a 0d 0a 71 75 65  2a07d3075....que
e010: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
e020: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
e030: 35 39 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  59 * - col2 * + 
e040: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
e050: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
e060: 36 35 0d 0a 34 33 30 35 38 32 0d 0a 34 36 37 32  65..430582..4672
e070: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
e080: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
e090: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
e0a0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
e0b0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
e0c0: 2d 33 37 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -371..SELECT ALL
e0d0: 20 2d 20 63 6f 6c 30 20 44 49 56 20 36 31 20 46   - col0 DIV 61 F
e0e0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
e0f0: 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -1..0..0....skip
e100: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
e110: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
e120: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
e130: 2d 33 37 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -371..SELECT ALL
e140: 20 2d 20 63 6f 6c 30 20 2f 20 36 31 20 46 52 4f   - col0 / 61 FRO
e150: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
e160: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..0..0....onlyif
e170: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
e180: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
e190: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
e1a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
e1b0: 6c 61 62 65 6c 2d 33 37 32 0d 0a 53 45 4c 45 43  label-372..SELEC
e1c0: 54 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  T + ( + cor0.col
e1d0: 30 20 29 20 44 49 56 20 63 6f 6c 30 20 41 53 20  0 ) DIV col0 AS 
e1e0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
e1f0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
e200: 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..1....skipif 
e210: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
e220: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
e230: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
e240: 32 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20  2..SELECT + ( + 
e250: 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2f 20 63 6f  cor0.col0 ) / co
e260: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
e270: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
e280: 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71  --..1..1..1....q
e290: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e2a0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
e2b0: 32 20 2b 20 2d 20 38 30 20 41 53 20 63 6f 6c 30  2 + - 80 AS col0
e2c0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
e2d0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 0d 0a  r0..----..-113..
e2e0: 2d 31 36 32 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65  -162..-81....que
e2f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
e300: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
e310: 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2b 20  col0 * col1 * + 
e320: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
e330: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 35  or0..----..11965
e340: 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35 39 0d 0a  2..51034..5859..
e350: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
e360: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
e370: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
e380: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
e390: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
e3a0: 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  5..SELECT + col0
e3b0: 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20   + - col0 DIV - 
e3c0: 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
e3d0: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
e3e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 37 30  or0..----..3..70
e3f0: 0d 0a 38 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..86....skipif m
e400: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
e410: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
e420: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 35  owsort label-375
e430: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
e440: 2b 20 2d 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 72  + - col0 / - cor
e450: 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
e460: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
e470: 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 37 30 0d 0a 38  ..----..3..70..8
e480: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
e490: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
e4a0: 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 74   + tab1.col1 * t
e4b0: 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  ab1.col2 AS col1
e4c0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
e4d0: 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37  ..1248..1404..57
e4e0: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
e4f0: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
e500: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
e510: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
e520: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
e530: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
e540: 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 43 41  7..SELECT - - CA
e550: 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e  ST( col1 AS SIGN
e560: 45 44 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  ED ) * cor0.col1
e570: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
e580: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d 0a 33  r0..----..289..3
e590: 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a 73 6b 69 70  481..961....skip
e5a0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
e5b0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
e5c0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
e5d0: 2d 33 37 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -377..SELECT - -
e5e0: 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20   CAST ( col1 AS 
e5f0: 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 72 30  INTEGER ) * cor0
e600: 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20  .col1 FROM tab2 
e610: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
e620: 38 39 0d 0a 33 34 38 31 0d 0a 39 36 31 0d 0a 0d  89..3481..961...
e630: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e640: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
e650: 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T - cor0.col2 * 
e660: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31  cor0.col2 + col1
e670: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
e680: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
e690: 0d 0a 2d 32 38 39 30 0d 0a 2d 33 32 33 39 0d 0a  ..-2890..-3239..
e6a0: 2d 39 32 30 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  -9203....skipif 
e6b0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
e6c0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
e6d0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
e6e0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
e6f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e700: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
e710: 43 54 20 2b 20 31 38 20 2a 20 28 20 63 6f 6c 32  CT + 18 * ( col2
e720: 20 2a 20 2d 20 31 37 20 29 20 63 6f 6c 30 20 46   * - 17 ) col0 F
e730: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
e740: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 36 32 38 0d 0a  ..----..-11628..
e750: 2d 37 39 35 36 0d 0a 2d 38 32 36 32 0d 0a 0d 0a  -7956..-8262....
e760: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
e770: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
e780: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
e790: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
e7a0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
e7b0: 72 74 20 6c 61 62 65 6c 2d 33 38 30 0d 0a 53 45  rt label-380..SE
e7c0: 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28  LECT ALL - CAST(
e7d0: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
e7e0: 29 20 2b 20 2b 20 36 33 20 2a 20 2d 20 63 6f 6c  ) + + 63 * - col
e7f0: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
e800: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
e810: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
e820: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
e830: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
e840: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
e850: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 30 0d  wsort label-380.
e860: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41  .SELECT ALL - CA
e870: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
e880: 45 47 45 52 20 29 20 2b 20 2b 20 36 33 20 2a 20  EGER ) + + 63 * 
e890: 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
e8a0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
e8b0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
e8c0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
e8d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e8e0: 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63  ECT - col0 + + c
e8f0: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d  ol1 * + col2 * -
e900: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
e910: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
e920: 31 33 32 0d 0a 2d 36 31 31 39 37 33 0d 0a 2d 39  132..-611973..-9
e930: 33 36 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3678....query I 
e940: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e950: 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ALL + col1 * - c
e960: 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30  or0.col2 AS col0
e970: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
e980: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36  .----..-1534..-6
e990: 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72  46..-837....quer
e9a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e9b0: 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
e9c0: 2b 20 33 38 20 46 52 4f 4d 20 74 61 62 32 20 41  + 38 FROM tab2 A
e9d0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
e9e0: 36 0d 0a 31 31 37 0d 0a 34 35 0d 0a 0d 0a 71 75  6..117..45....qu
e9f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ea00: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
ea10: 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 * - cor0.col
ea20: 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 + col2 FROM ta
ea30: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
ea40: 0d 0a 2d 32 32 0d 0a 2d 36 30 35 38 0d 0a 2d 36  ..-22..-6058..-6
ea50: 32 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  203....query I r
ea60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
ea70: 49 53 54 49 4e 43 54 20 2b 20 2d 20 39 33 20 2a  ISTINCT + - 93 *
ea80: 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a   col1 + - col2 *
ea90: 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
eaa0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
eab0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 30  or0..----..-1010
eac0: 34 39 0d 0a 2d 33 37 34 31 30 0d 0a 2d 36 36 33  49..-37410..-663
ead0: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
eae0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
eaf0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
eb00: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
eb10: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
eb20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
eb30: 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a  ELECT - + col2 *
eb40: 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 63   col1 + + col2 c
eb50: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
eb60: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
eb70: 30 35 0d 0a 2d 37 33 38 30 0d 0a 2d 39 36 0d 0a  05..-7380..-96..
eb80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
eb90: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
eba0: 2d 20 33 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53  - 30 * + col1 AS
ebb0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
ebc0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 30 0d  cor0..----..300.
ebd0: 0a 33 39 30 0d 0a 37 38 30 0d 0a 0d 0a 6f 6e 6c  .390..780....onl
ebe0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
ebf0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
ec00: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
ec10: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
ec20: 72 74 20 6c 61 62 65 6c 2d 33 38 38 0d 0a 53 45  rt label-388..SE
ec30: 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20 2d 20  LECT col2 DIV - 
ec40: 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
ec50: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
ec60: 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b  -1..-1..-1....sk
ec70: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
ec80: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
ec90: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
eca0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
ecb0: 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
ecc0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
ecd0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
ece0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 38 0d  wsort label-388.
ecf0: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 2d  .SELECT col2 / -
ed00: 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
ed10: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
ed20: 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71  .-1..-1..-1....q
ed30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ed40: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
ed50: 6f 6c 31 20 2a 20 31 35 20 41 53 20 63 6f 6c 31  ol1 * 15 AS col1
ed60: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
ed70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 30 0d 0a  r0..----..1290..
ed80: 31 33 36 35 0d 0a 31 34 35 35 0d 0a 0d 0a 6f 6e  1365..1455....on
ed90: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
eda0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
edb0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
edc0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
edd0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ede0: 20 6c 61 62 65 6c 2d 33 39 30 0d 0a 53 45 4c 45   label-390..SELE
edf0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
ee00: 6c 31 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20  l1 - CAST( NULL 
ee10: 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f  AS SIGNED ) * co
ee20: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
ee30: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
ee40: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
ee50: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
ee60: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
ee70: 72 74 20 6c 61 62 65 6c 2d 33 39 30 0d 0a 53 45  rt label-390..SE
ee80: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
ee90: 63 6f 6c 31 20 2d 20 43 41 53 54 20 28 20 4e 55  col1 - CAST ( NU
eea0: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
eeb0: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
eec0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
eed0: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
eee0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
eef0: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
ef00: 2a 20 2b 20 28 20 2b 20 36 35 20 2b 20 2b 20 63  * + ( + 65 + + c
ef10: 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63  ol1 ) * - cor0.c
ef20: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
ef30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36   cor0..----..116
ef40: 34 30 37 32 0d 0a 31 35 37 31 34 0d 0a 34 32 38  4072..15714..428
ef50: 35 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  538....query I r
ef60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
ef70: 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30  ISTINCT + - cor0
ef80: 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2d  .col1 * col1 * -
ef90: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
efa0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
efb0: 37 37 35 30 34 0d 0a 33 32 39 33 31 35 0d 0a 37  77504..329315..7
efc0: 33 37 30 30 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  37009....skipif 
efd0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
efe0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
eff0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
f000: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
f010: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f020: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
f030: 6c 31 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46  l1 + col0 col1 F
f040: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
f050: 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a  ..----..29..74..
f060: 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  93....query I ro
f070: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
f080: 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  L + + cor0.col0 
f090: 2a 20 28 20 32 30 20 29 20 46 52 4f 4d 20 74 61  * ( 20 ) FROM ta
f0a0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
f0b0: 0d 0a 31 32 38 30 0d 0a 31 36 30 30 0d 0a 36 30  ..1280..1600..60
f0c0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f0d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
f0e0: 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63  l2 - + col0 AS c
f0f0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
f100: 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31 37 36 0d  ---..-121..-176.
f110: 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-57....query I 
f120: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f130: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
f140: 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  - - col0 * col2 
f150: 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  * col0 FROM tab0
f160: 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 34 0d 0a 31 38  ..----..1224..18
f170: 39 37 35 0d 0a 36 34 39 34 34 30 0d 0a 0d 0a 73  975..649440....s
f180: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
f190: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
f1a0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
f1b0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
f1c0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
f1d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f1e0: 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d  ALL + + col0 * -
f1f0: 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29   ( + cor0.col1 )
f200: 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   - col1 * + col2
f210: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
f220: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
f230: 31 35 35 36 31 0d 0a 2d 33 34 39 32 0d 0a 2d 34  15561..-3492..-4
f240: 39 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  902....query I r
f250: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
f260: 49 53 54 49 4e 43 54 20 2d 20 74 61 62 31 2e 63  ISTINCT - tab1.c
f270: 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63  ol1 + + col2 * c
f280: 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol2 * col1 AS co
f290: 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
f2a0: 2d 2d 0d 0a 31 31 39 37 39 35 0d 0a 33 32 34 38  --..119795..3248
f2b0: 30 0d 0a 37 35 37 39 30 0d 0a 0d 0a 71 75 65 72  0..75790....quer
f2c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f2d0: 45 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20  ECT + tab2.col1 
f2e0: 2a 20 2d 20 28 20 36 36 20 29 20 46 52 4f 4d 20  * - ( 66 ) FROM 
f2f0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32  tab2..----..-112
f300: 32 0d 0a 2d 32 30 34 36 0d 0a 2d 33 38 39 34 0d  2..-2046..-3894.
f310: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
f320: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
f330: 4e 43 54 20 2d 20 63 6f 6c 30 20 2d 20 39 31 20  NCT - col0 - 91 
f340: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
f350: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 39 0d 0a 2d  0..----..-169..-
f360: 31 37 30 0d 0a 2d 39 38 0d 0a 0d 0a 73 6b 69 70  170..-98....skip
f370: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
f380: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
f390: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
f3a0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
f3b0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
f3c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
f3d0: 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  0 * - col2 + + c
f3e0: 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
f3f0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
f400: 0d 0a 2d 31 35 39 0d 0a 2d 33 35 38 34 0d 0a 2d  ..-159..-3584..-
f410: 37 36 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7600....query I 
f420: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f430: 41 4c 4c 20 36 20 2a 20 63 6f 72 30 2e 63 6f 6c  ALL 6 * cor0.col
f440: 30 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  0 * col2 + - col
f450: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
f460: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 37 0d  or0..----..1107.
f470: 0a 31 32 31 34 32 0d 0a 31 37 39 37 34 0d 0a 0d  .12142..17974...
f480: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
f490: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
f4a0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
f4b0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
f4c0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
f4d0: 6f 72 74 20 6c 61 62 65 6c 2d 34 30 33 0d 0a 53  ort label-403..S
f4e0: 45 4c 45 43 54 20 2d 20 2d 20 43 41 53 54 28 20  ELECT - - CAST( 
f4f0: 2d 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  - col1 AS SIGNED
f500: 20 29 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63   ) * - col2 AS c
f510: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
f520: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   cor0..----..124
f530: 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a  8..1404..570....
f540: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
f550: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
f560: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
f570: 61 62 65 6c 2d 34 30 33 0d 0a 53 45 4c 45 43 54  abel-403..SELECT
f580: 20 2d 20 2d 20 43 41 53 54 20 28 20 2d 20 63 6f   - - CAST ( - co
f590: 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
f5a0: 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  * - col2 AS col1
f5b0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
f5c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a  r0..----..1248..
f5d0: 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65  1404..570....que
f5e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f5f0: 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 36 36  LECT col2 + + 66
f600: 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * + col0 AS col
f610: 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
f620: 0d 0a 2d 2d 2d 2d 0d 0a 34 38 39 0d 0a 35 31 37  ..----..489..517
f630: 34 0d 0a 35 32 35 32 0d 0a 0d 0a 71 75 65 72 79  4..5252....query
f640: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
f650: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
f660: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41   - col1 * col0 A
f670: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
f680: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
f690: 33 31 0d 0a 2d 33 33 39 34 0d 0a 2d 38 30 31 37  31..-3394..-8017
f6a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f6b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
f6c0: 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  INCT + col1 + - 
f6d0: 39 39 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  99 FROM tab0..--
f6e0: 2d 2d 0d 0a 2d 31 33 0d 0a 2d 32 0d 0a 2d 38 0d  --..-13..-2..-8.
f6f0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
f700: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
f710: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
f720: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
f730: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
f740: 30 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  07..SELECT col0 
f750: 2a 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20  * col0 DIV col2 
f760: 2b 20 2b 20 63 6f 6c 31 20 2a 20 37 32 20 41 53  + + col1 * 72 AS
f770: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
f780: 0a 2d 2d 2d 2d 0d 0a 36 32 30 39 0d 0a 36 36 34  .----..6209..664
f790: 38 0d 0a 38 32 30 39 0d 0a 0d 0a 73 6b 69 70 69  8..8209....skipi
f7a0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
f7b0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
f7c0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
f7d0: 34 30 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  407..SELECT col0
f7e0: 20 2a 20 63 6f 6c 30 20 2f 20 63 6f 6c 32 20 2b   * col0 / col2 +
f7f0: 20 2b 20 63 6f 6c 31 20 2a 20 37 32 20 41 53 20   + col1 * 72 AS 
f800: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
f810: 2d 2d 2d 2d 0d 0a 36 32 30 39 0d 0a 36 36 34 38  ----..6209..6648
f820: 0d 0a 38 32 30 39 0d 0a 0d 0a 71 75 65 72 79 20  ..8209....query 
f830: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f840: 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 28 20 2d  T ALL col0 + ( -
f850: 20 28 20 2d 20 63 6f 6c 31 20 29 20 29 20 41 53   ( - col1 ) ) AS
f860: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
f870: 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39  .----..29..74..9
f880: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
f890: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
f8a0: 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c  TINCT col1 * col
f8b0: 30 20 2b 20 31 36 20 2a 20 2b 20 63 6f 6c 32 20  0 + 16 * + col2 
f8c0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
f8d0: 0a 31 35 35 32 0d 0a 32 35 37 36 0d 0a 39 34 32  .1552..2576..942
f8e0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
f8f0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
f900: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
f910: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
f920: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
f930: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f940: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  LECT + col0 + + 
f950: 32 30 20 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c 31  20 + - col1 col1
f960: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
f970: 0d 0a 2d 33 0d 0a 37 34 0d 0a 38 37 0d 0a 0d 0a  ..-3..74..87....
f980: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
f990: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
f9a0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
f9b0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
f9c0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
f9d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f9e0: 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 30 20 29   col0 + ( col0 )
f9f0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
fa00: 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a  .----..14..156..
fa10: 31 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  158....query I r
fa20: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
fa30: 49 53 54 49 4e 43 54 20 2b 20 30 20 46 52 4f 4d  ISTINCT + 0 FROM
fa40: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
fa50: 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
fa60: 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  1..----..0....qu
fa70: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
fa80: 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b  ELECT + - col2 +
fa90: 20 63 6f 6c 30 20 2a 20 2d 20 37 33 20 46 52 4f   col0 * - 73 FRO
faa0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
fab0: 2d 2d 2d 2d 0d 0a 2d 31 37 38 35 0d 0a 2d 32 35  ----..-1785..-25
fac0: 35 36 0d 0a 2d 36 35 37 39 0d 0a 0d 0a 71 75 65  56..-6579....que
fad0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
fae0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 20  LECT DISTINCT 9 
faf0: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
fb00: 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
fb10: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 0d 0a   cor1..----..9..
fb20: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
fb30: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
fb40: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
fb50: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
fb60: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
fb70: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
fb80: 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 28 20  CT + col1 * + ( 
fb90: 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 35 36  col2 * col1 + 56
fba0: 20 2a 20 2d 20 63 6f 6c 31 20 29 20 63 6f 6c 32   * - col1 ) col2
fbb0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
fbc0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 32 0d  r0..----..-1352.
fbd0: 0a 31 30 30 0d 0a 36 37 36 30 0d 0a 0d 0a 71 75  .100..6760....qu
fbe0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
fbf0: 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63  ELECT col0 * + c
fc00: 6f 72 30 2e 63 6f 6c 31 20 2a 20 28 20 2b 20 63  or0.col1 * ( + c
fc10: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 29 20 46  ol2 * + col0 ) F
fc20: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
fc30: 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 33 36 0d 0a 32  ..----..12636..2
fc40: 33 33 34 37 32 30 0d 0a 37 39 38 37 32 30 30 0d  334720..7987200.
fc50: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
fc60: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
fc70: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
fc80: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
fc90: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
fca0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
fcb0: 45 43 54 20 41 4c 4c 20 2b 20 34 37 20 2a 20 2b  ECT ALL + 47 * +
fcc0: 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2b 20 28   tab0.col0 * + (
fcd0: 20 32 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74   2 ) col1 FROM t
fce0: 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
fcf0: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
fd00: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 66 61  s hashing to bfa
fd10: 33 34 62 65 61 31 62 38 65 66 61 32 30 32 36 39  34bea1b8efa20269
fd20: 62 34 61 39 37 62 62 37 31 38 65 37 63 0d 0a 0d  b4a97bb718e7c...
fd30: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
fd40: 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 37  ..SELECT - ( - 7
fd50: 38 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  8 ) * col0 FROM 
fd60: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 37 32  tab0..----..1872
fd70: 0d 0a 32 37 33 30 0d 0a 36 39 34 32 0d 0a 0d 0a  ..2730..6942....
fd80: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
fd90: 0a 53 45 4c 45 43 54 20 28 20 2b 20 36 37 20 29  .SELECT ( + 67 )
fda0: 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46   * + cor0.col2 F
fdb0: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 2c 20  ROM tab2, tab1, 
fdc0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
fdd0: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
fde0: 73 68 69 6e 67 20 74 6f 20 31 38 33 30 32 32 33  shing to 1830223
fdf0: 38 38 61 30 61 64 32 63 66 62 34 33 65 36 61 34  88a0ad2cfb43e6a4
fe00: 38 30 32 31 66 37 33 61 32 0d 0a 0d 0a 71 75 65  8021f73a2....que
fe10: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
fe20: 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20 29 20  LECT - ( col2 ) 
fe30: 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * + col2 AS col2
fe40: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
fe50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
fe60: 30 38 39 0d 0a 2d 36 37 32 34 0d 0a 0d 0a 71 75  089..-6724....qu
fe70: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
fe80: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
fe90: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63   cor0.col0 * + c
fea0: 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  ol2 + - col0 AS 
feb0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
fec0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
fed0: 30 0d 0a 2d 37 33 38 37 0d 0a 2d 38 31 36 0d 0a  0..-7387..-816..
fee0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fef0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
ff00: 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20  ( cor0.col0 ) * 
ff10: 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 34 36 20 41  cor0.col1 - 46 A
ff20: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
ff30: 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
ff40: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
ff50: 61 73 68 69 6e 67 20 74 6f 20 66 38 63 38 66 62  ashing to f8c8fb
ff60: 36 62 61 37 64 34 62 31 34 34 32 64 36 30 33 36  6ba7d4b1442d6036
ff70: 61 37 36 33 61 65 39 65 63 39 0d 0a 0d 0a 71 75  a763ae9ec9....qu
ff80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ff90: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
ffa0: 20 33 39 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20   39 + col1 FROM 
ffb0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
ffc0: 2d 2d 0d 0a 31 30 37 33 0d 0a 31 30 38 34 0d 0a  --..1073..1084..
ffd0: 31 34 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1499....query I 
ffe0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
fff0: 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 31 20  + col0 - - col1 
10000 2a 20 2d 20 28 20 2d 20 28 20 63 6f 72 30 2e 63  * - ( - ( cor0.c
10010 6f 6c 32 20 29 20 29 20 41 53 20 63 6f 6c 31 20  ol2 ) ) AS col1 
10020 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
10030 2d 2d 2d 2d 0d 0a 31 33 32 38 0d 0a 31 34 30 37  ----..1328..1407
10040 0d 0a 36 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..634....query I
10050 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10060 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32   - col0 + - col2
10070 20 2b 20 28 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   + ( col1 + col1
10080 20 2a 20 28 20 2d 20 63 6f 6c 30 20 29 20 29 20   * ( - col0 ) ) 
10090 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
100a0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
100b0 0a 2d 31 30 39 0d 0a 2d 31 32 30 33 0d 0a 2d 37  .-109..-1203..-7
100c0 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  51....query I ro
100d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
100e0 4c 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63  L + + col1 + - c
100f0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f  ol2 + - col2 FRO
10100 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
10110 2d 2d 2d 2d 0d 0a 2d 37 33 0d 0a 32 30 0d 0a 39  ----..-73..20..9
10120 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
10130 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
10140 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c   col0 + cor0.col
10150 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  1 * - col1 + + c
10160 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
10170 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
10180 32 0d 0a 2d 33 33 37 37 0d 0a 2d 39 32 37 0d 0a  2..-3377..-927..
10190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
101a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
101b0 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  CT - + col2 * co
101c0 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46  r0.col2 + col0 F
101d0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
101e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 33 0d 0a 2d  ..----..-2913..-
101f0 33 31 38 35 0d 0a 2d 39 31 33 36 0d 0a 0d 0a 71  3185..-9136....q
10200 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10210 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
10220 32 37 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41  27 + cor0.col1 A
10230 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
10240 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10250 33 37 0d 0a 34 30 0d 0a 35 33 0d 0a 0d 0a 71 75  37..40..53....qu
10260 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10270 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b  ELECT + col2 * +
10280 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b   col2 * + col0 +
10290 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
102a0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
102b0 0a 31 31 34 31 35 35 0d 0a 35 31 31 30 0d 0a 35  .114155..5110..5
102c0 32 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2806....query I 
102d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
102e0 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f  - cor0.col0 + co
102f0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
10300 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
10310 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
10320 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10330 45 43 54 20 2b 20 35 37 20 2a 20 2b 20 63 6f 6c  ECT + 57 * + col
10340 32 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 - + col1 FROM 
10350 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
10360 2d 2d 0d 0a 31 34 32 33 0d 0a 31 35 30 38 0d 0a  --..1423..1508..
10370 32 31 34 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  2149....onlyif m
10380 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
10390 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
103a0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
103b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
103c0 62 65 6c 2d 34 33 33 0d 0a 53 45 4c 45 43 54 20  bel-433..SELECT 
103d0 2d 20 2d 20 33 38 20 2d 20 63 6f 6c 30 20 44 49  - - 38 - col0 DI
103e0 56 20 2b 20 32 34 20 41 53 20 63 6f 6c 32 20 46  V + 24 AS col2 F
103f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
10400 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 33 35 0d 0a  ..----..35..35..
10410 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  38....skipif mys
10420 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
10430 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
10440 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33 33 0d 0a  sort label-433..
10450 53 45 4c 45 43 54 20 2d 20 2d 20 33 38 20 2d 20  SELECT - - 38 - 
10460 63 6f 6c 30 20 2f 20 2b 20 32 34 20 41 53 20 63  col0 / + 24 AS c
10470 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
10480 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d   cor0..----..35.
10490 0a 33 35 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79  .35..38....query
104a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
104b0 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  CT + + cor0.col1
104c0 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46   * col1 + col1 F
104d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
104e0 0d 0a 2d 2d 2d 2d 0d 0a 33 30 36 0d 0a 33 35 34  ..----..306..354
104f0 30 0d 0a 39 39 32 0d 0a 0d 0a 71 75 65 72 79 20  0..992....query 
10500 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10510 54 20 44 49 53 54 49 4e 43 54 20 32 34 20 2a 20  T DISTINCT 24 * 
10520 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2d 20 2b 20  + tab1.col2 - + 
10530 36 38 20 2a 20 31 34 20 2a 20 63 6f 6c 30 20 46  68 * 14 * col0 F
10540 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
10550 2d 31 35 36 30 0d 0a 2d 35 39 35 36 30 0d 0a 2d  -1560..-59560..-
10560 37 33 38 35 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  73856....skipif 
10570 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
10580 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
10590 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
105a0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
105b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
105c0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28 20  t..SELECT + + ( 
105d0 2d 20 63 6f 6c 30 20 29 20 2d 20 63 6f 6c 32 20  - col0 ) - col2 
105e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
105f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
10600 30 34 0d 0a 2d 31 31 37 0d 0a 2d 33 34 0d 0a 0d  04..-117..-34...
10610 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10620 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
10630 6f 6c 32 20 2d 20 2d 20 37 39 20 41 53 20 63 6f  ol2 - - 79 AS co
10640 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
10650 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 0d 0a  cor0..----..41..
10660 35 32 0d 0a 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  52..53....onlyif
10670 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
10680 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
10690 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
106a0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
106b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
106c0 65 6c 2d 34 33 38 0d 0a 53 45 4c 45 43 54 20 2d  el-438..SELECT -
106d0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b   + cor0.col2 + +
106e0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
106f0 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
10700 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
10710 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
10720 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
10730 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
10740 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
10750 6f 72 74 20 6c 61 62 65 6c 2d 34 33 38 0d 0a 53  ort label-438..S
10760 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63  ELECT - + cor0.c
10770 6f 6c 32 20 2b 20 2b 20 43 41 53 54 20 28 20 4e  ol2 + + CAST ( N
10780 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
10790 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
107a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
107b0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
107c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
107d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
107e0 6f 6c 32 20 2b 20 28 20 2d 20 37 36 20 2b 20 63  ol2 + ( - 76 + c
107f0 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol1 ) AS col2 FR
10800 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
10810 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 32 31 0d  .----..-18..-21.
10820 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .9....query I ro
10830 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
10840 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  L - cor0.col0 * 
10850 34 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  41 + - cor0.col1
10860 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
10870 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
10880 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 34 38 0d  0..----..-11748.
10890 0a 2d 33 30 34 38 0d 0a 2d 34 38 33 30 0d 0a 0d  .-3048..-4830...
108a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
108b0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
108c0 2b 20 34 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 42 AS col1 FRO
108d0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
108e0 2d 2d 2d 2d 0d 0a 32 39 34 0d 0a 33 32 37 36 0d  ----..294..3276.
108f0 0a 33 33 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  .3318....skipif 
10900 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
10910 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
10920 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
10930 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
10940 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10950 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
10960 2b 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 32 20  + col2 * ( col2 
10970 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  ) col2 FROM tab0
10980 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
10990 31 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a 71 75  1089..6724....qu
109a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
109b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
109c0 20 2d 20 63 6f 6c 30 20 2b 20 36 36 20 46 52 4f   - col0 + 66 FRO
109d0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
109e0 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 32 0d 0a 36 33  ----..-14..2..63
109f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10a00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
10a10 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  INCT - col2 * + 
10a20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f  cor0.col1 * - co
10a30 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  l0 + cor0.col1 *
10a40 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
10a50 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
10a60 0a 2d 2d 2d 2d 0d 0a 31 30 31 30 38 38 0d 0a 33  .----..101088..3
10a70 37 30 35 30 0d 0a 35 36 31 36 0d 0a 0d 0a 71 75  7050..5616....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 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
10aa0 20 2b 20 28 20 34 30 20 29 20 41 53 20 63 6f 6c   + ( 40 ) AS col
10ab0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
10ac0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 30 0d  or0..----..1320.
10ad0 0a 33 32 38 30 0d 0a 34 30 0d 0a 0d 0a 6f 6e 6c  .3280..40....onl
10ae0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
10af0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
10b00 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
10b10 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
10b20 72 74 20 6c 61 62 65 6c 2d 34 34 36 0d 0a 53 45  rt label-446..SE
10b30 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  LECT + + col1 + 
10b40 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col2 + - col1 * 
10b50 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 41 53  col2 DIV col0 AS
10b60 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
10b70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
10b80 36 31 0d 0a 34 37 0d 0a 36 36 0d 0a 0d 0a 73 6b  61..47..66....sk
10b90 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
10ba0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
10bb0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
10bc0 65 6c 2d 34 34 36 0d 0a 53 45 4c 45 43 54 20 2b  el-446..SELECT +
10bd0 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2b   + col1 + col2 +
10be0 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2f   - col1 * col2 /
10bf0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
10c00 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
10c10 0a 2d 2d 2d 2d 0d 0a 2d 36 31 0d 0a 34 37 0d 0a  .----..-61..47..
10c20 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  66....query I ro
10c30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
10c40 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 30 20 29 20  col2 * ( col0 ) 
10c50 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
10c60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10c70 2d 32 30 38 37 0d 0a 2d 32 32 30 0d 0a 2d 33 30  -2087..-220..-30
10c80 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  19....query I ro
10c90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
10ca0 63 6f 6c 32 20 2a 20 35 31 20 2b 20 2b 20 63 6f  col2 * 51 + + co
10cb0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
10cc0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 30 0d 0a  0..----..-1300..
10cd0 2d 31 33 35 30 0d 0a 2d 31 39 30 30 0d 0a 0d 0a  -1350..-1900....
10ce0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10cf0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
10d00 6f 6c 31 20 2b 20 37 20 2a 20 2b 20 63 6f 72 30  ol1 + 7 * + cor0
10d10 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f  .col0 * col0 FRO
10d20 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
10d30 2d 2d 2d 2d 0d 0a 33 39 34 36 0d 0a 35 35 33 35  ----..3946..5535
10d40 36 0d 0a 38 34 37 38 0d 0a 0d 0a 71 75 65 72 79  6..8478....query
10d50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
10d60 43 54 20 39 20 2a 20 2d 20 32 33 20 2b 20 2b 20  CT 9 * - 23 + + 
10d70 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
10d80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
10d90 31 31 0d 0a 2d 31 35 30 0d 0a 2d 31 35 33 0d 0a  11..-150..-153..
10da0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
10db0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
10dc0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
10dd0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
10de0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
10df0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
10e00 43 54 20 32 33 20 63 6f 6c 31 20 46 52 4f 4d 20  CT 23 col1 FROM 
10e10 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
10e20 2d 2d 0d 0a 32 33 0d 0a 32 33 0d 0a 32 33 0d 0a  --..23..23..23..
10e30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10e40 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 36 20 2a  t..SELECT - 36 *
10e50 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
10e60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36  cor0..----..-136
10e70 38 0d 0a 2d 39 33 36 0d 0a 2d 39 37 32 0d 0a 0d  8..-936..-972...
10e80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10e90 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 31 33 20  ..SELECT - - 13 
10ea0 2a 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  * ( + cor0.col0 
10eb0 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
10ec0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
10ed0 31 31 35 37 0d 0a 33 31 32 0d 0a 34 35 35 0d 0a  1157..312..455..
10ee0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10ef0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20  t..SELECT - ( - 
10f00 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20 41 53  col2 ) * col2 AS
10f10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
10f20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
10f30 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d  916..3249..9216.
10f40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10f50 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
10f60 20 28 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 29   ( - tab0.col0 )
10f70 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
10f80 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d  b0..----..-24..-
10f90 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 6f 6e 6c 79 69  35..-89....onlyi
10fa0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
10fb0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
10fc0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
10fd0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
10fe0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10ff0 62 65 6c 2d 34 35 36 0d 0a 53 45 4c 45 43 54 20  bel-456..SELECT 
11000 34 31 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 43 41  41 + col2 * + CA
11010 53 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49  ST( + col2 AS SI
11020 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46  GNED ) AS col0 F
11030 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
11040 0d 0a 2d 2d 2d 2d 0d 0a 32 39 35 37 0d 0a 33 32  ..----..2957..32
11050 39 30 0d 0a 39 32 35 37 0d 0a 0d 0a 73 6b 69 70  90..9257....skip
11060 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
11070 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
11080 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
11090 2d 34 35 36 0d 0a 53 45 4c 45 43 54 20 34 31 20  -456..SELECT 41 
110a0 2b 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 20  + col2 * + CAST 
110b0 28 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54 45  ( + col2 AS INTE
110c0 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52  GER ) AS col0 FR
110d0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
110e0 0a 2d 2d 2d 2d 0d 0a 32 39 35 37 0d 0a 33 32 39  .----..2957..329
110f0 30 0d 0a 39 32 35 37 0d 0a 0d 0a 71 75 65 72 79  0..9257....query
11100 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11110 43 54 20 2b 20 63 6f 6c 30 20 2b 20 35 38 20 41  CT + col0 + 58 A
11120 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
11130 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11140 31 32 32 0d 0a 31 33 38 0d 0a 36 31 0d 0a 0d 0a  122..138..61....
11150 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
11160 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
11170 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
11180 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
11190 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35 38 0d  wsort label-458.
111a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
111b0 20 2a 20 63 6f 6c 32 20 2b 20 74 61 62 31 2e 63   * col2 + tab1.c
111c0 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 46  ol2 DIV + col1 F
111d0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
111e0 32 39 31 38 0d 0a 33 32 35 34 0d 0a 39 32 32 33  2918..3254..9223
111f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
11200 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
11210 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
11220 72 74 20 6c 61 62 65 6c 2d 34 35 38 0d 0a 53 45  rt label-458..SE
11230 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
11240 63 6f 6c 32 20 2b 20 74 61 62 31 2e 63 6f 6c 32  col2 + tab1.col2
11250 20 2f 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   / + col1 FROM t
11260 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 38 0d  ab1..----..2918.
11270 0a 33 32 35 34 0d 0a 39 32 32 33 0d 0a 0d 0a 71  .3254..9223....q
11280 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11290 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20  SELECT col0 * + 
112a0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col2 * - col1 + 
112b0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
112c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 35 39 33 0d  ..----..-119593.
112d0 0a 2d 35 31 30 31 37 0d 0a 2d 35 38 32 38 0d 0a  .-51017..-5828..
112e0 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
112f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
11300 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52  * FROM tab1 WHER
11310 45 20 4e 4f 54 20 2b 20 63 6f 6c 30 20 4e 4f 54  E NOT + col0 NOT
11320 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e   BETWEEN NULL AN
11330 44 20 28 20 2d 20 63 6f 6c 30 20 29 0d 0a 2d 2d  D ( - col0 )..--
11340 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
11350 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
11360 53 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 30  STINCT tab1.col0
11370 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   * - col1 + col1
11380 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 46   * - tab1.col0 F
11390 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
113a0 2d 31 32 38 30 0d 0a 2d 31 35 36 0d 0a 2d 32 30  -1280..-156..-20
113b0 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
113c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
113d0 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f  STINCT col1 * co
113e0 6c 31 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 30  l1 + + tab1.col0
113f0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11400 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32  b1..----..164..2
11410 34 39 0d 0a 36 37 39 0d 0a 0d 0a 71 75 65 72 79  49..679....query
11420 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11430 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20 2b  CT tab1.col2 + +
11440 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab1.col0 FROM 
11450 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d  tab1..----..121.
11460 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72  .176..57....quer
11470 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11480 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  ECT - col0 * col
11490 31 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20  1 * + tab2.col2 
114a0 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20  FROM tab2 WHERE 
114b0 4e 4f 54 20 28 20 63 6f 6c 32 20 29 20 49 4e 20  NOT ( col2 ) IN 
114c0 28 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a  ( col1 )..----..
114d0 2d 31 31 39 36 35 32 0d 0a 2d 35 31 30 33 34 0d  -119652..-51034.
114e0 0a 2d 35 38 35 39 0d 0a 0d 0a 71 75 65 72 79 20  .-5859....query 
114f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11500 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 31 2e  T DISTINCT tab1.
11510 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col1 * + col1 + 
11520 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
11530 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab1..----..11
11540 30 0d 0a 31 38 32 0d 0a 37 30 32 0d 0a 0d 0a 71  0..182..702....q
11550 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11560 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11570 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
11580 20 57 48 45 52 45 20 63 6f 6c 30 20 3d 20 28 20   WHERE col0 = ( 
11590 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  NULL )..----....
115a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
115b0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
115c0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
115d0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
115e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 37 0d  wsort label-467.
115f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
11600 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2d 20 63   tab0.col1 + - c
11610 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 46 52 4f  ol1 DIV col0 FRO
11620 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 33  M tab0..----..83
11630 0d 0a 39 30 0d 0a 39 35 0d 0a 0d 0a 73 6b 69 70  ..90..95....skip
11640 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
11650 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
11660 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
11670 2d 34 36 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  -467..SELECT DIS
11680 54 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 31 20  TINCT tab0.col1 
11690 2b 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20  + - col1 / col0 
116a0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
116b0 0a 38 33 0d 0a 39 30 0d 0a 39 35 0d 0a 0d 0a 73  .83..90..95....s
116c0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
116d0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
116e0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
116f0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
11700 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
11710 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11720 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 63 6f  col1 + + col0 co
11730 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
11740 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a  --..29..74..93..
11750 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11760 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
11770 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  l2 * - col0 + - 
11780 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
11790 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
117a0 38 38 0d 0a 2d 33 36 35 38 0d 0a 2d 37 36 39 33  88..-3658..-7693
117b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
117c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
117d0 62 30 2e 63 6f 6c 31 20 2b 20 74 61 62 30 2e 63  b0.col1 + tab0.c
117e0 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 63  ol2 * - col0 - c
117f0 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20  ol1 * tab0.col1 
11800 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
11810 0a 2d 31 35 34 38 38 0d 0a 2d 38 31 30 32 0d 0a  .-15488..-8102..
11820 2d 39 33 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49  -9347....query I
11830 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11840 20 41 4c 4c 20 2d 20 74 61 62 32 2e 63 6f 6c 30   ALL - tab2.col0
11850 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41   * col1 + col0 A
11860 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
11870 20 57 48 45 52 45 20 4e 4f 54 20 28 20 2b 20 63   WHERE NOT ( + c
11880 6f 6c 31 20 29 20 3c 3d 20 28 20 4e 55 4c 4c 20  ol1 ) <= ( NULL 
11890 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
118a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
118b0 43 54 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  CT + col1 AS col
118c0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
118d0 6f 72 30 20 57 48 45 52 45 20 2b 20 63 6f 6c 30  or0 WHERE + col0
118e0 20 3c 3e 20 28 20 63 6f 6c 30 20 2a 20 63 6f 6c   <> ( col0 * col
118f0 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  0 )..----..10..1
11900 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  3..26....query I
11910 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11920 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
11930 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52  .col2 AS col0 FR
11940 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  OM tab0 AS cor0 
11950 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 32 20 49  WHERE NOT col2 I
11960 4e 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  N ( cor0.col1 * 
11970 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29 0d 0a 2d  + cor0.col0 )..-
11980 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38  ---..-1..-33..-8
11990 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
119a0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
119b0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
119c0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
119d0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
119e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
119f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74  ELECT DISTINCT t
11a00 61 62 32 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  ab2.col2 + col0 
11a10 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d  - col2 col0 FROM
11a20 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a   tab2..----..7..
11a30 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20  78..79....query 
11a40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11a50 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 63  T ALL + col2 * c
11a60 6f 6c 32 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c  ol2 + + tab0.col
11a70 31 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  1 - col1 * + col
11a80 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
11a90 2d 0d 0a 2d 31 32 38 34 0d 0a 2d 33 32 39 37 0d  -..-1284..-3297.
11aa0 0a 2d 38 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-889....onlyif 
11ab0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
11ac0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
11ad0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
11ae0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
11af0 61 62 65 6c 2d 34 37 36 0d 0a 53 45 4c 45 43 54  abel-476..SELECT
11b00 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 44   - col1 * col2 D
11b10 49 56 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a  IV col2 + col0 *
11b20 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
11b30 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
11b40 33 36 0d 0a 33 36 33 38 0d 0a 37 36 36 37 0d 0a  36..3638..7667..
11b50 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
11b60 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
11b70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11b80 20 6c 61 62 65 6c 2d 34 37 36 0d 0a 53 45 4c 45   label-476..SELE
11b90 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  CT - col1 * col2
11ba0 20 2f 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a   / col2 + col0 *
11bb0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
11bc0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
11bd0 33 36 0d 0a 33 36 33 38 0d 0a 37 36 36 37 0d 0a  36..3638..7667..
11be0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11bf0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
11c00 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   + col0 * - col0
11c10 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
11c20 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32  b0..----..-11882
11c30 35 0d 0a 2d 34 39 35 33 36 0d 0a 2d 37 32 30 38  5..-49536..-7208
11c40 31 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  11....skipif pos
11c50 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
11c60 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
11c70 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
11c80 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
11c90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11ca0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11cb0 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  - col0 + - col2 
11cc0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20  + col1 * col1 * 
11cd0 2d 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  - col1 col2 FROM
11ce0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   tab2..----..-20
11cf0 35 34 38 33 0d 0a 2d 32 39 38 32 35 0d 0a 2d 35  5483..-29825..-5
11d00 30 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  030....query I r
11d10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
11d20 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b  ISTINCT + col2 +
11d30 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 46   col2 + - col2 F
11d40 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
11d50 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65  1..33..82....que
11d60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11d70 4c 45 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 30  LECT - tab2.col0
11d80 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 41   * - tab2.col1 A
11d90 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
11da0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31  ..----..1343..21
11db0 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79  7..4602....query
11dc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11dd0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20  CT ALL - col2 * 
11de0 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20  + col0 * col2 + 
11df0 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 46 52  col2 + + col2 FR
11e00 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
11e10 31 31 34 30 30 30 0d 0a 2d 35 30 34 39 0d 0a 2d  114000..-5049..-
11e20 35 32 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  52676....query I
11e30 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
11e40 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52  CT DISTINCT * FR
11e50 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f  OM tab1 WHERE NO
11e60 54 20 4e 55 4c 4c 20 49 4e 20 28 20 2d 20 63 6f  T NULL IN ( - co
11e70 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l1 )..----....qu
11e80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11e90 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b  ELECT - col2 * +
11ea0 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30 20 46   col1 - + col0 F
11eb0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
11ec0 2d 31 33 32 38 0d 0a 2d 31 34 30 37 0d 0a 2d 36  -1328..-1407..-6
11ed0 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
11ee0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
11ef0 4c 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  L + col2 FROM ta
11f00 62 32 20 41 53 20 63 6f 72 30 20 57 48 45 52 45  b2 AS cor0 WHERE
11f10 20 28 20 2d 20 63 6f 6c 32 20 29 20 49 4e 20 28   ( - col2 ) IN (
11f20 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 29   + col2 + col2 )
11f30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
11f40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11f50 54 20 2d 20 63 6f 6c 31 20 2d 20 28 20 2d 20 63  T - col1 - ( - c
11f60 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol1 ) FROM tab0 
11f70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
11f80 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
11f90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
11fa0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b  ISTINCT - col0 +
11fb0 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20   col1 + col2 AS 
11fc0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
11fd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a  or0..----..-24..
11fe0 35 31 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  51..7....skipif 
11ff0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
12000 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
12010 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
12020 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
12030 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12040 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
12050 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 28 20  CT + col2 * - ( 
12060 63 6f 72 30 2e 63 6f 6c 30 20 29 20 63 6f 6c 31  cor0.col0 ) col1
12070 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
12080 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a  r0..----..-189..
12090 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a  -2028..-3002....
120a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
120b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
120c0 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32   - col0 + + col2
120d0 20 2a 20 2b 20 32 35 20 41 53 20 63 6f 6c 31 20   * + 25 AS col1 
120e0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
120f0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 37 0d 0a 31  0..----..1347..1
12100 33 36 31 0d 0a 32 33 32 30 0d 0a 0d 0a 73 6b 69  361..2320....ski
12110 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
12120 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
12130 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
12140 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
12150 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
12160 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
12170 4c 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 28 20 2d  L - - col0 + ( -
12180 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 32   col2 ) * + col2
12190 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 63   * col1 + col2 c
121a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
121b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31   cor0..----..-61
121c0 0d 0a 2d 36 31 31 37 31 33 0d 0a 2d 39 33 35 39  ..-611713..-9359
121d0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
121e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
121f0 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a  TINCT + - col1 *
12200 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 63   col1 + col1 * c
12210 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
12220 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
12230 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12240 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
12250 2e 63 6f 6c 31 20 2b 20 28 20 2d 20 63 6f 6c 31  .col1 + ( - col1
12260 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72   ) FROM tab0 cor
12270 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
12280 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12290 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
122a0 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   + + col1 + + co
122b0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
122c0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 0d  tab1..----..124.
122d0 0a 31 33 34 0d 0a 32 30 35 0d 0a 0d 0a 71 75 65  .134..205....que
122e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
122f0 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 32 20 2a  LECT tab0.col2 *
12300 20 2b 20 35 33 20 46 52 4f 4d 20 74 61 62 30 0d   + 53 FROM tab0.
12310 0a 2d 2d 2d 2d 0d 0a 31 37 34 39 0d 0a 34 33 34  .----..1749..434
12320 36 0d 0a 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49  6..53....query I
12330 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12340 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2d 20   DISTINCT + ( - 
12350 38 20 29 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20  8 ) - tab2.col2 
12360 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
12370 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
12380 33 34 0d 0a 2d 33 35 0d 0a 2d 34 36 0d 0a 0d 0a  34..-35..-46....
12390 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
123a0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
123b0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
123c0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
123d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 35 0d  wsort label-495.
123e0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
123f0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56   - cor0.col2 DIV
12400 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
12410 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
12420 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a  .----..-1..0....
12430 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
12440 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
12450 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
12460 61 62 65 6c 2d 34 39 35 0d 0a 53 45 4c 45 43 54  abel-495..SELECT
12470 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
12480 2e 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 41 53 20  .col2 / col0 AS 
12490 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
124a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
124b0 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
124c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
124d0 49 53 54 49 4e 43 54 20 31 33 20 2b 20 2b 20 28  ISTINCT 13 + + (
124e0 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   + col0 ) AS col
124f0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
12500 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 39  or0..----..20..9
12510 31 0d 0a 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  1..92....query I
12520 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12530 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   ALL cor0.col0 *
12540 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31   + ( + cor0.col1
12550 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) * col1 FROM t
12560 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
12570 2d 0d 0a 32 32 38 33 31 0d 0a 32 37 31 35 31 38  -..22831..271518
12580 0d 0a 36 37 32 37 0d 0a 0d 0a 71 75 65 72 79 20  ..6727....query 
12590 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
125a0 54 20 41 4c 4c 20 28 20 63 6f 6c 31 20 29 20 2b  T ALL ( col1 ) +
125b0 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   + col2 * + col0
125c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
125d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
125e0 0d 0a 31 33 32 0d 0a 37 33 38 39 0d 0a 38 37 38  ..132..7389..878
125f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12600 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
12610 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  ( + cor0.col1 ) 
12620 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  * - col2 + - col
12630 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
12640 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
12650 2d 0d 0a 2d 31 32 36 31 0d 0a 2d 31 34 33 30 0d  -..-1261..-1430.
12660 0a 2d 35 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-580....onlyif 
12670 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
12680 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
12690 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
126a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
126b0 61 62 65 6c 2d 35 30 30 0d 0a 53 45 4c 45 43 54  abel-500..SELECT
126c0 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f   + - col1 DIV co
126d0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
126e0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
126f0 0a 2d 31 0d 0a 2d 32 0d 0a 2d 33 0d 0a 0d 0a 73  .-1..-2..-3....s
12700 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
12710 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
12720 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
12730 62 65 6c 2d 35 30 30 0d 0a 53 45 4c 45 43 54 20  bel-500..SELECT 
12740 2b 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20  + - col1 / col0 
12750 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
12760 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  0 cor0..----..-1
12770 0d 0a 2d 32 0d 0a 2d 33 0d 0a 0d 0a 71 75 65 72  ..-2..-3....quer
12780 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12790 45 43 54 20 41 4c 4c 20 2d 20 34 36 20 2a 20 2b  ECT ALL - 46 * +
127a0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
127b0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
127c0 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 0d 0a 2d 31  .----..-1196..-1
127d0 32 34 32 0d 0a 2d 31 37 34 38 0d 0a 0d 0a 71 75  242..-1748....qu
127e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
127f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
12800 20 2b 20 31 37 20 2a 20 63 6f 6c 31 20 46 52 4f   + 17 * col1 FRO
12810 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
12820 2d 2d 2d 2d 0d 0a 31 37 30 0d 0a 32 32 31 0d 0a  ----..170..221..
12830 34 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  442....query I r
12840 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38  owsort..SELECT 8
12850 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
12860 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
12870 38 32 0d 0a 38 32 0d 0a 38 32 0d 0a 0d 0a 71 75  82..82..82....qu
12880 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12890 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
128a0 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30   + col2 + + cor0
128b0 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20  .col1 * col0 AS 
128c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
128d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
128e0 33 31 0d 0a 33 33 39 34 0d 0a 38 30 31 37 0d 0a  31..3394..8017..
128f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
12900 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
12910 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
12920 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
12930 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30  rowsort label-50
12940 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
12950 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31  CT col2 + - col1
12960 20 44 49 56 20 2b 20 31 35 20 46 52 4f 4d 20 74   DIV + 15 FROM t
12970 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
12980 2d 0d 0a 35 33 0d 0a 35 37 0d 0a 39 36 0d 0a 0d  -..53..57..96...
12990 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
129a0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
129b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
129c0 6c 61 62 65 6c 2d 35 30 35 0d 0a 53 45 4c 45 43  label-505..SELEC
129d0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
129e0 2b 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 31 35 20  + - col1 / + 15 
129f0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12a00 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 37 0d  0..----..53..57.
12a10 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .96....onlyif my
12a20 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
12a30 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
12a40 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
12a50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
12a60 65 6c 2d 35 30 36 0d 0a 53 45 4c 45 43 54 20 63  el-506..SELECT c
12a70 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 2b 20 2d  ol1 DIV col2 + -
12a80 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20   col0 * col2 AS 
12a90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
12aa0 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34  ----..-162..-364
12ab0 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 73 6b 69 70  8..-7680....skip
12ac0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
12ad0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
12ae0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12af0 2d 35 30 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -506..SELECT col
12b00 31 20 2f 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  1 / col2 + - col
12b10 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  0 * col2 AS col0
12b20 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
12b30 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d  ..-162..-3648..-
12b40 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7680....query I 
12b50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12b60 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d  ALL - + col1 * -
12b70 20 63 6f 6c 31 20 2b 20 36 30 20 2b 20 28 20 2b   col1 + 60 + ( +
12b80 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20   col2 ) AS col1 
12b90 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
12ba0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 38 39 0d 0a 38  0..----..7489..8
12bb0 34 32 33 0d 0a 39 34 37 30 0d 0a 0d 0a 71 75 65  423..9470....que
12bc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12bd0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
12be0 2d 20 38 33 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  - 83 * cor0.col2
12bf0 20 2b 20 2b 20 33 31 20 41 53 20 63 6f 6c 30 20   + + 31 AS col0 
12c00 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12c10 30 0d 0a 2d 2d 2d 2d 0d 0a 34 35 31 33 0d 0a 34  0..----..4513..4
12c20 37 36 32 0d 0a 37 39 39 39 0d 0a 0d 0a 71 75 65  762..7999....que
12c30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12c40 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
12c50 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col1 * cor0.col0
12c60 20 2b 20 28 20 2b 20 31 39 20 29 20 46 52 4f 4d   + ( + 19 ) FROM
12c70 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
12c80 2d 2d 2d 0d 0a 2d 31 30 32 31 0d 0a 2d 35 39 0d  ---..-1021..-59.
12c90 0a 2d 36 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .-621....query I
12ca0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12cb0 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   ALL - cor0.col2
12cc0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   * + cor0.col0 +
12cd0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
12ce0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
12cf0 31 35 39 0d 0a 2d 33 35 38 34 0d 0a 2d 37 36 30  159..-3584..-760
12d00 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
12d10 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
12d20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
12d30 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
12d40 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
12d50 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31  rowsort label-51
12d60 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
12d70 43 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20  CT - CAST( NULL 
12d80 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 35 37  AS SIGNED ) * 57
12d90 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
12da0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
12db0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor1..----..NU
12dc0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
12dd0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
12de0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
12df0 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 31 0d 0a  sort label-511..
12e00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
12e10 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
12e20 20 49 4e 54 45 47 45 52 20 29 20 2a 20 35 37 20   INTEGER ) * 57 
12e30 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
12e40 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  AS cor0, tab2 AS
12e50 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor1..----..NUL
12e60 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  L....onlyif mysq
12e70 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
12e80 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
12e90 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
12ea0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
12eb0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31  rowsort label-51
12ec0 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  2..SELECT ALL + 
12ed0 2b 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 28  + col2 * + CAST(
12ee0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
12ef0 29 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ) + - cor0.col2 
12f00 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12f10 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
12f20 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
12f30 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
12f40 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
12f50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
12f60 6c 2d 35 31 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-512..SELECT AL
12f70 4c 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 43  L + + col2 * + C
12f80 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
12f90 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 72 30  TEGER ) + - cor0
12fa0 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20  .col2 FROM tab1 
12fb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
12fc0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
12fd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12fe0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
12ff0 31 20 2b 20 28 20 2b 20 31 38 20 29 20 2b 20 2b  1 + ( + 18 ) + +
13000 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
13010 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
13020 30 31 0d 0a 34 36 0d 0a 36 35 0d 0a 0d 0a 71 75  01..46..65....qu
13030 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13040 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
13050 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2b   col0 + + col1 +
13060 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   - col2 * + col1
13070 20 2a 20 34 30 20 46 52 4f 4d 20 74 61 62 31 20   * 40 FROM tab1 
13080 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
13090 32 32 37 32 36 0d 0a 2d 34 39 38 32 37 0d 0a 2d  22726..-49827..-
130a0 35 36 31 33 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  56131....onlyif 
130b0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
130c0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
130d0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
130e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
130f0 61 62 65 6c 2d 35 31 35 0d 0a 53 45 4c 45 43 54  abel-515..SELECT
13100 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
13110 6c 30 20 44 49 56 20 63 6f 6c 30 20 2b 20 2d 20  l0 DIV col0 + - 
13120 35 36 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  56 + - col0 FROM
13130 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
13140 2d 2d 2d 0d 0a 2d 31 33 33 0d 0a 2d 31 33 34 0d  ---..-133..-134.
13150 0a 2d 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-62....skipif m
13160 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
13170 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
13180 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 35  owsort label-515
13190 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
131a0 54 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c  T + + col0 / col
131b0 30 20 2b 20 2d 20 35 36 20 2b 20 2d 20 63 6f 6c  0 + - 56 + - col
131c0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
131d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 0d  or0..----..-133.
131e0 0a 2d 31 33 34 0d 0a 2d 36 32 0d 0a 0d 0a 71 75  .-134..-62....qu
131f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13200 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
13210 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 38 35 20 2a   - col0 * + 85 *
13220 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
13230 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
13240 2d 2d 0d 0a 2d 31 36 30 37 32 0d 0a 2d 31 37 32  --..-16072..-172
13250 34 35 38 0d 0a 2d 32 35 35 32 34 39 0d 0a 0d 0a  458..-255249....
13260 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
13270 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
13280 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
13290 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
132a0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
132b0 72 74 20 6c 61 62 65 6c 2d 35 31 37 0d 0a 53 45  rt label-517..SE
132c0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20  LECT ALL col0 + 
132d0 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49  CAST( col2 AS SI
132e0 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32  GNED ) FROM tab2
132f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13300 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a  104..117..34....
13310 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
13320 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
13330 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
13340 61 62 65 6c 2d 35 31 37 0d 0a 53 45 4c 45 43 54  abel-517..SELECT
13350 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 43 41 53 54   ALL col0 + CAST
13360 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   ( col2 AS INTEG
13370 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  ER ) FROM tab2 A
13380 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
13390 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 71 75  4..117..34....qu
133a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
133b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
133c0 20 2d 20 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 31   - col1 + ( col1
133d0 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
133e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  cor0..----..0...
133f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13400 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
13410 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  1 + + col1 * + c
13420 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 * - col1 FRO
13430 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
13440 2d 2d 2d 2d 0d 0a 2d 31 36 32 31 31 0d 0a 2d 33  ----..-16211..-3
13450 36 34 37 38 0d 0a 2d 35 36 39 30 0d 0a 0d 0a 71  6478..-5690....q
13460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13470 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20  SELECT + col1 * 
13480 63 6f 6c 30 20 2b 20 28 20 2b 20 63 6f 6c 32 20  col0 + ( + col2 
13490 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
134a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d  or0..----..1381.
134b0 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d 0a 71 75  .244..4628....qu
134c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
134d0 45 4c 45 43 54 20 35 31 20 2a 20 63 6f 6c 30 20  ELECT 51 * col0 
134e0 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
134f0 2d 2d 2d 2d 0d 0a 33 35 37 0d 0a 33 39 37 38 0d  ----..357..3978.
13500 0a 34 30 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .4029....onlyif 
13510 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
13520 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
13530 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
13540 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
13550 61 62 65 6c 2d 35 32 32 0d 0a 53 45 4c 45 43 54  abel-522..SELECT
13560 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20 34 36   + + col2 DIV 46
13570 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   - cor0.col0 AS 
13580 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
13590 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
135a0 0d 0a 2d 36 33 0d 0a 2d 37 38 0d 0a 0d 0a 73 6b  ..-63..-78....sk
135b0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
135c0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
135d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
135e0 65 6c 2d 35 32 32 0d 0a 53 45 4c 45 43 54 20 2b  el-522..SELECT +
135f0 20 2b 20 63 6f 6c 32 20 2f 20 34 36 20 2d 20 63   + col2 / 46 - c
13600 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  or0.col0 AS col2
13610 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
13620 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36  r0..----..-2..-6
13630 33 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20  3..-78....query 
13640 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13650 54 20 2b 20 28 20 35 37 20 29 20 2a 20 2b 20 63  T + ( 57 ) * + c
13660 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 * col2 AS co
13670 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
13680 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 34 39  cor0..----..3249
13690 30 0d 0a 37 31 31 33 36 0d 0a 38 30 30 32 38 0d  0..71136..80028.
136a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
136b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  rt..SELECT ALL (
136c0 20 2b 20 39 37 20 29 20 2b 20 74 61 62 31 2e 63   + 97 ) + tab1.c
136d0 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol0 * cor0.col2 
136e0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
136f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
13700 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
13710 74 6f 20 62 63 39 32 31 66 64 66 39 63 63 35 34  to bc921fdf9cc54
13720 61 61 66 30 35 35 30 37 63 64 30 62 63 33 36 35  aaf05507cd0bc365
13730 30 62 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  0b4....query I r
13740 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
13750 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2d 20 37   tab0.col0 * - 7
13760 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  8 AS col0 FROM t
13770 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 37 32  ab0..----..-1872
13780 0d 0a 2d 32 37 33 30 0d 0a 2d 36 39 34 32 0d 0a  ..-2730..-6942..
13790 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
137a0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
137b0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
137c0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
137d0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
137e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
137f0 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  CT + cor0.col2 *
13800 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 63   col2 * + col2 c
13810 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
13820 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 35   cor0..----..175
13830 37 36 0d 0a 31 39 36 38 33 0d 0a 35 34 38 37 32  76..19683..54872
13840 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13850 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
13860 6c 31 20 2b 20 2d 20 32 30 20 41 53 20 63 6f 6c  l1 + - 20 AS col
13870 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
13880 2d 0d 0a 2d 33 0d 0a 31 31 0d 0a 33 39 0d 0a 0d  -..-3..11..39...
13890 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
138a0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
138b0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
138c0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
138d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32 38  owsort label-528
138e0 0d 0a 53 45 4c 45 43 54 20 32 35 20 44 49 56 20  ..SELECT 25 DIV 
138f0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
13900 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
13910 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
13920 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
13930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13940 74 20 6c 61 62 65 6c 2d 35 32 38 0d 0a 53 45 4c  t label-528..SEL
13950 45 43 54 20 32 35 20 2f 20 2b 20 63 6f 6c 31 20  ECT 25 / + col1 
13960 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
13970 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
13980 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13990 45 43 54 20 38 31 20 2a 20 2d 20 63 6f 6c 32 20  ECT 81 * - col2 
139a0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
139b0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33 37 34 0d 0a  1..----..-4374..
139c0 2d 34 36 31 37 0d 0a 2d 37 37 37 36 0d 0a 0d 0a  -4617..-7776....
139d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
139e0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
139f0 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63 6f   ( + col1 ) * co
13a00 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
13a10 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38  --..1534..646..8
13a20 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
13a30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
13a40 33 38 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 72 30  38 * col2 + cor0
13a50 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
13a60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
13a70 31 32 32 31 0d 0a 2d 33 30 33 34 0d 0a 2d 33 37  1221..-3034..-37
13a80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13a90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
13aa0 49 4e 43 54 20 2b 20 2b 20 35 39 20 41 53 20 63  INCT + + 59 AS c
13ab0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
13ac0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 39 0d   cor0..----..59.
13ad0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13ae0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
13af0 6f 6c 30 20 2a 20 28 20 63 6f 6c 32 20 29 20 41  ol0 * ( col2 ) A
13b00 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
13b10 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32  ..----..189..202
13b20 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79  8..3002....query
13b30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13b40 43 54 20 2d 20 36 20 46 52 4f 4d 20 74 61 62 30  CT - 6 FROM tab0
13b50 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  , tab1, tab0 AS 
13b60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
13b70 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
13b80 20 38 62 65 38 39 31 30 35 30 37 39 30 38 65 36   8be8910507908e6
13b90 33 35 33 64 30 32 61 35 34 35 62 37 34 38 32 35  353d02a545b74825
13ba0 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
13bb0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
13bc0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
13bd0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
13be0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
13bf0 2d 35 33 35 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -535..SELECT - +
13c00 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63   col1 + + cor0.c
13c10 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30 20 41  ol2 DIV + col0 A
13c20 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
13c30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13c40 2d 38 35 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d  -85..-91..-97...
13c50 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
13c60 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
13c70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
13c80 6c 61 62 65 6c 2d 35 33 35 0d 0a 53 45 4c 45 43  label-535..SELEC
13c90 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  T - + col1 + + c
13ca0 6f 72 30 2e 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c  or0.col2 / + col
13cb0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
13cc0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
13cd0 2d 0d 0a 2d 38 35 0d 0a 2d 39 31 0d 0a 2d 39 37  -..-85..-91..-97
13ce0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13cf0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
13d00 49 4e 43 54 20 2d 20 38 39 20 2a 20 2d 20 74 61  INCT - 89 * - ta
13d10 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  b1.col0 AS col0 
13d20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c  FROM tab1, tab2,
13d30 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
13d40 2d 2d 2d 0d 0a 32 36 37 0d 0a 35 36 39 36 0d 0a  ---..267..5696..
13d50 37 31 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7120....query I 
13d60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13d70 2d 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  - + col1 + col1 
13d80 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
13d90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13da0 31 30 32 37 0d 0a 35 32 0d 0a 36 33 30 0d 0a 0d  1027..52..630...
13db0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13dc0 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 32 2e  ..SELECT - tab2.
13dd0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
13de0 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72  M tab2, tab1 cor
13df0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
13e00 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 62 35  s hashing to 7b5
13e10 39 33 38 31 32 34 32 35 33 37 39 38 34 32 36 66  938124253798426f
13e20 62 66 30 39 63 31 38 65 31 66 64 37 35 0d 0a 0d  bf09c18e1fd75...
13e30 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
13e40 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
13e50 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
13e60 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
13e70 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
13e80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13e90 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
13ea0 32 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20  2 * + col1 col1 
13eb0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
13ec0 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d  .-1248..-1404..-
13ed0 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  570....query I r
13ee0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
13ef0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b  ol0 + + col1 * +
13f00 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
13f10 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
13f20 30 38 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d  088..3430..8188.
13f30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13f40 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
13f50 30 2e 63 6f 6c 31 20 2a 20 31 31 20 46 52 4f 4d  0.col1 * 11 FROM
13f60 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
13f70 2d 2d 2d 0d 0a 31 38 37 0d 0a 33 34 31 0d 0a 36  ---..187..341..6
13f80 34 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  49....onlyif mys
13f90 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
13fa0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
13fb0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
13fc0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
13fd0 6c 2d 35 34 32 0d 0a 53 45 4c 45 43 54 20 44 49  l-542..SELECT DI
13fe0 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e  STINCT + + cor0.
13ff0 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20  col0 DIV - col1 
14000 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
14010 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ----..0....skipi
14020 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
14030 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
14040 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
14050 35 34 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  542..SELECT DIST
14060 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  INCT + + cor0.co
14070 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l0 / - col1 FROM
14080 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
14090 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
140a0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
140b0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
140c0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
140d0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
140e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
140f0 35 34 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  543..SELECT DIST
14100 49 4e 43 54 20 63 6f 6c 31 20 2a 20 43 41 53 54  INCT col1 * CAST
14110 28 20 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e  ( + col1 AS SIGN
14120 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  ED ) FROM tab1..
14130 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a  ----..100..169..
14140 36 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  676....skipif my
14150 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
14160 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
14170 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34 33 0d  wsort label-543.
14180 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
14190 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 2b   col1 * CAST ( +
141a0 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52   col1 AS INTEGER
141b0 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d   ) FROM tab1..--
141c0 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a 36 37  --..100..169..67
141d0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
141e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 20 41  sort..SELECT 9 A
141f0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
14200 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
14210 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
14220 61 73 68 69 6e 67 20 74 6f 20 30 33 62 39 33 62  ashing to 03b93b
14230 35 33 31 30 37 65 33 36 63 66 37 64 35 32 34 65  53107e36cf7d524e
14240 34 38 63 35 30 39 62 31 37 62 0d 0a 0d 0a 71 75  48c509b17b....qu
14250 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14260 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63  ELECT + col0 * c
14270 6f 6c 30 20 2a 20 28 20 2b 20 63 6f 6c 31 20 29  ol0 * ( + col1 )
14280 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
14290 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
142a0 0d 0a 32 33 34 0d 0a 34 30 39 36 30 0d 0a 38 33  ..234..40960..83
142b0 32 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  200....onlyif my
142c0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
142d0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
142e0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
142f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
14300 65 6c 2d 35 34 36 0d 0a 53 45 4c 45 43 54 20 2d  el-546..SELECT -
14310 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20 37 20   + col0 DIV - 7 
14320 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
14330 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 31 0d 0a  0..----..0..11..
14340 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
14350 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
14360 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
14370 6f 72 74 20 6c 61 62 65 6c 2d 35 34 36 0d 0a 53  ort label-546..S
14380 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2f  ELECT - + col0 /
14390 20 2d 20 37 20 46 52 4f 4d 20 74 61 62 31 20 41   - 7 FROM tab1 A
143a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
143b0 0a 31 31 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20  .11..9....query 
143c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
143d0 54 20 63 6f 6c 32 20 2b 20 2b 20 34 31 20 2a 20  T col2 + + 41 * 
143e0 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  - col0 * - col0 
143f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
14400 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
14410 0a 32 33 36 34 39 0d 0a 33 32 34 38 34 33 0d 0a  .23649..324843..
14420 35 30 32 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  50226....query I
14430 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14440 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
14450 6c 32 20 2a 20 2d 20 28 20 2d 20 63 6f 72 30 2e  l2 * - ( - cor0.
14460 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 29 20  col0 + - col0 ) 
14470 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
14480 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
14490 0a 31 34 35 39 36 0d 0a 31 35 38 34 0d 0a 37 30  .14596..1584..70
144a0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
144b0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
144c0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
144d0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
144e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
144f0 35 34 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  549..SELECT ALL 
14500 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20  col0 DIV - col1 
14510 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
14520 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  1 cor0..----..-6
14530 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ..-6..0....skipi
14540 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
14550 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
14560 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
14570 35 34 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  549..SELECT ALL 
14580 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 41 53  col0 / - col1 AS
14590 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
145a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a  cor0..----..-6..
145b0 2d 36 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -6..0....query I
145c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
145d0 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f   DISTINCT - + co
145e0 6c 30 20 2a 20 2d 20 35 38 20 41 53 20 63 6f 6c  l0 * - 58 AS col
145f0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
14600 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 36 0d 0a  or0..----..406..
14610 34 35 32 34 0d 0a 34 35 38 32 0d 0a 0d 0a 71 75  4524..4582....qu
14620 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14630 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
14640 20 63 6f 6c 31 20 2a 20 2b 20 32 32 20 41 53 20   col1 * + 22 AS 
14650 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
14660 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  S cor0..----..22
14670 30 0d 0a 32 38 36 0d 0a 35 37 32 0d 0a 0d 0a 71  0..286..572....q
14680 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14690 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
146a0 2d 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  - - col1 * + col
146b0 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  2 + - col0 * col
146c0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
146d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
146e0 2d 0d 0a 2d 34 35 35 30 0d 0a 2d 35 35 39 35 0d  -..-4550..-5595.
146f0 0a 37 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49  .788....query II
14700 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14710 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62  T ALL * FROM tab
14720 31 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20  1 AS cor0 WHERE 
14730 4e 55 4c 4c 20 42 45 54 57 45 45 4e 20 63 6f 72  NULL BETWEEN cor
14740 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  0.col1 * cor0.co
14750 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 41 4e 44 20  l1 + + col1 AND 
14760 2b 20 63 6f 6c 32 20 4f 52 20 4e 4f 54 20 63 6f  + col2 OR NOT co
14770 6c 30 20 3d 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d  l0 = ( NULL )..-
14780 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
14790 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
147a0 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a   col1 + + col0 *
147b0 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
147c0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
147d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 37 0d 0a  0..----..-2087..
147e0 2d 32 32 30 0d 0a 2d 33 30 31 39 0d 0a 0d 0a 6f  -220..-3019....o
147f0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
14800 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
14810 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
14820 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
14830 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 35 0d 0a  sort label-555..
14840 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
14850 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 44 49  + col1 * col1 DI
14860 56 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72  V + col2 + - cor
14870 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  0.col1 AS col0 F
14880 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
14890 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31 34  ..----..-12..-14
148a0 0d 0a 2d 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..-9....skipif m
148b0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
148c0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
148d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 35  owsort label-555
148e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
148f0 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  T + col1 * col1 
14900 2f 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72  / + col2 + - cor
14910 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  0.col1 AS col0 F
14920 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
14930 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31 34  ..----..-12..-14
14940 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-9....query I 
14950 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14960 2b 20 2d 20 38 30 20 2b 20 63 6f 6c 30 20 46 52  + - 80 + col0 FR
14970 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
14980 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 37 37 0d  .----..-16..-77.
14990 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
149a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 33  wsort..SELECT 83
149b0 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   + - col2 * col1
149c0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46   * + cor0.col0 F
149d0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
149e0 2d 2d 2d 0d 0a 2d 33 33 31 32 0d 0a 2d 36 36 34  ---..-3312..-664
149f0 30 33 35 0d 0a 2d 36 38 30 32 39 0d 0a 0d 0a 73  035..-68029....s
14a00 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
14a10 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
14a20 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
14a30 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
14a40 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
14a50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14a60 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col1 * - col0 + 
14a70 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 30 20 46  cor0.col1 col0 F
14a80 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
14a90 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 36 0d 0a 2d  ..----..-1326..-
14aa0 31 38 36 0d 0a 2d 34 35 34 33 0d 0a 0d 0a 71 75  186..-4543....qu
14ab0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14ac0 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a  ELECT - + col1 *
14ad0 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c   col0 + cor0.col
14ae0 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  2 * col0 AS col2
14af0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
14b00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 30 38 0d 0a  r0..----..3008..
14b10 36 36 34 30 0d 0a 38 34 0d 0a 0d 0a 73 6b 69 70  6640..84....skip
14b20 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
14b30 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
14b40 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
14b50 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
14b60 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
14b70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
14b80 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  2 * + col2 * col
14b90 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  2 + + cor0.col1 
14ba0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
14bb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36  S cor0..----..36
14bc0 30 32 33 0d 0a 35 35 31 34 35 39 0d 0a 39 38 0d  023..551459..98.
14bd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14be0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
14bf0 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e  0.col1 * - cor0.
14c00 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col1 + col0 FROM
14c10 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
14c20 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 36 37 33 0d 0a  ---..-36..-673..
14c30 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -89....query I r
14c40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
14c50 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  LL + cor0.col1 *
14c60 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f   col1 * col2 FRO
14c70 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
14c80 2d 2d 2d 2d 0d 0a 31 30 39 38 32 0d 0a 32 35 39  ----..10982..259
14c90 34 37 0d 0a 39 30 35 30 36 0d 0a 0d 0a 71 75 65  47..90506....que
14ca0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14cb0 4c 45 43 54 20 2b 20 37 36 20 41 53 20 63 6f 6c  LECT + 76 AS col
14cc0 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
14cd0 32 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  2 cor0, tab2 AS 
14ce0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
14cf0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
14d00 20 37 62 32 62 30 38 64 64 33 66 31 61 64 65 66   7b2b08dd3f1adef
14d10 30 32 38 64 33 66 34 30 65 66 37 63 37 31 36 64  028d3f40ef7c716d
14d20 61 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  a....onlyif mysq
14d30 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
14d40 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
14d50 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
14d60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
14d70 2d 35 36 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -564..SELECT ALL
14d80 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31   + col2 DIV col1
14d90 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 46   + + tab0.col0 F
14da0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
14db0 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b  24..35..89....sk
14dc0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
14dd0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
14de0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
14df0 65 6c 2d 35 36 34 0d 0a 53 45 4c 45 43 54 20 41  el-564..SELECT A
14e00 4c 4c 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 31  LL + col2 / col1
14e10 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 46   + + tab0.col0 F
14e20 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
14e30 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75  24..35..89....qu
14e40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14e50 45 4c 45 43 54 20 41 4c 4c 20 32 36 20 41 53 20  ELECT ALL 26 AS 
14e60 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
14e70 74 61 62 30 2c 20 74 61 62 32 20 63 6f 72 30 0d  tab0, tab2 cor0.
14e80 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
14e90 20 68 61 73 68 69 6e 67 20 74 6f 20 65 64 65 38   hashing to ede8
14ea0 32 32 36 62 62 37 65 36 30 32 65 32 32 31 66 39  226bb7e602e221f9
14eb0 64 39 38 33 34 35 62 34 64 61 33 37 0d 0a 0d 0a  d98345b4da37....
14ec0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
14ed0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
14ee0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
14ef0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
14f00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 36 36 0d  wsort label-566.
14f10 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61  .SELECT ALL - ta
14f20 62 32 2e 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31  b2.col2 DIV col1
14f30 20 2b 20 37 36 20 41 53 20 63 6f 6c 31 20 46 52   + 76 AS col1 FR
14f40 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab2..----..7
14f50 34 0d 0a 37 36 0d 0a 37 36 0d 0a 0d 0a 73 6b 69  4..76..76....ski
14f60 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
14f70 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
14f80 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
14f90 6c 2d 35 36 36 0d 0a 53 45 4c 45 43 54 20 41 4c  l-566..SELECT AL
14fa0 4c 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2f 20  L - tab2.col2 / 
14fb0 63 6f 6c 31 20 2b 20 37 36 20 41 53 20 63 6f 6c  col1 + 76 AS col
14fc0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
14fd0 2d 0d 0a 37 34 0d 0a 37 36 0d 0a 37 36 0d 0a 0d  -..74..76..76...
14fe0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14ff0 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c  ..SELECT - ( col
15000 31 20 29 20 2b 20 38 32 20 2a 20 2d 20 28 20 63  1 ) + 82 * - ( c
15010 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol2 ) FROM tab2 
15020 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
15030 32 31 39 31 0d 0a 2d 32 32 34 35 0d 0a 2d 33 31  2191..-2245..-31
15040 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  33....skipif pos
15050 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
15060 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
15070 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
15080 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
15090 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
150a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
150b0 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  + - col1 + + col
150c0 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  2 col1 FROM tab2
150d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
150e0 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 73  -33..-4..21....s
150f0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
15100 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
15110 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
15120 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
15130 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
15140 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15150 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
15160 30 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20  0 * + col2 col2 
15170 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
15180 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d  0..----..-162..-
15190 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71  3648..-7680....q
151a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
151b0 53 45 4c 45 43 54 20 63 6f 6c 31 20 2d 20 63 6f  SELECT col1 - co
151c0 6c 30 20 2a 20 2d 20 35 33 20 46 52 4f 4d 20 74  l0 * - 53 FROM t
151d0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
151e0 34 30 32 0d 0a 34 31 39 33 0d 0a 34 32 30 34 0d  402..4193..4204.
151f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
15200 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
15210 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2d   col0 + col0 * -
15220 20 63 6f 6c 31 20 2a 20 2d 20 35 35 20 2b 20 63   col1 * - 55 + c
15230 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
15240 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
15250 35 39 0d 0a 32 35 33 30 39 31 0d 0a 37 33 38 30  59..253091..7380
15260 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
15270 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15280 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c  TINCT col0 + col
15290 31 20 2a 20 31 39 20 46 52 4f 4d 20 74 61 62 31  1 * 19 FROM tab1
152a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
152b0 32 35 34 0d 0a 33 32 37 0d 0a 34 39 37 0d 0a 0d  254..327..497...
152c0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
152d0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
152e0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
152f0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
15300 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
15310 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15320 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20  T ALL cor0.col2 
15330 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 63 6f  * col1 + col2 co
15340 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
15350 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 34  cor0..----..1344
15360 0d 0a 31 34 35 38 0d 0a 36 32 37 0d 0a 0d 0a 71  ..1458..627....q
15370 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15380 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63  SELECT ALL - + c
15390 6f 6c 32 20 2b 20 2d 20 33 35 20 41 53 20 63 6f  ol2 + - 35 AS co
153a0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
153b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 31  cor0..----..-131
153c0 0d 0a 2d 38 39 0d 0a 2d 39 32 0d 0a 0d 0a 71 75  ..-89..-92....qu
153d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
153e0 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 34  ELECT col2 + + 4
153f0 34 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  4 * col0 AS col0
15400 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
15410 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 36 0d 0a 32  r0..----..186..2
15420 38 37 33 0d 0a 33 36 31 36 0d 0a 0d 0a 71 75 65  873..3616....que
15430 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15440 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  LECT col0 * - co
15450 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  l0 + - col0 * co
15460 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
15470 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
15480 2d 2d 0d 0a 2d 31 32 36 30 0d 0a 2d 31 33 36 38  --..-1260..-1368
15490 0d 0a 2d 31 35 32 31 39 0d 0a 0d 0a 71 75 65 72  ..-15219....quer
154a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
154b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
154c0 6f 6c 30 20 2b 20 28 20 63 6f 6c 30 20 29 20 41  ol0 + ( col0 ) A
154d0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
154e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
154f0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
15500 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15510 54 49 4e 43 54 20 34 36 20 2a 20 63 6f 6c 32 20  TINCT 46 * col2 
15520 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + + col0 FROM ta
15530 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 39 0d 0a  b2..----..1249..
15540 31 32 37 34 0d 0a 31 38 32 37 0d 0a 0d 0a 6f 6e  1274..1827....on
15550 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
15560 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
15570 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
15580 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
15590 6f 72 74 20 6c 61 62 65 6c 2d 35 37 39 0d 0a 53  ort label-579..S
155a0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44 49 56  ELECT - col2 DIV
155b0 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
155c0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
155d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  0..----..-1..-1.
155e0 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .-1....skipif my
155f0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
15600 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
15610 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 39 0d  wsort label-579.
15620 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2f  .SELECT - col2 /
15630 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
15640 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
15650 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  0..----..-1..-1.
15660 0a 2d 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .-1....onlyif my
15670 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
15680 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
15690 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
156a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
156b0 65 6c 2d 35 38 30 0d 0a 53 45 4c 45 43 54 20 2d  el-580..SELECT -
156c0 20 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f 72 30   col1 + + ( cor0
156d0 2e 63 6f 6c 31 20 29 20 44 49 56 20 63 6f 72 30  .col1 ) DIV cor0
156e0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
156f0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
15700 2d 2d 0d 0a 2d 38 33 0d 0a 2d 39 30 0d 0a 2d 39  --..-83..-90..-9
15710 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
15720 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
15730 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
15740 6f 72 74 20 6c 61 62 65 6c 2d 35 38 30 0d 0a 53  ort label-580..S
15750 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b  ELECT - col1 + +
15760 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2f   ( cor0.col1 ) /
15770 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
15780 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
15790 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 33 0d 0a 2d 39  0..----..-83..-9
157a0 30 0d 0a 2d 39 35 0d 0a 0d 0a 71 75 65 72 79 20  0..-95....query 
157b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
157c0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
157d0 6f 6c 32 20 2b 20 32 30 20 2a 20 36 33 20 46 52  ol2 + 20 * 63 FR
157e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
157f0 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a 31 32 39  .----..1261..129
15800 33 0d 0a 31 33 34 32 0d 0a 0d 0a 71 75 65 72 79  3..1342....query
15810 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15820 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20  CT ALL + col0 + 
15830 2b 20 34 36 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 46 AS col1 FRO
15840 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
15850 2d 2d 2d 2d 0d 0a 31 33 35 0d 0a 37 30 0d 0a 38  ----..135..70..8
15860 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
15870 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
15880 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
15890 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
158a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
158b0 2d 35 38 33 0d 0a 53 45 4c 45 43 54 20 63 6f 72  -583..SELECT cor
158c0 30 2e 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20  0.col1 DIV col2 
158d0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
158e0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  0 cor0..----..1.
158f0 0a 32 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  .2..97....skipif
15900 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
15910 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
15920 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
15930 38 33 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  83..SELECT cor0.
15940 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 41 53 20 63  col1 / col2 AS c
15950 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
15960 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a  r0..----..1..2..
15970 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  97....onlyif mys
15980 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
15990 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
159a0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
159b0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
159c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
159d0 38 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  84..SELECT ALL +
159e0 20 63 6f 6c 32 20 2a 20 43 41 53 54 28 20 2d 20   col2 * CAST( - 
159f0 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
15a00 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
15a10 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
15a20 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d  ..-1444..-676..-
15a30 37 32 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  729....skipif my
15a40 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
15a50 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
15a60 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38 34 0d  wsort label-584.
15a70 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
15a80 6c 32 20 2a 20 43 41 53 54 20 28 20 2d 20 63 6f  l2 * CAST ( - co
15a90 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l2 AS INTEGER ) 
15aa0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
15ab0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
15ac0 0a 2d 31 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37  .-1444..-676..-7
15ad0 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  29....query I ro
15ae0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
15af0 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 39 38  STINCT col1 * 98
15b00 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
15b10 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
15b20 32 37 34 0d 0a 32 35 34 38 0d 0a 39 38 30 0d 0a  274..2548..980..
15b30 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
15b40 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
15b50 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
15b60 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
15b70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38  rowsort label-58
15b80 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  6..SELECT ALL - 
15b90 63 6f 6c 30 20 44 49 56 20 2d 20 36 35 20 41 53  col0 DIV - 65 AS
15ba0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
15bb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
15bc0 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..1....skipif
15bd0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
15be0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
15bf0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
15c00 38 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  86..SELECT ALL -
15c10 20 63 6f 6c 30 20 2f 20 2d 20 36 35 20 41 53 20   col0 / - 65 AS 
15c20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
15c30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
15c40 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..1....query I
15c50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15c60 20 2d 20 38 39 20 2a 20 2b 20 63 6f 6c 31 20 46   - 89 * + col1 F
15c70 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
15c80 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 31 33 0d 0a 2d  ..----..-1513..-
15c90 32 37 35 39 0d 0a 2d 35 32 35 31 0d 0a 0d 0a 71  2759..-5251....q
15ca0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15cb0 53 45 4c 45 43 54 20 35 35 20 2a 20 63 6f 6c 30  SELECT 55 * col0
15cc0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
15cd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 30 0d 0a  r0..----..1320..
15ce0 31 39 32 35 0d 0a 34 38 39 35 0d 0a 0d 0a 71 75  1925..4895....qu
15cf0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15d00 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
15d10 20 2d 20 31 30 20 29 20 2a 20 63 6f 6c 32 20 41   - 10 ) * col2 A
15d20 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
15d30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15d40 2d 32 36 30 0d 0a 2d 32 37 30 0d 0a 2d 33 38 30  -260..-270..-380
15d50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15d60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 31 20 2b  ort..SELECT 21 +
15d70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
15d80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
15d90 30 37 0d 0a 31 31 32 0d 0a 31 31 38 0d 0a 0d 0a  07..112..118....
15da0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15db0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 31 20 2b  .SELECT ALL 21 +
15dc0 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2d   col1 * col1 * -
15dd0 20 39 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   98 AS col0 FROM
15de0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
15df0 2d 2d 2d 0d 0a 2d 32 38 33 30 31 0d 0a 2d 33 34  ---..-28301..-34
15e00 31 31 31 37 0d 0a 2d 39 34 31 35 37 0d 0a 0d 0a  1117..-94157....
15e10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15e20 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
15e30 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c   col2 + cor0.col
15e40 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  1 * - col1 + col
15e50 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
15e60 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
15e70 2d 0d 0a 2d 37 33 33 30 0d 0a 2d 38 31 31 37 0d  -..-7330..-8117.
15e80 0a 2d 39 34 30 37 0d 0a 0d 0a 71 75 65 72 79 20  .-9407....query 
15e90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15ea0 54 20 2d 20 37 35 20 2b 20 34 20 46 52 4f 4d 20  T - 75 + 4 FROM 
15eb0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
15ec0 2d 2d 0d 0a 2d 37 31 0d 0a 2d 37 31 0d 0a 2d 37  --..-71..-71..-7
15ed0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
15ee0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
15ef0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
15f00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
15f10 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20 52  CAST ( col2 AS R
15f20 45 41 4c 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2b  EAL ) * + col0 +
15f30 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 41 53 20   col0 / col1 AS 
15f40 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
15f50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
15f60 39 0d 0a 32 30 32 39 0d 0a 33 30 30 36 0d 0a 0d  9..2029..3006...
15f70 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
15f80 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
15f90 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
15fa0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
15fb0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39 35  owsort label-595
15fc0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
15fd0 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  T + + col2 + - c
15fe0 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 41 53 20  ol1 DIV col1 AS 
15ff0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
16000 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35  S cor0..----..25
16010 0d 0a 32 36 0d 0a 33 37 0d 0a 0d 0a 73 6b 69 70  ..26..37....skip
16020 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
16030 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
16040 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16050 2d 35 39 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  -595..SELECT DIS
16060 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b  TINCT + + col2 +
16070 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 41   - col1 / col1 A
16080 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
16090 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
160a0 32 35 0d 0a 32 36 0d 0a 33 37 0d 0a 0d 0a 6f 6e  25..26..37....on
160b0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
160c0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
160d0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
160e0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
160f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16100 20 6c 61 62 65 6c 2d 35 39 36 0d 0a 53 45 4c 45   label-596..SELE
16110 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28 20 4e  CT ALL - CAST( N
16120 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
16130 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  * + col2 + - col
16140 30 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  0 * col1 * + col
16150 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
16160 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
16170 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
16180 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
16190 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
161a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
161b0 62 65 6c 2d 35 39 36 0d 0a 53 45 4c 45 43 54 20  bel-596..SELECT 
161c0 41 4c 4c 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  ALL - CAST ( NUL
161d0 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
161e0 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30   + col2 + - col0
161f0 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   * col1 * + col2
16200 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
16210 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
16220 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
16230 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16240 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20  ELECT ALL - ( - 
16250 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2a 20 2b 20  cor0.col1 ) * + 
16260 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2d 20 2b 20  col1 * col0 - + 
16270 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
16280 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
16290 2d 2d 2d 2d 0d 0a 31 33 34 32 34 0d 0a 31 39 37  ----..13424..197
162a0 34 0d 0a 36 33 34 33 0d 0a 0d 0a 73 6b 69 70 69  4..6343....skipi
162b0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
162c0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
162d0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
162e0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
162f0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
16300 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
16310 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  INCT + col1 * co
16320 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
16330 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  0 cor0..----..28
16340 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a  38..7462..97....
16350 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16360 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
16370 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol2 + col1 AS co
16380 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
16390 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37  0..----..109..67
163a0 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..80....skipif p
163b0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
163c0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
163d0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
163e0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
163f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16400 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
16410 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 2a   col0 - + col2 *
16420 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f   - col2 col0 FRO
16430 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
16440 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 31 30 36 35 0d  ----..-34..1065.
16450 0a 36 36 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .6635....query I
16460 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16470 20 41 4c 4c 20 2d 20 38 35 20 2d 20 2d 20 33 34   ALL - 85 - - 34
16480 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
16490 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d 0a 2d  b0..----..-51..-
164a0 35 31 0d 0a 2d 35 31 0d 0a 0d 0a 71 75 65 72 79  51..-51....query
164b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
164c0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
164d0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20 63  col0 * col1 AS c
164e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
164f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30   cor0..----..130
16500 35 0d 0a 31 39 30 0d 0a 34 35 37 36 0d 0a 0d 0a  5..190..4576....
16510 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16520 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b  .SELECT col1 * +
16530 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
16540 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
16550 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36  0..----..100..16
16560 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20  9..676....query 
16570 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16580 54 20 2b 20 2b 20 31 36 20 41 53 20 63 6f 6c 30  T + + 16 AS col0
16590 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
165a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 31 36  r0..----..16..16
165b0 0d 0a 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..16....query I 
165c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
165d0 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  - - col1 * - col
165e0 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  2 - - cor0.col2 
165f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
16600 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
16610 35 30 38 0d 0a 2d 36 30 38 0d 0a 2d 38 31 30 0d  508..-608..-810.
16620 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16630 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
16640 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   + col1 * - col0
16650 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
16660 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
16670 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 36 0d 0a  0..----..-1326..
16680 2d 31 38 36 0d 0a 2d 34 35 34 33 0d 0a 0d 0a 71  -186..-4543....q
16690 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
166a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
166b0 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72 30  cor0.col1 + cor0
166c0 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f  .col2 * col0 FRO
166d0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
166e0 2d 2d 2d 2d 0d 0a 32 30 38 37 0d 0a 32 32 30 0d  ----..2087..220.
166f0 0a 33 30 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .3019....query I
16700 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16710 20 41 4c 4c 20 2d 20 36 32 20 2a 20 63 6f 72 30   ALL - 62 * cor0
16720 2e 63 6f 6c 31 20 2b 20 33 37 20 2a 20 63 6f 6c  .col1 + 37 * col
16730 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
16740 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 35  or0..----..-1475
16750 0d 0a 2d 34 32 35 0d 0a 2d 37 37 35 0d 0a 0d 0a  ..-425..-775....
16760 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16770 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
16780 20 2b 20 2b 20 31 20 2a 20 2d 20 63 6f 72 30 2e   + + 1 * - cor0.
16790 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52  col0 * + col1 FR
167a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
167b0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36  .----..-1040..-6
167c0 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 73 6b 69 70 69  40..-78....skipi
167d0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
167e0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
167f0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
16800 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
16810 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
16820 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
16830 2b 20 28 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  + ( - col2 + col
16840 31 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 ) col0 FROM ta
16850 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33  b2..----..-21..3
16860 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3..4....query I 
16870 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16880 2b 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2d 20 63  + col0 + + ( - c
16890 6f 6c 31 20 2b 20 63 6f 6c 30 20 29 20 2a 20 2b  ol1 + col0 ) * +
168a0 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f   tab1.col1 AS co
168b0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
168c0 2d 2d 0d 0a 2d 35 39 35 0d 0a 36 30 34 0d 0a 39  --..-595..604..9
168d0 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  51....query I ro
168e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
168f0 4c 20 2b 20 37 37 20 2d 20 2b 20 63 6f 6c 30 20  L + 77 - + col0 
16900 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
16910 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
16920 0a 2d 33 0d 0a 31 33 0d 0a 37 34 0d 0a 0d 0a 6f  .-3..13..74....o
16930 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
16940 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
16950 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
16960 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
16970 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 33 0d 0a  sort label-613..
16980 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
16990 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30 20  col2 DIV + col0 
169a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
169b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 32  0..----..-24..-2
169c0 36 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70 69 66  6..-38....skipif
169d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
169e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
169f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
16a00 31 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  13..SELECT - col
16a10 32 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c  2 + col2 / + col
16a20 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
16a30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a  or0..----..-24..
16a40 2d 32 36 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70  -26..-38....skip
16a50 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
16a60 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
16a70 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
16a80 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
16a90 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
16aa0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
16ab0 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d  TINCT - col0 * -
16ac0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63   col0 * + cor0.c
16ad0 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
16ae0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor0..----..2
16af0 36 32 31 34 34 0d 0a 32 37 0d 0a 35 31 32 30 30  62144..27..51200
16b00 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
16b10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
16b20 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63  TINCT col1 * + c
16b30 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 33 20 2a  or0.col1 + + 3 *
16b40 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   - col2 * + col1
16b50 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
16b60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 38 0d  r0..----..-1118.
16b70 0a 2d 31 34 31 30 35 0d 0a 39 31 31 38 0d 0a 0d  .-14105..9118...
16b80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16b90 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
16ba0 32 20 2a 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c  2 * col2 + ( col
16bb0 31 20 2a 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  1 * col0 ) FROM 
16bc0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
16bd0 2d 2d 0d 0a 32 37 38 37 0d 0a 35 32 37 38 0d 0a  --..2787..5278..
16be0 39 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  946....query I r
16bf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
16c00 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30  ISTINCT + + cor0
16c10 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2d  .col0 + + col0 -
16c20 20 2d 20 33 37 20 2a 20 2d 20 63 6f 6c 32 20 46   - 37 * - col2 F
16c30 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
16c40 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d  ..----..-1248..-
16c50 38 30 36 0d 0a 2d 39 38 35 0d 0a 0d 0a 71 75 65  806..-985....que
16c60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16c70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
16c80 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 2d 20 31  + ( col1 ) * - 1
16c90 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
16ca0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
16cb0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  0..----..0....qu
16cc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16cd0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
16ce0 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 2b   col0 + col2 + +
16cf0 20 36 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   62 FROM tab1..-
16d00 2d 2d 2d 0d 0a 31 31 33 0d 0a 35 35 0d 0a 37 38  ---..113..55..78
16d10 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
16d20 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
16d30 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
16d40 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
16d50 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
16d60 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 30  owsort label-620
16d70 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28  ..SELECT - CAST(
16d80 20 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45   + col1 AS SIGNE
16d90 44 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  D ) col0 FROM ta
16da0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d  b2..----..-17..-
16db0 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 73 6b 69 70 69  31..-59....skipi
16dc0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
16dd0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
16de0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
16df0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
16e00 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
16e10 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
16e20 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
16e30 72 74 20 6c 61 62 65 6c 2d 36 32 30 0d 0a 53 45  rt label-620..SE
16e40 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 2b 20  LECT - CAST ( + 
16e50 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
16e60 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  ) col0 FROM tab2
16e70 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31  ..----..-17..-31
16e80 0d 0a 2d 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-59....onlyif 
16e90 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
16ea0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
16eb0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
16ec0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
16ed0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
16ee0 6c 2d 36 32 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-621..SELECT DI
16ef0 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 4e  STINCT - CAST( N
16f00 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
16f10 2a 20 36 36 20 2a 20 2b 20 63 6f 6c 30 20 46 52  * 66 * + col0 FR
16f20 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
16f30 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
16f40 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
16f50 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
16f60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
16f70 62 65 6c 2d 36 32 31 0d 0a 53 45 4c 45 43 54 20  bel-621..SELECT 
16f80 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20  DISTINCT - CAST 
16f90 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
16fa0 52 20 29 20 2a 20 36 36 20 2a 20 2b 20 63 6f 6c  R ) * 66 * + col
16fb0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
16fc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
16fd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16fe0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
16ff0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
17000 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
17010 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
17020 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
17030 20 35 38 35 61 34 31 61 35 32 63 30 63 36 63 30   585a41a52c0c6c0
17040 64 36 39 37 62 35 64 33 39 32 36 35 62 37 34 64  d697b5d39265b74d
17050 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  c....query I row
17060 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
17070 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2b 20 32   tab2.col0 * + 2
17080 34 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  4 FROM tab2..---
17090 2d 0d 0a 31 36 38 0d 0a 31 38 37 32 0d 0a 31 38  -..168..1872..18
170a0 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
170b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
170c0 4c 20 2b 20 35 38 20 2d 20 74 61 62 32 2e 63 6f  L + 58 - tab2.co
170d0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
170e0 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
170f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
17100 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 61  es hashing to ca
17110 63 30 66 33 34 31 36 31 31 35 38 33 31 38 37 32  c0f3416115831872
17120 36 65 61 35 33 66 33 39 37 32 64 66 63 32 0d 0a  6ea53f3972dfc2..
17130 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
17140 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
17150 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
17160 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
17170 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32  rowsort label-62
17180 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  5..SELECT ALL + 
17190 28 20 32 38 20 29 20 44 49 56 20 63 6f 6c 30 20  ( 28 ) DIV col0 
171a0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
171b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
171c0 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .0..0..1....skip
171d0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
171e0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
171f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
17200 2d 36 32 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -625..SELECT ALL
17210 20 2b 20 28 20 32 38 20 29 20 2f 20 63 6f 6c 30   + ( 28 ) / col0
17220 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
17230 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
17240 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65  ..0..0..1....que
17250 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17260 4c 45 43 54 20 31 33 20 2a 20 2b 20 32 32 20 41  LECT 13 * + 22 A
17270 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
17280 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17290 32 38 36 0d 0a 32 38 36 0d 0a 32 38 36 0d 0a 0d  286..286..286...
172a0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
172b0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
172c0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
172d0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
172e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 37  owsort label-627
172f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
17300 54 20 2d 20 2d 20 35 33 20 44 49 56 20 2b 20 28  T - - 53 DIV + (
17310 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20   col2 ) AS col2 
17320 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
17330 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b  0..----..0....sk
17340 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
17350 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
17360 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
17370 65 6c 2d 36 32 37 0d 0a 53 45 4c 45 43 54 20 44  el-627..SELECT D
17380 49 53 54 49 4e 43 54 20 2d 20 2d 20 35 33 20 2f  ISTINCT - - 53 /
17390 20 2b 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63   + ( col2 ) AS c
173a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
173b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
173c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
173d0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
173e0 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  - col2 + col2 * 
173f0 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63  col1 * col2 AS c
17400 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
17410 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36   cor0..----..226
17420 32 36 0d 0a 32 34 35 38 36 0d 0a 33 39 39 31 30  26..24586..39910
17430 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17440 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
17450 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 72 30  cor0.col2 - cor0
17460 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
17470 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
17480 31 36 34 0d 0a 2d 32 0d 0a 2d 36 36 0d 0a 0d 0a  164..-2..-66....
17490 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
174a0 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
174b0 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  0 + - col2 * + c
174c0 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 + col2 FROM 
174d0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
174e0 2d 2d 0d 0a 2d 37 31 32 37 0d 0a 2d 37 33 35 0d  --..-7127..-735.
174f0 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
17500 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
17510 72 31 2e 63 6f 6c 30 20 2b 20 2b 20 31 35 20 46  r1.col0 + + 15 F
17520 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 63  ROM tab1, tab1 c
17530 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
17540 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
17550 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 37  es hashing to b7
17560 33 64 66 66 39 31 62 36 61 38 66 64 66 37 39 39  3dff91b6a8fdf799
17570 38 33 62 39 30 64 33 35 62 34 38 34 32 38 0d 0a  83b90d35b48428..
17580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17590 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
175a0 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 32 20 2a 20  col1 - + col2 * 
175b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
175c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
175d0 30 36 0d 0a 2d 37 32 30 37 0d 0a 36 32 0d 0a 0d  06..-7207..62...
175e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
175f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
17600 54 20 2d 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a  T - - ( col2 ) *
17610 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
17620 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
17630 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
17640 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d  9..2028..3002...
17650 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17660 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
17670 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  T + col2 * col0 
17680 2a 20 2d 20 28 20 39 20 29 20 2b 20 63 6f 6c 30  * - ( 9 ) + col0
17690 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
176a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 39 34 0d  r0..----..-1694.
176b0 0a 2d 31 38 31 37 34 0d 0a 2d 32 36 39 33 39 0d  .-18174..-26939.
176c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
176d0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
176e0 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  NCT - cor0.col2 
176f0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
17700 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  2, tab2 AS cor0,
17710 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
17720 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d  ---..-26..-27..-
17730 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
17740 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
17750 6c 30 20 2a 20 74 61 62 32 2e 63 6f 6c 30 20 2b  l0 * tab2.col0 +
17760 20 74 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab2.col0 FROM 
17770 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a  tab2..----..56..
17780 36 31 36 32 0d 0a 36 33 32 30 0d 0a 0d 0a 71 75  6162..6320....qu
17790 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
177a0 45 4c 45 43 54 20 2d 20 34 32 20 2a 20 2d 20 63  ELECT - 42 * - c
177b0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d  ol0 * + col0 + -
177c0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
177d0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab2..----..2
177e0 30 35 31 0d 0a 32 35 35 34 35 30 0d 0a 32 36 32  051..255450..262
177f0 30 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  043....query I r
17800 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
17810 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20  LL cor0.col1 AS 
17820 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
17830 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30 0d  tab0, tab0 cor0.
17840 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
17850 20 68 61 73 68 69 6e 67 20 74 6f 20 32 64 36 64   hashing to 2d6d
17860 33 30 33 31 64 66 65 39 30 65 30 63 30 32 64 62  3031dfe90e0c02db
17870 31 33 61 61 36 33 39 39 33 62 66 64 0d 0a 0d 0a  13aa63993bfd....
17880 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
17890 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
178a0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
178b0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
178c0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
178d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
178e0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
178f0 20 2a 20 32 32 20 63 6f 6c 30 20 46 52 4f 4d 20   * 22 col0 FROM 
17900 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
17910 2d 2d 0d 0a 31 38 30 34 0d 0a 32 32 0d 0a 37 32  --..1804..22..72
17920 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
17930 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
17940 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
17950 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
17960 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
17970 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34  rowsort label-64
17980 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
17990 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53  CT CAST( NULL AS
179a0 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
179b0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
179c0 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
179d0 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
179e0 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
179f0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
17a00 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
17a10 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
17a20 36 34 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  640..SELECT DIST
17a30 49 4e 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c  INCT CAST ( NULL
17a40 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
17a50 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
17a60 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
17a70 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  IN tab2 AS cor1.
17a80 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
17a90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17aa0 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 32  SELECT tab0.col2
17ab0 20 2d 20 34 33 20 46 52 4f 4d 20 74 61 62 30 0d   - 43 FROM tab0.
17ac0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 34 32 0d  .----..-10..-42.
17ad0 0a 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .39....query I r
17ae0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
17af0 20 63 6f 6c 30 20 2d 20 2b 20 74 61 62 30 2e 63   col0 - + tab0.c
17b00 6f 6c 32 20 2a 20 39 34 20 46 52 4f 4d 20 74 61  ol2 * 94 FROM ta
17b10 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 37 38 0d  b0..----..-3078.
17b20 0a 2d 35 39 0d 0a 2d 37 36 31 39 0d 0a 0d 0a 71  .-59..-7619....q
17b30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17b40 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
17b50 2d 20 32 34 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  - 24 + col2 + co
17b60 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
17b70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37  cor0..----..-197
17b80 32 0d 0a 2d 35 31 30 0d 0a 2d 38 33 38 0d 0a 0d  2..-510..-838...
17b90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17ba0 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c  ..SELECT - ( col
17bb0 32 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 63  2 ) * + col2 - c
17bc0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
17bd0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
17be0 2d 2d 2d 0d 0a 2d 32 39 37 30 0d 0a 2d 33 33 30  ---..-2970..-330
17bf0 36 0d 0a 2d 39 33 31 32 0d 0a 0d 0a 71 75 65 72  6..-9312....quer
17c00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17c10 45 43 54 20 2b 20 36 31 20 2a 20 2b 20 63 6f 6c  ECT + 61 * + col
17c20 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
17c30 2d 0d 0a 31 35 38 36 0d 0a 31 36 34 37 0d 0a 32  -..1586..1647..2
17c40 33 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  318....skipif po
17c50 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
17c60 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
17c70 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
17c80 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
17c90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17ca0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
17cb0 20 39 30 20 2a 20 74 61 62 32 2e 63 6f 6c 32 20   90 * tab2.col2 
17cc0 2a 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d  * col2 col0 FROM
17cd0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39   tab2..----..129
17ce0 39 36 30 0d 0a 36 30 38 34 30 0d 0a 36 35 36 31  960..60840..6561
17cf0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
17d00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
17d10 20 28 20 36 33 20 29 20 46 52 4f 4d 20 74 61 62   ( 63 ) FROM tab
17d20 32 0d 0a 2d 2d 2d 2d 0d 0a 36 33 0d 0a 36 33 0d  2..----..63..63.
17d30 0a 36 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .63....onlyif my
17d40 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
17d50 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
17d60 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
17d70 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
17d80 65 6c 2d 36 34 38 0d 0a 53 45 4c 45 43 54 20 44  el-648..SELECT D
17d90 49 53 54 49 4e 43 54 20 2b 20 32 20 44 49 56 20  ISTINCT + 2 DIV 
17da0 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 41 53 20 63  col2 - col1 AS c
17db0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
17dc0 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d  ---..-86..-91..-
17dd0 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  95....skipif mys
17de0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
17df0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
17e00 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 38 0d 0a  sort label-648..
17e10 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
17e20 2b 20 32 20 2f 20 63 6f 6c 32 20 2d 20 63 6f 6c  + 2 / col2 - col
17e30 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
17e40 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a  ab0..----..-86..
17e50 2d 39 31 0d 0a 2d 39 35 0d 0a 0d 0a 6f 6e 6c 79  -91..-95....only
17e60 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
17e70 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
17e80 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
17e90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17ea0 74 20 6c 61 62 65 6c 2d 36 34 39 0d 0a 53 45 4c  t label-649..SEL
17eb0 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63  ECT + - col2 * c
17ec0 6f 6c 30 20 44 49 56 20 31 34 20 46 52 4f 4d 20  ol0 DIV 14 FROM 
17ed0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
17ee0 2d 2d 0d 0a 2d 31 31 0d 0a 2d 32 36 30 0d 0a 2d  --..-11..-260..-
17ef0 35 34 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  548....skipif my
17f00 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
17f10 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
17f20 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 39 0d  wsort label-649.
17f30 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32  .SELECT + - col2
17f40 20 2a 20 63 6f 6c 30 20 2f 20 31 34 20 46 52 4f   * col0 / 14 FRO
17f50 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
17f60 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 32 36 30 0d  ----..-11..-260.
17f70 0a 2d 35 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .-548....query I
17f80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17f90 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   - + col1 + - co
17fa0 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41  l2 + cor0.col1 A
17fb0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
17fc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17fd0 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d  -26..-27..-38...
17fe0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17ff0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
18000 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63  col1 + col2 AS c
18010 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
18020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d  r0..----..-53..-
18030 39 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  9..-96....onlyif
18040 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
18050 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
18060 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
18070 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
18080 6c 61 62 65 6c 2d 36 35 32 0d 0a 53 45 4c 45 43  label-652..SELEC
18090 54 20 2b 20 36 35 20 2b 20 63 6f 6c 31 20 2a 20  T + 65 + col1 * 
180a0 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 72  - col2 DIV - cor
180b0 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 46 52  0.col2 + col1 FR
180c0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
180d0 0a 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a 38 35 0d 0a  .----..117..85..
180e0 39 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  91....skipif mys
180f0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
18100 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
18110 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 32 0d 0a  sort label-652..
18120 53 45 4c 45 43 54 20 2b 20 36 35 20 2b 20 63 6f  SELECT + 65 + co
18130 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2f 20 2d 20  l1 * - col2 / - 
18140 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31  cor0.col2 + col1
18150 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
18160 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a 38  r0..----..117..8
18170 35 0d 0a 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  5..91....onlyif 
18180 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
18190 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
181a0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
181b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
181c0 61 62 65 6c 2d 36 35 33 0d 0a 53 45 4c 45 43 54  abel-653..SELECT
181d0 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f   DISTINCT - + co
181e0 6c 32 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f  l2 DIV - cor0.co
181f0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
18200 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d  cor0..----..1...
18210 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
18220 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
18230 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
18240 6c 61 62 65 6c 2d 36 35 33 0d 0a 53 45 4c 45 43  label-653..SELEC
18250 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
18260 6f 6c 32 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 / - cor0.col
18270 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
18280 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a  or0..----..1....
18290 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
182a0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
182b0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
182c0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
182d0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
182e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
182f0 20 2b 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f   + - ( - cor0.co
18300 6c 31 20 29 20 2b 20 2b 20 28 20 2b 20 63 6f 6c  l1 ) + + ( + col
18310 32 20 2b 20 2b 20 63 6f 6c 30 20 29 20 63 6f 6c  2 + + col0 ) col
18320 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
18330 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a  or0..----..133..
18340 31 34 33 0d 0a 32 36 32 0d 0a 0d 0a 71 75 65 72  143..262....quer
18350 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18360 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
18370 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2d   col1 * col1 * -
18380 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
18390 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 32  cor0..----..1352
183a0 30 0d 0a 32 30 32 38 0d 0a 36 34 30 30 0d 0a 0d  0..2028..6400...
183b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
183c0 0d 0a 53 45 4c 45 43 54 20 2d 20 31 20 2b 20 2d  ..SELECT - 1 + -
183d0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41   col2 * + col1 A
183e0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
183f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18400 2d 31 35 33 35 0d 0a 2d 36 34 37 0d 0a 2d 38 33  -1535..-647..-83
18410 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  8....skipif post
18420 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
18430 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
18440 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
18450 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
18460 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18470 45 4c 45 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c  ELECT - tab0.col
18480 31 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  1 - col2 col2 FR
18490 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
184a0 31 31 39 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a  119..-173..-98..
184b0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
184c0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
184d0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
184e0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
184f0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
18500 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18510 43 54 20 2b 20 63 6f 6c 30 20 2b 20 31 37 20 2b  CT + col0 + 17 +
18520 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
18530 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
18540 2d 2d 0d 0a 31 31 30 0d 0a 34 36 0d 0a 39 31 0d  --..110..46..91.
18550 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18560 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
18570 4e 43 54 20 2b 20 35 34 20 2a 20 2b 20 63 6f 6c  NCT + 54 * + col
18580 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
18590 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
185a0 2d 0d 0a 31 37 38 32 0d 0a 34 34 32 38 0d 0a 35  -..1782..4428..5
185b0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
185c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
185d0 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2d   - tab1.col0 * -
185e0 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30 20 46   col1 - + col0 F
185f0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
18600 35 37 36 0d 0a 37 35 0d 0a 39 36 30 0d 0a 0d 0a  576..75..960....
18610 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18620 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
18630 20 2d 20 34 39 20 46 52 4f 4d 20 74 61 62 30 2c   - 49 FROM tab0,
18640 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
18650 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
18660 2d 0d 0a 2d 34 39 0d 0a 0d 0a 71 75 65 72 79 20  -..-49....query 
18670 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18680 54 20 44 49 53 54 49 4e 43 54 20 2b 20 38 30 20  T DISTINCT + 80 
18690 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c  FROM tab1, tab2,
186a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
186b0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 30 0d 0a 0d  ab0..----..80...
186c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
186d0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
186e0 2d 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20  - - tab0.col0 * 
186f0 2b 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63  + tab0.col2 AS c
18700 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
18710 2d 2d 2d 0d 0a 2d 36 32 0d 0a 37 30 36 0d 0a 37  ---..-62..706..7
18720 32 30 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  207....onlyif my
18730 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
18740 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
18750 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
18760 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
18770 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
18780 36 36 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  664..SELECT col2
18790 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
187a0 20 44 45 43 49 4d 41 4c 20 29 20 41 53 20 63 6f   DECIMAL ) AS co
187b0 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
187c0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
187d0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
187e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
187f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
18800 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 34  owsort label-664
18810 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
18820 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52  CAST ( NULL AS R
18830 45 41 4c 20 29 20 41 53 20 63 6f 6c 31 20 46 52  EAL ) AS col1 FR
18840 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab2..----..N
18850 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
18860 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
18870 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
18880 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
18890 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
188a0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
188b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 35 0d  wsort label-665.
188c0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 43  .SELECT col1 + C
188d0 41 53 54 28 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  AST( + col1 + co
188e0 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l1 AS SIGNED ) *
188f0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
18900 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
18910 34 38 37 38 0d 0a 31 36 36 35 33 0d 0a 31 38 39  4878..16653..189
18920 31 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  15....skipif mys
18930 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
18940 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
18950 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 35 0d 0a  sort label-665..
18960 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 43 41  SELECT col1 + CA
18970 53 54 20 28 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  ST ( + col1 + co
18980 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
18990 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
189a0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
189b0 31 34 38 37 38 0d 0a 31 36 36 35 33 0d 0a 31 38  14878..16653..18
189c0 39 31 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  915....onlyif my
189d0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
189e0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
189f0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
18a00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18a10 65 6c 2d 36 36 36 0d 0a 53 45 4c 45 43 54 20 44  el-666..SELECT D
18a20 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 44  ISTINCT + col2 D
18a30 49 56 20 28 20 2b 20 35 30 20 29 20 41 53 20 63  IV ( + 50 ) AS c
18a40 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
18a50 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ---..0....skipif
18a60 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
18a70 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
18a80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
18a90 36 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  66..SELECT DISTI
18aa0 4e 43 54 20 2b 20 63 6f 6c 32 20 2f 20 28 20 2b  NCT + col2 / ( +
18ab0 20 35 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52   50 ) AS col2 FR
18ac0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab2..----..0
18ad0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18ae0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 34  ort..SELECT + 74
18af0 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t
18b00 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
18b10 2d 0d 0a 2d 32 32 0d 0a 31 37 0d 0a 32 30 0d 0a  -..-22..17..20..
18b20 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
18b30 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
18b40 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
18b50 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
18b60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36  rowsort label-66
18b70 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  8..SELECT + cor0
18b80 2e 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30  .col2 DIV + col0
18b90 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + + col2 FROM t
18ba0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
18bb0 2d 0d 0a 31 0d 0a 33 34 0d 0a 38 32 0d 0a 0d 0a  -..1..34..82....
18bc0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
18bd0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
18be0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
18bf0 61 62 65 6c 2d 36 36 38 0d 0a 53 45 4c 45 43 54  abel-668..SELECT
18c00 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2b   + cor0.col2 / +
18c10 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 46   col0 + + col2 F
18c20 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
18c30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 34 0d 0a 38  ..----..1..34..8
18c40 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
18c50 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
18c60 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
18c70 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
18c80 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
18c90 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36  rowsort label-66
18ca0 39 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20  9..SELECT CAST( 
18cb0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
18cc0 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
18cd0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
18ce0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
18cf0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
18d00 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
18d10 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
18d20 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 39 0d  wsort label-669.
18d30 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e  .SELECT CAST ( N
18d40 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
18d50 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
18d60 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
18d70 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
18d80 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
18d90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
18da0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
18db0 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2b 20 63   tab2.col2 + + c
18dc0 6f 6c 30 20 2b 20 2d 20 37 20 41 53 20 63 6f 6c  ol0 + - 7 AS col
18dd0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
18de0 2d 0d 0a 31 38 39 0d 0a 32 30 39 39 0d 0a 33 30  -..189..2099..30
18df0 37 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  74....onlyif mys
18e00 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
18e10 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
18e20 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
18e30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
18e40 6c 2d 36 37 31 0d 0a 53 45 4c 45 43 54 20 2d 20  l-671..SELECT - 
18e50 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 2d 20  col0 DIV col0 - 
18e60 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 72 30  cor0.col0 * cor0
18e70 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20  .col1 * col1 AS 
18e80 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
18e90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37 35  or0..----..-1775
18ea0 30 35 0d 0a 2d 33 32 39 33 31 36 0d 0a 2d 37 33  05..-329316..-73
18eb0 37 30 31 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7010....skipif m
18ec0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
18ed0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
18ee0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 31  owsort label-671
18ef0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
18f00 2f 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63 6f  / col0 - cor0.co
18f10 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  l0 * cor0.col1 *
18f20 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
18f30 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
18f40 2d 2d 0d 0a 2d 31 37 37 35 30 35 0d 0a 2d 33 32  --..-177505..-32
18f50 39 33 31 36 0d 0a 2d 37 33 37 30 31 30 0d 0a 0d  9316..-737010...
18f60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18f70 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
18f80 54 20 2d 20 2b 20 37 35 20 2a 20 2d 20 63 6f 72  T - + 75 * - cor
18f90 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
18fa0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18fb0 32 32 35 0d 0a 34 38 30 30 0d 0a 36 30 30 30 0d  225..4800..6000.
18fc0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18fd0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
18fe0 4e 43 54 20 2b 20 28 20 63 6f 6c 32 20 29 20 2b  NCT + ( col2 ) +
18ff0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   + cor0.col1 AS 
19000 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
19010 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35  S cor0..----..55
19020 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72  ..58..85....quer
19030 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19040 45 43 54 20 2d 20 2b 20 28 20 2b 20 33 34 20 29  ECT - + ( + 34 )
19050 20 2a 20 63 6f 6c 32 20 2b 20 33 39 20 2a 20 63   * col2 + 39 * c
19060 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
19070 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
19080 34 0d 0a 2d 31 37 31 39 0d 0a 35 35 38 0d 0a 0d  4..-1719..558...
19090 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
190a0 0d 0a 53 45 4c 45 43 54 20 32 20 2b 20 2d 20 63  ..SELECT 2 + - c
190b0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f  ol2 + - col2 FRO
190c0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
190d0 2d 0d 0a 2d 31 36 32 0d 0a 2d 36 34 0d 0a 30 0d  -..-162..-64..0.
190e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
190f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
19100 20 35 31 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29   51 + ( - col0 )
19110 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
19120 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a 2d  r0..----..-13..-
19130 32 39 0d 0a 34 38 0d 0a 0d 0a 71 75 65 72 79 20  29..48....query 
19140 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19150 54 20 2d 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29  T - - ( + col2 )
19160 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 28 20   * + col1 * - ( 
19170 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 29 20 46  + ( + col1 ) ) F
19180 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
19190 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 32 34 0d 0a  ..----..-16224..
191a0 2d 33 36 35 30 34 0d 0a 2d 35 37 30 30 0d 0a 0d  -36504..-5700...
191b0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
191c0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
191d0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
191e0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
191f0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
19200 6f 72 74 20 6c 61 62 65 6c 2d 36 37 38 0d 0a 53  ort label-678..S
19210 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
19220 20 43 41 53 54 28 20 2d 20 63 6f 72 30 2e 63 6f   CAST( - cor0.co
19230 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  l2 AS SIGNED ) A
19240 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
19250 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19260 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 73 6b  26..27..38....sk
19270 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
19280 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
19290 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
192a0 65 6c 2d 36 37 38 0d 0a 53 45 4c 45 43 54 20 44  el-678..SELECT D
192b0 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28  ISTINCT - CAST (
192c0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   - cor0.col2 AS 
192d0 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
192e0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
192f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32  or0..----..26..2
19300 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49  7..38....query I
19310 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19320 20 41 4c 4c 20 2b 20 2d 20 32 38 20 2b 20 63 6f   ALL + - 28 + co
19330 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  l1 * + col1 AS c
19340 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
19350 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 36   cor0..----..736
19360 38 0d 0a 38 32 35 33 0d 0a 39 33 38 31 0d 0a 0d  8..8253..9381...
19370 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
19380 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
19390 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
193a0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
193b0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
193c0 6f 72 74 20 6c 61 62 65 6c 2d 36 38 30 0d 0a 53  ort label-680..S
193d0 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 63 6f  ELECT - CAST( co
193e0 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l1 AS SIGNED ) *
193f0 20 2b 20 63 6f 6c 32 20 2b 20 38 39 20 41 53 20   + col2 + 89 AS 
19400 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
19410 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 34 39  or0..----..-2749
19420 0d 0a 2d 37 33 37 33 0d 0a 2d 38 0d 0a 0d 0a 73  ..-7373..-8....s
19430 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
19440 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
19450 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
19460 62 65 6c 2d 36 38 30 0d 0a 53 45 4c 45 43 54 20  bel-680..SELECT 
19470 2d 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53  - CAST ( col1 AS
19480 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63   INTEGER ) * + c
19490 6f 6c 32 20 2b 20 38 39 20 41 53 20 63 6f 6c 31  ol2 + 89 AS col1
194a0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
194b0 0a 2d 2d 2d 2d 0d 0a 2d 32 37 34 39 0d 0a 2d 37  .----..-2749..-7
194c0 33 37 33 0d 0a 2d 38 0d 0a 0d 0a 71 75 65 72 79  373..-8....query
194d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
194e0 43 54 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 37 32  CT + col2 - + 72
194f0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
19500 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d  r0..----..-15..-
19510 31 38 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20  18..24....query 
19520 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19530 54 20 41 4c 4c 20 2b 20 2b 20 39 20 2b 20 63 6f  T ALL + + 9 + co
19540 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
19550 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d  cor0..----..100.
19560 0a 31 30 36 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72  .106..95....quer
19570 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19580 45 43 54 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 31  ECT + + ( + col1
19590 20 29 20 2a 20 2b 20 32 30 20 2a 20 2b 20 38 34   ) * + 20 * + 84
195a0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
195b0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
195c0 0d 0a 31 34 34 34 38 30 0d 0a 31 35 32 38 38 30  ..144480..152880
195d0 0d 0a 31 36 32 39 36 30 0d 0a 0d 0a 73 6b 69 70  ..162960....skip
195e0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
195f0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
19600 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
19610 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
19620 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
19630 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
19640 31 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20  1 + + col0 col0 
19650 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
19660 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a  .110..132..180..
19670 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19680 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
19690 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  CT + col0 * + co
196a0 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 28 20  l2 + + col2 * ( 
196b0 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 31 20  col1 ) * - col1 
196c0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
196d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 37 35 38 0d  0..----..-25758.
196e0 0a 2d 37 39 38 30 0d 0a 2d 38 38 34 37 38 0d 0a  .-7980..-88478..
196f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19700 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
19710 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  col2 + + col2 + 
19720 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
19730 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32   cor0..----..152
19740 0d 0a 32 35 35 0d 0a 39 39 0d 0a 0d 0a 71 75 65  ..255..99....que
19750 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19760 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20  LECT ALL col2 + 
19770 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20  + cor0.col0 * - 
19780 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
19790 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
197a0 2d 2d 2d 2d 0d 0a 2d 31 33 30 35 0d 0a 2d 31 39  ----..-1305..-19
197b0 30 0d 0a 2d 34 35 37 36 0d 0a 0d 0a 71 75 65 72  0..-4576....quer
197c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
197d0 45 43 54 20 41 4c 4c 20 2d 20 35 33 20 41 53 20  ECT ALL - 53 AS 
197e0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
197f0 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61  tab1 AS cor0, ta
19800 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
19810 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
19820 69 6e 67 20 74 6f 20 32 38 37 36 34 31 38 35 38  ing to 287641858
19830 37 63 37 37 61 31 38 32 64 38 38 64 62 32 39 30  7c77a182d88db290
19840 37 62 30 61 35 31 61 0d 0a 0d 0a 6f 6e 6c 79 69  7b0a51a....onlyi
19850 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
19860 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
19870 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
19880 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19890 20 6c 61 62 65 6c 2d 36 38 39 0d 0a 53 45 4c 45   label-689..SELE
198a0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20  CT ALL + col1 * 
198b0 2d 20 28 20 36 38 20 29 20 2b 20 63 6f 6c 30 20  - ( 68 ) + col0 
198c0 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  DIV col1 FROM ta
198d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
198e0 0d 0a 2d 35 38 34 38 0d 0a 2d 36 31 38 38 0d 0a  ..-5848..-6188..
198f0 2d 36 35 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  -6596....skipif 
19900 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
19910 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
19920 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 38  rowsort label-68
19930 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  9..SELECT ALL + 
19940 63 6f 6c 31 20 2a 20 2d 20 28 20 36 38 20 29 20  col1 * - ( 68 ) 
19950 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 46 52  + col0 / col1 FR
19960 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
19970 0a 2d 2d 2d 2d 0d 0a 2d 35 38 34 38 0d 0a 2d 36  .----..-5848..-6
19980 31 38 38 0d 0a 2d 36 35 39 36 0d 0a 0d 0a 71 75  188..-6596....qu
19990 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
199a0 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63  ELECT col2 * + c
199b0 6f 6c 30 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20  ol0 - tab0.col1 
199c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
199d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a 37 30  0..----..-62..70
199e0 36 0d 0a 37 32 30 37 0d 0a 0d 0a 73 6b 69 70 69  6..7207....skipi
199f0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
19a00 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
19a10 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
19a20 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
19a30 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
19a40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
19a50 49 4e 43 54 20 63 6f 6c 30 20 2a 20 28 20 2d 20  INCT col0 * ( - 
19a60 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 29 20  col0 + - col0 ) 
19a70 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
19a80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
19a90 32 31 36 38 0d 0a 2d 31 32 34 38 32 0d 0a 2d 39  2168..-12482..-9
19aa0 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
19ab0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
19ac0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
19ad0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
19ae0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
19af0 2d 36 39 32 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -692..SELECT + c
19b00 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 36 35 20  or0.col0 + + 65 
19b10 44 49 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  DIV col2 AS col1
19b20 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
19b30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 36 35 0d  r0..----..4..65.
19b40 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .80....skipif my
19b50 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
19b60 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
19b70 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 32 0d  wsort label-692.
19b80 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
19b90 6f 6c 30 20 2b 20 2b 20 36 35 20 2f 20 63 6f 6c  ol0 + + 65 / col
19ba0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
19bb0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
19bc0 2d 0d 0a 34 0d 0a 36 35 0d 0a 38 30 0d 0a 0d 0a  -..4..65..80....
19bd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19be0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
19bf0 20 36 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63   6 * - col0 AS c
19c00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
19c10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d  r0..----..-49..-
19c20 35 34 36 0d 0a 2d 35 35 33 0d 0a 0d 0a 71 75 65  546..-553....que
19c30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19c40 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
19c50 6c 31 20 2a 20 28 20 63 6f 6c 30 20 29 20 2a 20  l1 * ( col0 ) * 
19c60 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  - cor0.col1 FROM
19c70 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
19c80 2d 2d 2d 0d 0a 2d 31 33 35 32 30 0d 0a 2d 32 30  ---..-13520..-20
19c90 32 38 0d 0a 2d 36 34 30 30 0d 0a 0d 0a 73 6b 69  28..-6400....ski
19ca0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
19cb0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
19cc0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
19cd0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
19ce0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
19cf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
19d00 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 34 20  STINCT col2 * 4 
19d10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
19d20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
19d30 34 0d 0a 31 30 38 0d 0a 31 35 32 0d 0a 0d 0a 73  4..108..152....s
19d40 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
19d50 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
19d60 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
19d70 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
19d80 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
19d90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19da0 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
19db0 31 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20  1 * + col1 col0 
19dc0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
19dd0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d  0..----..-289..-
19de0 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a 71 75  3481..-961....qu
19df0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19e00 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
19e10 6c 32 20 2a 20 39 38 20 2a 20 63 6f 72 30 2e 63  l2 * 98 * cor0.c
19e20 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f  ol1 + + col0 FRO
19e30 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
19e40 2d 2d 2d 2d 0d 0a 31 35 30 34 31 30 0d 0a 36 33  ----..150410..63
19e50 33 38 37 0d 0a 38 32 30 33 33 0d 0a 0d 0a 73 6b  387..82033....sk
19e60 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
19e70 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
19e80 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
19e90 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
19ea0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
19eb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
19ec0 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  LL + + col0 * + 
19ed0 28 20 2d 20 63 6f 6c 32 20 29 20 63 6f 6c 30 20  ( - col2 ) col0 
19ee0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
19ef0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d  0..----..-189..-
19f00 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71  2028..-3002....q
19f10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19f20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
19f30 2d 20 63 6f 6c 30 20 2a 20 31 31 20 2b 20 2b 20  - col0 * 11 + + 
19f40 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2a 20  col0 * + col1 * 
19f50 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
19f60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 37   cor0..----..357
19f70 37 36 0d 0a 34 31 37 39 0d 0a 39 38 39 36 30 0d  76..4179..98960.
19f80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19f90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
19fa0 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 30 20 41 53   + col0 - + 0 AS
19fb0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
19fc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
19fd0 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 73  7..-78..-79....s
19fe0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
19ff0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1a000 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1a010 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1a020 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1a030 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a040 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 74  ALL - col2 + + t
1a050 61 62 31 2e 63 6f 6c 30 20 63 6f 6c 32 20 46 52  ab1.col0 col2 FR
1a060 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
1a070 31 36 0d 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 6f 6e  16..-51..7....on
1a080 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1a090 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1a0a0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1a0b0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1a0c0 6f 72 74 20 6c 61 62 65 6c 2d 37 30 32 0d 0a 53  ort label-702..S
1a0d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1a0e0 20 63 6f 6c 31 20 44 49 56 20 38 20 46 52 4f 4d   col1 DIV 8 FROM
1a0f0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1a100 2d 2d 2d 0d 0a 31 0d 0a 33 0d 0a 0d 0a 73 6b 69  ---..1..3....ski
1a110 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1a120 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1a130 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1a140 6c 2d 37 30 32 0d 0a 53 45 4c 45 43 54 20 44 49  l-702..SELECT DI
1a150 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2f 20  STINCT + col1 / 
1a160 38 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  8 FROM tab1 AS c
1a170 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 0d  or0..----..1..3.
1a180 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1a190 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1a1a0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 31   - cor0.col1 + 1
1a1b0 33 20 2a 20 37 37 20 46 52 4f 4d 20 74 61 62 31  3 * 77 FROM tab1
1a1c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1a1d0 39 37 35 0d 0a 39 38 38 0d 0a 39 39 31 0d 0a 0d  975..988..991...
1a1e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a1f0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1a200 6f 6c 30 20 2b 20 2d 20 37 20 41 53 20 63 6f 6c  ol0 + - 7 AS col
1a210 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1a220 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a  or0..----..-14..
1a230 2d 38 35 0d 0a 2d 38 36 0d 0a 0d 0a 71 75 65 72  -85..-86....quer
1a240 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a250 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1a260 6f 6c 32 20 2d 20 28 20 2b 20 37 38 20 2b 20 2d  ol2 - ( + 78 + -
1a270 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20   col2 ) AS col2 
1a280 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1a290 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 32 34  0..----..-2..-24
1a2a0 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-26....query I
1a2b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a2c0 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   + col1 * - col0
1a2d0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
1a2e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1a2f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
1a300 37 36 0d 0a 2d 37 35 0d 0a 2d 39 36 30 0d 0a 0d  76..-75..-960...
1a310 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a320 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1a330 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 28 20 38  T - col1 + - ( 8
1a340 35 20 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  5 ) * - col0 FRO
1a350 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1a360 2d 2d 2d 2d 0d 0a 32 32 39 0d 0a 35 34 33 30 0d  ----..229..5430.
1a370 0a 36 37 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .6787....query I
1a380 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a390 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2b   col1 * + col2 +
1a3a0 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
1a3b0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1a3c0 0a 31 35 30 38 0d 0a 36 30 38 0d 0a 38 31 30 0d  .1508..608..810.
1a3d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1a3e0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1a3f0 4e 43 54 20 37 20 2a 20 74 61 62 30 2e 63 6f 6c  NCT 7 * tab0.col
1a400 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 39  2 + + col0 * - 9
1a410 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
1a420 2d 0d 0a 2d 31 39 35 33 0d 0a 2d 33 31 37 38 0d  -..-1953..-3178.
1a430 0a 2d 37 35 32 35 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-7525....onlyif
1a440 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1a450 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1a460 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1a470 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1a480 6c 61 62 65 6c 2d 37 31 30 0d 0a 53 45 4c 45 43  label-710..SELEC
1a490 54 20 44 49 53 54 49 4e 43 54 20 2b 20 37 37 20  T DISTINCT + 77 
1a4a0 44 49 56 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  DIV cor0.col2 AS
1a4b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
1a4c0 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
1a4d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d  or0..----..0..2.
1a4e0 0a 37 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .77....skipif my
1a4f0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1a500 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1a510 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 31 30 0d  wsort label-710.
1a520 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1a530 20 2b 20 37 37 20 2f 20 63 6f 72 30 2e 63 6f 6c   + 77 / cor0.col
1a540 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
1a550 61 62 30 2c 20 74 61 62 32 2c 20 74 61 62 30 20  ab0, tab2, tab0 
1a560 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1a570 0d 0a 32 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72 79  ..2..77....query
1a580 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a590 43 54 20 44 49 53 54 49 4e 43 54 20 34 36 20 2b  CT DISTINCT 46 +
1a5a0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d   + col0 * col0 -
1a5b0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63   col0 * + cor0.c
1a5c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1a5d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 34   cor0..----..-94
1a5e0 0d 0a 33 32 38 35 0d 0a 34 31 30 32 0d 0a 0d 0a  ..3285..4102....
1a5f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a600 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
1a610 37 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  7 * col0 AS col0
1a620 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1a630 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 35 34  r0..----..49..54
1a640 36 0d 0a 35 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  6..553....onlyif
1a650 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1a660 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1a670 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1a680 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1a690 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1a6a0 65 6c 2d 37 31 33 0d 0a 53 45 4c 45 43 54 20 44  el-713..SELECT D
1a6b0 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 4e 55  ISTINCT CAST( NU
1a6c0 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20  LL AS DECIMAL ) 
1a6d0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20  FROM tab1, tab2 
1a6e0 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 63 6f  AS cor0, tab0 co
1a6f0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r1..----..NULL..
1a700 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1a710 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1a720 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a730 20 6c 61 62 65 6c 2d 37 31 33 0d 0a 53 45 4c 45   label-713..SELE
1a740 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54  CT DISTINCT CAST
1a750 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20   ( NULL AS REAL 
1a760 29 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  ) FROM tab1, tab
1a770 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  2 AS cor0, tab0 
1a780 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor1..----..NULL
1a790 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a7a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1a7b0 49 4e 43 54 20 36 33 20 2b 20 63 6f 72 30 2e 63  INCT 63 + cor0.c
1a7c0 6f 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d  ol0 - + col1 * -
1a7d0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
1a7e0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1a7f0 0a 2d 2d 2d 2d 0d 0a 31 33 39 31 0d 0a 31 34 37  .----..1391..147
1a800 30 0d 0a 36 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  0..697....skipif
1a810 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1a820 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1a830 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1a840 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1a850 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
1a860 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1a870 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  NCT + - cor0.col
1a880 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f  1 + cor0.col2 co
1a890 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
1a8a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d  cor0..----..-53.
1a8b0 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e 6c 79  .-9..-96....only
1a8c0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1a8d0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1a8e0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1a8f0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1a900 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1a910 61 62 65 6c 2d 37 31 36 0d 0a 53 45 4c 45 43 54  abel-716..SELECT
1a920 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28 20   DISTINCT CAST( 
1a930 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
1a940 20 2a 20 2b 20 37 38 20 41 53 20 63 6f 6c 31 20   * + 78 AS col1 
1a950 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1a960 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
1a970 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1a980 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1a990 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1a9a0 6c 61 62 65 6c 2d 37 31 36 0d 0a 53 45 4c 45 43  label-716..SELEC
1a9b0 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 20  T DISTINCT CAST 
1a9c0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
1a9d0 52 20 29 20 2a 20 2b 20 37 38 20 41 53 20 63 6f  R ) * + 78 AS co
1a9e0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
1a9f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
1aa00 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1aa10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
1aa20 6c 30 20 2b 20 2d 20 38 38 20 2a 20 63 6f 6c 32  l0 + - 88 * col2
1aa30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1aa40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 36 36 0d  r0..----..-2366.
1aa50 0a 2d 32 33 38 33 0d 0a 2d 33 34 32 33 0d 0a 0d  .-2383..-3423...
1aa60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1aa70 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28  ..SELECT ALL + (
1aa80 20 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 72 30   col0 ) + + cor0
1aa90 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20  .col0 FROM tab0 
1aaa0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d  cor0..----..178.
1aab0 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79  .48..70....query
1aac0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1aad0 43 54 20 37 31 20 41 53 20 63 6f 6c 31 20 46 52  CT 71 AS col1 FR
1aae0 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
1aaf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
1ab00 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1ab10 20 63 31 61 61 63 65 35 64 35 66 65 32 37 37 32   c1aace5d5fe2772
1ab20 31 63 63 39 32 35 35 35 32 35 31 33 63 38 35 63  1cc925552513c85c
1ab30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
1ab40 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1ab50 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1ab60 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1ab70 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1ab80 2d 37 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -720..SELECT - +
1ab90 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 63 6f   ( + col2 ) * co
1aba0 6c 30 20 44 49 56 20 2d 20 35 30 20 46 52 4f 4d  l0 DIV - 50 FROM
1abb0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1abc0 2d 2d 2d 0d 0a 30 0d 0a 31 34 35 0d 0a 31 35 0d  ---..0..145..15.
1abd0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1abe0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1abf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ac00 74 20 6c 61 62 65 6c 2d 37 32 30 0d 0a 53 45 4c  t label-720..SEL
1ac10 45 43 54 20 2d 20 2b 20 28 20 2b 20 63 6f 6c 32  ECT - + ( + col2
1ac20 20 29 20 2a 20 63 6f 6c 30 20 2f 20 2d 20 35 30   ) * col0 / - 50
1ac30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1ac40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 34 35  r0..----..0..145
1ac50 0d 0a 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..15....query I 
1ac60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ac70 2b 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  + - ( - cor0.col
1ac80 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  2 ) FROM tab1 co
1ac90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37  r0..----..54..57
1aca0 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..96....query I 
1acb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1acc0 28 20 63 6f 6c 31 20 29 20 2a 20 2d 20 31 20 41  ( col1 ) * - 1 A
1acd0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1ace0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1acf0 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d  -10..-13..-26...
1ad00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ad10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
1ad20 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or1.col1 FROM ta
1ad30 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
1ad40 2c 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d  , tab1 cor1..---
1ad50 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
1ad60 68 69 6e 67 20 74 6f 20 64 36 37 31 61 30 36 34  hing to d671a064
1ad70 65 32 64 61 37 30 39 63 61 34 63 64 66 65 61 33  e2da709ca4cdfea3
1ad80 31 37 62 38 65 38 39 32 0d 0a 0d 0a 6f 6e 6c 79  17b8e892....only
1ad90 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1ada0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1adb0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1adc0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1add0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ade0 61 62 65 6c 2d 37 32 34 0d 0a 53 45 4c 45 43 54  abel-724..SELECT
1adf0 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2d 20   ALL + - col2 - 
1ae00 43 41 53 54 28 20 28 20 2b 20 63 6f 6c 30 20 29  CAST( ( + col0 )
1ae10 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
1ae20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
1ae30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1ae40 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d  21..-176..-57...
1ae50 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1ae60 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1ae70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1ae80 6c 61 62 65 6c 2d 37 32 34 0d 0a 53 45 4c 45 43  label-724..SELEC
1ae90 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2d  T ALL + - col2 -
1aea0 20 43 41 53 54 20 28 20 28 20 2b 20 63 6f 6c 30   CAST ( ( + col0
1aeb0 20 29 20 41 53 20 49 4e 54 45 47 45 52 20 29 20   ) AS INTEGER ) 
1aec0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1aed0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1aee0 0a 2d 31 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37  .-121..-176..-57
1aef0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1af00 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1af10 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1af20 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1af30 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1af40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1af50 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20  LECT - col1 + + 
1af60 28 20 2d 20 38 33 20 29 20 63 6f 6c 30 20 46 52  ( - 83 ) col0 FR
1af70 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1af80 0a 2d 2d 2d 2d 0d 0a 2d 31 36 39 0d 0a 2d 31 37  .----..-169..-17
1af90 34 0d 0a 2d 31 38 30 0d 0a 0d 0a 73 6b 69 70 69  4..-180....skipi
1afa0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1afb0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1afc0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1afd0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1afe0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1aff0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1b000 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a 20  - col0 - col1 * 
1b010 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d  + col0 col0 FROM
1b020 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1b030 2d 2d 2d 0d 0a 2d 31 34 32 32 0d 0a 2d 32 32 34  ---..-1422..-224
1b040 0d 0a 2d 34 36 38 30 0d 0a 0d 0a 71 75 65 72 79  ..-4680....query
1b050 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b060 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20  CT ALL + col0 * 
1b070 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  + ( cor0.col2 + 
1b080 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46  col0 ) AS col0 F
1b090 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1b0a0 0d 0a 2d 2d 2d 2d 0d 0a 32 33 38 0d 0a 38 31 31  ..----..238..811
1b0b0 32 0d 0a 39 32 34 33 0d 0a 0d 0a 6f 6e 6c 79 69  2..9243....onlyi
1b0c0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1b0d0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1b0e0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1b0f0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1b100 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1b110 62 65 6c 2d 37 32 38 0d 0a 53 45 4c 45 43 54 20  bel-728..SELECT 
1b120 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20  - cor0.col1 * + 
1b130 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
1b140 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 30 20  GNED ) + - col0 
1b150 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1b160 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1b170 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
1b180 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
1b190 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1b1a0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1b1b0 6f 72 74 20 6c 61 62 65 6c 2d 37 32 38 0d 0a 53  ort label-728..S
1b1c0 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
1b1d0 31 20 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  1 * + CAST ( NUL
1b1e0 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  L AS INTEGER ) +
1b1f0 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
1b200 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1b210 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
1b220 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
1b230 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b240 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1b250 6c 32 20 2b 20 2d 20 36 20 41 53 20 63 6f 6c 31  l2 + - 6 AS col1
1b260 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1b270 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 32 37  r0..----..-5..27
1b280 0d 0a 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..76....onlyif m
1b290 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1b2a0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1b2b0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1b2c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1b2d0 62 65 6c 2d 37 33 30 0d 0a 53 45 4c 45 43 54 20  bel-730..SELECT 
1b2e0 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 38 30 20  + col1 DIV - 80 
1b2f0 2d 20 2d 20 33 31 20 46 52 4f 4d 20 74 61 62 32  - - 31 FROM tab2
1b300 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1b310 33 31 0d 0a 33 31 0d 0a 33 31 0d 0a 0d 0a 73 6b  31..31..31....sk
1b320 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1b330 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1b340 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1b350 65 6c 2d 37 33 30 0d 0a 53 45 4c 45 43 54 20 2b  el-730..SELECT +
1b360 20 63 6f 6c 31 20 2f 20 2d 20 38 30 20 2d 20 2d   col1 / - 80 - -
1b370 20 33 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53   31 FROM tab2 AS
1b380 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d   cor0..----..31.
1b390 0a 33 31 0d 0a 33 31 0d 0a 0d 0a 71 75 65 72 79  .31..31....query
1b3a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b3b0 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 33 31  CT - col1 + - 31
1b3c0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1b3d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 0d 0a  r0..----..-117..
1b3e0 2d 31 32 32 0d 0a 2d 31 32 38 0d 0a 0d 0a 71 75  -122..-128....qu
1b3f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b400 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1b410 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2b 20   - col2 * + ( + 
1b420 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 30 20  col1 ) * - col0 
1b430 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
1b440 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1b450 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32   cor0..----..-32
1b460 39 38 0d 0a 2d 36 36 34 30 32 37 0d 0a 2d 36 38  98..-664027..-68
1b470 30 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  026....query I r
1b480 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1b490 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63  ol0 - - col0 * c
1b4a0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
1b4b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1b4c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a  r0..----..1120..
1b4d0 37 30 34 0d 0a 38 31 0d 0a 0d 0a 6f 6e 6c 79 69  704..81....onlyi
1b4e0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1b4f0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1b500 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1b510 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1b520 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1b530 62 65 6c 2d 37 33 34 0d 0a 53 45 4c 45 43 54 20  bel-734..SELECT 
1b540 2b 20 2d 20 43 41 53 54 28 20 2b 20 63 6f 6c 30  + - CAST( + col0
1b550 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
1b560 6f 6c 30 20 2b 20 2b 20 43 41 53 54 28 20 4e 55  ol0 + + CAST( NU
1b570 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
1b580 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1b590 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1b5a0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
1b5b0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1b5c0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1b5d0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1b5e0 72 74 20 6c 61 62 65 6c 2d 37 33 34 0d 0a 53 45  rt label-734..SE
1b5f0 4c 45 43 54 20 2b 20 2d 20 43 41 53 54 20 28 20  LECT + - CAST ( 
1b600 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  + col0 AS INTEGE
1b610 52 20 29 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 43  R ) * col0 + + C
1b620 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
1b630 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20  TEGER ) AS col2 
1b640 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1b650 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
1b660 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
1b670 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b680 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 39 33  LECT - col1 + 93
1b690 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1b6a0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a 36 32  b2..----..34..62
1b6b0 0d 0a 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..76....onlyif m
1b6c0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
1b6d0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
1b6e0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
1b6f0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
1b700 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1b710 2d 37 33 36 0d 0a 53 45 4c 45 43 54 20 2b 20 43  -736..SELECT + C
1b720 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
1b730 4e 45 44 20 29 20 2a 20 33 36 20 2b 20 63 6f 72  NED ) * 36 + cor
1b740 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
1b750 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1b760 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1b770 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
1b780 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1b790 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1b7a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1b7b0 2d 37 33 36 0d 0a 53 45 4c 45 43 54 20 2b 20 43  -736..SELECT + C
1b7c0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
1b7d0 54 45 47 45 52 20 29 20 2a 20 33 36 20 2b 20 63  TEGER ) * 36 + c
1b7e0 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  or0.col0 AS col2
1b7f0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1b800 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1b810 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
1b820 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b830 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
1b840 32 20 2b 20 2d 20 33 39 20 46 52 4f 4d 20 74 61  2 + - 39 FROM ta
1b850 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1b860 0d 0a 2d 31 0d 0a 2d 31 32 0d 0a 2d 31 33 0d 0a  ..-1..-12..-13..
1b870 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1b880 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1b890 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1b8a0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1b8b0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1b8c0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 33 38 0d 0a  sort label-738..
1b8d0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
1b8e0 2b 20 43 41 53 54 28 20 2b 20 38 35 20 41 53 20  + CAST( + 85 AS 
1b8f0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
1b900 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 39 35 0d 0a  b2..----..-595..
1b910 2d 36 36 33 30 0d 0a 2d 36 37 31 35 0d 0a 0d 0a  -6630..-6715....
1b920 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1b930 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1b940 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b950 61 62 65 6c 2d 37 33 38 0d 0a 53 45 4c 45 43 54  abel-738..SELECT
1b960 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54   - col0 * + CAST
1b970 20 28 20 2b 20 38 35 20 41 53 20 49 4e 54 45 47   ( + 85 AS INTEG
1b980 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  ER ) FROM tab2..
1b990 2d 2d 2d 2d 0d 0a 2d 35 39 35 0d 0a 2d 36 36 33  ----..-595..-663
1b9a0 30 0d 0a 2d 36 37 31 35 0d 0a 0d 0a 71 75 65 72  0..-6715....quer
1b9b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1b9c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1b9d0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
1b9e0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
1b9f0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
1ba00 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor1..----..10
1ba10 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72  ..13..26....quer
1ba20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1ba30 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 35 20 41  ECT - col0 * 5 A
1ba40 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1ba50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ba60 2d 31 35 0d 0a 2d 33 32 30 0d 0a 2d 34 30 30 0d  -15..-320..-400.
1ba70 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1ba80 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
1ba90 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
1baa0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
1bab0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
1bac0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 31 0d  wsort label-741.
1bad0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 43 41 53 54  .SELECT + - CAST
1bae0 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  ( - cor0.col2 AS
1baf0 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f   SIGNED ) + - co
1bb00 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
1bb10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d  cor0..----..-34.
1bb20 0a 2d 37 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69 66  .-7..9....skipif
1bb30 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1bb40 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1bb50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1bb60 34 31 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 43  41..SELECT + - C
1bb70 41 53 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  AST ( - cor0.col
1bb80 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  2 AS INTEGER ) +
1bb90 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
1bba0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1bbb0 0a 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 71  .-34..-7..9....q
1bbc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1bbd0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 28  SELECT ALL - + (
1bbe0 20 33 31 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2b   31 ) + - col0 +
1bbf0 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20   + ( - col1 ) * 
1bc00 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
1bc10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1bc20 2d 33 35 39 30 0d 0a 2d 33 39 39 0d 0a 2d 39 39  -3590..-399..-99
1bc30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
1bc40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1bc50 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b   - col0 * col1 +
1bc60 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46   col1 * + col1 F
1bc70 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
1bc80 2d 2d 2d 0d 0a 31 38 32 0d 0a 35 33 33 32 0d 0a  ---..182..5332..
1bc90 36 30 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6014....query I 
1bca0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1bcb0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
1bcc0 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  * - cor0.col1 AS
1bcd0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1bce0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1bcf0 30 30 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a  00..169..676....
1bd00 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1bd10 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1bd20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1bd30 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1bd40 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 35 0d  wsort label-745.
1bd50 0a 53 45 4c 45 43 54 20 28 20 2d 20 36 37 20 29  .SELECT ( - 67 )
1bd60 20 44 49 56 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   DIV col0 + col2
1bd70 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1bd80 0d 0a 30 0d 0a 33 31 0d 0a 38 32 0d 0a 0d 0a 73  ..0..31..82....s
1bd90 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1bda0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1bdb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1bdc0 62 65 6c 2d 37 34 35 0d 0a 53 45 4c 45 43 54 20  bel-745..SELECT 
1bdd0 28 20 2d 20 36 37 20 29 20 2f 20 63 6f 6c 30 20  ( - 67 ) / col0 
1bde0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
1bdf0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 33 31 0d 0a 38  ..----..0..31..8
1be00 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1be10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1be20 20 2b 20 32 36 20 2a 20 74 61 62 31 2e 63 6f 6c   + 26 * tab1.col
1be30 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
1be40 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
1be50 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
1be60 20 68 61 73 68 69 6e 67 20 74 6f 20 61 38 34 38   hashing to a848
1be70 35 39 66 62 34 62 39 35 63 33 35 30 36 36 66 65  59fb4b95c35066fe
1be80 65 36 65 39 39 66 63 66 33 65 61 36 0d 0a 0d 0a  e6e99fcf3ea6....
1be90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1bea0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1beb0 20 2b 20 34 33 20 2a 20 63 6f 6c 32 20 2b 20 2b   + 43 * col2 + +
1bec0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
1bed0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
1bee0 33 34 38 0d 0a 32 34 36 31 0d 0a 34 31 34 31 0d  348..2461..4141.
1bef0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1bf00 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1bf10 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1bf20 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1bf30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1bf40 34 38 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 28  48..SELECT + ( (
1bf50 20 63 6f 6c 30 20 29 20 29 20 44 49 56 20 63 6f   col0 ) ) DIV co
1bf60 6c 30 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  l0 - col0 * col2
1bf70 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1bf80 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d  b0..----..-34..-
1bf90 37 32 39 37 0d 0a 2d 37 39 31 0d 0a 0d 0a 73 6b  7297..-791....sk
1bfa0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1bfb0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1bfc0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1bfd0 65 6c 2d 37 34 38 0d 0a 53 45 4c 45 43 54 20 2b  el-748..SELECT +
1bfe0 20 28 20 28 20 63 6f 6c 30 20 29 20 29 20 2f 20   ( ( col0 ) ) / 
1bff0 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  col0 - col0 * co
1c000 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
1c010 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d  tab0..----..-34.
1c020 0a 2d 37 32 39 37 0d 0a 2d 37 39 31 0d 0a 0d 0a  .-7297..-791....
1c030 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c040 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1c050 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 36 35 20 41   + - col0 * 65 A
1c060 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1c070 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c080 2d 34 35 35 0d 0a 2d 35 30 37 30 0d 0a 2d 35 31  -455..-5070..-51
1c090 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
1c0a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1c0b0 53 54 49 4e 43 54 20 39 36 20 2a 20 63 6f 6c 32  STINCT 96 * col2
1c0c0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1c0d0 0d 0a 33 31 36 38 0d 0a 37 38 37 32 0d 0a 39 36  ..3168..7872..96
1c0e0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1c0f0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1c100 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1c110 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1c120 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1c130 37 35 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  751..SELECT ALL 
1c140 28 20 63 6f 6c 30 20 29 20 2a 20 74 61 62 31 2e  ( col0 ) * tab1.
1c150 63 6f 6c 30 20 44 49 56 20 2d 20 36 36 20 46 52  col0 DIV - 66 FR
1c160 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
1c170 36 32 0d 0a 2d 39 36 0d 0a 30 0d 0a 0d 0a 73 6b  62..-96..0....sk
1c180 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1c190 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1c1a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1c1b0 65 6c 2d 37 35 31 0d 0a 53 45 4c 45 43 54 20 41  el-751..SELECT A
1c1c0 4c 4c 20 28 20 63 6f 6c 30 20 29 20 2a 20 74 61  LL ( col0 ) * ta
1c1d0 62 31 2e 63 6f 6c 30 20 2f 20 2d 20 36 36 20 46  b1.col0 / - 66 F
1c1e0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1c1f0 2d 36 32 0d 0a 2d 39 36 0d 0a 30 0d 0a 0d 0a 71  -62..-96..0....q
1c200 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c210 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
1c220 6c 31 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c 32  l1 * col0 - col2
1c230 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1c240 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 36 0d  r0..----..-1136.
1c250 0a 2d 31 33 32 0d 0a 2d 36 39 37 0d 0a 0d 0a 71  .-132..-697....q
1c260 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c270 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20  SELECT - col1 + 
1c280 2b 20 63 6f 6c 31 20 2d 20 35 20 46 52 4f 4d 20  + col1 - 5 FROM 
1c290 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1c2a0 2d 2d 0d 0a 2d 35 0d 0a 2d 35 0d 0a 2d 35 0d 0a  --..-5..-5..-5..
1c2b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c2c0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  t..SELECT ALL ( 
1c2d0 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 30 20 41 53  col2 ) * col0 AS
1c2e0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
1c2f0 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d  .----..35..7298.
1c300 0a 37 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .792....onlyif m
1c310 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
1c320 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
1c330 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
1c340 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
1c350 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1c360 2d 37 35 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -755..SELECT col
1c370 30 20 2a 20 2d 20 43 41 53 54 28 20 63 6f 6c 30  0 * - CAST( col0
1c380 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
1c390 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  M tab1..----..-4
1c3a0 30 39 36 0d 0a 2d 36 34 30 30 0d 0a 2d 39 0d 0a  096..-6400..-9..
1c3b0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1c3c0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1c3d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c3e0 20 6c 61 62 65 6c 2d 37 35 35 0d 0a 53 45 4c 45   label-755..SELE
1c3f0 43 54 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54  CT col0 * - CAST
1c400 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   ( col0 AS INTEG
1c410 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  ER ) FROM tab1..
1c420 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34  ----..-4096..-64
1c430 30 30 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20  00..-9....query 
1c440 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c450 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  T - col0 * col1 
1c460 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  * + col2 AS col0
1c470 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1c480 0d 0a 2d 31 31 39 36 35 32 0d 0a 2d 35 31 30 33  ..-119652..-5103
1c490 34 0d 0a 2d 35 38 35 39 0d 0a 0d 0a 71 75 65 72  4..-5859....quer
1c4a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c4b0 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  ECT + col0 + col
1c4c0 32 20 2d 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20  2 - - tab2.col0 
1c4d0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1c4e0 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 39  2..----..182..19
1c4f0 36 0d 0a 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  6..41....query I
1c500 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
1c510 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52  CT DISTINCT * FR
1c520 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 20  OM tab1 AS cor0 
1c530 57 48 45 52 45 20 4e 55 4c 4c 20 42 45 54 57 45  WHERE NULL BETWE
1c540 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 2b 20 63 6f  EN NULL AND + co
1c550 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 0d 0a  r0.col2 * col2..
1c560 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ----....onlyif m
1c570 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1c580 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1c590 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1c5a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1c5b0 62 65 6c 2d 37 35 39 0d 0a 53 45 4c 45 43 54 20  bel-759..SELECT 
1c5c0 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
1c5d0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 44 49  col0 + - col1 DI
1c5e0 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  V col0 FROM tab1
1c5f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c600 31 35 34 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d  154..3648..7680.
1c610 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1c620 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1c630 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c640 74 20 6c 61 62 65 6c 2d 37 35 39 0d 0a 53 45 4c  t label-759..SEL
1c650 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
1c660 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  2 * col0 + - col
1c670 31 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 / col0 FROM ta
1c680 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1c690 0d 0a 31 35 34 0d 0a 33 36 34 38 0d 0a 37 36 38  ..154..3648..768
1c6a0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  0....query III r
1c6b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1c6c0 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 63  LL * FROM tab1 c
1c6d0 6f 72 30 20 57 48 45 52 45 20 4e 4f 54 20 4e 55  or0 WHERE NOT NU
1c6e0 4c 4c 20 49 4e 20 28 20 2b 20 63 6f 6c 32 20 29  LL IN ( + col2 )
1c6f0 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
1c700 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c710 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
1c720 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  * - col0 AS col2
1c730 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1c740 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35  .----..-1225..-5
1c750 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65  76..-7921....que
1c760 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c770 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1c780 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l1 + col0 * - co
1c790 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l1 * + col1 FROM
1c7a0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1c7b0 2d 2d 2d 0d 0a 2d 31 37 37 34 31 38 0d 0a 2d 33  ---..-177418..-3
1c7c0 32 39 32 31 38 0d 0a 2d 37 33 36 39 31 38 0d 0a  29218..-736918..
1c7d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c7e0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1c7f0 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  CT + col1 + col0
1c800 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   * - col2 + col2
1c810 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1c820 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 38 31 0d  r0..----..-3581.
1c830 0a 2d 37 35 37 31 0d 0a 2d 38 32 0d 0a 0d 0a 71  .-7571..-82....q
1c840 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c850 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
1c860 2a 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c  * + col0 - - col
1c870 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
1c880 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1c890 2d 0d 0a 32 30 35 34 0d 0a 32 31 36 0d 0a 33 30  -..2054..216..30
1c8a0 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  40....query I ro
1c8b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
1c8c0 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 74 61  l1 * col0 + + ta
1c8d0 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  b0.col0 AS col0 
1c8e0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1c8f0 0a 32 30 38 38 0d 0a 33 34 33 30 0d 0a 38 31 38  .2088..3430..818
1c900 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1c910 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
1c920 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
1c930 62 31 20 41 53 20 63 6f 72 30 20 57 48 45 52 45  b1 AS cor0 WHERE
1c940 20 4e 55 4c 4c 20 3d 20 4e 55 4c 4c 0d 0a 2d 2d   NULL = NULL..--
1c950 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  --....query III 
1c960 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c970 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 32 20  ALL * FROM tab2 
1c980 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c  WHERE NOT NULL <
1c990 3e 20 2d 20 63 6f 6c 32 0d 0a 2d 2d 2d 2d 0d 0a  > - col2..----..
1c9a0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1c9b0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1c9c0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1c9d0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1c9e0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1c9f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ca00 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20  CT ALL - col1 * 
1ca10 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  + col0 + - col1 
1ca20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
1ca30 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 30 35  ----..-104..-105
1ca40 33 0d 0a 2d 36 35 30 0d 0a 0d 0a 71 75 65 72 79  3..-650....query
1ca50 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
1ca60 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20  LECT DISTINCT * 
1ca70 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20  FROM tab2 WHERE 
1ca80 4e 4f 54 20 2b 20 63 6f 6c 30 20 4e 4f 54 20 49  NOT + col0 NOT I
1ca90 4e 20 28 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d  N ( col2 )..----
1caa0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1cab0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  ort..SELECT - ta
1cac0 62 30 2e 63 6f 6c 32 20 2a 20 2b 20 74 61 62 30  b0.col2 * + tab0
1cad0 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 63  .col2 + col1 + c
1cae0 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 * col0 FROM 
1caf0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 37  tab0..----..-427
1cb00 0d 0a 31 32 38 38 0d 0a 31 33 32 31 0d 0a 0d 0a  ..1288..1321....
1cb10 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1cb20 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1cb30 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1cb40 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1cb50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 31 0d  wsort label-771.
1cb60 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1cb70 20 2d 20 63 6f 6c 31 20 2a 20 74 61 62 31 2e 63   - col1 * tab1.c
1cb80 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol1 * col1 + col
1cb90 30 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20  0 DIV col0 FROM 
1cba0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 35  tab1..----..-175
1cbb0 37 35 0d 0a 2d 32 31 39 36 0d 0a 2d 39 39 39 0d  75..-2196..-999.
1cbc0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1cbd0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1cbe0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1cbf0 74 20 6c 61 62 65 6c 2d 37 37 31 0d 0a 53 45 4c  t label-771..SEL
1cc00 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
1cc10 6f 6c 31 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20  ol1 * tab1.col1 
1cc20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2f 20  * col1 + col0 / 
1cc30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
1cc40 2d 2d 2d 2d 0d 0a 2d 31 37 35 37 35 0d 0a 2d 32  ----..-17575..-2
1cc50 31 39 36 0d 0a 2d 39 39 39 0d 0a 0d 0a 71 75 65  196..-999....que
1cc60 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
1cc70 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
1cc80 62 32 20 57 48 45 52 45 20 4e 4f 54 20 28 20 2d  b2 WHERE NOT ( -
1cc90 20 63 6f 6c 32 20 29 20 4e 4f 54 20 42 45 54 57   col2 ) NOT BETW
1cca0 45 45 4e 20 2b 20 63 6f 6c 30 20 41 4e 44 20 4e  EEN + col0 AND N
1ccb0 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ULL..----....que
1ccc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ccd0 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e  LECT ALL + cor0.
1cce0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  col2 + col2 + + 
1ccf0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
1cd00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 36 0d 0a  or0..----..246..
1cd10 33 0d 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  3..99....query I
1cd20 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
1cd30 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57  CT * FROM tab0 W
1cd40 48 45 52 45 20 4e 4f 54 20 2b 20 63 6f 6c 30 20  HERE NOT + col0 
1cd50 49 4e 20 28 20 2d 20 63 6f 6c 30 20 29 0d 0a 2d  IN ( - col0 )..-
1cd60 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
1cd70 73 68 69 6e 67 20 74 6f 20 33 38 61 31 36 37 33  shing to 38a1673
1cd80 65 32 65 30 39 64 36 39 34 63 38 63 65 63 34 35  e2e09d694c8cec45
1cd90 63 37 39 37 30 33 34 61 37 0d 0a 0d 0a 73 6b 69  c797034a7....ski
1cda0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1cdb0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1cdc0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1cdd0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1cde0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
1cdf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1ce00 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 74 61  col1 * col0 * ta
1ce10 62 32 2e 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f  b2.col1 col1 FRO
1ce20 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32  M tab2..----..22
1ce30 38 33 31 0d 0a 32 37 31 35 31 38 0d 0a 36 37 32  831..271518..672
1ce40 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1ce50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1ce60 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20 74  TINCT col2 * - t
1ce70 61 62 31 2e 63 6f 6c 31 20 2b 20 2d 20 74 61 62  ab1.col1 + - tab
1ce80 31 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53  1.col2 + col0 AS
1ce90 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
1cea0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 34 0d 0a 2d 31  .----..-1264..-1
1ceb0 34 35 35 0d 0a 2d 35 36 33 0d 0a 0d 0a 6f 6e 6c  455..-563....onl
1cec0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1ced0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1cee0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1cef0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1cf00 72 74 20 6c 61 62 65 6c 2d 37 37 37 0d 0a 53 45  rt label-777..SE
1cf10 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  LECT col2 + col0
1cf20 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74   DIV col0 FROM t
1cf30 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35  ab1..----..55..5
1cf40 38 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  8..97....skipif 
1cf50 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1cf60 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1cf70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37  rowsort label-77
1cf80 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  7..SELECT col2 +
1cf90 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 46 52 4f   col0 / col0 FRO
1cfa0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 35  M tab1..----..55
1cfb0 0d 0a 35 38 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  ..58..97....quer
1cfc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1cfd0 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT + - cor0.col
1cfe0 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  2 * col0 + + col
1cff0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1d000 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d  or0..----..-159.
1d010 0a 2d 33 35 38 34 0d 0a 2d 37 36 30 30 0d 0a 0d  .-3584..-7600...
1d020 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d030 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
1d040 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol1 + col2 * col
1d050 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
1d060 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 37 33 38  ..----..132..738
1d070 39 0d 0a 38 37 38 0d 0a 0d 0a 71 75 65 72 79 20  9..878....query 
1d080 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d090 54 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20  T + tab2.col1 + 
1d0a0 2b 20 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d  + tab2.col1 FROM
1d0b0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38   tab2..----..118
1d0c0 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72  ..34..62....quer
1d0d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d0e0 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  ECT col0 + col2 
1d0f0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
1d100 0d 0a 2d 2d 2d 2d 0d 0a 32 36 30 0d 0a 37 31 0d  ..----..260..71.
1d110 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .81....query I r
1d120 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1d130 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a   col1 + + col0 *
1d140 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
1d150 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 36 0d 0a  2..----..-1326..
1d160 2d 31 38 36 0d 0a 2d 34 35 34 33 0d 0a 0d 0a 73  -186..-4543....s
1d170 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1d180 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1d190 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1d1a0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1d1b0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1d1c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d1d0 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
1d1e0 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f  tab0.col1 + + co
1d1f0 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 30  l1 * + col2 col0
1d200 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1d210 0d 0a 31 34 39 32 34 0d 0a 31 39 34 0d 0a 35 36  ..14924..194..56
1d220 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  76....query IIII
1d230 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
1d240 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a  ELECT DISTINCT *
1d250 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
1d260 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 57  , tab2 AS cor0 W
1d270 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3e 3d  HERE NOT NULL >=
1d280 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   NULL..----....q
1d290 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d2a0 53 45 4c 45 43 54 20 63 6f 6c 31 20 2d 20 2d 20  SELECT col1 - - 
1d2b0 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col1 * col1 FROM
1d2c0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 30 36   tab2..----..306
1d2d0 0d 0a 33 35 34 30 0d 0a 39 39 32 0d 0a 0d 0a 6f  ..3540..992....o
1d2e0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1d2f0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1d300 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1d310 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1d320 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 36 0d 0a  sort label-786..
1d330 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1d340 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20 2b 20  col0 DIV col1 + 
1d350 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
1d360 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  M tab1..----..3.
1d370 0a 37 30 0d 0a 38 36 0d 0a 0d 0a 73 6b 69 70 69  .70..86....skipi
1d380 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1d390 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1d3a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1d3b0 37 38 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  786..SELECT DIST
1d3c0 49 4e 43 54 20 63 6f 6c 30 20 2f 20 63 6f 6c 31  INCT col0 / col1
1d3d0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
1d3e0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1d3f0 0a 33 0d 0a 37 30 0d 0a 38 36 0d 0a 0d 0a 71 75  .3..70..86....qu
1d400 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d410 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63  ELECT + col0 + c
1d420 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 * cor0.col0 
1d430 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
1d440 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1d450 0d 0a 31 33 33 30 0d 0a 31 35 38 32 36 32 0d 0a  ..1330..158262..
1d460 32 33 37 32 33 37 0d 0a 0d 0a 71 75 65 72 79 20  237237....query 
1d470 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d480 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  T col2 + col2 * 
1d490 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
1d4a0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30  M tab2..----..20
1d4b0 35 34 0d 0a 32 31 36 0d 0a 33 30 34 30 0d 0a 0d  54..216..3040...
1d4c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d4d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1d4e0 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  T col0 * + col1 
1d4f0 2b 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20  + - col1 - col0 
1d500 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1d510 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 37 0d 0a 31  0..----..1247..1
1d520 37 39 0d 0a 34 34 36 35 0d 0a 0d 0a 71 75 65 72  79..4465....quer
1d530 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d540 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63  ECT ALL col2 * c
1d550 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 * col2 AS co
1d560 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1d570 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 35 39  cor0..----..2259
1d580 39 0d 0a 32 34 35 34 38 0d 0a 33 39 38 38 34 0d  9..24548..39884.
1d590 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d5a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
1d5b0 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  1 + + col1 * col
1d5c0 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 + + col2 AS co
1d5d0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
1d5e0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 35 31 35 0d 0a 38  0..----..7515..8
1d5f0 34 35 34 0d 0a 39 35 30 37 0d 0a 0d 0a 71 75 65  454..9507....que
1d600 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d610 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
1d620 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  * + col1 + col1 
1d630 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  * - col0 AS col0
1d640 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1d650 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
1d660 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1d670 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1d680 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32   - col2 + + col2
1d690 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   * + col2 * col1
1d6a0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1d6b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 35 37 32 0d  r0..----..22572.
1d6c0 0a 32 34 35 31 30 0d 0a 33 39 38 35 38 0d 0a 0d  .24510..39858...
1d6d0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1d6e0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1d6f0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1d700 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1d710 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1d720 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d730 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  T - col2 * - col
1d740 30 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52  0 + col2 col0 FR
1d750 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1d760 0a 2d 2d 2d 2d 0d 0a 32 30 35 34 0d 0a 32 31 36  .----..2054..216
1d770 0d 0a 33 30 34 30 0d 0a 0d 0a 71 75 65 72 79 20  ..3040....query 
1d780 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d790 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2a  T ALL - - col0 *
1d7a0 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30   - col2 * - cor0
1d7b0 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col0 + cor0.col
1d7c0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1d7d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 33 35 33  or0..----..23353
1d7e0 36 0d 0a 34 38 39 0d 0a 36 31 34 34 38 30 0d 0a  6..489..614480..
1d7f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d800 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
1d810 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b   - cor0.col1 * +
1d820 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
1d830 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1d840 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32 0d 0a  .----..-119652..
1d850 2d 35 31 30 33 34 0d 0a 2d 35 38 35 39 0d 0a 0d  -51034..-5859...
1d860 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d870 0d 0a 53 45 4c 45 43 54 20 32 35 20 2a 20 2b 20  ..SELECT 25 * + 
1d880 63 6f 72 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor1.col0 FROM t
1d890 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
1d8a0 30 2c 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d  0, tab1 cor1..--
1d8b0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
1d8c0 73 68 69 6e 67 20 74 6f 20 64 64 31 37 39 36 61  shing to dd1796a
1d8d0 61 64 38 36 35 35 38 63 33 35 66 38 38 31 38 36  ad86558c35f88186
1d8e0 61 38 66 65 34 63 36 33 63 0d 0a 0d 0a 71 75 65  a8fe4c63c....que
1d8f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d900 4c 45 43 54 20 41 4c 4c 20 35 30 20 2a 20 2b 20  LECT ALL 50 * + 
1d910 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
1d920 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35  M tab1..----..15
1d930 30 0d 0a 33 32 30 30 0d 0a 34 30 30 30 0d 0a 0d  0..3200..4000...
1d940 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d950 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
1d960 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  2 * col2 + col2 
1d970 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  + - col0 AS col0
1d980 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1d990 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 33 0d 0a  r0..----..1403..
1d9a0 36 32 34 0d 0a 37 34 39 0d 0a 0d 0a 6f 6e 6c 79  624..749....only
1d9b0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1d9c0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1d9d0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1d9e0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1d9f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1da00 61 62 65 6c 2d 38 30 30 0d 0a 53 45 4c 45 43 54  abel-800..SELECT
1da10 20 41 4c 4c 20 2d 20 43 41 53 54 28 20 4e 55 4c   ALL - CAST( NUL
1da20 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
1da30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
1da40 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
1da50 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
1da60 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
1da70 68 69 6e 67 20 74 6f 20 31 36 62 65 38 38 36 38  hing to 16be8868
1da80 61 31 65 36 66 34 65 38 38 35 30 35 30 39 66 39  a1e6f4e8850509f9
1da90 33 32 37 61 66 65 39 30 0d 0a 0d 0a 73 6b 69 70  327afe90....skip
1daa0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1dab0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1dac0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1dad0 2d 38 30 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -800..SELECT ALL
1dae0 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
1daf0 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
1db00 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol2 FROM tab0, t
1db10 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
1db20 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
1db30 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
1db40 6e 67 20 74 6f 20 31 36 62 65 38 38 36 38 61 31  ng to 16be8868a1
1db50 65 36 66 34 65 38 38 35 30 35 30 39 66 39 33 32  e6f4e8850509f932
1db60 37 61 66 65 39 30 0d 0a 0d 0a 71 75 65 72 79 20  7afe90....query 
1db70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1db80 54 20 2d 20 32 30 20 2a 20 2d 20 63 6f 6c 32 20  T - 20 * - col2 
1db90 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  * + col1 AS col1
1dba0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1dbb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 30 30 0d  r0..----..11400.
1dbc0 0a 32 34 39 36 30 0d 0a 32 38 30 38 30 0d 0a 0d  .24960..28080...
1dbd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1dbe0 0d 0a 53 45 4c 45 43 54 20 39 37 20 2a 20 2d 20  ..SELECT 97 * - 
1dbf0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
1dc00 2d 2d 2d 2d 0d 0a 2d 35 32 33 38 0d 0a 2d 35 35  ----..-5238..-55
1dc10 32 39 0d 0a 2d 39 33 31 32 0d 0a 0d 0a 6f 6e 6c  29..-9312....onl
1dc20 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1dc30 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1dc40 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1dc50 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1dc60 72 74 20 6c 61 62 65 6c 2d 38 30 33 0d 0a 53 45  rt label-803..SE
1dc70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1dc80 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20  + cor0.col2 DIV 
1dc90 28 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  ( col2 * - col2 
1dca0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
1dcb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
1dcc0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1dcd0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1dce0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1dcf0 61 62 65 6c 2d 38 30 33 0d 0a 53 45 4c 45 43 54  abel-803..SELECT
1dd00 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
1dd10 72 30 2e 63 6f 6c 32 20 2f 20 28 20 63 6f 6c 32  r0.col2 / ( col2
1dd20 20 2a 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f 4d   * - col2 ) FROM
1dd30 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1dd40 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ---..0....onlyif
1dd50 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1dd60 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1dd70 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1dd80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1dd90 6c 61 62 65 6c 2d 38 30 34 0d 0a 53 45 4c 45 43  label-804..SELEC
1dda0 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 30  T - - col1 + + 0
1ddb0 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c   DIV col0 AS col
1ddc0 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
1ddd0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a  ..----..10..13..
1dde0 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  26....skipif mys
1ddf0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1de00 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1de10 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 34 0d 0a  sort label-804..
1de20 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20  SELECT - - col1 
1de30 2b 20 2b 20 30 20 2f 20 63 6f 6c 30 20 41 53 20  + + 0 / col0 AS 
1de40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
1de50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  or0..----..10..1
1de60 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  3..26....query I
1de70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1de80 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2b 20   ALL + + col2 + 
1de90 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c  ( col0 ) * + col
1dea0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
1deb0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1dec0 2d 0d 0a 32 31 36 0d 0a 33 37 30 35 0d 0a 37 37  -..216..3705..77
1ded0 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  76....onlyif mys
1dee0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
1def0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
1df00 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
1df10 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
1df20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1df30 30 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  06..SELECT DISTI
1df40 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b  NCT - - col0 * +
1df50 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44   CAST( NULL AS D
1df60 45 43 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c 32  ECIMAL ) AS col2
1df70 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1df80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1df90 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1dfa0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1dfb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1dfc0 20 6c 61 62 65 6c 2d 38 30 36 0d 0a 53 45 4c 45   label-806..SELE
1dfd0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
1dfe0 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 20 28 20  col0 * + CAST ( 
1dff0 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 41  NULL AS REAL ) A
1e000 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
1e010 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e020 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
1e030 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e040 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2b 20  col0 * col1 * + 
1e050 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1e060 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36  S cor0..----..36
1e070 34 38 30 0d 0a 34 32 31 32 0d 0a 39 39 38 34 30  480..4212..99840
1e080 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e090 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1e0a0 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  INCT col1 * col2
1e0b0 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   * + col2 + - co
1e0c0 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
1e0d0 2d 2d 0d 0a 31 31 39 37 32 38 0d 0a 33 32 34 32  --..119728..3242
1e0e0 36 0d 0a 37 35 38 31 33 0d 0a 0d 0a 71 75 65 72  6..75813....quer
1e0f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e100 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  ECT - col1 + col
1e110 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  1 * + col0 FROM 
1e120 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 37  tab1..----..1027
1e130 0d 0a 35 32 0d 0a 36 33 30 0d 0a 0d 0a 71 75 65  ..52..630....que
1e140 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e150 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  LECT - col1 * + 
1e160 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col2 + col1 FROM
1e170 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   tab2..----..-14
1e180 37 35 0d 0a 2d 36 32 39 0d 0a 2d 38 30 36 0d 0a  75..-629..-806..
1e190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e1a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1e1b0 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  CT + col1 * col1
1e1c0 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + + col0 AS col
1e1d0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
1e1e0 2d 0d 0a 31 36 34 0d 0a 32 34 39 0d 0a 36 37 39  -..164..249..679
1e1f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e200 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1e210 49 4e 43 54 20 74 61 62 32 2e 63 6f 6c 30 20 2a  INCT tab2.col0 *
1e220 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   + col1 * + col2
1e230 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20   + tab2.col1 AS 
1e240 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
1e250 2d 2d 2d 2d 0d 0a 31 31 39 37 31 31 0d 0a 35 31  ----..119711..51
1e260 30 35 31 0d 0a 35 38 39 30 0d 0a 0d 0a 71 75 65  051..5890....que
1e270 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
1e280 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
1e290 62 31 20 57 48 45 52 45 20 2d 20 63 6f 6c 32 20  b1 WHERE - col2 
1e2a0 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44  BETWEEN NULL AND
1e2b0 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d   ( NULL )..----.
1e2c0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1e2d0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1e2e0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1e2f0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1e300 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1e310 31 34 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e  14..SELECT tab1.
1e320 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20 2b 20  col0 DIV col2 + 
1e330 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab1.col1 FROM t
1e340 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31  ab1..----..11..1
1e350 33 0d 0a 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..26....skipif 
1e360 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1e370 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1e380 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31  rowsort label-81
1e390 34 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63  4..SELECT tab1.c
1e3a0 6f 6c 30 20 2f 20 63 6f 6c 32 20 2b 20 74 61 62  ol0 / col2 + tab
1e3b0 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  1.col1 FROM tab1
1e3c0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 33 0d 0a  ..----..11..13..
1e3d0 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  26....query I ro
1e3e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1e3f0 4c 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  L col2 FROM tab2
1e400 20 57 48 45 52 45 20 4e 4f 54 20 2d 20 63 6f 6c   WHERE NOT - col
1e410 32 20 42 45 54 57 45 45 4e 20 28 20 4e 55 4c 4c  2 BETWEEN ( NULL
1e420 20 29 20 41 4e 44 20 63 6f 6c 31 0d 0a 2d 2d 2d   ) AND col1..---
1e430 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
1e440 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1e450 20 2b 20 28 20 33 33 20 29 20 41 53 20 63 6f 6c   + ( 33 ) AS col
1e460 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
1e470 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1e480 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
1e490 67 20 74 6f 20 36 32 30 64 33 38 34 32 38 36 65  g to 620d384286e
1e4a0 38 32 64 31 63 36 63 38 62 31 62 32 62 31 30 39  82d1c6c8b1b2b109
1e4b0 61 37 64 61 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  a7da5....onlyif 
1e4c0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1e4d0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1e4e0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1e4f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1e500 61 62 65 6c 2d 38 31 37 0d 0a 53 45 4c 45 43 54  abel-817..SELECT
1e510 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 36 34   DISTINCT - + 64
1e520 20 44 49 56 20 2d 20 63 6f 6c 32 20 2b 20 2d 20   DIV - col2 + - 
1e530 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20  ( cor0.col1 ) + 
1e540 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
1e550 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1e560 0a 31 0d 0a 36 34 0d 0a 0d 0a 73 6b 69 70 69 66  .1..64....skipif
1e570 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1e580 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1e590 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1e5a0 31 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  17..SELECT DISTI
1e5b0 4e 43 54 20 2d 20 2b 20 36 34 20 2f 20 2d 20 63  NCT - + 64 / - c
1e5c0 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 72 30 2e 63  ol2 + - ( cor0.c
1e5d0 6f 6c 31 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f  ol1 ) + col1 FRO
1e5e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1e5f0 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 36 34 0d 0a  ----..0..1..64..
1e600 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e610 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 35 37  t..SELECT + - 57
1e620 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   * + col0 * - co
1e630 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  l1 + cor0.col1 +
1e640 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
1e650 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
1e660 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 35 30  cor0..----..3650
1e670 30 0d 0a 34 34 39 38 0d 0a 35 39 33 30 36 0d 0a  0..4498..59306..
1e680 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e690 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1e6a0 32 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  20 + col1 AS col
1e6b0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1e6c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 0d 0a 33  or0..----..30..3
1e6d0 33 0d 0a 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49  3..46....query I
1e6e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e6f0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
1e700 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 55  OM tab0 WHERE NU
1e710 4c 4c 20 3c 3e 20 28 20 4e 55 4c 4c 20 29 0d 0a  LL <> ( NULL )..
1e720 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49  ----....query II
1e730 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e740 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57 48  T * FROM tab0 WH
1e750 45 52 45 20 4e 4f 54 20 2b 20 63 6f 6c 30 20 2b  ERE NOT + col0 +
1e760 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30   + col0 * + col0
1e770 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 4e   + + tab0.col0 N
1e780 4f 54 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20  OT BETWEEN NULL 
1e790 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a  AND NULL..----..
1e7a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e7b0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
1e7c0 20 2d 20 63 6f 6c 32 20 2a 20 74 61 62 30 2e 63   - col2 * tab0.c
1e7d0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
1e7e0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   tab0..----..-12
1e7f0 32 35 0d 0a 2d 31 39 30 30 38 0d 0a 2d 36 34 39  25..-19008..-649
1e800 35 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  522....query I r
1e810 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1e820 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20 2d 20 74   tab0.col0 + - t
1e830 61 62 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  ab0.col2 + col1 
1e840 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1e850 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 30 0d 0a 32 39  0..----..-80..29
1e860 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..61....query I 
1e870 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e880 2d 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72  - - col2 + + cor
1e890 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20  0.col1 + + col0 
1e8a0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1e8b0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a 31 34  0..----..133..14
1e8c0 33 0d 0a 32 36 32 0d 0a 0d 0a 71 75 65 72 79 20  3..262....query 
1e8d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e8e0 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2a  T ALL - + col1 *
1e8f0 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41   + col2 + col0 A
1e900 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1e910 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e920 2d 32 38 31 34 0d 0a 2d 36 32 0d 0a 2d 37 33 37  -2814..-62..-737
1e930 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
1e940 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1e950 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b  TINCT - + col1 +
1e960 20 37 36 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f   76 * col1 AS co
1e970 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
1e980 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 34 35 30  cor0..----..6450
1e990 0d 0a 36 38 32 35 0d 0a 37 32 37 35 0d 0a 0d 0a  ..6825..7275....
1e9a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
1e9b0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
1e9c0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
1e9d0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
1e9e0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
1e9f0 72 74 20 6c 61 62 65 6c 2d 38 32 37 0d 0a 53 45  rt label-827..SE
1ea00 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20  LECT + - col1 + 
1ea10 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
1ea20 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46  GNED ) AS col0 F
1ea30 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1ea40 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1ea50 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
1ea60 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1ea70 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1ea80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1ea90 2d 38 32 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  -827..SELECT + -
1eaa0 20 63 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 4e   col1 + CAST ( N
1eab0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
1eac0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1ead0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1eae0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
1eaf0 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
1eb00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1eb10 63 6f 6c 32 20 2b 20 32 35 20 2a 20 2d 20 63 6f  col2 + 25 * - co
1eb20 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
1eb30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 38  cor0..----..-218
1eb40 33 0d 0a 2d 32 33 35 37 0d 0a 2d 32 34 32 36 0d  3..-2357..-2426.
1eb50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1eb60 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1eb70 4e 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20  NCT tab1.col2 * 
1eb80 2b 20 31 34 20 46 52 4f 4d 20 74 61 62 31 2c 20  + 14 FROM tab1, 
1eb90 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1eba0 2d 2d 0d 0a 31 33 34 34 0d 0a 37 35 36 0d 0a 37  --..1344..756..7
1ebb0 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
1ebc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1ebd0 31 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  14 AS col1 FROM 
1ebe0 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61 62 30  tab1, tab0, tab0
1ebf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
1ec00 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1ec10 6f 20 63 32 62 66 30 65 32 34 32 30 64 32 32 63  o c2bf0e2420d22c
1ec20 64 35 38 64 37 65 65 33 62 33 30 38 32 37 61 66  d58d7ee3b30827af
1ec30 63 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  cc....query I ro
1ec40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1ec50 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 2d 20  col2 * col2 * - 
1ec60 34 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  40 AS col0 FROM 
1ec70 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 38  tab0..----..-268
1ec80 39 36 30 0d 0a 2d 34 30 0d 0a 2d 34 33 35 36 30  960..-40..-43560
1ec90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1eca0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 33 20 46  ort..SELECT 33 F
1ecb0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1ecc0 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
1ecd0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
1ece0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
1ecf0 20 74 6f 20 36 32 30 64 33 38 34 32 38 36 65 38   to 620d384286e8
1ed00 32 64 31 63 36 63 38 62 31 62 32 62 31 30 39 61  2d1c6c8b1b2b109a
1ed10 37 64 61 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7da5....query I 
1ed20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ed30 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  - + cor0.col2 * 
1ed40 32 34 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  24 + - col0 * co
1ed50 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
1ed60 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  2 cor0..----..-6
1ed70 37 30 38 0d 0a 2d 36 39 37 0d 0a 2d 37 31 35 33  708..-697..-7153
1ed80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ed90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 31  ort..SELECT cor1
1eda0 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
1edb0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  OM tab2 AS cor0 
1edc0 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c  CROSS JOIN tab1,
1edd0 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
1ede0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
1edf0 61 73 68 69 6e 67 20 74 6f 20 34 30 66 64 38 63  ashing to 40fd8c
1ee00 63 30 64 65 39 32 65 61 36 38 64 37 33 36 33 34  c0de92ea68d73634
1ee10 63 32 64 38 66 37 35 62 66 35 0d 0a 0d 0a 71 75  c2d8f75bf5....qu
1ee20 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
1ee30 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
1ee40 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74  ECT ALL * FROM t
1ee50 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab1 AS cor0 CROS
1ee60 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61 62  S JOIN tab0, tab
1ee70 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31 2c  2 AS cor1, tab1,
1ee80 20 74 61 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d   tab1 AS cor2..-
1ee90 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73  ---..3645 values
1eea0 20 68 61 73 68 69 6e 67 20 74 6f 20 31 36 30 36   hashing to 1606
1eeb0 34 39 62 34 32 38 62 38 64 32 35 34 35 31 37 63  49b428b8d254517c
1eec0 64 32 30 39 36 65 30 35 34 64 32 31 0d 0a 0d 0a  d2096e054d21....
1eed0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1eee0 0a 53 45 4c 45 43 54 20 36 39 20 2a 20 38 36 20  .SELECT 69 * 86 
1eef0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1ef00 0a 35 39 33 34 0d 0a 35 39 33 34 0d 0a 35 39 33  .5934..5934..593
1ef10 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1ef20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 31 20  sort..SELECT 81 
1ef30 2b 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 32 20  + col2 + ( col2 
1ef40 29 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  ) * col0 * col2 
1ef50 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1ef60 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1ef70 0a 31 31 34 31 39 35 0d 0a 35 32 31 31 0d 0a 35  .114195..5211..5
1ef80 32 38 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2835....query I 
1ef90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1efa0 41 4c 4c 20 63 6f 6c 30 20 2a 20 74 61 62 32 2e  ALL col0 * tab2.
1efb0 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20 63  col0 + col2 AS c
1efc0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
1efd0 2d 2d 2d 0d 0a 36 31 31 30 0d 0a 36 32 37 39 0d  ---..6110..6279.
1efe0 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .76....query I r
1eff0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1f000 4c 4c 20 2b 20 31 32 20 2a 20 63 6f 6c 30 20 41  LL + 12 * col0 A
1f010 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
1f020 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f030 38 34 0d 0a 39 33 36 0d 0a 39 34 38 0d 0a 0d 0a  84..936..948....
1f040 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f050 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
1f060 63 6f 6c 30 20 2b 20 2d 20 35 39 20 41 53 20 63  col0 + - 59 AS c
1f070 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
1f080 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
1f090 33 0d 0a 2d 31 33 39 0d 0a 2d 36 32 0d 0a 0d 0a  3..-139..-62....
1f0a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f0b0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
1f0c0 20 63 6f 6c 31 20 2a 20 39 36 20 2b 20 63 6f 6c   col1 * 96 + col
1f0d0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
1f0e0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1f0f0 2d 0d 0a 31 30 38 38 0d 0a 31 34 30 38 0d 0a 32  -..1088..1408..2
1f100 35 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  502....skipif po
1f110 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1f120 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1f130 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1f140 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1f150 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f160 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 35 20  .SELECT + ( - 5 
1f170 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  ) col1 FROM tab2
1f180 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab1 cor0..---
1f190 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
1f1a0 69 6e 67 20 74 6f 20 37 34 36 36 35 66 62 62 34  ing to 74665fbb4
1f1b0 37 64 35 62 31 37 64 61 30 31 31 62 63 61 35 36  7d5b17da011bca56
1f1c0 37 31 39 35 62 32 31 0d 0a 0d 0a 73 6b 69 70 69  7195b21....skipi
1f1d0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1f1e0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1f1f0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1f200 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1f210 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1f220 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
1f230 30 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 28 20 2d  0 + + col0 * ( -
1f240 20 31 39 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20   19 ) col1 FROM 
1f250 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1f260 2d 2d 0d 0a 2d 31 36 39 31 0d 0a 2d 34 35 36 0d  --..-1691..-456.
1f270 0a 2d 36 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .-665....query I
1f280 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1f290 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 63   col0 * col2 * c
1f2a0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
1f2b0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   tab2..----..119
1f2c0 36 35 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35 39  652..51034..5859
1f2d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1f2e0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1f2f0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1f300 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1f310 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1f320 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1f330 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1f340 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  col0 + col0 * co
1f350 6c 31 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30  l1 - col2 * col0
1f360 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
1f370 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 30 0d 0a 32 36  .----..-1580..26
1f380 35 32 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20  52..35....query 
1f390 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f3a0 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T - col2 * + col
1f3b0 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
1f3c0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1f3d0 0d 0a 2d 32 34 34 30 36 38 0d 0a 2d 36 37 39 30  ..-244068..-6790
1f3e0 34 32 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 73 6b 69  42..-9409....ski
1f3f0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1f400 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1f410 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1f420 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1f430 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
1f440 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1f450 4c 20 2b 20 28 20 63 6f 6c 32 20 29 20 2d 20 63  L + ( col2 ) - c
1f460 6f 6c 30 20 2a 20 63 6f 6c 31 20 63 6f 6c 30 20  ol0 * col1 col0 
1f470 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1f480 0a 2d 32 30 33 31 0d 0a 2d 33 33 39 34 0d 0a 2d  .-2031..-3394..-
1f490 38 30 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8017....query I 
1f4a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f4b0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
1f4c0 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  * + col0 * + col
1f4d0 32 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  2 + + col2 FROM 
1f4e0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1f4f0 2d 2d 0d 0a 31 31 39 36 37 38 0d 0a 35 31 30 37  --..119678..5107
1f500 32 0d 0a 35 38 38 36 0d 0a 0d 0a 71 75 65 72 79  2..5886....query
1f510 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f520 43 54 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 63 6f  CT - col2 - - co
1f530 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  l2 * col2 * - co
1f540 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
1f550 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37  cor0..----..-207
1f560 39 39 33 0d 0a 2d 37 33 37 33 37 36 0d 0a 2d 38  993..-737376..-8
1f570 38 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  802....query I r
1f580 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1f590 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63   + col1 + cor0.c
1f5a0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63  ol2 + - col1 * c
1f5b0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
1f5c0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
1f5d0 31 35 36 37 0d 0a 2d 36 32 35 0d 0a 2d 38 34 31  1567..-625..-841
1f5e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f5f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1f600 49 4e 43 54 20 63 6f 6c 32 20 2a 20 63 6f 72 30  INCT col2 * cor0
1f610 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c  .col1 * cor0.col
1f620 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 + col2 FROM ta
1f630 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1f640 0d 0a 31 36 33 32 30 0d 0a 33 36 35 35 38 0d 0a  ..16320..36558..
1f650 35 37 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5757....query I 
1f660 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f670 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 39 38 20  DISTINCT - - 98 
1f680 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  + + cor0.col0 AS
1f690 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1f6a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1f6b0 32 32 0d 0a 31 33 33 0d 0a 31 38 37 0d 0a 0d 0a  22..133..187....
1f6c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f6d0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
1f6e0 20 2a 20 32 35 20 46 52 4f 4d 20 74 61 62 30 20   * 25 FROM tab0 
1f6f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1f700 31 35 30 0d 0a 32 32 37 35 0d 0a 32 34 32 35 0d  150..2275..2425.
1f710 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1f720 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1f730 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1f740 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1f750 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1f760 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f770 45 43 54 20 2d 20 32 31 20 2a 20 2b 20 63 6f 6c  ECT - 21 * + col
1f780 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  1 col1 FROM tab1
1f790 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f7a0 2d 32 31 30 0d 0a 2d 32 37 33 0d 0a 2d 35 34 36  -210..-273..-546
1f7b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f7c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1f7d0 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  INCT - col1 + co
1f7e0 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l2 * - col0 AS c
1f7f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1f800 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
1f810 38 0d 0a 2d 33 36 35 38 0d 0a 2d 37 36 39 33 0d  8..-3658..-7693.
1f820 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f830 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37  rt..SELECT ALL 7
1f840 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + - col0 FROM t
1f850 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1f860 2d 0d 0a 2d 35 37 0d 0a 2d 37 33 0d 0a 34 0d 0a  -..-57..-73..4..
1f870 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1f880 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1f890 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f8a0 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20  ..SELECT + CAST 
1f8b0 28 20 63 6f 6c 30 20 41 53 20 52 45 41 4c 20 29  ( col0 AS REAL )
1f8c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1f8d0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35  b0..----..24..35
1f8e0 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..89....query I 
1f8f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f900 2b 20 35 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52  + 51 * - col1 FR
1f910 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1f920 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 31 0d 0a 2d 33  .----..-1581..-3
1f930 30 30 39 0d 0a 2d 38 36 37 0d 0a 0d 0a 71 75 65  009..-867....que
1f940 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1f950 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1f960 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  l2 * - col0 + co
1f970 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31  r0.col2 * - col1
1f980 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1f990 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a  r0..----..-132..
1f9a0 2d 31 34 37 36 30 0d 0a 2d 33 36 33 30 0d 0a 0d  -14760..-3630...
1f9b0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1f9c0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1f9d0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1f9e0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1f9f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 30  owsort label-860
1fa00 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1fa10 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  T col2 + + col0 
1fa20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  DIV cor0.col1 FR
1fa30 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1fa40 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 35 34 0d 0a  .----..102..54..
1fa50 36 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  63....skipif mys
1fa60 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1fa70 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1fa80 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 30 0d 0a  sort label-860..
1fa90 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1faa0 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2f 20  col2 + + col0 / 
1fab0 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
1fac0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1fad0 2d 0d 0a 31 30 32 0d 0a 35 34 0d 0a 36 33 0d 0a  -..102..54..63..
1fae0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1faf0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1fb00 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20  + col2 + - col2 
1fb10 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
1fb20 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1fb30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 35 0d 0a 2d  ..----..-2805..-
1fb40 37 33 38 30 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65  7380..-96....que
1fb50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1fb60 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20 63  LECT ALL + ( - c
1fb70 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 31 20 46  ol2 ) + - col1 F
1fb80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1fb90 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d 31  ..----..-119..-1
1fba0 37 33 0d 0a 2d 39 38 0d 0a 0d 0a 6f 6e 6c 79 69  73..-98....onlyi
1fbb0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1fbc0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1fbd0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1fbe0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1fbf0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1fc00 62 65 6c 2d 38 36 33 0d 0a 53 45 4c 45 43 54 20  bel-863..SELECT 
1fc10 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28  DISTINCT - CAST(
1fc20 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
1fc30 20 29 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d   ) * + col2 FROM
1fc40 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1fc50 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
1fc60 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1fc70 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1fc80 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1fc90 6c 2d 38 36 33 0d 0a 53 45 4c 45 43 54 20 44 49  l-863..SELECT DI
1fca0 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20  STINCT - CAST ( 
1fcb0 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2a  NULL AS REAL ) *
1fcc0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
1fcd0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1fce0 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
1fcf0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fd00 20 41 4c 4c 20 32 20 2a 20 2d 20 28 20 2b 20 63   ALL 2 * - ( + c
1fd10 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol0 ) AS col0 FR
1fd20 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1fd30 2d 2d 0d 0a 2d 31 37 38 0d 0a 2d 34 38 0d 0a 2d  --..-178..-48..-
1fd40 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
1fd50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1fd60 38 39 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  89 * cor0.col0 *
1fd70 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 31 31 20 41   + col0 + + 11 A
1fd80 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
1fd90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1fda0 31 30 39 30 33 36 0d 0a 35 31 32 37 35 0d 0a 37  109036..51275..7
1fdb0 30 34 39 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  04980....onlyif 
1fdc0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1fdd0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1fde0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1fdf0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1fe00 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1fe10 6c 2d 38 36 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-866..SELECT DI
1fe20 53 54 49 4e 43 54 20 43 41 53 54 28 20 2b 20 63  STINCT CAST( + c
1fe30 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol1 AS SIGNED ) 
1fe40 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1fe50 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1fe60 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 73  .17..31..59....s
1fe70 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1fe80 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1fe90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1fea0 62 65 6c 2d 38 36 36 0d 0a 53 45 4c 45 43 54 20  bel-866..SELECT 
1feb0 44 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20  DISTINCT CAST ( 
1fec0 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  + col1 AS INTEGE
1fed0 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  R ) AS col1 FROM
1fee0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1fef0 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d  ---..17..31..59.
1ff00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ff10 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 36  rt..SELECT - + 6
1ff20 37 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  7 + + col2 FROM 
1ff30 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1ff40 2d 2d 0d 0a 2d 33 34 0d 0a 2d 36 36 0d 0a 31 35  --..-34..-66..15
1ff50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ff60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
1ff70 37 33 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  73 + + col0 FROM
1ff80 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1ff90 2d 2d 2d 0d 0a 31 35 31 0d 0a 31 35 32 0d 0a 38  ---..151..152..8
1ffa0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
1ffb0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1ffc0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1ffd0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1ffe0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1fff0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20000 45 4c 45 43 54 20 2d 20 2d 20 28 20 63 6f 6c 31  ELECT - - ( col1
20010 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
20020 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  1 cor0..----..10
20030 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 6f 6e 6c 79  ..13..26....only
20040 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
20050 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
20060 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
20070 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20080 74 20 6c 61 62 65 6c 2d 38 37 30 0d 0a 53 45 4c  t label-870..SEL
20090 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
200a0 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 31   col0 * col0 + 1
200b0 39 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20  9 DIV - col0 AS 
200c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
200d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
200e0 32 32 35 0d 0a 2d 35 37 36 0d 0a 2d 37 39 32 31  225..-576..-7921
200f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
20100 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
20110 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
20120 72 74 20 6c 61 62 65 6c 2d 38 37 30 0d 0a 53 45  rt label-870..SE
20130 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
20140 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  - col0 * col0 + 
20150 31 39 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63  19 / - col0 AS c
20160 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
20170 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
20180 32 35 0d 0a 2d 35 37 36 0d 0a 2d 37 39 32 31 0d  25..-576..-7921.
20190 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
201a0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
201b0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
201c0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
201d0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
201e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
201f0 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 63  ECT - + col1 + c
20200 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52  or0.col1 col2 FR
20210 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
20220 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
20230 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
20240 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
20250 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
20260 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
20270 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
20280 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20290 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31 33  CT DISTINCT - 13
202a0 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f   + col1 col0 FRO
202b0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
202c0 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 31 33 0d  ----..-3..0..13.
202d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
202e0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
202f0 4e 43 54 20 2b 20 2b 20 36 36 20 46 52 4f 4d 20  NCT + + 66 FROM 
20300 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
20310 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .66....query I r
20320 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
20330 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b  ISTINCT - col1 +
20340 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f   col0 + col2 FRO
20350 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
20360 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a 31 36 33 0d 0a  ----..111..163..
20370 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
20380 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
20390 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2b 20 33 37  tab2.col2 + + 37
203a0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
203b0 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b2, tab0 AS cor0
203c0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
203d0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
203e0 68 61 73 68 69 6e 67 20 74 6f 20 37 62 33 62 38  hashing to 7b3b8
203f0 31 66 32 36 32 66 65 32 30 35 37 65 66 36 35 39  1f262fe2057ef659
20400 39 31 37 35 66 31 34 35 64 65 30 0d 0a 0d 0a 71  9175f145de0....q
20410 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20420 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20  SELECT - col1 - 
20430 2d 20 35 35 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 55 AS col1 FRO
20440 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39  M tab1..----..29
20450 0d 0a 34 32 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72  ..42..45....quer
20460 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20470 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT - cor0.col0 
20480 2a 20 2b 20 39 36 20 2b 20 63 6f 6c 31 20 2a 20  * + 96 + col1 * 
20490 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
204a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
204b0 2d 36 32 34 34 0d 0a 2d 37 38 34 39 0d 0a 2d 39  -6244..-7849..-9
204c0 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
204d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
204e0 63 6f 6c 31 20 2a 20 38 33 20 2d 20 2d 20 34 31  col1 * 83 - - 41
204f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
20500 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 32 0d 0a  r0..----..1452..
20510 32 36 31 34 0d 0a 34 39 33 38 0d 0a 0d 0a 73 6b  2614..4938....sk
20520 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
20530 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
20540 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20550 4c 45 43 54 20 63 6f 6c 30 20 2a 20 43 41 53 54  LECT col0 * CAST
20560 20 28 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31   ( col0 * + col1
20570 20 41 53 20 52 45 41 4c 20 29 20 2b 20 2d 20 63   AS REAL ) + - c
20580 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  ol1 * - col1 FRO
20590 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
205a0 2d 2d 2d 2d 0d 0a 31 30 36 33 38 36 0d 0a 32 34  ----..106386..24
205b0 38 30 0d 0a 33 36 32 34 33 37 0d 0a 0d 0a 71 75  80..362437....qu
205c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
205d0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
205e0 6c 31 20 2b 20 2d 20 33 32 20 46 52 4f 4d 20 74  l1 + - 32 FROM t
205f0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
20600 2d 31 39 0d 0a 2d 32 32 0d 0a 2d 36 0d 0a 0d 0a  -19..-22..-6....
20610 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
20620 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
20630 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
20640 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
20650 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
20660 72 74 20 6c 61 62 65 6c 2d 38 38 31 0d 0a 53 45  rt label-881..SE
20670 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
20680 63 6f 6c 30 20 2a 20 43 41 53 54 28 20 36 36 20  col0 * CAST( 66 
20690 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20  AS SIGNED ) * + 
206a0 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
206b0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
206c0 2d 33 32 33 34 0d 0a 2d 34 30 31 35 34 34 0d 0a  -3234..-401544..
206d0 2d 34 31 31 39 30 36 0d 0a 0d 0a 73 6b 69 70 69  -411906....skipi
206e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
206f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
20700 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
20710 38 38 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  881..SELECT DIST
20720 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 43 41  INCT - col0 * CA
20730 53 54 20 28 20 36 36 20 41 53 20 49 4e 54 45 47  ST ( 66 AS INTEG
20740 45 52 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  ER ) * + cor0.co
20750 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
20760 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 33 34 0d 0a  0..----..-3234..
20770 2d 34 30 31 35 34 34 0d 0a 2d 34 31 31 39 30 36  -401544..-411906
20780 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
20790 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
207a0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
207b0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
207c0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
207d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38 32  owsort label-882
207e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
207f0 54 20 2d 20 2d 20 63 6f 6c 30 20 2d 20 43 41 53  T - - col0 - CAS
20800 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
20810 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  D ) FROM tab2 AS
20820 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
20830 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
20840 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
20850 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
20860 6f 72 74 20 6c 61 62 65 6c 2d 38 38 32 0d 0a 53  ort label-882..S
20870 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
20880 20 2d 20 63 6f 6c 30 20 2d 20 43 41 53 54 20 28   - col0 - CAST (
20890 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
208a0 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
208b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
208c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
208d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
208e0 6c 31 20 2a 20 34 33 20 2d 20 28 20 2b 20 63 6f  l1 * 43 - ( + co
208f0 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29  l2 + cor0.col0 )
20900 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
20910 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
20920 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 34 35 35 0d  0..----..-17455.
20930 0a 2d 34 31 39 36 0d 0a 2d 37 33 32 37 0d 0a 0d  .-4196..-7327...
20940 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
20950 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
20960 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
20970 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
20980 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
20990 6f 72 74 20 6c 61 62 65 6c 2d 38 38 34 0d 0a 53  ort label-884..S
209a0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
209b0 20 2b 20 2b 20 43 41 53 54 28 20 63 6f 6c 32 20   + + CAST( col2 
209c0 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20  AS SIGNED ) * - 
209d0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
209e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
209f0 2d 2d 2d 2d 0d 0a 2d 31 34 30 36 0d 0a 2d 36 35  ----..-1406..-65
20a00 30 0d 0a 2d 37 30 32 0d 0a 0d 0a 73 6b 69 70 69  0..-702....skipi
20a10 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
20a20 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
20a30 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
20a40 38 38 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  884..SELECT ALL 
20a50 2b 20 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54 20  + col2 + + CAST 
20a60 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45  ( col2 AS INTEGE
20a70 52 20 29 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20  R ) * - col2 AS 
20a80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
20a90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
20aa0 34 30 36 0d 0a 2d 36 35 30 0d 0a 2d 37 30 32 0d  406..-650..-702.
20ab0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20ac0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
20ad0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a   + col0 * col2 *
20ae0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
20af0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
20b00 32 33 33 34 37 32 0d 0a 2d 34 38 36 0d 0a 2d 36  233472..-486..-6
20b10 31 34 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  14400....query I
20b20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20b30 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30   DISTINCT + cor0
20b40 2e 63 6f 6c 30 20 2a 20 2d 20 34 34 20 46 52 4f  .col0 * - 44 FRO
20b50 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
20b60 2d 2d 2d 2d 0d 0a 2d 31 30 35 36 0d 0a 2d 31 35  ----..-1056..-15
20b70 34 30 0d 0a 2d 33 39 31 36 0d 0a 0d 0a 71 75 65  40..-3916....que
20b80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20b90 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
20ba0 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col0 * - cor0.co
20bb0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
20bc0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
20bd0 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34  --..1343..217..4
20be0 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  602....query III
20bf0 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72  IIIIIIIII rowsor
20c00 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
20c10 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20  CT * FROM tab2, 
20c20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30 2c  tab0, tab1 cor0,
20c30 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
20c40 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20  ---..972 values 
20c50 68 61 73 68 69 6e 67 20 74 6f 20 35 65 36 35 35  hashing to 5e655
20c60 62 31 32 38 37 37 37 31 38 36 38 61 38 66 38 36  b1287771868a8f86
20c70 38 35 37 34 61 39 34 64 37 34 39 0d 0a 0d 0a 71  8574a94d749....q
20c80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20c90 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
20ca0 38 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  8 - + col2 AS co
20cb0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
20cc0 2d 2d 0d 0a 2d 31 38 0d 0a 2d 31 39 0d 0a 2d 33  --..-18..-19..-3
20cd0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
20ce0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
20cf0 20 2b 20 38 30 20 2d 20 2b 20 63 6f 6c 31 20 2a   + 80 - + col1 *
20d00 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
20d10 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 31 0d 0a 33  2..----..1041..3
20d20 35 36 31 0d 0a 33 36 39 0d 0a 0d 0a 6f 6e 6c 79  561..369....only
20d30 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
20d40 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
20d50 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
20d60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20d70 74 20 6c 61 62 65 6c 2d 38 39 31 0d 0a 53 45 4c  t label-891..SEL
20d80 45 43 54 20 2d 20 34 39 20 44 49 56 20 63 6f 6c  ECT - 49 DIV col
20d90 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
20da0 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a  -..-1..-2..0....
20db0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
20dc0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
20dd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
20de0 61 62 65 6c 2d 38 39 31 0d 0a 53 45 4c 45 43 54  abel-891..SELECT
20df0 20 2d 20 34 39 20 2f 20 63 6f 6c 31 20 46 52 4f   - 49 / col1 FRO
20e00 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
20e10 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..-2..0....onlyi
20e20 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
20e30 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
20e40 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
20e50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20e60 20 6c 61 62 65 6c 2d 38 39 32 0d 0a 53 45 4c 45   label-892..SELE
20e70 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 28 20  CT + col0 DIV ( 
20e80 2d 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 32 20  - col0 ) + col2 
20e90 2b 20 2b 20 38 32 20 46 52 4f 4d 20 74 61 62 32  + + 82 FROM tab2
20ea0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20eb0 31 30 37 0d 0a 31 30 38 0d 0a 31 31 39 0d 0a 0d  107..108..119...
20ec0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
20ed0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
20ee0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
20ef0 6c 61 62 65 6c 2d 38 39 32 0d 0a 53 45 4c 45 43  label-892..SELEC
20f00 54 20 2b 20 63 6f 6c 30 20 2f 20 28 20 2d 20 63  T + col0 / ( - c
20f10 6f 6c 30 20 29 20 2b 20 63 6f 6c 32 20 2b 20 2b  ol0 ) + col2 + +
20f20 20 38 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53   82 FROM tab2 AS
20f30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37   cor0..----..107
20f40 0d 0a 31 30 38 0d 0a 31 31 39 0d 0a 0d 0a 71 75  ..108..119....qu
20f50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20f60 45 4c 45 43 54 20 34 30 20 46 52 4f 4d 20 74 61  ELECT 40 FROM ta
20f70 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
20f80 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  , tab0 AS cor1..
20f90 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
20fa0 68 61 73 68 69 6e 67 20 74 6f 20 65 34 64 31 30  hashing to e4d10
20fb0 66 37 64 36 63 33 34 61 32 38 31 66 35 32 34 65  f7d6c34a281f524e
20fc0 34 35 65 38 32 65 62 64 32 61 30 0d 0a 0d 0a 6f  45e82ebd2a0....o
20fd0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
20fe0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
20ff0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
21000 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
21010 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 34 0d 0a  sort label-894..
21020 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
21030 30 20 2a 20 39 35 20 2b 20 63 6f 6c 31 20 44 49  0 * 95 + col1 DI
21040 56 20 2d 20 63 6f 6c 31 20 2b 20 37 38 20 41 53  V - col1 + 78 AS
21050 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
21060 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
21070 36 32 0d 0a 36 31 35 37 0d 0a 37 36 37 37 0d 0a  62..6157..7677..
21080 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
21090 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
210a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
210b0 20 6c 61 62 65 6c 2d 38 39 34 0d 0a 53 45 4c 45   label-894..SELE
210c0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20  CT ALL + col0 * 
210d0 39 35 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 63 6f  95 + col1 / - co
210e0 6c 31 20 2b 20 37 38 20 41 53 20 63 6f 6c 30 20  l1 + 78 AS col0 
210f0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
21100 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 32 0d 0a 36 31  0..----..362..61
21110 35 37 0d 0a 37 36 37 37 0d 0a 0d 0a 71 75 65 72  57..7677....quer
21120 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21130 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2d  ECT ALL - col2 -
21140 20 2d 20 31 39 20 2a 20 63 6f 6c 30 20 2a 20 63   - 19 * col0 * c
21150 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
21160 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
21170 0d 0a 31 35 33 37 39 39 0d 0a 33 39 31 38 33 0d  ..153799..39183.
21180 0a 36 34 35 30 34 0d 0a 0d 0a 71 75 65 72 79 20  .64504....query 
21190 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
211a0 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2d 20 31  T ALL col0 + - 1
211b0 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  2 * col0 FROM ta
211c0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 34 0d 0a  b0..----..-264..
211d0 2d 33 38 35 0d 0a 2d 39 37 39 0d 0a 0d 0a 71 75  -385..-979....qu
211e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
211f0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 28  ELECT + col2 * (
21200 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20   col1 ) AS col0 
21210 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
21220 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d  .1534..646..837.
21230 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
21240 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
21250 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
21260 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
21270 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
21280 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 38 0d  wsort label-898.
21290 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
212a0 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
212b0 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
212c0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
212d0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
212e0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
212f0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
21300 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
21310 62 65 6c 2d 38 39 38 0d 0a 53 45 4c 45 43 54 20  bel-898..SELECT 
21320 2d 20 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54 20  - col0 + + CAST 
21330 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
21340 52 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  R ) FROM tab1..-
21350 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
21360 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .NULL....onlyif 
21370 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
21380 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
21390 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
213a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
213b0 61 62 65 6c 2d 38 39 39 0d 0a 53 45 4c 45 43 54  abel-899..SELECT
213c0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b   col0 * - col1 +
213d0 20 30 20 2a 20 63 6f 6c 30 20 44 49 56 20 74 61   0 * col0 DIV ta
213e0 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b1.col1 FROM tab
213f0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a  1..----..-1040..
21400 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 73 6b 69  -640..-78....ski
21410 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
21420 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
21430 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
21440 6c 2d 38 39 39 0d 0a 53 45 4c 45 43 54 20 63 6f  l-899..SELECT co
21450 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 30 20  l0 * - col1 + 0 
21460 2a 20 63 6f 6c 30 20 2f 20 74 61 62 31 2e 63 6f  * col0 / tab1.co
21470 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
21480 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d  --..-1040..-640.
21490 0a 2d 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-78....onlyif m
214a0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
214b0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
214c0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
214d0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
214e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
214f0 2d 39 30 30 0d 0a 53 45 4c 45 43 54 20 2d 20 74  -900..SELECT - t
21500 61 62 30 2e 63 6f 6c 32 20 2b 20 2b 20 43 41 53  ab0.col2 + + CAS
21510 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
21520 44 20 29 20 2b 20 2d 20 32 31 20 46 52 4f 4d 20  D ) + - 21 FROM 
21530 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab0..----..NULL
21540 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
21550 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
21560 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
21570 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
21580 61 62 65 6c 2d 39 30 30 0d 0a 53 45 4c 45 43 54  abel-900..SELECT
21590 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2b   - tab0.col2 + +
215a0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
215b0 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 32 31  INTEGER ) + - 21
215c0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
215d0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
215e0 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
215f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
21600 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 31 39  l1 * - col0 + 19
21610 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
21620 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 30 0d 0a 2d  1..----..-450..-
21630 37 39 33 0d 0a 34 31 36 0d 0a 0d 0a 6f 6e 6c 79  793..416....only
21640 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
21650 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
21660 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
21670 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
21680 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
21690 61 62 65 6c 2d 39 30 32 0d 0a 53 45 4c 45 43 54  abel-902..SELECT
216a0 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 36 38 20   tab0.col1 * 68 
216b0 2a 20 2d 20 32 20 2b 20 2b 20 63 6f 6c 31 20 2a  * - 2 + + col1 *
216c0 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53   CAST( col1 AS S
216d0 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20  IGNED ) AS col1 
216e0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
216f0 0a 2d 33 37 38 33 0d 0a 2d 34 30 39 35 0d 0a 2d  .-3783..-4095..-
21700 34 33 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  4300....skipif m
21710 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
21720 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
21730 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 32  owsort label-902
21740 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f  ..SELECT tab0.co
21750 6c 31 20 2a 20 36 38 20 2a 20 2d 20 32 20 2b 20  l1 * 68 * - 2 + 
21760 2b 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20  + col1 * CAST ( 
21770 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
21780 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
21790 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 38 33  ab0..----..-3783
217a0 0d 0a 2d 34 30 39 35 0d 0a 2d 34 33 30 30 0d 0a  ..-4095..-4300..
217b0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
217c0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
217d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
217e0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
217f0 31 36 20 2b 20 63 6f 6c 31 20 2a 20 43 41 53 54  16 + col1 * CAST
21800 20 28 20 63 6f 6c 31 20 41 53 20 52 45 41 4c 20   ( col1 AS REAL 
21810 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
21820 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 39 38 0d  or0..----..7498.
21830 0a 38 33 38 38 0d 0a 39 35 32 32 0d 0a 0d 0a 71  .8388..9522....q
21840 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21850 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
21860 2b 20 32 33 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  + 23 + col2 FROM
21870 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
21880 2d 2d 2d 0d 0a 32 33 0d 0a 32 33 0d 0a 32 33 0d  ---..23..23..23.
21890 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
218a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
218b0 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63  ol0 * col1 * - c
218c0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
218d0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
218e0 0d 0a 31 33 35 32 30 0d 0a 32 30 32 38 0d 0a 36  ..13520..2028..6
218f0 34 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  400....onlyif my
21900 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
21910 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
21920 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
21930 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
21940 65 6c 2d 39 30 36 0d 0a 53 45 4c 45 43 54 20 2d  el-906..SELECT -
21950 20 63 6f 6c 30 20 44 49 56 20 2b 20 74 61 62 31   col0 DIV + tab1
21960 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
21970 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
21980 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69  1..-1..-1....ski
21990 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
219a0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
219b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
219c0 6c 2d 39 30 36 0d 0a 53 45 4c 45 43 54 20 2d 20  l-906..SELECT - 
219d0 63 6f 6c 30 20 2f 20 2b 20 74 61 62 31 2e 63 6f  col0 / + tab1.co
219e0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
219f0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  tab1..----..-1..
21a00 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20  -1..-1....query 
21a10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21a20 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
21a30 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 74 61 62  + + col2 + + tab
21a40 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  1.col2 AS col1 F
21a50 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
21a60 31 36 32 0d 0a 31 37 31 0d 0a 32 38 38 0d 0a 0d  162..171..288...
21a70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21a80 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
21a90 54 20 2b 20 31 20 41 53 20 63 6f 6c 31 20 46 52  T + 1 AS col1 FR
21aa0 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  OM tab2, tab0 AS
21ab0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
21ac0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21ad0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
21ae0 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2a  CT - tab0.col1 *
21af0 20 2b 20 63 6f 6c 30 20 2b 20 34 35 20 41 53 20   + col0 + 45 AS 
21b00 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
21b10 2d 2d 2d 2d 0d 0a 2d 32 30 31 39 0d 0a 2d 33 33  ----..-2019..-33
21b20 35 30 0d 0a 2d 38 30 35 34 0d 0a 0d 0a 71 75 65  50..-8054....que
21b30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21b40 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  LECT + col0 + co
21b50 6c 31 20 2a 20 28 20 63 6f 6c 32 20 29 20 46 52  l1 * ( col2 ) FR
21b60 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
21b70 36 31 32 0d 0a 37 32 35 0d 0a 38 34 34 0d 0a 0d  612..725..844...
21b80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21b90 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
21ba0 6f 6c 32 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c  ol2 + + tab2.col
21bb0 32 20 2a 20 74 61 62 32 2e 63 6f 6c 32 20 41 53  2 * tab2.col2 AS
21bc0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
21bd0 0a 2d 2d 2d 2d 0d 0a 31 34 38 32 0d 0a 37 30 32  .----..1482..702
21be0 0d 0a 37 35 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..756....onlyif 
21bf0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
21c00 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
21c10 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
21c20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
21c30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
21c40 6c 2d 39 31 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-912..SELECT AL
21c50 4c 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  L - CAST( NULL A
21c60 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c  S SIGNED ) * col
21c70 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
21c80 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
21c90 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
21ca0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
21cb0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
21cc0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
21cd0 72 74 20 6c 61 62 65 6c 2d 39 31 32 0d 0a 53 45  rt label-912..SE
21ce0 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20  LECT ALL - CAST 
21cf0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
21d00 52 20 29 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  R ) * col1 AS co
21d10 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
21d20 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
21d30 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ULL..NULL....onl
21d40 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
21d50 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
21d60 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
21d70 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
21d80 72 74 20 6c 61 62 65 6c 2d 39 31 33 0d 0a 53 45  rt label-913..SE
21d90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 32 35  LECT DISTINCT 25
21da0 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56   * cor0.col2 DIV
21db0 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c   col2 + cor0.col
21dc0 30 20 2d 20 2b 20 33 30 20 46 52 4f 4d 20 74 61  0 - + 30 FROM ta
21dd0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
21de0 0d 0a 2d 32 0d 0a 35 39 0d 0a 37 35 0d 0a 0d 0a  ..-2..59..75....
21df0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
21e00 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
21e10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
21e20 61 62 65 6c 2d 39 31 33 0d 0a 53 45 4c 45 43 54  abel-913..SELECT
21e30 20 44 49 53 54 49 4e 43 54 20 32 35 20 2a 20 63   DISTINCT 25 * c
21e40 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f 6c 32 20  or0.col2 / col2 
21e50 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2b 20  + cor0.col0 - + 
21e60 33 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  30 FROM tab1 AS 
21e70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  cor0..----..-2..
21e80 35 39 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20  59..75....query 
21e90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21ea0 54 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f 72  T ( col1 ) + cor
21eb0 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  0.col0 + cor0.co
21ec0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
21ed0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 0d  cor0..----..134.
21ee0 0a 31 36 37 0d 0a 32 36 39 0d 0a 0d 0a 6f 6e 6c  .167..269....onl
21ef0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
21f00 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
21f10 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
21f20 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
21f30 72 74 20 6c 61 62 65 6c 2d 39 31 35 0d 0a 53 45  rt label-915..SE
21f40 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 38 32  LECT col0 * + 82
21f50 20 2b 20 63 6f 6c 30 20 44 49 56 20 36 30 20 46   + col0 DIV 60 F
21f60 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
21f70 0d 0a 2d 2d 2d 2d 0d 0a 32 34 36 0d 0a 35 32 34  ..----..246..524
21f80 39 0d 0a 36 35 36 31 0d 0a 0d 0a 73 6b 69 70 69  9..6561....skipi
21f90 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
21fa0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
21fb0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
21fc0 39 31 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  915..SELECT col0
21fd0 20 2a 20 2b 20 38 32 20 2b 20 63 6f 6c 30 20 2f   * + 82 + col0 /
21fe0 20 36 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53   60 FROM tab1 AS
21ff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 36   cor0..----..246
22000 0d 0a 35 32 34 39 0d 0a 36 35 36 31 0d 0a 0d 0a  ..5249..6561....
22010 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
22020 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
22030 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
22040 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
22050 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 36 0d  wsort label-916.
22060 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44  .SELECT - col2 D
22070 49 56 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  IV + col0 + + co
22080 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
22090 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a  cor0..----..85..
220a0 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  91..97....skipif
220b0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
220c0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
220d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
220e0 31 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  16..SELECT - col
220f0 32 20 2f 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  2 / + col0 + + c
22100 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
22110 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d   cor0..----..85.
22120 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79  .91..97....query
22130 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22140 43 54 20 41 4c 4c 20 2d 20 2b 20 34 34 20 2b 20  CT ALL - + 44 + 
22150 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20  - ( cor0.col0 ) 
22160 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
22170 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
22180 0a 2d 31 33 33 0d 0a 2d 36 38 0d 0a 2d 37 39 0d  .-133..-68..-79.
22190 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
221a0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
221b0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
221c0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
221d0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
221e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 38 0d  wsort label-918.
221f0 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20  .SELECT + CAST( 
22200 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20  NULL AS DECIMAL 
22210 29 20 2a 20 2d 20 34 31 20 2b 20 63 6f 6c 30 20  ) * - 41 + col0 
22220 2b 20 2b 20 38 32 20 63 6f 6c 30 20 46 52 4f 4d  + + 82 col0 FROM
22230 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
22240 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
22250 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
22260 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
22270 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
22280 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
22290 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
222a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
222b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
222c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
222d0 20 6c 61 62 65 6c 2d 39 31 38 0d 0a 53 45 4c 45   label-918..SELE
222e0 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT + CAST ( NULL
222f0 20 41 53 20 52 45 41 4c 20 29 20 2a 20 2d 20 34   AS REAL ) * - 4
22300 31 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 38 32 20  1 + col0 + + 82 
22310 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
22320 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
22330 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
22340 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22350 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 38  t..SELECT ALL 38
22360 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
22370 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
22380 0a 31 32 30 0d 0a 33 39 0d 0a 37 31 0d 0a 0d 0a  .120..39..71....
22390 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
223a0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
223b0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
223c0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
223d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 32 30 0d  wsort label-920.
223e0 0a 53 45 4c 45 43 54 20 2d 20 28 20 28 20 63 6f  .SELECT - ( ( co
223f0 6c 30 20 29 20 29 20 2a 20 63 6f 6c 32 20 2b 20  l0 ) ) * col2 + 
22400 2b 20 37 30 20 44 49 56 20 63 6f 6c 32 20 46 52  + 70 DIV col2 FR
22410 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
22420 0a 2d 2d 2d 2d 0d 0a 2d 37 32 39 38 0d 0a 2d 37  .----..-7298..-7
22430 39 30 0d 0a 33 35 0d 0a 0d 0a 73 6b 69 70 69 66  90..35....skipif
22440 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
22450 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
22460 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
22470 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 28  20..SELECT - ( (
22480 20 63 6f 6c 30 20 29 20 29 20 2a 20 63 6f 6c 32   col0 ) ) * col2
22490 20 2b 20 2b 20 37 30 20 2f 20 63 6f 6c 32 20 46   + + 70 / col2 F
224a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
224b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 39 38 0d 0a 2d  ..----..-7298..-
224c0 37 39 30 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79  790..35....query
224d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
224e0 43 54 20 44 49 53 54 49 4e 43 54 20 34 38 20 2d  CT DISTINCT 48 -
224f0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
22500 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
22510 0a 31 30 0d 0a 32 31 0d 0a 32 32 0d 0a 0d 0a 73  .10..21..22....s
22520 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
22530 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
22540 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
22550 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
22560 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
22570 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22580 35 30 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 30  50 + + col0 col0
22590 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
225a0 0d 0a 31 32 38 0d 0a 31 32 39 0d 0a 35 37 0d 0a  ..128..129..57..
225b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
225c0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
225d0 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46   col2 * - col2 F
225e0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
225f0 2d 2d 2d 0d 0a 2d 31 35 37 34 36 34 0d 0a 2d 31  ---..-157464..-1
22600 38 35 31 39 33 0d 0a 2d 38 38 34 37 33 36 0d 0a  85193..-884736..
22610 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22620 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
22630 43 54 20 2d 20 2d 20 28 20 2d 20 63 6f 72 30 2e  CT - - ( - cor0.
22640 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30  col0 ) FROM tab0
22650 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22660 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d  -24..-35..-89...
22670 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22680 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 72  ..SELECT - ( cor
22690 30 2e 63 6f 6c 30 20 29 20 2a 20 34 30 20 41 53  0.col0 ) * 40 AS
226a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
226b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30  cor0..----..-140
226c0 30 0d 0a 2d 33 35 36 30 0d 0a 2d 39 36 30 0d 0a  0..-3560..-960..
226d0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
226e0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
226f0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
22700 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
22710 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
22720 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22730 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20  CT ALL - col1 + 
22740 63 6f 6c 30 20 2a 20 2d 20 32 36 20 2b 20 2b 20  col0 * - 26 + + 
22750 33 38 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  38 col0 FROM tab
22760 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
22770 0a 2d 32 33 36 37 0d 0a 2d 36 37 32 0d 0a 2d 39  .-2367..-672..-9
22780 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  69....query I ro
22790 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
227a0 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2b 20  STINCT col0 * + 
227b0 32 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  21 + col1 FROM t
227c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
227d0 2d 0d 0a 31 39 36 30 0d 0a 35 39 30 0d 0a 38 33  -..1960..590..83
227e0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
227f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
22800 31 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 63  1 * + col1 - - c
22810 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
22820 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31  r0..----..110..1
22830 38 32 0d 0a 37 30 32 0d 0a 0d 0a 71 75 65 72 79  82..702....query
22840 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22850 43 54 20 2d 20 63 6f 6c 30 20 2b 20 31 32 20 2a  CT - col0 + 12 *
22860 20 39 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53   92 FROM tab2 AS
22870 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32   cor0..----..102
22880 35 0d 0a 31 30 32 36 0d 0a 31 30 39 37 0d 0a 0d  5..1026..1097...
22890 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
228a0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
228b0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
228c0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
228d0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
228e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
228f0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
22900 6f 72 30 2e 63 6f 6c 31 20 2a 20 35 34 20 2b 20  or0.col1 * 54 + 
22910 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  + col0 col2 FROM
22920 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
22930 2d 2d 2d 0d 0a 31 34 30 37 0d 0a 36 30 34 0d 0a  ---..1407..604..
22940 37 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  782....skipif po
22950 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
22960 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
22970 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
22980 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
22990 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
229a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
229b0 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   - col2 + - col2
229c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
229d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
229e0 31 30 38 0d 0a 2d 31 31 34 0d 0a 2d 31 39 32 0d  108..-114..-192.
229f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22a00 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
22a10 32 20 2b 20 2b 20 28 20 2b 20 33 36 20 29 20 41  2 + + ( + 36 ) A
22a20 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
22a30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22a40 31 33 32 0d 0a 39 30 0d 0a 39 33 0d 0a 0d 0a 71  132..90..93....q
22a50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22a60 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
22a70 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  * col1 AS col0 F
22a80 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
22a90 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36  ---..-2838..-746
22aa0 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20  2..-97....query 
22ab0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22ac0 54 20 2d 20 33 39 20 2b 20 2b 20 63 6f 6c 32 20  T - 39 + + col2 
22ad0 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  * - col1 AS col2
22ae0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
22af0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 0d 0a  r0..----..-136..
22b00 2d 32 38 37 37 0d 0a 2d 37 35 30 31 0d 0a 0d 0a  -2877..-7501....
22b10 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
22b20 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
22b30 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
22b40 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
22b50 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
22b60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22b70 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 30   ALL col0 * col0
22b80 20 2d 20 28 20 63 6f 6c 31 20 2a 20 63 6f 6c 31   - ( col1 * col1
22b90 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
22ba0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 31 32 0d 0a 32  2..----..-912..2
22bb0 36 30 33 0d 0a 35 39 35 32 0d 0a 0d 0a 71 75 65  603..5952....que
22bc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22bd0 4c 45 43 54 20 32 36 20 2d 20 2d 20 63 6f 6c 31  LECT 26 - - col1
22be0 20 2a 20 37 20 41 53 20 63 6f 6c 31 20 46 52 4f   * 7 AS col1 FRO
22bf0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
22c00 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a 32 30 38 0d 0a  ----..117..208..
22c10 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
22c20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
22c30 33 36 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  36 * col1 AS col
22c40 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
22c50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 30 0d 0a  or0..----..360..
22c60 34 36 38 0d 0a 39 33 36 0d 0a 0d 0a 71 75 65 72  468..936....quer
22c70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22c80 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 36  ECT DISTINCT + 6
22c90 36 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  6 + col1 * - col
22ca0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
22cb0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 32  ab1..----..-1182
22cc0 0d 0a 2d 31 33 33 38 0d 0a 2d 35 30 34 0d 0a 0d  ..-1338..-504...
22cd0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
22ce0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
22cf0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
22d00 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
22d10 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
22d20 6f 72 74 20 6c 61 62 65 6c 2d 39 33 39 0d 0a 53  ort label-939..S
22d30 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
22d40 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
22d50 49 47 4e 45 44 20 29 20 2b 20 36 37 20 2a 20 2d  IGNED ) + 67 * -
22d60 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
22d70 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
22d80 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
22d90 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
22da0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
22db0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33 39 0d  wsort label-939.
22dc0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
22dd0 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
22de0 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 36 37  S INTEGER ) + 67
22df0 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
22e00 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
22e10 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  -..NULL....onlyi
22e20 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
22e30 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
22e40 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
22e50 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
22e60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22e70 62 65 6c 2d 39 34 30 0d 0a 53 45 4c 45 43 54 20  bel-940..SELECT 
22e80 2b 20 31 32 20 2a 20 2d 20 63 6f 6c 31 20 2d 20  + 12 * - col1 - 
22e90 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
22ea0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
22eb0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
22ec0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
22ed0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
22ee0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
22ef0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
22f00 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34 30 0d 0a  sort label-940..
22f10 53 45 4c 45 43 54 20 2b 20 31 32 20 2a 20 2d 20  SELECT + 12 * - 
22f20 63 6f 6c 31 20 2d 20 2b 20 43 41 53 54 20 28 20  col1 - + CAST ( 
22f30 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
22f40 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
22f50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
22f60 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
22f70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22f80 53 45 4c 45 43 54 20 31 37 20 2d 20 63 6f 6c 30  SELECT 17 - col0
22f90 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
22fa0 0a 2d 2d 2d 2d 0d 0a 2d 36 31 0d 0a 2d 36 32 0d  .----..-61..-62.
22fb0 0a 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .10....query I r
22fc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
22fd0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b   + col2 * col0 +
22fe0 20 33 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53   30 FROM tab0 AS
22ff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 35 0d   cor0..----..65.
23000 0a 37 33 32 38 0d 0a 38 32 32 0d 0a 0d 0a 71 75  .7328..822....qu
23010 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23020 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
23030 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 37   col1 + col0 * 7
23040 35 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  5 FROM tab0 cor0
23050 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 36 0d 0a 32 37  ..----..1886..27
23060 32 32 0d 0a 36 37 36 36 0d 0a 0d 0a 71 75 65 72  22..6766....quer
23070 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23080 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT - col2 * col
23090 30 20 2b 20 39 31 20 2a 20 63 6f 6c 30 20 41 53  0 + 91 * col0 AS
230a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
230b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
230c0 31 38 37 0d 0a 34 34 38 0d 0a 35 30 37 30 0d 0a  187..448..5070..
230d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
230e0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28 20  t..SELECT + + ( 
230f0 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 30 20  col1 ) * - col0 
23100 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
23110 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a  0..----..-2064..
23120 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a  -3395..-8099....
23130 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23140 0a 53 45 4c 45 43 54 20 2b 20 36 38 20 2b 20 63  .SELECT + 68 + c
23150 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63  ol1 * + col0 * c
23160 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
23170 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
23180 2d 2d 2d 0d 0a 31 31 39 37 32 30 0d 0a 35 31 31  ---..119720..511
23190 30 32 0d 0a 35 39 32 37 0d 0a 0d 0a 71 75 65 72  02..5927....quer
231a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
231b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 36 20  ECT DISTINCT 96 
231c0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
231d0 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  0, tab2 AS cor0.
231e0 0a 2d 2d 2d 2d 0d 0a 39 36 0d 0a 0d 0a 71 75 65  .----..96....que
231f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23200 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f 72 30  LECT col0 + cor0
23210 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63  .col2 * - cor0.c
23220 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
23230 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
23240 2d 2d 2d 0d 0a 2d 32 38 31 34 0d 0a 2d 36 32 0d  ---..-2814..-62.
23250 0a 2d 37 33 37 33 0d 0a 0d 0a 71 75 65 72 79 20  .-7373....query 
23260 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23270 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 31 2e 63  T ALL + - cor1.c
23280 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
23290 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
232a0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53  OSS JOIN tab1 AS
232b0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
232c0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
232d0 20 34 65 63 33 30 34 62 38 63 65 39 33 35 66 32   4ec304b8ce935f2
232e0 32 32 36 65 37 35 34 38 64 37 32 63 32 62 32 66  226e7548d72c2b2f
232f0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
23300 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
23310 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
23320 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
23330 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
23340 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23350 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
23360 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
23370 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
23380 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
23390 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
233a0 68 61 73 68 69 6e 67 20 74 6f 20 32 64 36 64 33  hashing to 2d6d3
233b0 30 33 31 64 66 65 39 30 65 30 63 30 32 64 62 31  031dfe90e0c02db1
233c0 33 61 61 36 33 39 39 33 62 66 64 0d 0a 0d 0a 6f  3aa63993bfd....o
233d0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
233e0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
233f0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
23400 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
23410 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35 31 0d 0a  sort label-951..
23420 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f  SELECT col1 * co
23430 6c 32 20 44 49 56 20 63 6f 6c 30 20 63 6f 6c 31  l2 DIV col0 col1
23440 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
23450 0d 0a 31 31 39 0d 0a 31 39 0d 0a 38 0d 0a 0d 0a  ..119..19..8....
23460 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
23470 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
23480 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
23490 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
234a0 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
234b0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
234c0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
234d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35  rowsort label-95
234e0 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  1..SELECT col1 *
234f0 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 63 6f 6c   col2 / col0 col
23500 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
23510 2d 0d 0a 31 31 39 0d 0a 31 39 0d 0a 38 0d 0a 0d  -..119..19..8...
23520 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
23530 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
23540 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
23550 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
23560 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
23570 6f 72 74 20 6c 61 62 65 6c 2d 39 35 32 0d 0a 53  ort label-952..S
23580 45 4c 45 43 54 20 41 4c 4c 20 35 36 20 2a 20 2b  ELECT ALL 56 * +
23590 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63   cor0.col2 + - c
235a0 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 4e 55  ol1 * + CAST( NU
235b0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
235c0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
235d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
235e0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
235f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
23600 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
23610 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
23620 72 74 20 6c 61 62 65 6c 2d 39 35 32 0d 0a 53 45  rt label-952..SE
23630 4c 45 43 54 20 41 4c 4c 20 35 36 20 2a 20 2b 20  LECT ALL 56 * + 
23640 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f  cor0.col2 + - co
23650 6c 31 20 2a 20 2b 20 43 41 53 54 20 28 20 4e 55  l1 * + CAST ( NU
23660 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
23670 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
23680 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
23690 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
236a0 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  L....onlyif mysq
236b0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
236c0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
236d0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
236e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
236f0 2d 39 35 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -953..SELECT ALL
23700 20 36 36 20 44 49 56 20 33 38 20 46 52 4f 4d 20   66 DIV 38 FROM 
23710 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  tab1..----..1..1
23720 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
23730 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
23740 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
23750 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35 33 0d  wsort label-953.
23760 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 36 20 2f  .SELECT ALL 66 /
23770 20 33 38 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   38 FROM tab1..-
23780 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a  ---..1..1..1....
23790 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
237a0 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 31  .SELECT + ( col1
237b0 20 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   ) + + col0 FROM
237c0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37   tab2..----..137
237d0 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  ..38..96....quer
237e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
237f0 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  ECT col2 + - col
23800 32 20 2b 20 38 20 41 53 20 63 6f 6c 31 20 46 52  2 + 8 AS col1 FR
23810 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 38  OM tab2..----..8
23820 0d 0a 38 0d 0a 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..8..8....onlyif
23830 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
23840 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
23850 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
23860 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
23870 6c 61 62 65 6c 2d 39 35 36 0d 0a 53 45 4c 45 43  label-956..SELEC
23880 54 20 44 49 53 54 49 4e 43 54 20 34 39 20 2d 20  T DISTINCT 49 - 
23890 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20  + col0 DIV col1 
238a0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
238b0 0a 34 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .49....skipif my
238c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
238d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
238e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35 36 0d  wsort label-956.
238f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
23900 20 34 39 20 2d 20 2b 20 63 6f 6c 30 20 2f 20 63   49 - + col0 / c
23910 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
23920 2d 2d 2d 0d 0a 34 39 0d 0a 0d 0a 73 6b 69 70 69  ---..49....skipi
23930 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
23940 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
23950 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
23960 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
23970 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
23980 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
23990 2d 20 33 36 20 63 6f 6c 30 20 46 52 4f 4d 20 74  - 36 col0 FROM t
239a0 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
239b0 30 2c 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d  0, tab1 cor1..--
239c0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
239d0 73 68 69 6e 67 20 74 6f 20 33 62 63 64 30 37 64  shing to 3bcd07d
239e0 32 32 62 36 32 64 32 30 34 32 62 34 39 39 32 35  22b62d2042b49925
239f0 33 62 31 63 31 33 64 39 65 0d 0a 0d 0a 71 75 65  3b1c13d9e....que
23a00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23a10 4c 45 43 54 20 32 36 20 41 53 20 63 6f 6c 31 20  LECT 26 AS col1 
23a20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
23a30 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
23a40 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
23a50 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
23a60 6f 20 65 64 65 38 32 32 36 62 62 37 65 36 30 32  o ede8226bb7e602
23a70 65 32 32 31 66 39 64 39 38 33 34 35 62 34 64 61  e221f9d98345b4da
23a80 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
23a90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
23aa0 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32  STINCT cor0.col2
23ab0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
23ac0 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
23ad0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  , tab0 AS cor1..
23ae0 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36  ----..54..57..96
23af0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23b00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 20 2a 20  ort..SELECT 8 * 
23b10 35 35 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  55 FROM tab1, ta
23b20 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
23b30 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
23b40 6e 67 20 74 6f 20 35 37 34 30 35 30 34 34 38 62  ng to 574050448b
23b50 66 36 61 31 34 62 37 34 33 36 64 37 65 34 35 36  f6a14b7436d7e456
23b60 39 34 35 38 33 32 0d 0a 0d 0a 71 75 65 72 79 20  945832....query 
23b70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23b80 54 20 37 39 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  T 79 * - col1 + 
23b90 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
23ba0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
23bb0 37 36 31 0d 0a 2d 37 31 30 37 0d 0a 2d 37 36 36  761..-7107..-766
23bc0 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
23bd0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
23be0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
23bf0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
23c00 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
23c10 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36  rowsort label-96
23c20 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  2..SELECT col2 *
23c30 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54 28 20   + col2 * CAST( 
23c40 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
23c50 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
23c60 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b2 cor0..----..N
23c70 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
23c80 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
23c90 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
23ca0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23cb0 74 20 6c 61 62 65 6c 2d 39 36 32 0d 0a 53 45 4c  t label-962..SEL
23cc0 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  ECT col2 * + col
23cd0 32 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  2 * CAST ( NULL 
23ce0 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
23cf0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
23d00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
23d10 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
23d20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23d30 53 45 4c 45 43 54 20 63 6f 6c 31 20 2d 20 2b 20  SELECT col1 - + 
23d40 37 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  73 AS col2 FROM 
23d50 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37 0d  tab1..----..-47.
23d60 0a 2d 36 30 0d 0a 2d 36 33 0d 0a 0d 0a 71 75 65  .-60..-63....que
23d70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23d80 4c 45 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c 32  LECT - cor1.col2
23d90 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
23da0 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b2, tab0 AS cor0
23db0 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d  , tab2 cor1..---
23dc0 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
23dd0 68 69 6e 67 20 74 6f 20 66 39 64 34 62 62 38 36  hing to f9d4bb86
23de0 37 37 64 62 37 62 39 38 63 37 65 64 38 39 64 30  77db7b98c7ed89d0
23df0 36 65 36 65 38 63 64 36 0d 0a 0d 0a 71 75 65 72  6e6e8cd6....quer
23e00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23e10 45 43 54 20 41 4c 4c 20 2d 20 2b 20 31 33 20 2b  ECT ALL - + 13 +
23e20 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
23e30 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
23e40 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 32  0..----..-23..-2
23e50 36 0d 0a 2d 33 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  6..-39....onlyif
23e60 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
23e70 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
23e80 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
23e90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
23ea0 6c 61 62 65 6c 2d 39 36 36 0d 0a 53 45 4c 45 43  label-966..SELEC
23eb0 54 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 72  T col2 DIV - cor
23ec0 30 2e 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d  0.col0 col0 FROM
23ed0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
23ee0 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 38 0d 0a 30 0d  ---..-1..-18..0.
23ef0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
23f00 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
23f10 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
23f20 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
23f30 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
23f40 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
23f50 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
23f60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
23f70 2d 39 36 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -966..SELECT col
23f80 32 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  2 / - cor0.col0 
23f90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
23fa0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
23fb0 0d 0a 2d 31 38 0d 0a 30 0d 0a 0d 0a 71 75 65 72  ..-18..0....quer
23fc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23fd0 45 43 54 20 2b 20 2b 20 28 20 34 31 20 29 20 46  ECT + + ( 41 ) F
23fe0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
23ff0 0d 0a 2d 2d 2d 2d 0d 0a 34 31 0d 0a 34 31 0d 0a  ..----..41..41..
24000 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  41....query I ro
24010 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
24020 33 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  33 AS col1 FROM 
24030 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
24040 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
24050 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36 32  es hashing to 62
24060 30 64 33 38 34 32 38 36 65 38 32 64 31 63 36 63  0d384286e82d1c6c
24070 38 62 31 62 32 62 31 30 39 61 37 64 61 35 0d 0a  8b1b2b109a7da5..
24080 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24090 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 37 20 41  t..SELECT + 77 A
240a0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
240b0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20  , tab0 AS cor0, 
240c0 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
240d0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
240e0 73 68 69 6e 67 20 74 6f 20 64 37 62 30 32 37 62  shing to d7b027b
240f0 63 61 35 64 33 37 63 36 37 65 32 39 30 31 33 39  ca5d37c67e290139
24100 30 34 64 65 66 38 31 32 35 0d 0a 0d 0a 71 75 65  04def8125....que
24110 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24120 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  LECT - col0 * + 
24130 33 36 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  36 FROM tab0..--
24140 2d 2d 0d 0a 2d 31 32 36 30 0d 0a 2d 33 32 30 34  --..-1260..-3204
24150 0d 0a 2d 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20  ..-864....query 
24160 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24170 54 20 41 4c 4c 20 2d 20 2b 20 36 32 20 2b 20 2d  T ALL - + 62 + -
24180 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
24190 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
241a0 31 31 36 0d 0a 2d 31 31 39 0d 0a 2d 31 35 38 0d  116..-119..-158.
241b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
241c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
241d0 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  NCT + cor0.col0 
241e0 2b 20 2d 20 33 34 20 41 53 20 63 6f 6c 32 20 46  + - 34 AS col2 F
241f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
24200 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 34 34 0d  ..----..-27..44.
24210 0a 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .45....query I r
24220 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
24230 4c 4c 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20  LL - ( - col1 ) 
24240 2b 20 63 6f 6c 32 20 2a 20 2d 20 36 20 41 53 20  + col2 * - 6 AS 
24250 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
24260 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
24270 31 32 0d 0a 2d 34 30 31 0d 0a 39 31 0d 0a 0d 0a  12..-401..91....
24280 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24290 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 35 20 2a  .SELECT ALL 25 *
242a0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
242b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
242c0 0a 2d 2d 2d 2d 0d 0a 32 35 30 0d 0a 33 32 35 0d  .----..250..325.
242d0 0a 36 35 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .650....onlyif m
242e0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
242f0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
24300 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
24310 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
24320 62 65 6c 2d 39 37 35 0d 0a 53 45 4c 45 43 54 20  bel-975..SELECT 
24330 2d 20 39 30 20 44 49 56 20 2b 20 63 6f 72 30 2e  - 90 DIV + cor0.
24340 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
24350 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
24360 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
24370 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
24380 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
24390 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
243a0 37 35 0d 0a 53 45 4c 45 43 54 20 2d 20 39 30 20  75..SELECT - 90 
243b0 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  / + cor0.col1 FR
243c0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
243d0 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d  .----..-1..0..0.
243e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
243f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74  rt..SELECT ALL t
24400 61 62 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  ab0.col1 * + col
24410 32 20 2a 20 63 6f 6c 31 20 2b 20 32 32 20 41 53  2 * col1 + 22 AS
24420 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
24430 0a 2d 2d 2d 2d 0d 0a 32 34 34 30 39 30 0d 0a 36  .----..244090..6
24440 37 39 30 36 34 0d 0a 39 34 33 31 0d 0a 0d 0a 73  79064..9431....s
24450 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
24460 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
24470 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
24480 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
24490 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
244a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
244b0 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  + col1 * + col0 
244c0 2d 20 39 36 20 63 6f 6c 30 20 46 52 4f 4d 20 74  - 96 col0 FROM t
244d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
244e0 2d 0d 0a 31 39 36 38 0d 0a 33 32 39 39 0d 0a 38  -..1968..3299..8
244f0 30 30 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  003....skipif po
24500 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
24510 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
24520 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
24530 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
24540 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24550 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
24560 20 34 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   40 col0 FROM ta
24570 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
24580 0d 0a 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..40....query I 
24590 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
245a0 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  + col2 * - col0 
245b0 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20 63  + ( - col2 ) + c
245c0 6f 6c 32 20 2a 20 2d 20 31 30 20 41 53 20 63 6f  ol2 * - 10 AS co
245d0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
245e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 31  cor0..----..-231
245f0 34 0d 0a 2d 33 34 32 30 0d 0a 2d 34 38 36 0d 0a  4..-3420..-486..
24600 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24610 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20  t..SELECT - ( - 
24620 74 61 62 32 2e 63 6f 6c 30 20 29 20 2a 20 63 6f  tab2.col0 ) * co
24630 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
24640 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d 0a 36 32  --..49..6084..62
24650 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  41....query I ro
24660 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
24670 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f  STINCT - cor0.co
24680 6c 31 20 2b 20 2d 20 38 34 20 46 52 4f 4d 20 74  l1 + - 84 FROM t
24690 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
246a0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 30 0d 0a 2d  0..----..-170..-
246b0 31 37 35 0d 0a 2d 31 38 31 0d 0a 0d 0a 6f 6e 6c  175..-181....onl
246c0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
246d0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
246e0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
246f0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
24700 72 74 20 6c 61 62 65 6c 2d 39 38 32 0d 0a 53 45  rt label-982..SE
24710 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
24720 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 44 49  col2 + + col1 DI
24730 56 20 28 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20  V ( tab1.col2 * 
24740 74 61 62 31 2e 63 6f 6c 31 20 29 20 46 52 4f 4d  tab1.col1 ) FROM
24750 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d   tab1..----..54.
24760 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69  .57..96....skipi
24770 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
24780 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
24790 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
247a0 39 38 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  982..SELECT DIST
247b0 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  INCT + col2 + + 
247c0 63 6f 6c 31 20 2f 20 28 20 74 61 62 31 2e 63 6f  col1 / ( tab1.co
247d0 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 29  l2 * tab1.col1 )
247e0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
247f0 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a  ..54..57..96....
24800 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24810 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
24820 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 33 32 20 46   + + col1 + 32 F
24830 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
24840 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 31 32 33  ..----..118..123
24850 0d 0a 31 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..129....query I
24860 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24870 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 37 36 20   cor0.col1 + 76 
24880 2a 20 2d 20 35 35 20 2b 20 2b 20 63 6f 72 30 2e  * - 55 + + cor0.
24890 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
248a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
248b0 30 39 35 0d 0a 2d 34 31 32 32 0d 0a 2d 34 31 32  095..-4122..-412
248c0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
248d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
248e0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d  ol2 * + col2 + -
248f0 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29   ( - cor0.col2 )
24900 20 2a 20 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 30   * col1 + ( col0
24910 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
24920 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
24930 2d 2d 0d 0a 31 30 35 34 34 0d 0a 33 38 38 33 0d  --..10544..3883.
24940 0a 34 33 32 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .4323....onlyif 
24950 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
24960 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
24970 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
24980 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
24990 61 62 65 6c 2d 39 38 36 0d 0a 53 45 4c 45 43 54  abel-986..SELECT
249a0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 44   DISTINCT col1 D
249b0 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  IV col0 FROM tab
249c0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  2 cor0..----..0.
249d0 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .4....skipif mys
249e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
249f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
24a00 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38 36 0d 0a  sort label-986..
24a10 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
24a20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 46 52 4f 4d  col1 / col0 FROM
24a30 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
24a40 0d 0a 30 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20  ..0..4....query 
24a50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24a60 54 20 44 49 53 54 49 4e 43 54 20 2b 20 36 31 20  T DISTINCT + 61 
24a70 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20  FROM tab2, tab0 
24a80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a  cor0..----..61..
24a90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24aa0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
24ab0 20 2a 20 39 30 20 2a 20 2b 20 63 6f 6c 30 20 46   * 90 * + col0 F
24ac0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
24ad0 31 37 30 31 30 0d 0a 31 38 32 35 32 30 0d 0a 32  17010..182520..2
24ae0 37 30 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  70180....query I
24af0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24b00 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 2b 20   ALL - col0 * + 
24b10 37 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  70 + col2 AS col
24b20 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
24b30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 37  or0..----..-1647
24b40 0d 0a 2d 32 34 34 39 0d 0a 2d 36 31 34 38 0d 0a  ..-2449..-6148..
24b50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24b60 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
24b70 20 2b 20 38 35 20 2a 20 63 6f 6c 31 20 41 53 20   + 85 * col1 AS 
24b80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
24b90 2d 2d 2d 2d 0d 0a 31 31 31 38 0d 0a 32 32 33 36  ----..1118..2236
24ba0 0d 0a 38 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..860....query I
24bb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24bc0 20 2d 20 2d 20 33 39 20 41 53 20 63 6f 6c 32 20   - - 39 AS col2 
24bd0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
24be0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 0d 0a 33 39 0d  0..----..39..39.
24bf0 0a 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .39....query I r
24c00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
24c10 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  LL - - col0 + - 
24c20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f  cor0.col2 * + co
24c30 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31  r0.col2 * - col1
24c40 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
24c50 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
24c60 0d 0a 31 31 39 38 38 38 0d 0a 33 32 35 35 34 0d  ..119888..32554.
24c70 0a 37 35 38 31 39 0d 0a 0d 0a 71 75 65 72 79 20  .75819....query 
24c80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24c90 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
24ca0 32 20 2a 20 34 30 20 2a 20 2b 20 63 6f 6c 30 20  2 * 40 * + col0 
24cb0 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52  + col0 * col0 FR
24cc0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
24cd0 0a 2d 2d 2d 2d 0d 0a 2d 31 34 31 38 32 34 0d 0a  .----..-141824..
24ce0 2d 33 30 30 38 30 30 0d 0a 2d 36 34 37 31 0d 0a  -300800..-6471..
24cf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24d00 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
24d10 43 54 20 2b 20 35 31 20 2a 20 28 20 2d 20 63 6f  CT + 51 * ( - co
24d20 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  l1 ) + - col0 * 
24d30 35 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  53 FROM tab1 AS 
24d40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 38  cor0..----..-148
24d50 35 0d 0a 2d 33 39 30 32 0d 0a 2d 34 39 30 33 0d  5..-3902..-4903.
24d60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24d70 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
24d80 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  NCT - col0 * - c
24d90 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol0 + col1 * col
24da0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
24db0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 33 0d  or0..----..1413.
24dc0 0a 34 36 36 36 0d 0a 37 36 34 38 0d 0a 0d 0a 6f  .4666..7648....o
24dd0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
24de0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
24df0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
24e00 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
24e10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24e20 74 20 6c 61 62 65 6c 2d 39 39 36 0d 0a 53 45 4c  t label-996..SEL
24e30 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28 20  ECT ALL - CAST( 
24e40 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
24e50 20 2a 20 39 37 20 2a 20 63 6f 72 30 2e 63 6f 6c   * 97 * cor0.col
24e60 32 20 2b 20 31 31 20 2f 20 2b 20 36 33 20 2b 20  2 + 11 / + 63 + 
24e70 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
24e80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24e90 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
24ea0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
24eb0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
24ec0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
24ed0 72 74 20 6c 61 62 65 6c 2d 39 39 36 0d 0a 53 45  rt label-996..SE
24ee0 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20  LECT ALL - CAST 
24ef0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
24f00 52 20 29 20 2a 20 39 37 20 2a 20 63 6f 72 30 2e  R ) * 97 * cor0.
24f10 63 6f 6c 32 20 2b 20 31 31 20 2f 20 2b 20 36 33  col2 + 11 / + 63
24f20 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + - col0 FROM t
24f30 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
24f40 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
24f50 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
24f60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
24f70 20 2d 20 32 34 20 2a 20 2b 20 63 6f 6c 30 20 41   - 24 * + col0 A
24f80 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
24f90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24fa0 2d 31 35 33 36 0d 0a 2d 31 39 32 30 0d 0a 2d 37  -1536..-1920..-7
24fb0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
24fc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35  sort..SELECT - 5
24fd0 33 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  3 + col1 * cor0.
24fe0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
24ff0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
25000 39 35 0d 0a 31 33 35 31 0d 0a 35 31 37 0d 0a 0d  95..1351..517...
25010 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25020 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
25030 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 35  T + + col1 + - 5
25040 37 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  7 * - col2 AS co
25050 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
25060 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 30 34  cor0..----..3104
25070 0d 0a 33 32 35 39 0d 0a 35 34 38 35 0d 0a 0d 0a  ..3259..5485....
25080 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
25090 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
250a0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
250b0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
250c0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
250d0 72 74 20 6c 61 62 65 6c 2d 31 30 30 30 0d 0a 53  rt label-1000..S
250e0 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 2d 20 63  ELECT col2 - - c
250f0 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 63 6f  ol1 * + CAST( co
25100 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 53  l1 + - col1 AS S
25110 49 47 4e 45 44 20 29 20 2f 20 43 41 53 54 28 20  IGNED ) / CAST( 
25120 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
25130 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
25140 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
25150 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
25160 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
25170 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
25180 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25190 65 6c 2d 31 30 30 30 0d 0a 53 45 4c 45 43 54 20  el-1000..SELECT 
251a0 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31 20 2a 20  col2 - - col1 * 
251b0 2b 20 43 41 53 54 20 28 20 63 6f 6c 31 20 2b 20  + CAST ( col1 + 
251c0 2d 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  - col1 AS INTEGE
251d0 52 20 29 20 2f 20 43 41 53 54 20 28 20 4e 55 4c  R ) / CAST ( NUL
251e0 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
251f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
25200 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
25210 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
25220 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25230 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 63  ECT + + col1 - c
25240 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 * col2 AS co
25250 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
25260 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37  cor0..----..-147
25270 35 0d 0a 2d 36 32 39 0d 0a 2d 38 30 36 0d 0a 0d  5..-629..-806...
25280 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25290 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
252a0 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  T + - col0 * col
252b0 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  1 * - col1 AS co
252c0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
252d0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 32 30 0d 0a  0..----..13520..
252e0 32 30 32 38 0d 0a 36 34 30 30 0d 0a 0d 0a 71 75  2028..6400....qu
252f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25300 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d  ELECT + col2 * -
25310 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 39   cor0.col0 * + 9
25320 34 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  4 + cor0.col0 * 
25330 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
25340 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
25350 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 39 35 35 0d 0a  ..----..-17955..
25360 2d 31 39 32 36 36 30 0d 0a 2d 32 38 35 31 39 30  -192660..-285190
25370 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25380 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
25390 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b   + col0 * col0 +
253a0 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
253b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
253c0 2d 0d 0a 31 30 37 0d 0a 36 31 36 39 0d 0a 36 32  -..107..6169..62
253d0 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
253e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
253f0 4c 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  L - - col1 + - c
25400 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
25410 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
25420 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 0d 0a 2d 31  ..----..-158..-1
25430 39 36 39 0d 0a 2d 32 39 38 35 0d 0a 0d 0a 71 75  969..-2985....qu
25440 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25450 45 4c 45 43 54 20 2d 20 2d 20 34 39 20 2a 20 63  ELECT - - 49 * c
25460 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 * col1 FROM 
25470 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
25480 2d 2d 0d 0a 32 37 39 33 30 0d 0a 36 31 31 35 32  --..27930..61152
25490 0d 0a 36 38 37 39 36 0d 0a 0d 0a 71 75 65 72 79  ..68796....query
254a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
254b0 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2d  CT + cor0.col0 -
254c0 20 2b 20 63 6f 6c 30 20 2a 20 32 36 20 46 52 4f   + col0 * 26 FRO
254d0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
254e0 2d 2d 2d 2d 0d 0a 2d 31 36 30 30 0d 0a 2d 32 30  ----..-1600..-20
254f0 30 30 0d 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72 79  00..-75....query
25500 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25510 43 54 20 2d 20 2d 20 37 33 20 2b 20 2d 20 63 6f  CT - - 73 + - co
25520 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
25530 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
25540 2d 2d 0d 0a 2d 32 33 0d 0a 31 36 0d 0a 31 39 0d  --..-23..16..19.
25550 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25560 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
25570 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   + cor0.col1 + c
25580 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 72  or0.col1 * - cor
25590 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
255a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
255b0 2d 31 39 37 38 0d 0a 2d 33 32 39 38 0d 0a 2d 38  -1978..-3298..-8
255c0 30 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  008....onlyif my
255d0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
255e0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
255f0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
25600 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
25610 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25620 31 30 31 30 0d 0a 53 45 4c 45 43 54 20 43 41 53  1010..SELECT CAS
25630 54 28 20 2b 20 37 34 20 41 53 20 53 49 47 4e 45  T( + 74 AS SIGNE
25640 44 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  D ) FROM tab2, t
25650 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
25660 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
25670 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
25680 6e 67 20 74 6f 20 64 63 32 32 39 37 39 65 36 64  ng to dc22979e6d
25690 32 36 31 37 39 35 62 64 33 63 65 32 39 39 30 66  261795bd3ce2990f
256a0 64 62 62 66 38 32 0d 0a 0d 0a 73 6b 69 70 69 66  dbbf82....skipif
256b0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
256c0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
256d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
256e0 30 31 30 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  010..SELECT CAST
256f0 20 28 20 2b 20 37 34 20 41 53 20 49 4e 54 45 47   ( + 74 AS INTEG
25700 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20  ER ) FROM tab2, 
25710 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
25720 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
25730 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
25740 69 6e 67 20 74 6f 20 64 63 32 32 39 37 39 65 36  ing to dc22979e6
25750 64 32 36 31 37 39 35 62 64 33 63 65 32 39 39 30  d261795bd3ce2990
25760 66 64 62 62 66 38 32 0d 0a 0d 0a 6f 6e 6c 79 69  fdbbf82....onlyi
25770 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
25780 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
25790 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
257a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
257b0 20 6c 61 62 65 6c 2d 31 30 31 31 0d 0a 53 45 4c   label-1011..SEL
257c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
257d0 20 35 37 20 44 49 56 20 36 35 20 46 52 4f 4d 20   57 DIV 65 FROM 
257e0 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
257f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73  r0..----..0....s
25800 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
25810 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
25820 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25830 62 65 6c 2d 31 30 31 31 0d 0a 53 45 4c 45 43 54  bel-1011..SELECT
25840 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 35 37   DISTINCT + + 57
25850 20 2f 20 36 35 20 46 52 4f 4d 20 74 61 62 32 2c   / 65 FROM tab2,
25860 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
25870 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ---..0....query 
25880 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25890 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 36 38 20  T - + col1 + 68 
258a0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
258b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 32  0..----..-18..-2
258c0 33 0d 0a 2d 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  3..-29....onlyif
258d0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
258e0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
258f0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
25900 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
25910 6c 61 62 65 6c 2d 31 30 31 33 0d 0a 53 45 4c 45  label-1013..SELE
25920 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20  CT + col0 DIV + 
25930 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2d 20 31 35  tab1.col1 + - 15
25940 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a   + col0 * col0 *
25950 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
25960 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 32 31 35 33  1..----..-262153
25970 0d 0a 2d 34 32 0d 0a 2d 35 31 32 30 30 39 0d 0a  ..-42..-512009..
25980 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
25990 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
259a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
259b0 20 6c 61 62 65 6c 2d 31 30 31 33 0d 0a 53 45 4c   label-1013..SEL
259c0 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 74  ECT + col0 / + t
259d0 61 62 31 2e 63 6f 6c 31 20 2b 20 2d 20 31 35 20  ab1.col1 + - 15 
259e0 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20  + col0 * col0 * 
259f0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
25a00 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 32 31 35 33 0d  ..----..-262153.
25a10 0a 2d 34 32 0d 0a 2d 35 31 32 30 30 39 0d 0a 0d  .-42..-512009...
25a20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25a30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
25a40 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  + - col0 + + col
25a50 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
25a60 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
25a70 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a  -3..-64..-80....
25a80 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
25a90 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
25aa0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
25ab0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
25ac0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
25ad0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25ae0 20 2d 20 63 6f 6c 30 20 2b 20 31 20 2b 20 2b 20   - col0 + 1 + + 
25af0 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
25b00 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
25b10 2d 0d 0a 33 0d 0a 36 33 0d 0a 36 33 0d 0a 0d 0a  -..3..63..63....
25b20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25b30 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
25b40 20 32 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74   20 FROM tab2, t
25b50 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
25b60 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 0d 0a 71  0..----..20....q
25b70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25b80 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e  SELECT + - cor0.
25b90 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  col2 FROM tab0, 
25ba0 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 0d  tab1, tab2 cor0.
25bb0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
25bc0 20 68 61 73 68 69 6e 67 20 74 6f 20 66 39 64 34   hashing to f9d4
25bd0 62 62 38 36 37 37 64 62 37 62 39 38 63 37 65 64  bb8677db7b98c7ed
25be0 38 39 64 30 36 65 36 65 38 63 64 36 0d 0a 0d 0a  89d06e6e8cd6....
25bf0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25c00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
25c10 20 2d 20 33 39 20 46 52 4f 4d 20 74 61 62 31 2c   - 39 FROM tab1,
25c20 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
25c30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 0d 0a  or0..----..-39..
25c40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25c50 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 33 20 2a  t..SELECT + 63 *
25c60 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41   - col1 * col2 A
25c70 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
25c80 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 39 31 30 0d 0a  ..----..-35910..
25c90 2d 37 38 36 32 34 0d 0a 2d 38 38 34 35 32 0d 0a  -78624..-88452..
25ca0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25cb0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
25cc0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d  ol2 + - col2 * -
25cd0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 46   col0 * - col0 F
25ce0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
25cf0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 33 34 31 35 0d  ..----..-233415.
25d00 0a 2d 34 33 32 0d 0a 2d 36 31 34 33 30 34 0d 0a  .-432..-614304..
25d10 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
25d20 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
25d30 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
25d40 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
25d50 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
25d60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25d70 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  CT - col2 * - co
25d80 6c 32 20 2d 20 2b 20 28 20 2d 20 63 6f 6c 30 20  l2 - + ( - col0 
25d90 2b 20 2d 20 32 35 20 29 20 2a 20 2d 20 74 61 62  + - 25 ) * - tab
25da0 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 63 6f  0.col1 * col0 co
25db0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
25dc0 2d 2d 0d 0a 2d 31 30 30 30 34 37 0d 0a 2d 32 30  --..-100047..-20
25dd0 33 36 39 39 0d 0a 2d 39 31 36 35 36 32 0d 0a 0d  3699..-916562...
25de0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25df0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
25e00 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e  T + col2 + cor0.
25e10 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53  col1 * - col1 AS
25e20 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
25e30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 36  cor0..----..-736
25e40 33 0d 0a 2d 38 31 39 39 0d 0a 2d 39 34 30 38 0d  3..-8199..-9408.
25e50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25e60 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
25e70 30 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  0 + col1 * - col
25e80 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
25e90 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
25ea0 2d 0d 0a 2d 37 33 37 32 0d 0a 2d 38 31 39 32 0d  -..-7372..-8192.
25eb0 0a 2d 39 33 37 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-9374....onlyif
25ec0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
25ed0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
25ee0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
25ef0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
25f00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25f10 65 6c 2d 31 30 32 34 0d 0a 53 45 4c 45 43 54 20  el-1024..SELECT 
25f20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20  - CAST( col1 AS 
25f30 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c  SIGNED ) * - col
25f40 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
25f50 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
25f60 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a 36 37 36  -..100..169..676
25f70 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
25f80 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
25f90 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
25fa0 72 74 20 6c 61 62 65 6c 2d 31 30 32 34 0d 0a 53  rt label-1024..S
25fb0 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 63  ELECT - CAST ( c
25fc0 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
25fd0 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
25fe0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
25ff0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a  or0..----..100..
26000 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75 65 72  169..676....quer
26010 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26020 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 28 20 63  ECT + col0 + ( c
26030 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 29 20 2a  ol0 + - col2 ) *
26040 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab0.col1 FROM 
26050 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 35 30  tab0..----..-750
26060 0d 0a 33 33 33 33 0d 0a 37 32 36 0d 0a 0d 0a 71  ..3333..726....q
26070 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26080 53 45 4c 45 43 54 20 28 20 2d 20 63 6f 72 30 2e  SELECT ( - cor0.
26090 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30  col2 ) FROM tab0
260a0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43  , tab1 AS cor0 C
260b0 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 0d 0a  ROSS JOIN tab2..
260c0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
260d0 68 61 73 68 69 6e 67 20 74 6f 20 34 34 66 64 63  hashing to 44fdc
260e0 64 37 63 64 36 30 33 33 35 32 64 34 64 31 32 37  d7cd603352d4d127
260f0 38 31 31 64 31 36 34 63 63 31 65 0d 0a 0d 0a 73  811d164cc1e....s
26100 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
26110 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
26120 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
26130 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
26140 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
26150 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26160 2b 20 35 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + 5 col1 FROM ta
26170 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  b2 cor0..----..5
26180 0d 0a 35 0d 0a 35 0d 0a 0d 0a 71 75 65 72 79 20  ..5..5....query 
26190 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
261a0 54 20 41 4c 4c 20 2b 20 34 33 20 2b 20 2d 20 63  T ALL + 43 + - c
261b0 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 * col1 FROM 
261c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
261d0 2d 2d 0d 0a 2d 32 30 32 31 0d 0a 2d 33 33 35 32  --..-2021..-3352
261e0 0d 0a 2d 38 30 35 36 0d 0a 0d 0a 6f 6e 6c 79 69  ..-8056....onlyi
261f0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
26200 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
26210 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
26220 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26230 20 6c 61 62 65 6c 2d 31 30 32 39 0d 0a 53 45 4c   label-1029..SEL
26240 45 43 54 20 41 4c 4c 20 2d 20 2d 20 38 30 20 44  ECT ALL - - 80 D
26250 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63  IV + cor0.col0 c
26260 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
26270 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
26280 31 0d 0a 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..26....skipif 
26290 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
262a0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
262b0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
262c0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
262d0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
262e0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
262f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26300 20 6c 61 62 65 6c 2d 31 30 32 39 0d 0a 53 45 4c   label-1029..SEL
26310 45 43 54 20 41 4c 4c 20 2d 20 2d 20 38 30 20 2f  ECT ALL - - 80 /
26320 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c   + cor0.col0 col
26330 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
26340 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d  or0..----..1..1.
26350 0a 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .26....onlyif my
26360 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
26370 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
26380 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
26390 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
263a0 65 6c 2d 31 30 33 30 0d 0a 53 45 4c 45 43 54 20  el-1030..SELECT 
263b0 44 49 53 54 49 4e 43 54 20 2d 20 33 31 20 2a 20  DISTINCT - 31 * 
263c0 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 63 6f  cor0.col1 DIV co
263d0 6c 30 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 32 35  l0 - - col0 * 25
263e0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
263f0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
26400 0d 0a 2d 31 39 33 0d 0a 31 35 39 36 0d 0a 31 39  ..-193..1596..19
26410 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  95....skipif mys
26420 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
26430 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
26440 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 30 0d  sort label-1030.
26450 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
26460 20 2d 20 33 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   - 31 * cor0.col
26470 31 20 2f 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c  1 / col0 - - col
26480 30 20 2a 20 32 35 20 41 53 20 63 6f 6c 32 20 46  0 * 25 AS col2 F
26490 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
264a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 33 0d 0a 31 35  ..----..-193..15
264b0 39 36 0d 0a 31 39 39 35 0d 0a 0d 0a 71 75 65 72  96..1995....quer
264c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
264d0 45 43 54 20 41 4c 4c 20 2d 20 2b 20 34 20 2b 20  ECT ALL - + 4 + 
264e0 2b 20 39 38 20 46 52 4f 4d 20 74 61 62 30 20 41  + 98 FROM tab0 A
264f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 34  S cor0..----..94
26500 0d 0a 39 34 0d 0a 39 34 0d 0a 0d 0a 6f 6e 6c 79  ..94..94....only
26510 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
26520 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
26530 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
26540 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26550 74 20 6c 61 62 65 6c 2d 31 30 33 32 0d 0a 53 45  t label-1032..SE
26560 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
26570 33 30 20 44 49 56 20 2d 20 32 38 20 2b 20 2b 20  30 DIV - 28 + + 
26580 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
26590 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35  S cor0..----..85
265a0 0d 0a 39 30 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70  ..90..96....skip
265b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
265c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
265d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
265e0 2d 31 30 33 32 0d 0a 53 45 4c 45 43 54 20 44 49  -1032..SELECT DI
265f0 53 54 49 4e 43 54 20 2b 20 33 30 20 2f 20 2d 20  STINCT + 30 / - 
26600 32 38 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  28 + + col1 FROM
26610 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
26620 2d 2d 2d 0d 0a 38 35 0d 0a 39 30 0d 0a 39 36 0d  ---..85..90..96.
26630 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
26640 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
26650 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
26660 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
26670 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
26680 30 33 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  033..SELECT DIST
26690 49 4e 43 54 20 2b 20 2d 20 38 33 20 2a 20 2b 20  INCT + - 83 * + 
266a0 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 31 20  col1 DIV + col1 
266b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
266c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 33 0d 0a 0d 0a  0..----..-83....
266d0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
266e0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
266f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26700 61 62 65 6c 2d 31 30 33 33 0d 0a 53 45 4c 45 43  abel-1033..SELEC
26710 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 38  T DISTINCT + - 8
26720 33 20 2a 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63  3 * + col1 / + c
26730 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
26740 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 33   cor0..----..-83
26750 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
26760 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
26770 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
26780 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
26790 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
267a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33  owsort label-103
267b0 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  4..SELECT ALL - 
267c0 43 41 53 54 28 20 2d 20 32 20 41 53 20 53 49 47  CAST( - 2 AS SIG
267d0 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 2c  NED ) FROM tab2,
267e0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
267f0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
26800 6e 67 20 74 6f 20 38 34 64 62 66 61 66 39 62 63  ng to 84dbfaf9bc
26810 31 37 64 64 30 39 37 66 31 35 62 63 33 36 62 34  17dd097f15bc36b4
26820 31 38 36 32 36 31 0d 0a 0d 0a 73 6b 69 70 69 66  186261....skipif
26830 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
26840 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
26850 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
26860 30 33 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  034..SELECT ALL 
26870 2d 20 43 41 53 54 20 28 20 2d 20 32 20 41 53 20  - CAST ( - 2 AS 
26880 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
26890 61 62 32 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a  ab2, tab1 cor0..
268a0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
268b0 61 73 68 69 6e 67 20 74 6f 20 38 34 64 62 66 61  ashing to 84dbfa
268c0 66 39 62 63 31 37 64 64 30 39 37 66 31 35 62 63  f9bc17dd097f15bc
268d0 33 36 62 34 31 38 36 32 36 31 0d 0a 0d 0a 71 75  36b4186261....qu
268e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
268f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
26900 6f 6c 31 20 2a 20 35 37 20 2a 20 74 61 62 31 2e  ol1 * 57 * tab1.
26910 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
26920 2d 2d 2d 2d 0d 0a 33 38 35 33 32 0d 0a 35 37 30  ----..38532..570
26930 30 0d 0a 39 36 33 33 0d 0a 0d 0a 71 75 65 72 79  0..9633....query
26940 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26950 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 37 39  CT + col1 * + 79
26960 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
26970 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  b0 cor0..----..6
26980 37 39 34 0d 0a 37 31 38 39 0d 0a 37 36 36 33 0d  794..7189..7663.
26990 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
269a0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
269b0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
269c0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
269d0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
269e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 37  wsort label-1037
269f0 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28  ..SELECT + CAST(
26a00 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
26a10 20 29 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   ) * col0 + - co
26a20 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
26a30 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
26a40 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
26a50 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
26a60 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
26a70 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
26a80 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33  owsort label-103
26a90 37 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54  7..SELECT + CAST
26aa0 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20   ( NULL AS REAL 
26ab0 29 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  ) * col0 + - col
26ac0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
26ad0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
26ae0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
26af0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
26b00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
26b10 6f 6c 32 20 2d 20 2b 20 30 20 2a 20 2b 20 63 6f  ol2 - + 0 * + co
26b20 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
26b30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33  cor0..----..1..3
26b40 33 0d 0a 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  3..82....onlyif 
26b50 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
26b60 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
26b70 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
26b80 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
26b90 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
26ba0 6c 2d 31 30 33 39 0d 0a 53 45 4c 45 43 54 20 2b  l-1039..SELECT +
26bb0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
26bc0 49 47 4e 45 44 20 29 20 2a 20 2b 20 63 6f 6c 31  IGNED ) * + col1
26bd0 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
26be0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
26bf0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
26c00 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
26c10 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
26c20 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
26c30 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 39  wsort label-1039
26c40 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20  ..SELECT + CAST 
26c50 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
26c60 52 20 29 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d  R ) * + col1 * -
26c70 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
26c80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
26c90 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
26ca0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26cb0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
26cc0 6f 6c 31 20 2a 20 28 20 2d 20 63 6f 6c 30 20 2b  ol1 * ( - col0 +
26cd0 20 63 6f 6c 30 20 29 20 2a 20 2d 20 28 20 63 6f   col0 ) * - ( co
26ce0 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l2 ) AS col0 FRO
26cf0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
26d00 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
26d10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26d20 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
26d30 31 20 2a 20 2b 20 34 36 20 41 53 20 63 6f 6c 31  1 * + 46 AS col1
26d40 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
26d50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 36 0d 0a  r0..----..1426..
26d60 32 37 31 34 0d 0a 37 38 32 0d 0a 0d 0a 71 75 65  2714..782....que
26d70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26d80 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
26d90 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2b 20 28 20  tab0.col0 * + ( 
26da0 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20  - col1 * + col2 
26db0 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
26dc0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d  ab0..----..3395.
26dd0 0a 36 36 34 31 31 38 0d 0a 36 38 31 31 32 0d 0a  .664118..68112..
26de0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26df0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
26e00 2b 20 63 6f 6c 32 20 2b 20 2d 20 36 20 2a 20 63  + col2 + - 6 * c
26e10 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
26e20 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
26e30 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d 33 32 38 0d  ---..-159..-328.
26e40 0a 2d 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-64....onlyif m
26e50 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
26e60 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
26e70 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
26e80 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
26e90 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
26ea0 2d 31 30 34 34 0d 0a 53 45 4c 45 43 54 20 2b 20  -1044..SELECT + 
26eb0 43 41 53 54 28 20 39 36 20 41 53 20 53 49 47 4e  CAST( 96 AS SIGN
26ec0 45 44 20 29 20 2a 20 63 6f 6c 30 20 2b 20 43 41  ED ) * col0 + CA
26ed0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
26ee0 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  ED ) FROM tab0 A
26ef0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
26f00 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
26f10 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
26f20 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
26f30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26f40 20 6c 61 62 65 6c 2d 31 30 34 34 0d 0a 53 45 4c   label-1044..SEL
26f50 45 43 54 20 2b 20 43 41 53 54 20 28 20 39 36 20  ECT + CAST ( 96 
26f60 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63  AS INTEGER ) * c
26f70 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ol0 + CAST ( NUL
26f80 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
26f90 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
26fa0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
26fb0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
26fc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26fd0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
26fe0 20 35 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53   52 FROM tab2 AS
26ff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32   cor0..----..-52
27000 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27010 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
27020 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  INCT + col2 * - 
27030 33 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  32 FROM tab0 cor
27040 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 36 0d 0a  0..----..-1056..
27050 2d 32 36 32 34 0d 0a 2d 33 32 0d 0a 0d 0a 73 6b  -2624..-32....sk
27060 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
27070 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
27080 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
27090 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
270a0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
270b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
270c0 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 34  ol0 * col1 + + 4
270d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
270e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
270f0 33 34 37 0d 0a 32 32 31 0d 0a 34 36 30 36 0d 0a  347..221..4606..
27100 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
27110 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
27120 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
27130 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
27140 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
27150 34 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  48..SELECT col1 
27160 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  DIV cor0.col1 + 
27170 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col1 * - cor0.co
27180 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l2 * - col0 FROM
27190 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
271a0 2d 2d 2d 0d 0a 31 31 39 36 35 33 0d 0a 35 31 30  ---..119653..510
271b0 33 35 0d 0a 35 38 36 30 0d 0a 0d 0a 73 6b 69 70  35..5860....skip
271c0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
271d0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
271e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
271f0 2d 31 30 34 38 0d 0a 53 45 4c 45 43 54 20 63 6f  -1048..SELECT co
27200 6c 31 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  l1 / cor0.col1 +
27210 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63   col1 * - cor0.c
27220 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  ol2 * - col0 FRO
27230 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
27240 2d 2d 2d 2d 0d 0a 31 31 39 36 35 33 0d 0a 35 31  ----..119653..51
27250 30 33 35 0d 0a 35 38 36 30 0d 0a 0d 0a 71 75 65  035..5860....que
27260 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27270 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20  LECT + - col1 + 
27280 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 72 30  cor0.col2 * cor0
27290 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20  .col1 FROM tab0 
272a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
272b0 0d 0a 32 37 35 32 0d 0a 37 33 37 31 0d 0a 0d 0a  ..2752..7371....
272c0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
272d0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
272e0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
272f0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
27300 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 30  wsort label-1050
27310 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
27320 54 20 2b 20 34 37 20 44 49 56 20 63 6f 72 30 2e  T + 47 DIV cor0.
27330 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
27340 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
27350 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  --..0..1....skip
27360 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
27370 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
27380 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
27390 2d 31 30 35 30 0d 0a 53 45 4c 45 43 54 20 44 49  -1050..SELECT DI
273a0 53 54 49 4e 43 54 20 2b 20 34 37 20 2f 20 63 6f  STINCT + 47 / co
273b0 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
273c0 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  1, tab0 AS cor0.
273d0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71  .----..0..1....q
273e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
273f0 53 45 4c 45 43 54 20 2b 20 2d 20 31 35 20 2b 20  SELECT + - 15 + 
27400 2b 20 34 33 20 46 52 4f 4d 20 74 61 62 32 20 41  + 43 FROM tab2 A
27410 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
27420 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  N tab0 AS cor1..
27430 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
27440 61 73 68 69 6e 67 20 74 6f 20 61 61 64 33 32 32  ashing to aad322
27450 33 32 63 34 32 38 62 33 65 63 62 35 61 64 61 36  32c428b3ecb5ada6
27460 33 66 37 65 39 62 30 61 39 37 0d 0a 0d 0a 73 6b  3f7e9b0a97....sk
27470 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
27480 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
27490 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
274a0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
274b0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
274c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
274d0 6f 6c 30 20 2b 20 2d 20 28 20 38 32 20 29 20 63  ol0 + - ( 82 ) c
274e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
274f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor0..----..-3.
27500 0a 2d 34 0d 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72  .-4..-75....quer
27510 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27520 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
27530 20 32 37 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f   27 * + col1 FRO
27540 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
27550 2d 2d 2d 2d 0d 0a 32 38 30 0d 0a 33 36 34 0d 0a  ----..280..364..
27560 37 32 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  728....skipif po
27570 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
27580 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
27590 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
275a0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
275b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
275c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
275d0 20 63 6f 6c 32 20 2b 20 2d 20 31 30 20 2d 20 2d   col2 + - 10 - -
275e0 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
275f0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
27600 0a 31 30 34 0d 0a 31 38 32 0d 0a 39 38 0d 0a 0d  .104..182..98...
27610 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27620 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
27630 2a 20 28 20 2d 20 28 20 63 6f 6c 30 20 29 20 29  * ( - ( col0 ) )
27640 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
27650 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
27660 0a 31 33 32 0d 0a 37 33 38 39 0d 0a 38 37 38 0d  .132..7389..878.
27670 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27680 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
27690 20 63 6f 6c 32 20 2b 20 28 20 2b 20 28 20 2d 20   col2 + ( + ( - 
276a0 63 6f 72 30 2e 63 6f 6c 32 20 29 20 29 20 2b 20  cor0.col2 ) ) + 
276b0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
276c0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
276d0 2d 0d 0a 32 0d 0a 32 0d 0a 32 0d 0a 0d 0a 71 75  -..2..2..2....qu
276e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
276f0 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20 2b  ELECT - ( col2 +
27700 20 37 20 2a 20 2d 20 63 6f 6c 30 20 29 20 46 52   7 * - col0 ) FR
27710 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
27720 33 33 0d 0a 33 39 31 0d 0a 34 36 34 0d 0a 0d 0a  33..391..464....
27730 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27740 0a 53 45 4c 45 43 54 20 35 39 20 2a 20 2b 20 63  .SELECT 59 * + c
27750 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
27760 2d 2d 2d 0d 0a 31 34 31 36 0d 0a 32 30 36 35 0d  ---..1416..2065.
27770 0a 35 32 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .5251....query I
27780 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27790 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
277a0 6c 31 20 2a 20 63 6f 6c 32 20 2d 20 2d 20 63 6f  l1 * col2 - - co
277b0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
277c0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
277d0 0a 31 33 32 38 0d 0a 31 34 30 37 0d 0a 36 33 34  .1328..1407..634
277e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
277f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
27800 63 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 32 20  col2 + - ( col2 
27810 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
27820 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
27830 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
27840 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
27850 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  l0 * + col1 + co
27860 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
27870 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d  cor0..----..104.
27880 0a 31 30 35 33 0d 0a 36 35 30 0d 0a 0d 0a 71 75  .1053..650....qu
27890 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
278a0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
278b0 6f 6c 32 20 2a 20 2d 20 37 35 20 46 52 4f 4d 20  ol2 * - 75 FROM 
278c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
278d0 2d 2d 0d 0a 2d 32 34 37 35 0d 0a 2d 36 31 35 30  --..-2475..-6150
278e0 0d 0a 2d 37 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-75....skipif 
278f0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
27900 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
27910 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
27920 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
27930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27940 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
27950 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  CT - col2 + + co
27960 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
27970 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
27980 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
27990 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
279a0 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col2 + - col1 * 
279b0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
279c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
279d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33   cor0..----..-43
279e0 0d 0a 2d 36 32 32 0d 0a 2d 37 33 0d 0a 0d 0a 71  ..-622..-73....q
279f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27a00 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 37 20  SELECT ALL - 77 
27a10 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
27a20 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
27a30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d 0a 2d 36 34  ..----..-51..-64
27a40 0d 0a 2d 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-67....query I
27a50 49 49 49 49 49 49 49 49 49 49 49 49 49 49 20 72  IIIIIIIIIIIIII r
27a60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a  owsort..SELECT *
27a70 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 20   FROM tab2 cor0 
27a80 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c  CROSS JOIN tab1,
27a90 20 74 61 62 31 20 63 6f 72 31 2c 20 74 61 62 30   tab1 cor1, tab0
27aa0 20 41 53 20 63 6f 72 32 2c 20 74 61 62 31 20 63   AS cor2, tab1 c
27ab0 6f 72 33 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20  or3..----..3645 
27ac0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
27ad0 6f 20 66 39 31 30 31 31 37 33 61 62 63 39 65 35  o f9101173abc9e5
27ae0 32 34 63 36 33 31 30 65 36 63 30 65 65 65 66 62  24c6310e6c0eeefb
27af0 30 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  0c....skipif pos
27b00 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
27b10 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
27b20 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
27b30 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
27b40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27b50 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 31  SELECT tab2.col1
27b60 20 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46   + - col1 col0 F
27b70 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
27b80 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
27b90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27ba0 43 54 20 2b 20 63 6f 72 32 2e 63 6f 6c 31 20 41  CT + cor2.col1 A
27bb0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
27bc0 2c 20 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62  , tab1 cor0, tab
27bd0 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32 20  1 AS cor1, tab2 
27be0 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor2..----..81 v
27bf0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
27c00 20 61 35 62 36 61 63 62 34 37 31 39 31 30 65 61   a5b6acb471910ea
27c10 34 61 64 37 66 33 31 63 61 65 33 62 38 31 38 66  4ad7f31cae3b818f
27c20 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
27c30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
27c40 54 49 4e 43 54 20 33 34 20 46 52 4f 4d 20 74 61  TINCT 34 FROM ta
27c50 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b2, tab0 AS cor0
27c60 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20  , tab2 AS cor1, 
27c70 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab0 AS cor2..--
27c80 2d 2d 0d 0a 33 34 0d 0a 0d 0a 73 6b 69 70 69 66  --..34....skipif
27c90 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
27ca0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
27cb0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
27cc0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
27cd0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
27ce0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
27cf0 4e 43 54 20 63 6f 6c 32 20 2d 20 2b 20 35 37 20  NCT col2 - + 57 
27d00 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
27d10 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 33 39 0d  ----..-3..0..39.
27d20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27d30 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 36 20  rt..SELECT + 56 
27d40 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 41 53  * - tab2.col2 AS
27d50 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c   col0 FROM tab2,
27d60 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
27d70 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
27d80 6e 67 20 74 6f 20 61 32 35 35 32 38 63 62 32 61  ng to a25528cb2a
27d90 64 61 66 62 39 39 35 33 63 65 63 38 37 36 37 36  dafb9953cec87676
27da0 35 63 62 31 34 32 0d 0a 0d 0a 71 75 65 72 79 20  5cb142....query 
27db0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27dc0 54 20 2b 20 37 31 20 2a 20 2d 20 63 6f 6c 30 20  T + 71 * - col0 
27dd0 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  * + col2 AS col1
27de0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
27df0 0d 0a 2d 32 34 38 35 0d 0a 2d 35 31 38 31 35 38  ..-2485..-518158
27e00 0d 0a 2d 35 36 32 33 32 0d 0a 0d 0a 71 75 65 72  ..-56232....quer
27e10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27e20 45 43 54 20 32 37 20 2b 20 2d 20 74 61 62 30 2e  ECT 27 + - tab0.
27e30 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
27e40 2d 2d 2d 2d 0d 0a 2d 35 39 0d 0a 2d 36 34 0d 0a  ----..-59..-64..
27e50 2d 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -70....query I r
27e60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
27e70 6f 6c 30 20 2d 20 2d 20 74 61 62 31 2e 63 6f 6c  ol0 - - tab1.col
27e80 30 20 2a 20 2b 20 32 32 20 46 52 4f 4d 20 74 61  0 * + 22 FROM ta
27e90 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 32 0d 0a  b1..----..1472..
27ea0 31 38 34 30 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72  1840..69....quer
27eb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27ec0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34  ECT DISTINCT - 4
27ed0 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 34  1 * - col0 + - 4
27ee0 33 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  3 FROM tab2..---
27ef0 2d 0d 0a 32 34 34 0d 0a 33 31 35 35 0d 0a 33 31  -..244..3155..31
27f00 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
27f10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 39  wsort..SELECT 49
27f20 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   - + col2 AS col
27f30 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
27f40 2d 0d 0a 31 31 0d 0a 32 32 0d 0a 32 33 0d 0a 0d  -..11..22..23...
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 44 49 53 54 49 4e 43  ..SELECT DISTINC
27f70 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  T + + col1 + col
27f80 32 20 2a 20 2d 20 28 20 2d 20 33 20 2b 20 2d 20  2 * - ( - 3 + - 
27f90 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46 52 4f 4d  cor0.col0 ) FROM
27fa0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
27fb0 2d 2d 2d 0d 0a 32 31 36 35 0d 0a 33 30 31 0d 0a  ---..2165..301..
27fc0 33 31 33 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3133....onlyif m
27fd0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
27fe0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
27ff0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
28000 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
28010 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
28020 2d 31 30 37 38 0d 0a 53 45 4c 45 43 54 20 2d 20  -1078..SELECT - 
28030 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45  CAST( NULL AS DE
28040 43 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c 32 20  CIMAL ) AS col2 
28050 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
28060 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
28070 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
28080 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31 35  cd7a7901e47c1515
28090 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30 62  5404aff0d216fe0b
280a0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
280b0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
280c0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
280d0 72 74 20 6c 61 62 65 6c 2d 31 30 37 38 0d 0a 53  rt label-1078..S
280e0 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 4e  ELECT - CAST ( N
280f0 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 41 53  ULL AS REAL ) AS
28100 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c   col2 FROM tab2,
28110 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
28120 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
28130 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34  ng to cd7a7901e4
28140 37 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32  7c15155404aff0d2
28150 31 36 66 65 30 62 0d 0a 0d 0a 71 75 65 72 79 20  16fe0b....query 
28160 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28170 54 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 63  T + ( col2 ) * c
28180 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 63  ol2 - - col1 * c
28190 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  or0.col2 AS col2
281a0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
281b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 36 0d 0a  r0..----..1566..
281c0 32 30 39 30 0d 0a 32 32 31 30 0d 0a 0d 0a 71 75  2090..2210....qu
281d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
281e0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d  ELECT - col2 * -
281f0 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20   col2 * col0 AS 
28200 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
28210 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
28220 31 33 36 0d 0a 33 35 0d 0a 35 39 38 34 33 36 0d  136..35..598436.
28230 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28240 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
28250 31 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  1 - col2 * col1 
28260 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
28270 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 33 0d 0a  0..----..-1593..
28280 2d 36 36 33 0d 0a 2d 38 36 38 0d 0a 0d 0a 6f 6e  -663..-868....on
28290 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
282a0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
282b0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
282c0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
282d0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 32 0d 0a  ort label-1082..
282e0 53 45 4c 45 43 54 20 63 6f 6c 30 20 44 49 56 20  SELECT col0 DIV 
282f0 63 6f 6c 31 20 2b 20 34 38 20 46 52 4f 4d 20 74  col1 + 48 FROM t
28300 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 38 0d 0a 35  ab1..----..48..5
28310 34 0d 0a 35 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..54....skipif 
28320 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
28330 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
28340 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
28350 38 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  82..SELECT col0 
28360 2f 20 63 6f 6c 31 20 2b 20 34 38 20 46 52 4f 4d  / col1 + 48 FROM
28370 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 38 0d   tab1..----..48.
28380 0a 35 34 0d 0a 35 34 0d 0a 0d 0a 73 6b 69 70 69  .54..54....skipi
28390 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
283a0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
283b0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
283c0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
283d0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
283e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39 36  ort..SELECT + 96
283f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c   col2 FROM tab2,
28400 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
28410 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
28420 73 68 69 6e 67 20 74 6f 20 32 32 63 35 31 34 31  shing to 22c5141
28430 61 36 32 39 66 30 65 66 33 39 36 37 33 38 65 65  a629f0ef396738ee
28440 32 63 38 62 65 36 33 30 33 0d 0a 0d 0a 71 75 65  2c8be6303....que
28450 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28460 4c 45 43 54 20 2d 20 37 32 20 2a 20 63 6f 72 30  LECT - 72 * cor0
28470 2e 63 6f 6c 30 20 2b 20 2b 20 35 32 20 41 53 20  .col0 + + 52 AS 
28480 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20  col1 FROM tab0, 
28490 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
284a0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
284b0 67 20 74 6f 20 33 37 39 35 38 34 31 34 35 36 32  g to 37958414562
284c0 61 39 37 39 34 33 64 65 35 36 38 39 66 38 62 39  a97943de5689f8b9
284d0 36 38 63 33 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  68c32....onlyif 
284e0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
284f0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
28500 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
28510 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28520 61 62 65 6c 2d 31 30 38 35 0d 0a 53 45 4c 45 43  abel-1085..SELEC
28530 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20 63  T DISTINCT ( - c
28540 6f 6c 30 20 29 20 44 49 56 20 63 6f 6c 30 20 2b  ol0 ) DIV col0 +
28550 20 38 30 20 2a 20 28 20 2d 20 63 6f 6c 30 20 29   80 * ( - col0 )
28560 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
28570 0a 2d 2d 2d 2d 0d 0a 2d 35 36 31 0d 0a 2d 36 32  .----..-561..-62
28580 34 31 0d 0a 2d 36 33 32 31 0d 0a 0d 0a 73 6b 69  41..-6321....ski
28590 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
285a0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
285b0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
285c0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
285d0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
285e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
285f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
28600 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 35 0d  sort label-1085.
28610 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
28620 20 28 20 2d 20 63 6f 6c 30 20 29 20 2f 20 63 6f   ( - col0 ) / co
28630 6c 30 20 2b 20 38 30 20 2a 20 28 20 2d 20 63 6f  l0 + 80 * ( - co
28640 6c 30 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 ) col1 FROM t
28650 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 31 0d  ab2..----..-561.
28660 0a 2d 36 32 34 31 0d 0a 2d 36 33 32 31 0d 0a 0d  .-6241..-6321...
28670 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28680 0d 0a 53 45 4c 45 43 54 20 2b 20 38 36 20 2a 20  ..SELECT + 86 * 
28690 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  - col2 AS col2 F
286a0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
286b0 2d 32 32 33 36 0d 0a 2d 32 33 32 32 0d 0a 2d 33  -2236..-2322..-3
286c0 32 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  268....onlyif my
286d0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
286e0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
286f0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
28700 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
28710 65 6c 2d 31 30 38 37 0d 0a 53 45 4c 45 43 54 20  el-1087..SELECT 
28720 41 4c 4c 20 38 36 20 44 49 56 20 2d 20 36 38 20  ALL 86 DIV - 68 
28730 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  + + col0 AS col0
28740 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
28750 0d 0a 32 33 0d 0a 33 34 0d 0a 38 38 0d 0a 0d 0a  ..23..34..88....
28760 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
28770 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
28780 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28790 61 62 65 6c 2d 31 30 38 37 0d 0a 53 45 4c 45 43  abel-1087..SELEC
287a0 54 20 41 4c 4c 20 38 36 20 2f 20 2d 20 36 38 20  T ALL 86 / - 68 
287b0 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  + + col0 AS col0
287c0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
287d0 0d 0a 32 33 0d 0a 33 34 0d 0a 38 38 0d 0a 0d 0a  ..23..34..88....
287e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
287f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
28800 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a   + col0 + col0 *
28810 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   - cor0.col1 FRO
28820 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
28830 2d 2d 2d 2d 0d 0a 2d 31 32 36 34 0d 0a 2d 32 31  ----..-1264..-21
28840 30 0d 0a 2d 34 35 32 34 0d 0a 0d 0a 71 75 65 72  0..-4524....quer
28850 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28860 45 43 54 20 41 4c 4c 20 2d 20 28 20 28 20 63 6f  ECT ALL - ( ( co
28870 6c 32 20 29 20 29 20 46 52 4f 4d 20 74 61 62 32  l2 ) ) FROM tab2
28880 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28890 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d  -26..-27..-38...
288a0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
288b0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
288c0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
288d0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
288e0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
288f0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39 30 0d 0a  ort label-1090..
28900 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
28910 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l0 * + cor0.col0
28920 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   * CAST( NULL AS
28930 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 30 20 46   SIGNED ) col0 F
28940 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
28950 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
28960 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
28970 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35  o cd7a7901e47c15
28980 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65  155404aff0d216fe
28990 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  0b....skipif pos
289a0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
289b0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
289c0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
289d0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
289e0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
289f0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
28a00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
28a10 62 65 6c 2d 31 30 39 30 0d 0a 53 45 4c 45 43 54  bel-1090..SELECT
28a20 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b   - cor0.col0 * +
28a30 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 43 41 53   cor0.col0 * CAS
28a40 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
28a50 47 45 52 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20  GER ) col0 FROM 
28a60 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
28a70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
28a80 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64  es hashing to cd
28a90 37 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34  7a7901e47c151554
28aa0 30 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a  04aff0d216fe0b..
28ab0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
28ac0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
28ad0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
28ae0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
28af0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
28b00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28b10 43 54 20 2b 20 2d 20 28 20 2b 20 31 39 20 29 20  CT + - ( + 19 ) 
28b20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
28b30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
28b40 39 0d 0a 2d 31 39 0d 0a 2d 31 39 0d 0a 0d 0a 6f  9..-19..-19....o
28b50 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
28b60 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
28b70 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
28b80 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
28b90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28ba0 74 20 6c 61 62 65 6c 2d 31 30 39 32 0d 0a 53 45  t label-1092..SE
28bb0 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 28  LECT ALL + CAST(
28bc0 20 36 33 20 41 53 20 53 49 47 4e 45 44 20 29 20   63 AS SIGNED ) 
28bd0 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  + + col1 * - col
28be0 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  1 col0 FROM tab0
28bf0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28c00 2d 37 33 33 33 0d 0a 2d 38 32 31 38 0d 0a 2d 39  -7333..-8218..-9
28c10 33 34 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  346....skipif po
28c20 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
28c30 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
28c40 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
28c50 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
28c60 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
28c70 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
28c80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28c90 61 62 65 6c 2d 31 30 39 32 0d 0a 53 45 4c 45 43  abel-1092..SELEC
28ca0 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28 20 36  T ALL + CAST ( 6
28cb0 33 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  3 AS INTEGER ) +
28cc0 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31   + col1 * - col1
28cd0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
28ce0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
28cf0 37 33 33 33 0d 0a 2d 38 32 31 38 0d 0a 2d 39 33  7333..-8218..-93
28d00 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  46....query I ro
28d10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 32  wsort..SELECT 12
28d20 20 2b 20 2b 20 28 20 63 6f 6c 30 20 29 20 41 53   + + ( col0 ) AS
28d30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
28d40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
28d50 39 0d 0a 39 30 0d 0a 39 31 0d 0a 0d 0a 71 75 65  9..90..91....que
28d60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28d70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
28d80 37 34 20 2a 20 2b 20 28 20 2b 20 63 6f 6c 32 20  74 * + ( + col2 
28d90 29 20 2b 20 2b 20 33 39 20 46 52 4f 4d 20 74 61  ) + + 39 FROM ta
28da0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
28db0 0d 0a 2d 32 34 30 33 0d 0a 2d 33 35 0d 0a 2d 36  ..-2403..-35..-6
28dc0 30 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  029....query I r
28dd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
28de0 4c 4c 20 36 39 20 2a 20 63 6f 6c 31 20 41 53 20  LL 69 * col1 AS 
28df0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
28e00 2d 2d 2d 2d 0d 0a 31 31 37 33 0d 0a 32 31 33 39  ----..1173..2139
28e10 0d 0a 34 30 37 31 0d 0a 0d 0a 71 75 65 72 79 20  ..4071....query 
28e20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28e30 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39 38 20  T DISTINCT + 98 
28e40 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  * col1 AS col0 F
28e50 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
28e60 0d 0a 2d 2d 2d 2d 0d 0a 31 36 36 36 0d 0a 33 30  ..----..1666..30
28e70 33 38 0d 0a 35 37 38 32 0d 0a 0d 0a 71 75 65 72  38..5782....quer
28e80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28e90 45 43 54 20 38 32 20 41 53 20 63 6f 6c 32 20 46  ECT 82 AS col2 F
28ea0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41  ROM tab2, tab2 A
28eb0 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  S cor0, tab2 AS 
28ec0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
28ed0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
28ee0 20 39 39 39 32 30 64 39 66 37 63 64 39 63 64 63   99920d9f7cd9cdc
28ef0 63 65 66 39 39 63 66 61 34 35 39 61 65 36 39 34  cef99cfa459ae694
28f00 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
28f10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
28f20 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2a   col2 * + col0 *
28f30 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
28f40 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
28f50 0a 31 31 39 36 35 32 0d 0a 35 31 30 33 34 0d 0a  .119652..51034..
28f60 35 38 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5859....query I 
28f70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28f80 2b 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  + - col2 + - col
28f90 32 20 2a 20 39 20 41 53 20 63 6f 6c 32 20 46 52  2 * 9 AS col2 FR
28fa0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
28fb0 2d 2d 0d 0a 2d 31 30 0d 0a 2d 33 33 30 0d 0a 2d  --..-10..-330..-
28fc0 38 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  820....query I r
28fd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
28fe0 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  LL + - col1 * - 
28ff0 28 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  ( + col2 ) AS co
29000 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
29010 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34  cor0..----..1534
29020 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75  ..646..837....qu
29030 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29040 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20  ELECT cor0.col1 
29050 2a 20 36 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52  * 62 * - col1 FR
29060 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
29070 0a 2d 2d 2d 2d 0d 0a 2d 31 37 39 31 38 0d 0a 2d  .----..-17918..-
29080 32 31 35 38 32 32 0d 0a 2d 35 39 35 38 32 0d 0a  215822..-59582..
29090 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
290a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
290b0 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a  CT col0 + col2 *
290c0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   - col1 AS col1 
290d0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
290e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 36 0d 0a  0..----..-1456..
290f0 2d 35 36 37 0d 0a 2d 38 33 30 0d 0a 0d 0a 6f 6e  -567..-830....on
29100 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
29110 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
29120 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
29130 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
29140 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 33 0d 0a  ort label-1103..
29150 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
29160 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 39  0 + + col1 * + 9
29170 33 20 2b 20 2b 20 63 6f 6c 31 20 44 49 56 20 33  3 + + col1 DIV 3
29180 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  6 AS col2 FROM t
29190 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
291a0 2d 0d 0a 31 36 36 30 0d 0a 32 38 39 30 0d 0a 35  -..1660..2890..5
291b0 35 36 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  566....skipif my
291c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
291d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
291e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 33  wsort label-1103
291f0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
29200 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b  ol0 + + col1 * +
29210 20 39 33 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 33   93 + + col1 / 3
29220 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  6 AS col2 FROM t
29230 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
29240 2d 0d 0a 31 36 36 30 0d 0a 32 38 39 30 0d 0a 35  -..1660..2890..5
29250 35 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  566....query I r
29260 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
29270 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 39 38 20   cor0.col2 * 98 
29280 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
29290 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
292a0 0a 2d 33 32 33 34 0d 0a 2d 38 30 33 36 0d 0a 2d  .-3234..-8036..-
292b0 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
292c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
292d0 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20  STINCT - - col0 
292e0 2a 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20  * + ( cor0.col2 
292f0 2b 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  + + col0 ) FROM 
29300 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
29310 2d 2d 0d 0a 32 33 38 0d 0a 38 31 31 32 0d 0a 39  --..238..8112..9
29320 32 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  243....query I r
29330 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
29340 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 38 36 20   cor0.col2 * 86 
29350 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
29360 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
29370 0a 32 32 33 36 0d 0a 32 33 32 32 0d 0a 33 32 36  .2236..2322..326
29380 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
29390 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
293a0 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   + + col0 * + co
293b0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
293c0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
293d0 0a 31 32 32 35 0d 0a 35 37 36 0d 0a 37 39 32 31  .1225..576..7921
293e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
293f0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
29400 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
29410 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
29420 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
29430 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29440 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
29450 63 6f 6c 32 20 2b 20 2d 20 28 20 35 30 20 29 20  col2 + - ( 50 ) 
29460 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
29470 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
29480 30 34 0d 0a 2d 31 30 37 0d 0a 2d 31 34 36 0d 0a  04..-107..-146..
29490 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
294a0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
294b0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
294c0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
294d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
294e0 30 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  09..SELECT ALL +
294f0 20 63 6f 6c 32 20 44 49 56 20 35 30 20 46 52 4f   col2 DIV 50 FRO
29500 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
29510 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
29520 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
29530 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
29540 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
29550 65 6c 2d 31 31 30 39 0d 0a 53 45 4c 45 43 54 20  el-1109..SELECT 
29560 41 4c 4c 20 2b 20 63 6f 6c 32 20 2f 20 35 30 20  ALL + col2 / 50 
29570 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
29580 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
29590 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
295a0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
295b0 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20  col2 * col0 * - 
295c0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
295d0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
295e0 2d 2d 2d 2d 0d 0a 2d 32 33 33 34 37 32 0d 0a 2d  ----..-233472..-
295f0 34 38 36 0d 0a 2d 36 31 34 34 30 30 0d 0a 0d 0a  486..-614400....
29600 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
29610 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
29620 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
29630 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
29640 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
29650 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29660 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
29670 20 2a 20 2d 20 34 33 20 63 6f 6c 32 20 46 52 4f   * - 43 col2 FRO
29680 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
29690 2d 2d 2d 2d 0d 0a 2d 31 33 33 33 0d 0a 2d 32 35  ----..-1333..-25
296a0 33 37 0d 0a 2d 37 33 31 0d 0a 0d 0a 71 75 65 72  37..-731....quer
296b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
296c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
296d0 20 63 6f 6c 31 20 2b 20 34 34 20 41 53 20 63 6f   col1 + 44 AS co
296e0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
296f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a  cor0..----..54..
29700 35 37 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20  57..70....query 
29710 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29720 54 20 63 6f 6c 30 20 2a 20 28 20 39 37 20 29 20  T col0 * ( 97 ) 
29730 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
29740 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 0d 0a 36 32  0..----..291..62
29750 30 38 0d 0a 37 37 36 30 0d 0a 0d 0a 6f 6e 6c 79  08..7760....only
29760 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
29770 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
29780 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
29790 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
297a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
297b0 61 62 65 6c 2d 31 31 31 34 0d 0a 53 45 4c 45 43  abel-1114..SELEC
297c0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53  T DISTINCT - CAS
297d0 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d  T( NULL AS DECIM
297e0 41 4c 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74  AL ) col1 FROM t
297f0 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
29800 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
29810 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
29820 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
29830 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
29840 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
29850 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
29860 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
29870 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
29880 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
29890 31 31 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  114..SELECT DIST
298a0 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55  INCT - CAST ( NU
298b0 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 63 6f 6c  LL AS REAL ) col
298c0 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
298d0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
298e0 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
298f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29900 20 2d 20 63 6f 6c 31 20 2a 20 35 30 20 41 53 20   - col1 * 50 AS 
29910 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
29920 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
29930 35 35 30 0d 0a 2d 32 39 35 30 0d 0a 2d 38 35 30  550..-2950..-850
29940 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29950 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
29960 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 34 31 20 46  r0.col1 * - 41 F
29970 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
29980 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 36 0d 0a 34 31  ..----..1066..41
29990 30 0d 0a 35 33 33 0d 0a 0d 0a 71 75 65 72 79 20  0..533....query 
299a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
299b0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
299c0 31 20 2a 20 34 35 20 46 52 4f 4d 20 74 61 62 31  1 * 45 FROM tab1
299d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
299e0 2d 31 31 37 30 0d 0a 2d 34 35 30 0d 0a 2d 35 38  -1170..-450..-58
299f0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
29a00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
29a10 20 63 6f 6c 30 20 2b 20 2d 20 30 20 2a 20 63 6f   col0 + - 0 * co
29a20 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
29a30 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a  0..----..3..64..
29a40 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  80....onlyif mys
29a50 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
29a60 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
29a70 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
29a80 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
29a90 6c 2d 31 31 31 39 0d 0a 53 45 4c 45 43 54 20 2b  l-1119..SELECT +
29aa0 20 33 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52   3 DIV + col1 FR
29ab0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
29ac0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
29ad0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
29ae0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
29af0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
29b00 62 65 6c 2d 31 31 31 39 0d 0a 53 45 4c 45 43 54  bel-1119..SELECT
29b10 20 2b 20 33 20 2f 20 2b 20 63 6f 6c 31 20 46 52   + 3 / + col1 FR
29b20 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
29b30 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f  --..0..0..0....o
29b40 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
29b50 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
29b60 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
29b70 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
29b80 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 30 0d  sort label-1120.
29b90 0a 53 45 4c 45 43 54 20 2b 20 35 30 20 2b 20 2b  .SELECT + 50 + +
29ba0 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 30   col1 DIV - col0
29bb0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
29bc0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
29bd0 0d 0a 34 32 0d 0a 35 30 0d 0a 35 30 0d 0a 0d 0a  ..42..50..50....
29be0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
29bf0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
29c00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
29c10 61 62 65 6c 2d 31 31 32 30 0d 0a 53 45 4c 45 43  abel-1120..SELEC
29c20 54 20 2b 20 35 30 20 2b 20 2b 20 63 6f 6c 31 20  T + 50 + + col1 
29c30 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  / - col0 AS col2
29c40 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
29c50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 35 30  r0..----..42..50
29c60 0d 0a 35 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..50....onlyif m
29c70 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
29c80 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
29c90 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
29ca0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
29cb0 62 65 6c 2d 31 31 32 31 0d 0a 53 45 4c 45 43 54  bel-1121..SELECT
29cc0 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56 20 2d 20   ALL col2 DIV - 
29cd0 28 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f  ( + col0 ) AS co
29ce0 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
29cf0 2d 2d 0d 0a 2d 31 0d 0a 2d 31 38 0d 0a 30 0d 0a  --..-1..-18..0..
29d00 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
29d10 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
29d20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29d30 20 6c 61 62 65 6c 2d 31 31 32 31 0d 0a 53 45 4c   label-1121..SEL
29d40 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2f 20 2d  ECT ALL col2 / -
29d50 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63   ( + col0 ) AS c
29d60 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
29d70 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 38 0d 0a 30 0d  ---..-1..-18..0.
29d80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29d90 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62  rt..SELECT + tab
29da0 30 2e 63 6f 6c 30 20 2b 20 38 30 20 46 52 4f 4d  0.col0 + 80 FROM
29db0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   tab0..----..104
29dc0 0d 0a 31 31 35 0d 0a 31 36 39 0d 0a 0d 0a 71 75  ..115..169....qu
29dd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29de0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  ELECT + col2 * c
29df0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d  ol1 * - col2 + -
29e00 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 41   col2 * - col1 A
29e10 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
29e20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29e30 2d 31 31 38 35 36 30 0d 0a 2d 33 31 39 32 30 0d  -118560..-31920.
29e40 0a 2d 37 34 34 31 32 0d 0a 0d 0a 71 75 65 72 79  .-74412....query
29e50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29e60 43 54 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20  CT ( col0 ) * + 
29e70 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  9 AS col2 FROM t
29e80 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
29e90 2d 0d 0a 32 31 36 0d 0a 33 31 35 0d 0a 38 30 31  -..216..315..801
29ea0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29eb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
29ec0 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2d 20  INCT + + col0 - 
29ed0 2b 20 63 6f 6c 30 20 2a 20 38 35 20 2a 20 2d 20  + col0 * 85 * - 
29ee0 28 20 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 6c  ( col2 * + ( col
29ef0 30 20 29 20 29 20 46 52 4f 4d 20 74 61 62 31 20  0 ) ) FROM tab1 
29f00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
29f10 39 38 34 35 31 38 34 0d 0a 34 31 33 31 33 0d 0a  9845184..41313..
29f20 35 32 32 32 34 30 38 30 0d 0a 0d 0a 71 75 65 72  52224080....quer
29f30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29f40 45 43 54 20 41 4c 4c 20 39 30 20 2a 20 63 6f 72  ECT ALL 90 * cor
29f50 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46 52  0.col2 + col2 FR
29f60 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
29f70 0a 2d 2d 2d 2d 0d 0a 32 33 36 36 0d 0a 32 34 35  .----..2366..245
29f80 37 0d 0a 33 34 35 38 0d 0a 0d 0a 6f 6e 6c 79 69  7..3458....onlyi
29f90 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
29fa0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
29fb0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
29fc0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
29fd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
29fe0 62 65 6c 2d 31 31 32 37 0d 0a 53 45 4c 45 43 54  bel-1127..SELECT
29ff0 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
2a000 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  l0 * cor0.col0 *
2a010 20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   - CAST( col1 AS
2a020 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
2a030 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
2a040 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32 35 0d  ..----..-118825.
2a050 0a 2d 34 39 35 33 36 0d 0a 2d 37 32 30 38 31 31  .-49536..-720811
2a060 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2a070 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2a080 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2a090 72 74 20 6c 61 62 65 6c 2d 31 31 32 37 0d 0a 53  rt label-1127..S
2a0a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2a0b0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63   + col0 * cor0.c
2a0c0 6f 6c 30 20 2a 20 2d 20 43 41 53 54 20 28 20 63  ol0 * - CAST ( c
2a0d0 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
2a0e0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2a0f0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
2a100 31 31 38 38 32 35 0d 0a 2d 34 39 35 33 36 0d 0a  118825..-49536..
2a110 2d 37 32 30 38 31 31 0d 0a 0d 0a 71 75 65 72 79  -720811....query
2a120 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2a130 43 54 20 33 32 20 2b 20 63 6f 6c 31 20 46 52 4f  CT 32 + col1 FRO
2a140 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2a150 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 31 32 33 0d 0a  ----..118..123..
2a160 31 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  129....query I r
2a170 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2a180 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  LL - cor0.col1 +
2a190 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 46   col1 * - col0 F
2a1a0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2a1b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 30 0d 0a 2d  ..----..-1360..-
2a1c0 32 34 38 0d 0a 2d 34 36 36 31 0d 0a 0d 0a 71 75  248..-4661....qu
2a1d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a1e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 33  ELECT DISTINCT 3
2a1f0 39 20 2a 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20  9 * col2 - col2 
2a200 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2a210 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2a220 0a 32 30 35 32 0d 0a 32 31 36 36 0d 0a 33 36 34  .2052..2166..364
2a230 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2a240 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2a250 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2d 20 74  TINCT col2 + - t
2a260 61 62 32 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  ab2.col1 * - col
2a270 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
2a280 2d 0d 0a 31 33 38 31 0d 0a 32 34 34 0d 0a 34 36  -..1381..244..46
2a290 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  28....query I ro
2a2a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2a2b0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20  + col2 * col2 * 
2a2c0 2d 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  - ( col2 ) AS co
2a2d0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
2a2e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33  cor0..----..1..3
2a2f0 35 39 33 37 0d 0a 35 35 31 33 36 38 0d 0a 0d 0a  5937..551368....
2a300 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2a310 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63 6f  .SELECT + ( - co
2a320 6c 31 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  l1 ) * cor0.col0
2a330 20 2b 20 2d 20 32 36 20 46 52 4f 4d 20 74 61 62   + - 26 FROM tab
2a340 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2a350 0a 2d 32 30 39 30 0d 0a 2d 33 34 32 31 0d 0a 2d  .-2090..-3421..-
2a360 38 31 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8125....query I 
2a370 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a380 2d 20 28 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20  - ( tab1.col0 * 
2a390 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  + col1 ) FROM ta
2a3a0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d  b1..----..-1040.
2a3b0 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75  .-640..-78....qu
2a3c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a3d0 45 4c 45 43 54 20 2d 20 2b 20 35 32 20 41 53 20  ELECT - + 52 AS 
2a3e0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
2a3f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 0d 0a  or0..----..-52..
2a400 2d 35 32 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72  -52..-52....quer
2a410 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a420 45 43 54 20 41 4c 4c 20 2b 20 37 35 20 41 53 20  ECT ALL + 75 AS 
2a430 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2a440 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
2a450 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  N tab1 AS cor1..
2a460 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
2a470 61 73 68 69 6e 67 20 74 6f 20 32 32 30 34 32 62  ashing to 22042b
2a480 66 64 34 64 37 38 37 34 31 35 34 35 37 61 34 32  fd4d787415457a42
2a490 62 62 39 33 64 34 38 65 65 61 0d 0a 0d 0a 71 75  bb93d48eea....qu
2a4a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a4b0 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c  ELECT col1 * col
2a4c0 30 20 2b 20 33 33 20 41 53 20 63 6f 6c 31 20 46  0 + 33 AS col1 F
2a4d0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2a4e0 31 30 37 33 0d 0a 31 31 31 0d 0a 36 37 33 0d 0a  1073..111..673..
2a4f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2a500 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2a510 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2a520 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2a530 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2a540 33 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  38..SELECT DISTI
2a550 4e 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20  NCT - tab2.col2 
2a560 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  DIV col0 AS col0
2a570 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2a580 0d 0a 2d 33 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ..-3..0....skipi
2a590 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2a5a0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2a5b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2a5c0 31 31 33 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  1138..SELECT DIS
2a5d0 54 49 4e 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c  TINCT - tab2.col
2a5e0 32 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  2 / col0 AS col0
2a5f0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2a600 0d 0a 2d 33 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ..-3..0....skipi
2a610 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2a620 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2a630 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2a640 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2a650 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2a660 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2a670 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 2b 20 74  ( + col0 ) * + t
2a680 61 62 32 2e 63 6f 6c 30 20 63 6f 6c 32 20 46 52  ab2.col0 col2 FR
2a690 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34  OM tab2..----..4
2a6a0 39 0d 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d  9..6084..6241...
2a6b0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2a6c0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2a6d0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2a6e0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2a6f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34  owsort label-114
2a700 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
2a710 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 44  CT - tab0.col1 D
2a720 49 56 20 74 61 62 30 2e 63 6f 6c 32 20 63 6f 6c  IV tab0.col2 col
2a730 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2a740 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 39 37 0d 0a  -..-1..-2..-97..
2a750 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2a760 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2a770 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2a780 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2a790 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
2a7a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2a7b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2a7c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2a7d0 31 31 34 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  1140..SELECT DIS
2a7e0 54 49 4e 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c  TINCT - tab0.col
2a7f0 31 20 2f 20 74 61 62 30 2e 63 6f 6c 32 20 63 6f  1 / tab0.col2 co
2a800 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
2a810 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 39 37 0d  --..-1..-2..-97.
2a820 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2a830 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2a840 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2a850 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2a860 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2a870 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a880 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a  ECT ALL + col0 *
2a890 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 63 6f 6c   col1 * col2 col
2a8a0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2a8b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d  or0..----..3395.
2a8c0 0a 36 36 34 31 31 38 0d 0a 36 38 31 31 32 0d 0a  .664118..68112..
2a8d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a8e0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2a8f0 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  + col0 * + col1 
2a900 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2a910 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
2a920 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32  343..-217..-4602
2a930 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2a940 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
2a950 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 36  .col0 * col2 + 6
2a960 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  8 AS col1 FROM t
2a970 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
2a980 31 30 33 0d 0a 37 33 36 36 0d 0a 38 36 30 0d 0a  103..7366..860..
2a990 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a9a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2a9b0 43 54 20 36 31 20 41 53 20 63 6f 6c 32 20 46 52  CT 61 AS col2 FR
2a9c0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2a9d0 2d 2d 0d 0a 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  --..61....onlyif
2a9e0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2a9f0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2aa00 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2aa10 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2aa20 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2aa30 65 6c 2d 31 31 34 35 0d 0a 53 45 4c 45 43 54 20  el-1145..SELECT 
2aa40 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
2aa50 47 4e 45 44 20 29 20 2b 20 63 6f 72 30 2e 63 6f  GNED ) + cor0.co
2aa60 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  l0 * + col1 AS c
2aa70 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
2aa80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
2aa90 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
2aaa0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2aab0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2aac0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2aad0 6c 61 62 65 6c 2d 31 31 34 35 0d 0a 53 45 4c 45  label-1145..SELE
2aae0 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  CT CAST ( NULL A
2aaf0 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f  S INTEGER ) + co
2ab00 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31  r0.col0 * + col1
2ab10 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2ab20 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2ab30 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
2ab40 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
2ab50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2ab60 72 30 2e 63 6f 6c 31 20 2b 20 31 38 20 41 53 20  r0.col1 + 18 AS 
2ab70 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20  col1 FROM tab2, 
2ab80 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
2ab90 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
2aba0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
2abb0 69 6e 67 20 74 6f 20 63 32 30 35 34 30 63 64 38  ing to c20540cd8
2abc0 31 31 38 66 37 66 38 31 34 65 62 39 34 39 63 36  118f7f814eb949c6
2abd0 39 61 38 36 66 38 64 0d 0a 0d 0a 73 6b 69 70 69  9a86f8d....skipi
2abe0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2abf0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2ac00 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2ac10 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2ac20 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2ac30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2ac40 49 4e 43 54 20 2b 20 31 20 63 6f 6c 31 20 46 52  INCT + 1 col1 FR
2ac50 4f 4d 20 74 61 62 30 20 63 6f 72 30 20 43 52 4f  OM tab0 cor0 CRO
2ac60 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20  SS JOIN tab2 AS 
2ac70 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d  cor1..----..1...
2ac80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ac90 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
2aca0 2b 20 63 6f 6c 30 20 2a 20 31 35 20 41 53 20 63  + col0 * 15 AS c
2acb0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2acc0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31   cor0..----..101
2acd0 37 0d 0a 31 32 39 36 0d 0a 39 39 0d 0a 0d 0a 71  7..1296..99....q
2ace0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2acf0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2ad00 2d 20 2b 20 32 38 20 41 53 20 63 6f 6c 31 20 46  - + 28 AS col1 F
2ad10 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2ad20 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30   CROSS JOIN tab0
2ad30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
2ad40 2d 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -28....query I r
2ad50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2ad60 6f 6c 32 20 2a 20 2b 20 32 37 20 41 53 20 63 6f  ol2 * + 27 AS co
2ad70 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
2ad80 2d 2d 0d 0a 31 30 32 36 0d 0a 37 30 32 0d 0a 37  --..1026..702..7
2ad90 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  29....query I ro
2ada0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2adb0 74 61 62 32 2e 63 6f 6c 31 20 2a 20 28 20 34 20  tab2.col1 * ( 4 
2adc0 29 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20  ) * - tab2.col1 
2add0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2ade0 0a 31 31 35 36 0d 0a 31 33 39 32 34 0d 0a 33 38  .1156..13924..38
2adf0 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  44....query I ro
2ae00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2ae10 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  col2 + col2 * - 
2ae20 28 20 63 6f 6c 30 20 29 20 2d 20 2d 20 28 20 63  ( col0 ) - - ( c
2ae30 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 29 20 46  ol1 * - col0 ) F
2ae40 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2ae50 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 31 35 0d 0a  ..----..-15315..
2ae60 2d 32 38 32 33 0d 0a 2d 33 34 32 39 0d 0a 0d 0a  -2823..-3429....
2ae70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ae80 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
2ae90 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   + col1 + + col2
2aea0 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30   - col1 * + cor0
2aeb0 2e 63 6f 6c 32 20 2a 20 2b 20 32 35 20 41 53 20  .col2 * + 25 AS 
2aec0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
2aed0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2aee0 39 34 35 36 37 0d 0a 2d 35 38 31 39 0d 0a 2d 37  94567..-5819..-7
2aef0 32 39 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  2981....onlyif m
2af00 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2af10 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2af20 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2af30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2af40 62 65 6c 2d 31 31 35 34 0d 0a 53 45 4c 45 43 54  bel-1154..SELECT
2af50 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 37 34   + col1 DIV + 74
2af60 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32   + ( + cor0.col2
2af70 20 29 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   ) + col2 AS col
2af80 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2af90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a  or0..----..165..
2afa0 33 0d 0a 36 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..67....skipif 
2afb0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2afc0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2afd0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2afe0 35 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  54..SELECT + col
2aff0 31 20 2f 20 2b 20 37 34 20 2b 20 28 20 2b 20 63  1 / + 74 + ( + c
2b000 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 63 6f 6c  or0.col2 ) + col
2b010 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
2b020 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2b030 2d 0d 0a 31 36 35 0d 0a 33 0d 0a 36 37 0d 0a 0d  -..165..3..67...
2b040 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2b050 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2b060 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2b070 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2b080 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2b090 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b0a0 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  T + cor0.col1 * 
2b0b0 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2d 20  - col0 + col1 - 
2b0c0 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col1 col0 FROM t
2b0d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2b0e0 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d  -..-2064..-3395.
2b0f0 0a 2d 38 30 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-8099....onlyif
2b100 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2b110 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2b120 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2b130 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2b140 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2b150 65 6c 2d 31 31 35 36 0d 0a 53 45 4c 45 43 54 20  el-1156..SELECT 
2b160 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28 20 4e  col0 * + CAST( N
2b170 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
2b180 2f 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  / col1 + - col0 
2b190 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2b1a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2b1b0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
2b1c0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
2b1d0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2b1e0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2b1f0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 36 0d 0a  ort label-1156..
2b200 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20  SELECT col0 * + 
2b210 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
2b220 4e 54 45 47 45 52 20 29 20 2f 20 63 6f 6c 31 20  NTEGER ) / col1 
2b230 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  + - col0 AS col1
2b240 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2b250 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
2b260 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e  NULL..NULL....on
2b270 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2b280 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2b290 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2b2a0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2b2b0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 37 0d 0a  ort label-1157..
2b2c0 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 28 20 2d  SELECT + ( - ( -
2b2d0 20 63 6f 6c 32 20 29 20 29 20 44 49 56 20 63 6f   col2 ) ) DIV co
2b2e0 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
2b2f0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2b300 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 73 6b 69  .0..1..18....ski
2b310 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2b320 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2b330 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2b340 6c 2d 31 31 35 37 0d 0a 53 45 4c 45 43 54 20 2b  l-1157..SELECT +
2b350 20 28 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20   ( - ( - col2 ) 
2b360 29 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  ) / cor0.col0 FR
2b370 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2b380 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d  .----..0..1..18.
2b390 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b3a0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
2b3b0 30 2e 63 6f 6c 30 20 2a 20 2b 20 35 33 20 41 53  0.col0 * + 53 AS
2b3c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c   col0 FROM tab2,
2b3d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
2b3e0 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
2b3f0 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
2b400 68 69 6e 67 20 74 6f 20 65 30 61 33 39 64 33 35  hing to e0a39d35
2b410 32 30 33 34 36 33 62 38 63 34 32 64 66 31 61 33  203463b8c42df1a3
2b420 61 36 65 62 64 35 37 38 0d 0a 0d 0a 6f 6e 6c 79  a6ebd578....only
2b430 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2b440 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2b450 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2b460 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b470 74 20 6c 61 62 65 6c 2d 31 31 35 39 0d 0a 53 45  t label-1159..SE
2b480 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  LECT + + cor0.co
2b490 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 41 53  l2 DIV + col1 AS
2b4a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
2b4b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2b4c0 0d 0a 30 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..2....skipif
2b4d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2b4e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2b4f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2b500 31 35 39 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  159..SELECT + + 
2b510 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2b 20 63 6f  cor0.col2 / + co
2b520 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
2b530 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2b540 2d 2d 0d 0a 30 0d 0a 30 0d 0a 32 0d 0a 0d 0a 71  --..0..0..2....q
2b550 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b560 53 45 4c 45 43 54 20 2d 20 28 20 32 38 20 29 20  SELECT - ( 28 ) 
2b570 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
2b580 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2b590 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 36 31 0d 0a  ..----..-4..61..
2b5a0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2b5b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 39 20  sort..SELECT 89 
2b5c0 2a 20 37 34 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  * 74 * - col2 + 
2b5d0 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53 20  - ( + col1 ) AS 
2b5e0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2b5f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
2b600 35 35 36 37 30 0d 0a 2d 33 37 35 34 31 32 0d 0a  55670..-375412..
2b610 2d 36 33 32 32 36 39 0d 0a 0d 0a 71 75 65 72 79  -632269....query
2b620 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b630 43 54 20 2d 20 37 32 20 2a 20 2d 20 63 6f 6c 31  CT - 72 * - col1
2b640 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2b650 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 39 32 0d 0a  r0..----..6192..
2b660 36 35 35 32 0d 0a 36 39 38 34 0d 0a 0d 0a 71 75  6552..6984....qu
2b670 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b680 45 4c 45 43 54 20 2d 20 2b 20 28 20 63 6f 6c 32  ELECT - + ( col2
2b690 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   ) + cor0.col1 F
2b6a0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
2b6b0 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d  ---..-28..-47..-
2b6c0 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
2b6d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2b6e0 4c 20 2d 20 2b 20 28 20 2d 20 28 20 63 6f 6c 31  L - + ( - ( col1
2b6f0 20 29 20 29 20 2b 20 63 6f 6c 30 20 41 53 20 63   ) ) + col0 AS c
2b700 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2b710 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d   cor0..----..29.
2b720 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79  .74..93....query
2b730 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b740 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
2b750 63 6f 6c 30 20 2a 20 34 30 20 41 53 20 63 6f 6c  col0 * 40 AS col
2b760 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
2b770 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 30 0d  or0..----..-120.
2b780 0a 2d 32 35 36 30 0d 0a 2d 33 32 30 30 0d 0a 0d  .-2560..-3200...
2b790 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2b7a0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2b7b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b7c0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
2b7d0 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2a 20  - cor0.col1 ) * 
2b7e0 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 20  + col1 + + CAST 
2b7f0 28 20 2d 20 63 6f 6c 31 20 41 53 20 52 45 41 4c  ( - col1 AS REAL
2b800 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c   ) * col2 AS col
2b810 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2b820 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 35 35 38 0d  or0..----..4558.
2b830 0a 38 31 39 0d 0a 39 33 31 32 0d 0a 0d 0a 71 75  .819..9312....qu
2b840 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b850 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2b860 20 37 32 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f   72 + col1 AS co
2b870 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
2b880 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a 2d 34  0..----..-13..-4
2b890 31 0d 0a 2d 35 35 0d 0a 0d 0a 71 75 65 72 79 20  1..-55....query 
2b8a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b8b0 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63  T ALL + col1 * c
2b8c0 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  ol1 + col0 * + c
2b8d0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
2b8e0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2b8f0 0d 0a 33 37 34 38 0d 0a 37 38 34 39 0d 0a 38 33  ..3748..7849..83
2b900 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2b910 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2b920 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b  TINCT + - col2 +
2b930 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2d 20 2d   col1 * col2 - -
2b940 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
2b950 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2b960 0a 2d 2d 2d 2d 0d 0a 31 32 33 32 0d 0a 31 33 35  .----..1232..135
2b970 33 0d 0a 35 37 37 0d 0a 0d 0a 71 75 65 72 79 20  3..577....query 
2b980 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b990 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 28  T DISTINCT + + (
2b9a0 20 36 33 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41   63 ) * + col0 A
2b9b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
2b9c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b9d0 31 38 39 0d 0a 34 30 33 32 0d 0a 35 30 34 30 0d  189..4032..5040.
2b9e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b9f0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2ba00 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  NCT - cor0.col1 
2ba10 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53  * col1 + col1 AS
2ba20 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
2ba30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2ba40 31 35 36 0d 0a 2d 36 35 30 0d 0a 2d 39 30 0d 0a  156..-650..-90..
2ba50 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2ba60 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2ba70 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2ba80 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2ba90 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2baa0 37 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  72..SELECT ALL c
2bab0 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 63 6f 6c  ol1 DIV col0 col
2bac0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2bad0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d  or0..----..1..2.
2bae0 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .3....skipif pos
2baf0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2bb00 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2bb10 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2bb20 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
2bb30 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2bb40 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2bb50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2bb60 62 65 6c 2d 31 31 37 32 0d 0a 53 45 4c 45 43 54  bel-1172..SELECT
2bb70 20 41 4c 4c 20 63 6f 6c 31 20 2f 20 63 6f 6c 30   ALL col1 / col0
2bb80 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2bb90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2bba0 0d 0a 32 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79 20  ..2..3....query 
2bbb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bbc0 54 20 41 4c 4c 20 38 36 20 2a 20 63 6f 6c 31 20  T ALL 86 * col1 
2bbd0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2bbe0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 38 0d 0a 32  1..----..1118..2
2bbf0 32 33 36 0d 0a 38 36 30 0d 0a 0d 0a 71 75 65 72  236..860....quer
2bc00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2bc10 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2d  ECT ALL - col1 -
2bc20 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
2bc30 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2bc40 2d 0d 0a 2d 31 30 39 0d 0a 2d 36 37 0d 0a 2d 38  -..-109..-67..-8
2bc50 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
2bc60 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2bc70 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2bc80 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2bc90 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2bca0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2bcb0 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20 28  ELECT col0 + + (
2bcc0 20 2b 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31   + col0 ) * col1
2bcd0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
2bce0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2bcf0 34 32 32 0d 0a 32 32 34 0d 0a 34 36 38 30 0d 0a  422..224..4680..
2bd00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2bd10 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
2bd20 20 2d 20 31 37 20 2a 20 63 6f 6c 30 20 46 52 4f   - 17 * col0 FRO
2bd30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2bd40 2d 2d 2d 2d 0d 0a 2d 31 34 32 34 0d 0a 2d 33 38  ----..-1424..-38
2bd50 34 0d 0a 2d 35 36 30 0d 0a 0d 0a 71 75 65 72 79  4..-560....query
2bd60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2bd70 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
2bd80 2e 63 6f 6c 31 20 2a 20 2b 20 36 35 20 46 52 4f  .col1 * + 65 FRO
2bd90 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
2bda0 2d 0d 0a 31 36 39 30 0d 0a 36 35 30 0d 0a 38 34  -..1690..650..84
2bdb0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
2bdc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 30 20  sort..SELECT 30 
2bdd0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  + + cor0.col0 FR
2bde0 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
2bdf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
2be00 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2be10 20 34 36 38 31 33 63 36 64 39 33 30 63 37 62 61   46813c6d930c7ba
2be20 33 31 38 37 38 39 65 35 62 30 63 33 30 37 65 34  318789e5b0c307e4
2be30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2be40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2be50 54 49 4e 43 54 20 2d 20 28 20 63 6f 6c 31 20 29  TINCT - ( col1 )
2be60 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   * + cor0.col2 +
2be70 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
2be80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2be90 31 31 35 32 0d 0a 2d 31 33 35 30 0d 0a 2d 35 31  1152..-1350..-51
2bea0 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
2beb0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2bec0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2bed0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2bee0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2bef0 2d 31 31 38 30 0d 0a 53 45 4c 45 43 54 20 44 49  -1180..SELECT DI
2bf00 53 54 49 4e 43 54 20 63 6f 6c 32 20 44 49 56 20  STINCT col2 DIV 
2bf10 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  col1 - col1 FROM
2bf20 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   tab2..----..-15
2bf30 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 73 6b  ..-31..-59....sk
2bf40 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2bf50 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2bf60 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2bf70 65 6c 2d 31 31 38 30 0d 0a 53 45 4c 45 43 54 20  el-1180..SELECT 
2bf80 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2f 20  DISTINCT col2 / 
2bf90 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  col1 - col1 FROM
2bfa0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   tab2..----..-15
2bfb0 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71 75  ..-31..-59....qu
2bfc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2bfd0 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 30 20  ELECT tab1.col0 
2bfe0 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  * + col0 * col0 
2bff0 2b 20 63 6f 6c 31 20 2b 20 31 31 20 2a 20 63 6f  + col1 + 11 * co
2c000 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
2c010 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 36 32 32  tab1..----..2622
2c020 36 34 0d 0a 33 33 39 0d 0a 35 31 32 31 35 36 0d  64..339..512156.
2c030 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c040 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2c050 4e 43 54 20 2b 20 2b 20 36 34 20 2b 20 63 6f 72  NCT + + 64 + cor
2c060 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  0.col1 AS col1 F
2c070 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
2c080 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
2c090 30 0d 0a 31 35 35 0d 0a 31 36 31 0d 0a 0d 0a 71  0..155..161....q
2c0a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c0b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2c0c0 2b 20 63 6f 6c 32 20 2d 20 34 20 2a 20 2d 20 63  + col2 - 4 * - c
2c0d0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
2c0e0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36   tab2..----..106
2c0f0 0d 0a 31 35 31 0d 0a 32 36 32 0d 0a 0d 0a 6f 6e  ..151..262....on
2c100 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2c110 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2c120 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2c130 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2c140 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 34 0d 0a  ort label-1184..
2c150 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
2c160 31 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 39 36 20  1 * + col0 - 96 
2c170 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  DIV - col1 AS co
2c180 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
2c190 2d 2d 0d 0a 2d 31 33 33 38 0d 0a 2d 32 31 34 0d  --..-1338..-214.
2c1a0 0a 2d 34 36 30 31 0d 0a 0d 0a 73 6b 69 70 69 66  .-4601....skipif
2c1b0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2c1c0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2c1d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2c1e0 31 38 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  184..SELECT ALL 
2c1f0 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  - col1 * + col0 
2c200 2d 20 39 36 20 2f 20 2d 20 63 6f 6c 31 20 41 53  - 96 / - col1 AS
2c210 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
2c220 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 38 0d 0a 2d 32  .----..-1338..-2
2c230 31 34 0d 0a 2d 34 36 30 31 0d 0a 0d 0a 71 75 65  14..-4601....que
2c240 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c250 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  LECT - col1 + - 
2c260 37 31 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  71 * col0 + - co
2c270 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
2c280 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 39  tab2..----..-559
2c290 0d 0a 2d 35 36 34 33 0d 0a 2d 35 36 35 36 0d 0a  ..-5643..-5656..
2c2a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c2b0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d  t..SELECT col0 -
2c2c0 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46   - col2 * col1 F
2c2d0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2c2e0 31 33 32 0d 0a 32 38 36 32 0d 0a 37 35 35 31 0d  132..2862..7551.
2c2f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c300 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39 38 20  rt..SELECT - 98 
2c310 2a 20 32 31 20 46 52 4f 4d 20 74 61 62 30 2c 20  * 21 FROM tab0, 
2c320 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2c330 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2c340 68 69 6e 67 20 74 6f 20 61 66 35 34 38 36 32 32  hing to af548622
2c350 38 61 37 63 64 38 63 61 65 38 38 38 39 64 34 37  8a7cd8cae8889d47
2c360 62 35 35 33 61 31 30 65 0d 0a 0d 0a 71 75 65 72  b553a10e....quer
2c370 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c380 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
2c390 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  or0.col2 + col2 
2c3a0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2c3b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2c3c0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
2c3d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2c3e0 4c 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 39 20 46  L - col2 * - 9 F
2c3f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2c400 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34 0d 0a 32 34 33  ..----..234..243
2c410 0d 0a 33 34 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..342....onlyif 
2c420 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2c430 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2c440 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2c450 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2c460 61 62 65 6c 2d 31 31 39 30 0d 0a 53 45 4c 45 43  abel-1190..SELEC
2c470 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72  T DISTINCT + cor
2c480 30 2e 63 6f 6c 31 20 2a 20 2d 20 36 20 2b 20 2b  0.col1 * - 6 + +
2c490 20 31 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20   10 + cor0.col1 
2c4a0 44 49 56 20 2b 20 39 34 20 46 52 4f 4d 20 74 61  DIV + 94 FROM ta
2c4b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2c4c0 0d 0a 2d 31 34 36 0d 0a 2d 35 30 0d 0a 2d 36 38  ..-146..-50..-68
2c4d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2c4e0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2c4f0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2c500 72 74 20 6c 61 62 65 6c 2d 31 31 39 30 0d 0a 53  rt label-1190..S
2c510 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2c520 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 36   cor0.col1 * - 6
2c530 20 2b 20 2b 20 31 30 20 2b 20 63 6f 72 30 2e 63   + + 10 + cor0.c
2c540 6f 6c 31 20 2f 20 2b 20 39 34 20 46 52 4f 4d 20  ol1 / + 94 FROM 
2c550 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2c560 2d 2d 0d 0a 2d 31 34 36 0d 0a 2d 35 30 0d 0a 2d  --..-146..-50..-
2c570 36 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  68....skipif pos
2c580 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2c590 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2c5a0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2c5b0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2c5c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c5d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2c5e0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30  cor0.col2 + col0
2c5f0 20 2a 20 2b 20 39 32 20 2a 20 63 6f 6c 30 20 63   * + 92 * col0 c
2c600 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
2c610 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 37 30 31  r0..----..112701
2c620 0d 0a 35 33 30 32 35 0d 0a 37 32 38 38 31 34 0d  ..53025..728814.
2c630 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c640 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2c650 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 34 35 20  NCT - col0 * 45 
2c660 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + - cor0.col2 * 
2c670 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52  + col0 * col1 FR
2c680 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2c690 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 31 36 32 0d 0a  .----..-123162..
2c6a0 2d 35 34 35 38 39 0d 0a 2d 36 31 37 34 0d 0a 0d  -54589..-6174...
2c6b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c6c0 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
2c6d0 6c 32 20 2a 20 38 39 20 46 52 4f 4d 20 74 61 62  l2 * 89 FROM tab
2c6e0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2c6f0 0a 34 38 30 36 0d 0a 35 30 37 33 0d 0a 38 35 34  .4806..5073..854
2c700 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2c710 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2c720 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63  TINCT col2 * - c
2c730 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ol0 + - col2 AS 
2c740 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
2c750 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a  or0..----..-36..
2c760 2d 37 33 38 30 0d 0a 2d 38 32 35 0d 0a 0d 0a 71  -7380..-825....q
2c770 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c780 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
2c790 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29  ol2 + - ( col0 )
2c7a0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2c7b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2c7c0 0d 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a  ..-7..16..51....
2c7d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2c7e0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2c7f0 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30   - col2 + + cor0
2c800 2e 63 6f 6c 31 20 2a 20 2b 20 39 36 20 46 52 4f  .col1 * + 96 FRO
2c810 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2c820 2d 2d 2d 2d 0d 0a 31 35 39 34 0d 0a 32 39 34 39  ----..1594..2949
2c830 0d 0a 35 36 33 38 0d 0a 0d 0a 71 75 65 72 79 20  ..5638....query 
2c840 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c850 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 2d  T ALL - col2 + -
2c860 20 32 32 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f   22 - - col2 FRO
2c870 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2c880 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 32 32 0d 0a  ----..-22..-22..
2c890 2d 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -22....query I r
2c8a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2c8b0 20 2d 20 33 38 20 2a 20 63 6f 6c 32 20 41 53 20   - 38 * col2 AS 
2c8c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
2c8d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2c8e0 32 35 34 0d 0a 2d 33 31 31 36 0d 0a 2d 33 38 0d  254..-3116..-38.
2c8f0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2c900 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2c910 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2c920 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2c930 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2c940 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c950 45 43 54 20 2d 20 34 39 20 2b 20 63 6f 6c 32 20  ECT - 49 + col2 
2c960 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f  * + cor0.col1 co
2c970 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2c980 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 35  cor0..----..1485
2c990 0d 0a 35 39 37 0d 0a 37 38 38 0d 0a 0d 0a 71 75  ..597..788....qu
2c9a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c9b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2c9c0 20 39 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   90 AS col0 FROM
2c9d0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
2c9e0 0d 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-90....query I
2c9f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ca00 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2a 20   ALL - + col0 * 
2ca10 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  col0 + col2 + co
2ca20 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
2ca30 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2ca40 2d 2d 0d 0a 2d 31 31 38 39 0d 0a 2d 35 31 39 0d  --..-1189..-519.
2ca50 0a 2d 37 37 35 30 0d 0a 0d 0a 71 75 65 72 79 20  .-7750....query 
2ca60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ca70 54 20 34 31 20 2a 20 31 37 20 41 53 20 63 6f 6c  T 41 * 17 AS col
2ca80 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2ca90 2d 0d 0a 36 39 37 0d 0a 36 39 37 0d 0a 36 39 37  -..697..697..697
2caa0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2cab0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2cac0 49 4e 43 54 20 35 33 20 46 52 4f 4d 20 74 61 62  INCT 53 FROM tab
2cad0 32 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  2, tab2 cor0..--
2cae0 2d 2d 0d 0a 35 33 0d 0a 0d 0a 73 6b 69 70 69 66  --..53....skipif
2caf0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2cb00 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2cb10 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2cb20 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2cb30 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
2cb40 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63  rt..SELECT - ( c
2cb50 6f 6c 31 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 ) col1 FROM 
2cb60 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d  tab0..----..-86.
2cb70 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 6f 6e 6c  .-91..-97....onl
2cb80 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2cb90 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2cba0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2cbb0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2cbc0 72 74 20 6c 61 62 65 6c 2d 31 32 30 35 0d 0a 53  rt label-1205..S
2cbd0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2cbe0 20 28 20 37 31 20 29 20 44 49 56 20 2d 20 63 6f   ( 71 ) DIV - co
2cbf0 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  r0.col0 AS col2 
2cc00 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
2cc10 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
2cc20 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor1..----..0..
2cc30 31 0d 0a 32 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..23....skipif 
2cc40 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2cc50 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2cc60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2cc70 30 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  05..SELECT DISTI
2cc80 4e 43 54 20 2d 20 28 20 37 31 20 29 20 2f 20 2d  NCT - ( 71 ) / -
2cc90 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
2cca0 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l2 FROM tab2, ta
2ccb0 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b1 AS cor0, tab1
2ccc0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
2ccd0 30 0d 0a 31 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72  0..1..23....quer
2cce0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ccf0 45 43 54 20 33 39 20 2b 20 63 6f 6c 32 20 46 52  ECT 39 + col2 FR
2cd00 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
2cd10 32 31 0d 0a 34 30 0d 0a 37 32 0d 0a 0d 0a 71 75  21..40..72....qu
2cd20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2cd30 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 38 39  ELECT ALL - - 89
2cd40 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 41   * - tab1.col2 A
2cd50 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
2cd60 2c 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  , tab2, tab1 AS 
2cd70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
2cd80 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2cd90 20 34 30 62 31 31 36 64 63 63 30 39 65 36 34 61   40b116dcc09e64a
2cda0 32 32 38 61 31 66 36 66 31 30 61 32 34 39 33 32  228a1f6f10a24932
2cdb0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
2cdc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34  sort..SELECT - 4
2cdd0 37 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  7 FROM tab1, tab
2cde0 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
2cdf0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
2ce00 20 68 61 73 68 69 6e 67 20 74 6f 20 61 34 64 33   hashing to a4d3
2ce10 61 30 32 63 33 37 36 63 35 32 64 64 62 30 61 33  a02c376c52ddb0a3
2ce20 38 61 38 30 31 66 37 62 35 30 64 35 0d 0a 0d 0a  8a801f7b50d5....
2ce30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ce40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61  .SELECT ALL + ta
2ce50 62 32 2e 63 6f 6c 31 20 2a 20 2d 20 74 61 62 32  b2.col1 * - tab2
2ce60 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f  .col0 * col0 FRO
2ce70 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
2ce80 30 36 30 39 37 0d 0a 2d 31 35 31 39 0d 0a 2d 33  06097..-1519..-3
2ce90 35 38 39 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  58956....query I
2cea0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ceb0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d   - cor0.col1 + -
2cec0 20 38 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   84 AS col1 FROM
2ced0 20 74 61 62 32 2c 20 74 61 62 32 20 63 6f 72 30   tab2, tab2 cor0
2cee0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
2cef0 20 68 61 73 68 69 6e 67 20 74 6f 20 61 33 34 31   hashing to a341
2cf00 63 30 61 34 37 64 39 31 61 31 37 32 63 65 36 36  c0a47d91a172ce66
2cf10 63 32 66 66 64 37 31 31 30 35 36 65 0d 0a 0d 0a  c2ffd711056e....
2cf20 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2cf30 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2cf40 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2cf50 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2cf60 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2cf70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2cf80 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 63 6f   ALL - col2 * co
2cf90 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
2cfa0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
2cfb0 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30  62..-3648..-7680
2cfc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2cfd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2cfe0 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  r0.col1 AS col2 
2cff0 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
2d000 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
2d010 20 63 6f 72 31 2c 20 74 61 62 31 2c 20 74 61 62   cor1, tab1, tab
2d020 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  2 AS cor2..----.
2d030 0a 32 34 33 20 76 61 6c 75 65 73 20 68 61 73 68  .243 values hash
2d040 69 6e 67 20 74 6f 20 64 62 61 30 36 32 39 32 31  ing to dba062921
2d050 32 64 64 36 62 66 30 33 63 32 38 33 34 61 32 37  2dd6bf03c2834a27
2d060 64 30 62 30 37 66 62 0d 0a 0d 0a 71 75 65 72 79  d0b07fb....query
2d070 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d080 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33 35  CT DISTINCT + 35
2d090 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   * col0 AS col1 
2d0a0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2d0b0 0a 31 30 35 0d 0a 32 32 34 30 0d 0a 32 38 30 30  .105..2240..2800
2d0c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d0d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
2d0e0 2b 20 63 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c  + col0 ) * - col
2d0f0 30 20 2a 20 37 33 20 46 52 4f 4d 20 74 61 62 30  0 * 73 FROM tab0
2d100 0d 0a 2d 2d 2d 2d 0d 0a 34 32 30 34 38 0d 0a 35  ..----..42048..5
2d110 37 38 32 33 33 0d 0a 38 39 34 32 35 0d 0a 0d 0a  78233..89425....
2d120 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
2d130 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
2d140 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
2d150 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
2d160 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
2d170 72 74 20 6c 61 62 65 6c 2d 31 32 31 35 0d 0a 53  rt label-1215..S
2d180 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 4e 55  ELECT - CAST( NU
2d190 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f  LL AS SIGNED ) /
2d1a0 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f   tab2.col0 AS co
2d1b0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
2d1c0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2d1d0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2d1e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2d1f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2d200 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31  owsort label-121
2d210 35 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  5..SELECT - CAST
2d220 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
2d230 45 52 20 29 20 2f 20 74 61 62 32 2e 63 6f 6c 30  ER ) / tab2.col0
2d240 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2d250 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b2..----..NULL..
2d260 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e  NULL..NULL....on
2d270 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2d280 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2d290 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2d2a0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2d2b0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 36 0d 0a  ort label-1216..
2d2c0 53 45 4c 45 43 54 20 2b 20 35 30 20 44 49 56 20  SELECT + 50 DIV 
2d2d0 2d 20 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  - 4 AS col2 FROM
2d2e0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   tab2..----..-12
2d2f0 0d 0a 2d 31 32 0d 0a 2d 31 32 0d 0a 0d 0a 73 6b  ..-12..-12....sk
2d300 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2d310 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2d320 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2d330 65 6c 2d 31 32 31 36 0d 0a 53 45 4c 45 43 54 20  el-1216..SELECT 
2d340 2b 20 35 30 20 2f 20 2d 20 34 20 41 53 20 63 6f  + 50 / - 4 AS co
2d350 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
2d360 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31 32 0d 0a 2d 31  --..-12..-12..-1
2d370 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2d380 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28  sort..SELECT + (
2d390 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 31   + col1 ) * col1
2d3a0 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + + col2 FROM t
2d3b0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
2d3c0 31 35 37 0d 0a 32 36 35 0d 0a 37 33 30 0d 0a 0d  157..265..730...
2d3d0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2d3e0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2d3f0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2d400 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2d410 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2d420 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 38 0d 0a  ort label-1218..
2d430 53 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c  SELECT CAST( NUL
2d440 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  L AS SIGNED ) * 
2d450 63 6f 6c 32 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  col2 - cor0.col2
2d460 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
2d470 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2d480 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2d490 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
2d4a0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2d4b0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2d4c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 38  wsort label-1218
2d4d0 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20  ..SELECT CAST ( 
2d4e0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
2d4f0 29 20 2a 20 63 6f 6c 32 20 2d 20 63 6f 72 30 2e  ) * col2 - cor0.
2d500 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52  col2 * - col0 FR
2d510 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2d520 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
2d530 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  L..NULL....onlyi
2d540 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2d550 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2d560 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2d570 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d580 20 6c 61 62 65 6c 2d 31 32 31 39 0d 0a 53 45 4c   label-1219..SEL
2d590 45 43 54 20 41 4c 4c 20 2b 20 36 32 20 44 49 56  ECT ALL + 62 DIV
2d5a0 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
2d5b0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
2d5c0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2d5d0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2d5e0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2d5f0 72 74 20 6c 61 62 65 6c 2d 31 32 31 39 0d 0a 53  rt label-1219..S
2d600 45 4c 45 43 54 20 41 4c 4c 20 2b 20 36 32 20 2f  ELECT ALL + 62 /
2d610 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
2d620 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
2d630 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d640 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2d650 2b 20 63 6f 6c 30 20 2b 20 2d 20 38 33 20 46 52  + col0 + - 83 FR
2d660 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2d670 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 35 0d 0a 2d  .----..-4..-5..-
2d680 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  76....onlyif mys
2d690 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2d6a0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2d6b0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2d6c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2d6d0 6c 2d 31 32 32 31 0d 0a 53 45 4c 45 43 54 20 2d  l-1221..SELECT -
2d6e0 20 31 33 20 44 49 56 20 63 6f 6c 32 20 2d 20 63   13 DIV col2 - c
2d6f0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
2d700 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2d710 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a  r0..----..-110..
2d720 2d 38 36 0d 0a 2d 39 31 0d 0a 0d 0a 73 6b 69 70  -86..-91....skip
2d730 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2d740 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2d750 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d760 2d 31 32 32 31 0d 0a 53 45 4c 45 43 54 20 2d 20  -1221..SELECT - 
2d770 31 33 20 2f 20 63 6f 6c 32 20 2d 20 63 6f 72 30  13 / col2 - cor0
2d780 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
2d790 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2d7a0 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 38 36  .----..-110..-86
2d7b0 0d 0a 2d 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-91....query I
2d7c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d7d0 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   + - col2 + col1
2d7e0 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 31 20 2b 20   + + ( - col1 + 
2d7f0 2b 20 63 6f 6c 31 20 29 20 2a 20 2d 20 36 33 20  + col1 ) * - 63 
2d800 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2d810 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34  0..----..-28..-4
2d820 37 0d 0a 2d 38 33 0d 0a 0d 0a 73 6b 69 70 69 66  7..-83....skipif
2d830 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2d840 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2d850 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2d860 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2d870 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
2d880 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2d890 4e 43 54 20 38 30 20 2a 20 63 6f 72 30 2e 63 6f  NCT 80 * cor0.co
2d8a0 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
2d8b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2d8c0 0a 31 39 32 30 0d 0a 32 38 30 30 0d 0a 37 31 32  .1920..2800..712
2d8d0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2d8e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2d8f0 54 49 4e 43 54 20 2d 20 31 33 20 2a 20 63 6f 6c  TINCT - 13 * col
2d900 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
2d910 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 0d 0a 2d 31  ..----..-130..-1
2d920 36 39 0d 0a 2d 33 33 38 0d 0a 0d 0a 71 75 65 72  69..-338....quer
2d930 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d940 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63  ECT ALL col0 + c
2d950 6f 6c 30 20 2a 20 38 33 20 46 52 4f 4d 20 74 61  ol0 * 83 FROM ta
2d960 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2d970 0d 0a 35 38 38 0d 0a 36 35 35 32 0d 0a 36 36 33  ..588..6552..663
2d980 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2d990 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 28  sort..SELECT ( (
2d9a0 20 2d 20 63 6f 6c 31 20 29 20 29 20 41 53 20 63   - col1 ) ) AS c
2d9b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
2d9c0 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d  ---..-86..-91..-
2d9d0 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
2d9e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 30 20  wsort..SELECT 0 
2d9f0 2a 20 36 34 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  * 64 + col1 + co
2da00 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
2da10 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d  tab0..----..110.
2da20 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 6f 6e 6c  .132..180....onl
2da30 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2da40 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2da50 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2da60 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2da70 72 74 20 6c 61 62 65 6c 2d 31 32 32 38 0d 0a 53  rt label-1228..S
2da80 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63  ELECT col2 + + c
2da90 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20 2b 20 63  ol2 DIV col2 + c
2daa0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
2dab0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 0d 0a 31  r0..----..120..1
2dac0 37 34 0d 0a 39 39 0d 0a 0d 0a 73 6b 69 70 69 66  74..99....skipif
2dad0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2dae0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2daf0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2db00 32 32 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  228..SELECT col2
2db10 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 32   + + col2 / col2
2db20 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
2db30 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  0 cor0..----..12
2db40 30 0d 0a 31 37 34 0d 0a 39 39 0d 0a 0d 0a 71 75  0..174..99....qu
2db50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2db60 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20  ELECT ALL - ( - 
2db70 63 6f 6c 30 20 29 20 2d 20 2b 20 63 6f 6c 32 20  col0 ) - + col2 
2db80 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2db90 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35  0..----..-16..-5
2dba0 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..7....query I 
2dbb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2dbc0 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  - col2 * cor0.co
2dbd0 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l0 + col1 AS col
2dbe0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2dbf0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 0d  or0..----..-158.
2dc00 0a 2d 31 39 36 39 0d 0a 2d 32 39 38 35 0d 0a 0d  .-1969..-2985...
2dc10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2dc20 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28  ..SELECT ALL - (
2dc30 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 2d   cor0.col2 ) + -
2dc40 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
2dc50 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2dc60 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 0d 0a 2d 36 37  .----..-109..-67
2dc70 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-80....query I
2dc80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2dc90 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2a 20   ALL + - col0 * 
2dca0 35 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  54 AS col0 FROM 
2dcb0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2dcc0 2d 2d 0d 0a 2d 33 37 38 0d 0a 2d 34 32 31 32 0d  --..-378..-4212.
2dcd0 0a 2d 34 32 36 36 0d 0a 0d 0a 71 75 65 72 79 20  .-4266....query 
2dce0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2dcf0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 20 2a  T DISTINCT + 5 *
2dd00 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   + col2 + - col2
2dd10 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2dd20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 32  r0..----..216..2
2dd30 32 38 0d 0a 33 38 34 0d 0a 0d 0a 73 6b 69 70 69  28..384....skipi
2dd40 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2dd50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2dd60 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2dd70 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2dd80 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2dd90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39 36  ort..SELECT + 96
2dda0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c   col2 FROM tab1,
2ddb0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2ddc0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
2ddd0 73 68 69 6e 67 20 74 6f 20 32 32 63 35 31 34 31  shing to 22c5141
2dde0 61 36 32 39 66 30 65 66 33 39 36 37 33 38 65 65  a629f0ef396738ee
2ddf0 32 63 38 62 65 36 33 30 33 0d 0a 0d 0a 6f 6e 6c  2c8be6303....onl
2de00 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2de10 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2de20 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2de30 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2de40 72 74 20 6c 61 62 65 6c 2d 31 32 33 35 0d 0a 53  rt label-1235..S
2de50 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 44  ELECT ALL col0 D
2de60 49 56 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20  IV + ( + col2 ) 
2de70 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2de80 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33  0..----..0..1..3
2de90 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
2dea0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2deb0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2dec0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 35 0d 0a  ort label-1235..
2ded0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
2dee0 2f 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 41  / + ( + col2 ) A
2def0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2df00 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 35  ..----..0..1..35
2df10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2df20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2df30 49 4e 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 30  INCT + tab1.col0
2df40 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31   * col0 + - tab1
2df50 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d  .col0 FROM tab1.
2df60 0a 2d 2d 2d 2d 0d 0a 34 30 33 32 0d 0a 36 0d 0a  .----..4032..6..
2df70 36 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6320....query I 
2df80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2df90 2b 20 63 6f 6c 30 20 2a 20 2b 20 35 35 20 46 52  + col0 * + 55 FR
2dfa0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab2..----..3
2dfb0 38 35 0d 0a 34 32 39 30 0d 0a 34 33 34 35 0d 0a  85..4290..4345..
2dfc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2dfd0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2dfe0 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  CT - + col1 + + 
2dff0 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52  ( cor0.col1 ) FR
2e000 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2e010 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .----..0....quer
2e020 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e030 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
2e040 20 63 6f 6c 31 20 2d 20 36 20 41 53 20 63 6f 6c   col1 - 6 AS col
2e050 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2e060 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a  or0..----..-23..
2e070 2d 33 37 0d 0a 2d 36 35 0d 0a 0d 0a 71 75 65 72  -37..-65....quer
2e080 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e090 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  ECT col0 * - col
2e0a0 30 20 2b 20 2b 20 34 37 20 2a 20 63 6f 6c 31 20  0 + + 47 * col1 
2e0b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2e0c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 32 36 0d 0a  0..----..-3626..
2e0d0 2d 35 37 38 39 0d 0a 31 32 31 33 0d 0a 0d 0a 71  -5789..1213....q
2e0e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e0f0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20  SELECT - col2 * 
2e100 2b 20 32 34 20 2d 20 2b 20 28 20 63 6f 6c 30 20  + 24 - + ( col0 
2e110 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  + col1 * - col2 
2e120 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
2e130 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 36  or0..----..-1136
2e140 0d 0a 2d 38 36 32 0d 0a 31 30 35 0d 0a 0d 0a 6f  ..-862..105....o
2e150 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2e160 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2e170 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2e180 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2e190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e1a0 74 20 6c 61 62 65 6c 2d 31 32 34 32 0d 0a 53 45  t label-1242..SE
2e1b0 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  LECT + + col2 + 
2e1c0 2b 20 43 41 53 54 28 20 63 6f 72 30 2e 63 6f 6c  + CAST( cor0.col
2e1d0 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  0 AS SIGNED ) AS
2e1e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
2e1f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2e200 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 73  04..117..34....s
2e210 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2e220 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2e230 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2e240 62 65 6c 2d 31 32 34 32 0d 0a 53 45 4c 45 43 54  bel-1242..SELECT
2e250 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 43 41   + + col2 + + CA
2e260 53 54 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 41  ST ( cor0.col0 A
2e270 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
2e280 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
2e290 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
2e2a0 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 71 75 65  ..117..34....que
2e2b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e2c0 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  LECT + col2 * - 
2e2d0 63 6f 6c 31 20 2d 20 2d 20 33 38 20 46 52 4f 4d  col1 - - 38 FROM
2e2e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2e2f0 2d 2d 2d 0d 0a 2d 32 38 30 30 0d 0a 2d 35 39 0d  ---..-2800..-59.
2e300 0a 2d 37 34 32 34 0d 0a 0d 0a 71 75 65 72 79 20  .-7424....query 
2e310 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e320 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f  T cor0.col1 * co
2e330 72 30 2e 63 6f 6c 32 20 2a 20 32 32 20 2d 20 63  r0.col2 * 22 - c
2e340 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
2e350 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2e360 2d 2d 2d 0d 0a 31 32 34 38 33 0d 0a 32 37 33 36  ---..12483..2736
2e370 30 0d 0a 33 30 38 33 34 0d 0a 0d 0a 71 75 65 72  0..30834....quer
2e380 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e390 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30  ECT ALL + - col0
2e3a0 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 30   + - col0 - col0
2e3b0 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
2e3c0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2e3d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 30 30  or0..----..-1200
2e3e0 0d 0a 2d 37 36 38 0d 0a 2d 38 34 0d 0a 0d 0a 71  ..-768..-84....q
2e3f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e400 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20  SELECT col2 + + 
2e410 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20  ( col2 ) * col2 
2e420 2a 20 33 38 20 46 52 4f 4d 20 74 61 62 30 20 41  * 38 FROM tab0 A
2e430 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35  S cor0..----..25
2e440 35 35 39 34 0d 0a 33 39 0d 0a 34 31 34 31 35 0d  5594..39..41415.
2e450 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2e460 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2e470 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2e480 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2e490 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2e4a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e4b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
2e4c0 6f 6c 30 20 2b 20 35 36 20 2a 20 2b 20 63 6f 6c  ol0 + 56 * + col
2e4d0 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0 col0 FROM tab1
2e4e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35   cor0..----..165
2e4f0 0d 0a 33 35 32 30 0d 0a 34 34 30 30 0d 0a 0d 0a  ..3520..4400....
2e500 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2e510 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2e520 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 63   + tab2.col2 * c
2e530 6f 6c 30 20 2a 20 33 38 20 46 52 4f 4d 20 74 61  ol0 * 38 FROM ta
2e540 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 30 37 36  b2..----..114076
2e550 0d 0a 37 31 38 32 0d 0a 37 37 30 36 34 0d 0a 0d  ..7182..77064...
2e560 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e570 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e  ..SELECT + tab1.
2e580 63 6f 6c 32 20 2a 20 2d 20 28 20 2b 20 74 61 62  col2 * - ( + tab
2e590 31 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  1.col2 + + col0 
2e5a0 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
2e5b0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 38 39  ab1..----..-1689
2e5c0 36 0d 0a 2d 33 30 37 38 0d 0a 2d 36 38 39 37 0d  6..-3078..-6897.
2e5d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e5e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2e5f0 20 63 6f 6c 31 20 2d 20 2d 20 28 20 2d 20 74 61   col1 - - ( - ta
2e600 62 31 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74  b1.col1 ) FROM t
2e610 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a  ab1..----..-20..
2e620 2d 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72  -26..-52....quer
2e630 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e640 45 43 54 20 41 4c 4c 20 2d 20 33 37 20 41 53 20  ECT ALL - 37 AS 
2e650 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
2e660 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61  tab1 AS cor0, ta
2e670 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  b0, tab0 AS cor1
2e680 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
2e690 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 32 38  s hashing to a28
2e6a0 33 61 39 38 64 31 34 63 33 34 36 33 36 64 37 34  3a98d14c34636d74
2e6b0 62 30 65 30 62 35 37 36 33 33 35 38 35 0d 0a 0d  b0e0b57633585...
2e6c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e6d0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
2e6e0 2a 20 2b 20 32 39 20 41 53 20 63 6f 6c 31 20 46  * + 29 AS col1 F
2e6f0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2e700 2d 32 34 39 34 0d 0a 2d 32 36 33 39 0d 0a 2d 32  -2494..-2639..-2
2e710 38 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  813....query I r
2e720 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2e730 6f 6c 30 20 2d 20 30 20 46 52 4f 4d 20 74 61 62  ol0 - 0 FROM tab
2e740 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d  2 cor0..----..7.
2e750 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79  .78..79....query
2e760 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e770 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32  CT col2 + - col2
2e780 20 2b 20 2d 20 32 34 20 41 53 20 63 6f 6c 32 20   + - 24 AS col2 
2e790 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2e7a0 0a 2d 32 34 0d 0a 2d 32 34 0d 0a 2d 32 34 0d 0a  .-24..-24..-24..
2e7b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e7c0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
2e7d0 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  l0 + + col2 * co
2e7e0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
2e7f0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2e800 2d 2d 0d 0a 31 35 39 0d 0a 33 35 38 34 0d 0a 37  --..159..3584..7
2e810 36 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  600....query I r
2e820 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2e830 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
2e840 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30   + col1 - - col0
2e850 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2e860 0d 0a 2d 32 35 0d 0a 2d 33 0d 0a 31 37 0d 0a 0d  ..-25..-3..17...
2e870 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2e880 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2e890 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2e8a0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 43 41 53 54  .SELECT + + CAST
2e8b0 20 28 20 2d 20 36 33 20 41 53 20 52 45 41 4c 20   ( - 63 AS REAL 
2e8c0 29 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  ) + col1 AS col0
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 32 33 0d 0a 32 38  r0..----..23..28
2e8f0 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..34....query I 
2e900 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e910 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
2e920 2a 20 2b 20 37 33 20 41 53 20 63 6f 6c 32 20 46  * + 73 AS col2 F
2e930 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
2e940 2d 2d 2d 0d 0a 2d 32 31 39 0d 0a 2d 34 36 37 32  ---..-219..-4672
2e950 0d 0a 2d 35 38 34 30 0d 0a 0d 0a 71 75 65 72 79  ..-5840....query
2e960 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e970 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 28 20 2d  CT ALL - ( - ( -
2e980 20 63 6f 6c 31 20 29 20 29 20 2b 20 28 20 34 30   col1 ) ) + ( 40
2e990 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
2e9a0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2e9b0 2d 2d 0d 0a 31 34 0d 0a 32 37 0d 0a 33 30 0d 0a  --..14..27..30..
2e9c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e9d0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2e9e0 43 54 20 2d 20 31 31 20 2a 20 63 6f 72 30 2e 63  CT - 11 * cor0.c
2e9f0 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20  ol1 * tab0.col1 
2ea00 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2ea10 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  0, tab0 AS cor0.
2ea20 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 34 39 39 0d 0a  .----..-103499..
2ea30 2d 38 31 33 35 36 0d 0a 2d 38 36 30 38 36 0d 0a  -81356..-86086..
2ea40 2d 39 31 30 39 31 0d 0a 2d 39 31 37 36 32 0d 0a  -91091..-91762..
2ea50 2d 39 37 30 39 37 0d 0a 0d 0a 71 75 65 72 79 20  -97097....query 
2ea60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ea70 54 20 63 6f 6c 32 20 2b 20 2d 20 32 20 2d 20 63  T col2 + - 2 - c
2ea80 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
2ea90 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   tab0..----..-2.
2eaa0 0a 2d 32 0d 0a 2d 32 0d 0a 0d 0a 71 75 65 72 79  .-2..-2....query
2eab0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2eac0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2d 20  CT ALL + col1 - 
2ead0 38 33 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  83 FROM tab1..--
2eae0 2d 2d 0d 0a 2d 35 37 0d 0a 2d 37 30 0d 0a 2d 37  --..-57..-70..-7
2eaf0 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
2eb00 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2eb10 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2eb20 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2eb30 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2eb40 2d 31 32 36 33 0d 0a 53 45 4c 45 43 54 20 44 49  -1263..SELECT DI
2eb50 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 44 49  STINCT - col0 DI
2eb60 56 20 2d 20 28 20 2d 20 32 20 2a 20 2d 20 63 6f  V - ( - 2 * - co
2eb70 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l0 ) AS col0 FRO
2eb80 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab2..----..0.
2eb90 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2eba0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2ebb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ebc0 74 20 6c 61 62 65 6c 2d 31 32 36 33 0d 0a 53 45  t label-1263..SE
2ebd0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2ebe0 63 6f 6c 30 20 2f 20 2d 20 28 20 2d 20 32 20 2a  col0 / - ( - 2 *
2ebf0 20 2d 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   - col0 ) AS col
2ec00 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
2ec10 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..0....query I 
2ec20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ec30 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  - cor0.col2 AS c
2ec40 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
2ec50 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
2ec60 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
2ec70 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
2ec80 6e 67 20 74 6f 20 66 39 64 34 62 62 38 36 37 37  ng to f9d4bb8677
2ec90 64 62 37 62 39 38 63 37 65 64 38 39 64 30 36 65  db7b98c7ed89d06e
2eca0 36 65 38 63 64 36 0d 0a 0d 0a 71 75 65 72 79 20  6e8cd6....query 
2ecb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ecc0 54 20 41 4c 4c 20 2b 20 2b 20 38 32 20 2a 20 2b  T ALL + + 82 * +
2ecd0 20 34 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   47 AS col2 FROM
2ece0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2ecf0 2d 2d 2d 0d 0a 33 38 35 34 0d 0a 33 38 35 34 0d  ---..3854..3854.
2ed00 0a 33 38 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .3854....onlyif 
2ed10 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2ed20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2ed30 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2ed40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2ed50 61 62 65 6c 2d 31 32 36 36 0d 0a 53 45 4c 45 43  abel-1266..SELEC
2ed60 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
2ed70 6f 6c 32 20 44 49 56 20 28 20 63 6f 72 30 2e 63  ol2 DIV ( cor0.c
2ed80 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 31  ol0 + + col2 * 1
2ed90 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  1 ) AS col2 FROM
2eda0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2edb0 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ---..0....skipif
2edc0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2edd0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2ede0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2edf0 32 36 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  266..SELECT DIST
2ee00 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2f 20  INCT - + col2 / 
2ee10 28 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20  ( cor0.col0 + + 
2ee20 63 6f 6c 32 20 2a 20 31 31 20 29 20 41 53 20 63  col2 * 11 ) AS c
2ee30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2ee40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2ee50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ee60 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20  t..SELECT + ( + 
2ee70 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 32 20  col1 ) + + col2 
2ee80 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
2ee90 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2eea0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a 31 34 33  ..----..133..143
2eeb0 0d 0a 32 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..262....query I
2eec0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2eed0 20 41 4c 4c 20 2b 20 2b 20 39 31 20 2b 20 63 6f   ALL + + 91 + co
2eee0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
2eef0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 0d  cor0..----..115.
2ef00 0a 31 32 36 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65  .126..180....que
2ef10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ef20 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 28 20 63  LECT ALL + ( ( c
2ef30 6f 6c 32 20 29 20 29 20 2b 20 2b 20 28 20 63 6f  ol2 ) ) + + ( co
2ef40 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  l1 ) FROM tab0..
2ef50 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a  ----..119..173..
2ef60 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
2ef70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2ef80 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63  r0.col2 * cor0.c
2ef90 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
2efa0 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
2efb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
2efc0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
2efd0 66 31 33 38 33 64 33 31 30 65 35 65 33 65 31 39  f1383d310e5e3e19
2efe0 34 37 30 65 30 62 38 64 63 30 36 34 64 30 63 0d  470e0b8dc064d0c.
2eff0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2f000 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2f010 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2f020 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2f030 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2f040 32 37 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  271..SELECT - co
2f050 6c 30 20 44 49 56 20 28 20 2d 20 74 61 62 30 2e  l0 DIV ( - tab0.
2f060 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30  col0 ) FROM tab0
2f070 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
2f080 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2f090 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2f0a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f0b0 74 20 6c 61 62 65 6c 2d 31 32 37 31 0d 0a 53 45  t label-1271..SE
2f0c0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2f 20 28 20  LECT - col0 / ( 
2f0d0 2d 20 74 61 62 30 2e 63 6f 6c 30 20 29 20 46 52  - tab0.col0 ) FR
2f0e0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
2f0f0 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20  ..1..1....query 
2f100 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f110 54 20 41 4c 4c 20 2b 20 28 20 2d 20 38 37 20 29  T ALL + ( - 87 )
2f120 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2f130 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 37 0d 0a 2d  r0..----..-87..-
2f140 38 37 0d 0a 2d 38 37 0d 0a 0d 0a 6f 6e 6c 79 69  87..-87....onlyi
2f150 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
2f160 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
2f170 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
2f180 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
2f190 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f1a0 62 65 6c 2d 31 32 37 33 0d 0a 53 45 4c 45 43 54  bel-1273..SELECT
2f1b0 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
2f1c0 20 53 49 47 4e 45 44 20 29 20 2f 20 63 6f 6c 31   SIGNED ) / col1
2f1d0 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46   - col0 * col2 F
2f1e0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2f1f0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
2f200 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
2f210 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2f220 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2f230 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2f240 2d 31 32 37 33 0d 0a 53 45 4c 45 43 54 20 2b 20  -1273..SELECT + 
2f250 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
2f260 4e 54 45 47 45 52 20 29 20 2f 20 63 6f 6c 31 20  NTEGER ) / col1 
2f270 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52  - col0 * col2 FR
2f280 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2f290 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
2f2a0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  L..NULL....onlyi
2f2b0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2f2c0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2f2d0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2f2e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f2f0 20 6c 61 62 65 6c 2d 31 32 37 34 0d 0a 53 45 4c   label-1274..SEL
2f300 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2f310 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56  ol1 + + col2 DIV
2f320 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
2f330 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2f340 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 32 0d  0..----..10..12.
2f350 0a 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .8....skipif mys
2f360 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2f370 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2f380 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 34 0d  sort label-1274.
2f390 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2f3a0 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   + col1 + + col2
2f3b0 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   / - col0 AS col
2f3c0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2f3d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  or0..----..10..1
2f3e0 32 0d 0a 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  2..8....onlyif m
2f3f0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
2f400 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
2f410 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
2f420 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
2f430 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2f440 2d 31 32 37 35 0d 0a 53 45 4c 45 43 54 20 2b 20  -1275..SELECT + 
2f450 2d 20 43 41 53 54 28 20 34 35 20 41 53 20 53 49  - CAST( 45 AS SI
2f460 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
2f470 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35   cor0..----..-45
2f480 0d 0a 2d 34 35 0d 0a 2d 34 35 0d 0a 0d 0a 73 6b  ..-45..-45....sk
2f490 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2f4a0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2f4b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2f4c0 65 6c 2d 31 32 37 35 0d 0a 53 45 4c 45 43 54 20  el-1275..SELECT 
2f4d0 2b 20 2d 20 43 41 53 54 20 28 20 34 35 20 41 53  + - CAST ( 45 AS
2f4e0 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
2f4f0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2f500 0a 2d 34 35 0d 0a 2d 34 35 0d 0a 2d 34 35 0d 0a  .-45..-45..-45..
2f510 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2f520 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
2f530 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
2f540 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
2f550 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
2f560 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 36 0d  sort label-1276.
2f570 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
2f580 63 6f 6c 31 20 2f 20 2b 20 28 20 2d 20 63 6f 72  col1 / + ( - cor
2f590 30 2e 63 6f 6c 32 20 29 20 2d 20 43 41 53 54 28  0.col2 ) - CAST(
2f5a0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
2f5b0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
2f5c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2f5d0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
2f5e0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2f5f0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2f600 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f610 62 65 6c 2d 31 32 37 36 0d 0a 53 45 4c 45 43 54  bel-1276..SELECT
2f620 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2f 20   ALL - - col1 / 
2f630 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  + ( - cor0.col2 
2f640 29 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  ) - CAST ( NULL 
2f650 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
2f660 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2f670 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
2f680 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
2f690 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2f6a0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2f6b0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2f6c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2f6d0 6c 61 62 65 6c 2d 31 32 37 37 0d 0a 53 45 4c 45  label-1277..SELE
2f6e0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
2f6f0 6c 31 20 2a 20 38 33 20 44 49 56 20 63 6f 72 30  l1 * 83 DIV cor0
2f700 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
2f710 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
2f720 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31 33 0d 0a 2d 37  --..-12..-13..-7
2f730 31 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  19....skipif mys
2f740 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2f750 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2f760 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 37 0d  sort label-1277.
2f770 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2f780 20 2d 20 63 6f 6c 31 20 2a 20 38 33 20 2f 20 63   - col1 * 83 / c
2f790 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  or0.col0 AS col2
2f7a0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
2f7b0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31 33 0d  .----..-12..-13.
2f7c0 0a 2d 37 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .-719....query I
2f7d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f7e0 20 2b 20 2b 20 31 20 2a 20 2d 20 63 6f 6c 32 20   + + 1 * - col2 
2f7f0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
2f800 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2f810 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31  ..----..-16..-51
2f820 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..7....query I r
2f830 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2f840 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63  ISTINCT + cor0.c
2f850 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d  ol1 * - col0 + -
2f860 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41   col2 * - col0 A
2f870 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2f880 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2f890 2d 31 32 37 32 0d 0a 2d 33 33 36 30 0d 0a 2d 38  -1272..-3360..-8
2f8a0 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  01....query I ro
2f8b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2f8c0 53 54 49 4e 43 54 20 2b 20 2d 20 31 38 20 2a 20  STINCT + - 18 * 
2f8d0 32 37 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  27 FROM tab1 cor
2f8e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 36 0d 0a 0d  0..----..-486...
2f8f0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2f900 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2f910 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2f920 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2f930 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2f940 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 31 0d 0a  ort label-1281..
2f950 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 2b  SELECT - CAST( +
2f960 20 37 32 20 41 53 20 53 49 47 4e 45 44 20 29 20   72 AS SIGNED ) 
2f970 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  + - col2 + col1 
2f980 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2f990 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2f9a0 0a 2d 31 30 30 0d 0a 2d 31 31 39 0d 0a 2d 31 35  .-100..-119..-15
2f9b0 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
2f9c0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2f9d0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2f9e0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 31 0d 0a  ort label-1281..
2f9f0 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20  SELECT - CAST ( 
2fa00 2b 20 37 32 20 41 53 20 49 4e 54 45 47 45 52 20  + 72 AS INTEGER 
2fa10 29 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  ) + - col2 + col
2fa20 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2fa30 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2fa40 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 31 39 0d 0a 2d  -..-100..-119..-
2fa50 31 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  155....query I r
2fa60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2fa70 4c 4c 20 2b 20 2d 20 36 37 20 2b 20 63 6f 6c 30  LL + - 67 + col0
2fa80 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2fa90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36  r0..----..-3..-6
2faa0 34 0d 0a 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49  4..13....query I
2fab0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2fac0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c   cor0.col1 + col
2fad0 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  0 * - col0 AS co
2fae0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
2faf0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 38 0d 0a  0..----..-1128..
2fb00 2d 34 39 30 0d 0a 2d 37 38 33 30 0d 0a 0d 0a 71  -490..-7830....q
2fb10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2fb20 53 45 4c 45 43 54 20 2d 20 31 20 2b 20 63 6f 6c  SELECT - 1 + col
2fb30 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  2 * - col1 FROM 
2fb40 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33  tab2..----..-153
2fb50 35 0d 0a 2d 36 34 37 0d 0a 2d 38 33 38 0d 0a 0d  5..-647..-838...
2fb60 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2fb70 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2fb80 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2fb90 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2fba0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38  owsort label-128
2fbb0 35 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20  5..SELECT + ( + 
2fbc0 63 6f 6c 32 20 29 20 44 49 56 20 2d 20 38 34 20  col2 ) DIV - 84 
2fbd0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2fbe0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
2fbf0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2fc00 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2fc10 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2fc20 72 74 20 6c 61 62 65 6c 2d 31 32 38 35 0d 0a 53  rt label-1285..S
2fc30 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 32  ELECT + ( + col2
2fc40 20 29 20 2f 20 2d 20 38 34 20 46 52 4f 4d 20 74   ) / - 84 FROM t
2fc50 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2fc60 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
2fc70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2fc80 45 4c 45 43 54 20 2b 20 34 31 20 2a 20 63 6f 72  ELECT + 41 * cor
2fc90 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  0.col0 AS col1 F
2fca0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2fcb0 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 0d 0a 33 31 39  ..----..287..319
2fcc0 38 0d 0a 33 32 33 39 0d 0a 0d 0a 71 75 65 72 79  8..3239....query
2fcd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2fce0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36 35  CT DISTINCT - 65
2fcf0 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   + - col1 * - co
2fd00 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
2fd10 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
2fd20 0a 31 32 37 38 0d 0a 31 35 32 0d 0a 34 35 33 37  .1278..152..4537
2fd30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2fd40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
2fd50 35 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  52 + + col0 * co
2fd60 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
2fd70 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2fd80 2d 2d 0d 0a 32 36 0d 0a 35 38 38 0d 0a 39 38 38  --..26..588..988
2fd90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2fda0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
2fdb0 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col0 + + col1 * 
2fdc0 33 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  39 AS col1 FROM 
2fdd0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2fde0 2d 2d 0d 0a 31 32 30 32 0d 0a 32 32 32 33 0d 0a  --..1202..2223..
2fdf0 35 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  584....query I r
2fe00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2fe10 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a  ISTINCT + col1 *
2fe20 20 28 20 2d 20 63 6f 6c 30 20 29 20 46 52 4f 4d   ( - col0 ) FROM
2fe30 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2fe40 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37  ---..-1343..-217
2fe50 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79  ..-4602....query
2fe60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2fe70 43 54 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 30  CT col2 + ( col0
2fe80 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2b 20   ) * - col2 * + 
2fe90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
2fea0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2feb0 32 39 36 0d 0a 2d 31 35 38 31 35 38 0d 0a 2d 32  296..-158158..-2
2fec0 33 37 31 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  37120....skipif 
2fed0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2fee0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2fef0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2ff00 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2ff10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ff20 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
2ff30 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 63   - col0 * col1 c
2ff40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2ff50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
2ff60 33 31 0d 0a 2d 33 33 39 34 0d 0a 2d 38 30 31 37  31..-3394..-8017
2ff70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ff80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2ff90 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  + ( cor0.col2 ) 
2ffa0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2ffb0 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  2, tab0 AS cor0,
2ffc0 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
2ffd0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
2ffe0 61 73 68 69 6e 67 20 74 6f 20 37 37 38 36 37 31  ashing to 778671
2fff0 38 62 64 38 30 34 32 30 32 32 35 33 37 33 37 38  8bd8042022537378
30000 64 34 30 65 63 38 37 34 37 35 0d 0a 0d 0a 71 75  d40ec87475....qu
30010 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30020 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
30030 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 33 34 20 41  r0.col0 + - 34 A
30040 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
30050 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
30060 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31  OIN tab1 AS cor1
30070 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
30080 20 68 61 73 68 69 6e 67 20 74 6f 20 36 32 33 39   hashing to 6239
30090 35 32 31 64 38 65 36 38 65 31 66 62 61 62 34 32  521d8e68e1fbab42
300a0 39 34 62 61 32 63 37 38 33 39 31 65 0d 0a 0d 0a  94ba2c78391e....
300b0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
300c0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
300d0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
300e0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
300f0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 35  wsort label-1295
30100 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
30110 32 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 63  2 + col2 DIV + c
30120 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
30130 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
30140 2d 2d 2d 0d 0a 32 36 0d 0a 33 30 0d 0a 33 38 0d  ---..26..30..38.
30150 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
30160 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
30170 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30180 74 20 6c 61 62 65 6c 2d 31 32 39 35 0d 0a 53 45  t label-1295..SE
30190 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20  LECT ALL col2 + 
301a0 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 30 20 41 53  col2 / + col0 AS
301b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
301c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
301d0 36 0d 0a 33 30 0d 0a 33 38 0d 0a 0d 0a 6f 6e 6c  6..30..38....onl
301e0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
301f0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
30200 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
30210 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
30220 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
30230 6c 61 62 65 6c 2d 31 32 39 36 0d 0a 53 45 4c 45  label-1296..SELE
30240 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28 20 2b  CT ALL - CAST( +
30250 20 39 32 20 41 53 20 53 49 47 4e 45 44 20 29 20   92 AS SIGNED ) 
30260 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
30270 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
30280 0a 2d 39 32 0d 0a 2d 39 32 0d 0a 2d 39 32 0d 0a  .-92..-92..-92..
30290 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
302a0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
302b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
302c0 20 6c 61 62 65 6c 2d 31 32 39 36 0d 0a 53 45 4c   label-1296..SEL
302d0 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28  ECT ALL - CAST (
302e0 20 2b 20 39 32 20 41 53 20 49 4e 54 45 47 45 52   + 92 AS INTEGER
302f0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
30300 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
30310 2d 2d 0d 0a 2d 39 32 0d 0a 2d 39 32 0d 0a 2d 39  --..-92..-92..-9
30320 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
30330 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
30340 54 49 4e 43 54 20 2d 20 2b 20 28 20 2d 20 28 20  TINCT - + ( - ( 
30350 2d 20 63 6f 6c 31 20 29 20 29 20 2b 20 2b 20 63  - col1 ) ) + + c
30360 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 + col0 AS co
30370 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
30380 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d  cor0..----..100.
30390 0a 33 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72 79 20  .3..45....query 
303a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
303b0 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2b  T ALL - col1 * +
303c0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c   cor0.col1 + col
303d0 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
303e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a 2d 33  ..----..-210..-3
303f0 34 30 33 0d 0a 2d 39 35 34 0d 0a 0d 0a 71 75 65  403..-954....que
30400 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30410 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
30420 2b 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20  + col2 ) * col2 
30430 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
30440 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36  0..----..1444..6
30450 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79  76..729....query
30460 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30470 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
30480 63 6f 6c 32 20 2a 20 37 35 20 2a 20 2d 20 63 6f  col2 * 75 * - co
30490 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  l1 + - col2 * - 
304a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
304b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 37 30  or0..----..10670
304c0 34 0d 0a 34 33 33 32 30 0d 0a 39 34 38 34 38 0d  4..43320..94848.
304d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
304e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
304f0 6f 6c 30 20 2a 20 36 31 20 2b 20 63 6f 6c 30 20  ol0 * 61 + col0 
30500 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
30510 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
30520 0a 31 34 38 38 0d 0a 32 31 37 30 0d 0a 35 35 31  .1488..2170..551
30530 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
30540 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
30550 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a  TINCT - + col1 *
30560 20 31 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   18 AS col1 FROM
30570 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
30580 2d 2d 2d 0d 0a 2d 31 30 36 32 0d 0a 2d 33 30 36  ---..-1062..-306
30590 0d 0a 2d 35 35 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-558....onlyif
305a0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
305b0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
305c0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
305d0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
305e0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
305f0 65 6c 2d 31 33 30 33 0d 0a 53 45 4c 45 43 54 20  el-1303..SELECT 
30600 2b 20 32 35 20 2a 20 2b 20 63 6f 6c 31 20 2f 20  + 25 * + col1 / 
30610 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
30620 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
30630 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
30640 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
30650 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
30660 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
30670 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
30680 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30 33 0d  sort label-1303.
30690 0a 53 45 4c 45 43 54 20 2b 20 32 35 20 2a 20 2b  .SELECT + 25 * +
306a0 20 63 6f 6c 31 20 2f 20 2b 20 43 41 53 54 20 28   col1 / + CAST (
306b0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
306c0 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
306d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
306e0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
306f0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
30700 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
30710 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
30720 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
30730 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
30740 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30750 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2a 20   ALL + + col0 * 
30760 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
30770 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
30780 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d 0a 36 32 34  -..49..6084..624
30790 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
307a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
307b0 20 2d 20 38 20 2a 20 2b 20 63 6f 6c 30 20 46 52   - 8 * + col0 FR
307c0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
307d0 0a 2d 2d 2d 2d 0d 0a 2d 31 39 32 0d 0a 2d 32 38  .----..-192..-28
307e0 30 0d 0a 2d 37 31 32 0d 0a 0d 0a 6f 6e 6c 79 69  0..-712....onlyi
307f0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
30800 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
30810 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
30820 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30830 20 6c 61 62 65 6c 2d 31 33 30 36 0d 0a 53 45 4c   label-1306..SEL
30840 45 43 54 20 2b 20 38 36 20 44 49 56 20 2b 20 63  ECT + 86 DIV + c
30850 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  or0.col0 AS col0
30860 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
30870 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a  r0..----..0..2..
30880 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
30890 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
308a0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
308b0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30 36 0d 0a  ort label-1306..
308c0 53 45 4c 45 43 54 20 2b 20 38 36 20 2f 20 2b 20  SELECT + 86 / + 
308d0 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
308e0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
308f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d  or0..----..0..2.
30900 0a 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .3....query I ro
30910 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
30920 63 6f 6c 30 20 2d 20 2b 20 33 30 20 2a 20 63 6f  col0 - + 30 * co
30930 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l1 * - col0 AS c
30940 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
30950 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32   cor0..----..192
30960 36 34 0d 0a 32 33 34 33 0d 0a 33 31 32 38 30 0d  64..2343..31280.
30970 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
30980 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
30990 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b  NCT + + col1 * +
309a0 20 28 20 31 30 20 29 20 2b 20 63 6f 6c 31 20 41   ( 10 ) + col1 A
309b0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
309c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
309d0 31 30 30 31 0d 0a 31 30 36 37 0d 0a 39 34 36 0d  1001..1067..946.
309e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
309f0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
30a00 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  NCT col1 + - col
30a10 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  1 * col1 + col0 
30a20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
30a30 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
30a40 31 31 31 39 0d 0a 2d 33 32 37 34 0d 0a 2d 35 34  1119..-3274..-54
30a50 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  50....query I ro
30a60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
30a70 2b 20 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 31 20  + col1 + ( col1 
30a80 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
30a90 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
30aa0 2d 0d 0a 32 30 0d 0a 32 36 0d 0a 35 32 0d 0a 0d  -..20..26..52...
30ab0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
30ac0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
30ad0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
30ae0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
30af0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
30b00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30b10 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72  T - col0 + - cor
30b20 30 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  0.col0 * cor0.co
30b30 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
30b40 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
30b50 0a 2d 35 36 0d 0a 2d 36 31 36 32 0d 0a 2d 36 33  .-56..-6162..-63
30b60 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  20....onlyif mys
30b70 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
30b80 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
30b90 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
30ba0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
30bb0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
30bc0 33 31 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  312..SELECT ALL 
30bd0 2b 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 28  + col1 + - CAST(
30be0 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45   + col0 AS SIGNE
30bf0 44 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  D ) * - cor0.col
30c00 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
30c10 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
30c20 33 35 0d 0a 34 31 30 36 0d 0a 36 34 31 33 0d 0a  35..4106..6413..
30c30 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
30c40 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
30c50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30c60 20 6c 61 62 65 6c 2d 31 33 31 32 0d 0a 53 45 4c   label-1312..SEL
30c70 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
30c80 20 2d 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 30   - CAST ( + col0
30c90 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
30ca0 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  - cor0.col0 AS c
30cb0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
30cc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 34 31  r0..----..35..41
30cd0 30 36 0d 0a 36 34 31 33 0d 0a 0d 0a 73 6b 69 70  06..6413....skip
30ce0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
30cf0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
30d00 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
30d10 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
30d20 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
30d30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
30d40 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 32 39 20 63   + col0 * + 29 c
30d50 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
30d60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31   cor0..----..101
30d70 35 0d 0a 32 35 38 31 0d 0a 36 39 36 0d 0a 0d 0a  5..2581..696....
30d80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30d90 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d  .SELECT + col2 -
30da0 20 38 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   83 AS col2 FROM
30db0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
30dc0 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 39 0d 0a 31  ---..-26..-29..1
30dd0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
30de0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
30df0 54 49 4e 43 54 20 2d 20 37 37 20 2b 20 63 6f 6c  TINCT - 77 + col
30e00 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  0 * col2 AS col2
30e10 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
30e20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a 37  r0..----..-42..7
30e30 31 35 0d 0a 37 32 32 31 0d 0a 0d 0a 71 75 65 72  15..7221....quer
30e40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30e50 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 36  ECT + col2 + + 6
30e60 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  7 AS col2 FROM t
30e70 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
30e80 2d 0d 0a 31 32 31 0d 0a 31 32 34 0d 0a 31 36 33  -..121..124..163
30e90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30ea0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
30eb0 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   * - col0 + col2
30ec0 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
30ed0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
30ee0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 32 39 0d 0a  0..----..-4029..
30ef0 2d 36 32 39 31 0d 0a 37 31 0d 0a 0d 0a 71 75 65  -6291..71....que
30f00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30f10 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
30f20 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  l0 + - col0 + co
30f30 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
30f40 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a  --..10..13..26..
30f50 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
30f60 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
30f70 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
30f80 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
30f90 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
30fa0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 31 39 0d  sort label-1319.
30fb0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61  .SELECT ALL + ta
30fc0 62 31 2e 63 6f 6c 30 20 2a 20 43 41 53 54 28 20  b1.col0 * CAST( 
30fd0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
30fe0 20 2a 20 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63   * col0 + tab1.c
30ff0 6f 6c 30 20 2f 20 39 36 20 41 53 20 63 6f 6c 30  ol0 / 96 AS col0
31000 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
31010 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
31020 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
31030 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
31040 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
31050 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 31 39 0d  sort label-1319.
31060 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61  .SELECT ALL + ta
31070 62 31 2e 63 6f 6c 30 20 2a 20 43 41 53 54 20 28  b1.col0 * CAST (
31080 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
31090 20 29 20 2a 20 63 6f 6c 30 20 2b 20 74 61 62 31   ) * col0 + tab1
310a0 2e 63 6f 6c 30 20 2f 20 39 36 20 41 53 20 63 6f  .col0 / 96 AS co
310b0 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
310c0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
310d0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  NULL....skipif p
310e0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
310f0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
31100 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
31110 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
31120 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31130 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
31140 2d 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d  - col0 col0 FROM
31150 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   tab1..----..-54
31160 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65  ..-67..23....que
31170 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31180 4c 45 43 54 20 2d 20 31 39 20 2d 20 2b 20 63 6f  LECT - 19 - + co
31190 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
311a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d  cor0..----..-22.
311b0 0a 2d 38 33 0d 0a 2d 39 39 0d 0a 0d 0a 71 75 65  .-83..-99....que
311c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
311d0 4c 45 43 54 20 28 20 2d 20 37 32 20 29 20 2b 20  LECT ( - 72 ) + 
311e0 63 6f 6c 30 20 2a 20 28 20 2b 20 63 6f 6c 31 20  col0 * ( + col1 
311f0 2b 20 2d 20 63 6f 6c 30 20 29 20 41 53 20 63 6f  + - col0 ) AS co
31200 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
31210 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 0d  cor0..----..106.
31220 0a 31 34 31 36 0d 0a 32 30 39 38 0d 0a 0d 0a 71  .1416..2098....q
31230 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31240 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31250 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  3 AS col2 FROM t
31260 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab2 AS cor0 CROS
31270 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61 62  S JOIN tab1, tab
31280 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  1 cor1..----..3.
31290 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
312a0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
312b0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
312c0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
312d0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
312e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
312f0 45 43 54 20 2b 20 38 31 20 63 6f 6c 30 20 46 52  ECT + 81 col0 FR
31300 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f  OM tab0, tab0 co
31310 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
31320 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
31330 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 61 38  s hashing to 0a8
31340 35 36 33 39 65 30 64 64 64 62 66 66 64 61 62 32  5639e0dddbffdab2
31350 63 62 31 36 62 30 32 37 63 62 33 36 30 0d 0a 0d  cb16b027cb360...
31360 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31370 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 30  ..SELECT ALL - 0
31380 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
31390 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
313a0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
313b0 20 74 6f 20 38 62 37 35 31 33 36 62 32 62 35 31   to 8b75136b2b51
313c0 63 37 37 33 34 35 63 30 33 38 30 34 65 63 31 63  c77345c03804ec1c
313d0 64 61 35 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20  da5c....query I 
313e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
313f0 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ALL + - cor0.col
31400 30 20 2b 20 39 39 20 2a 20 2d 20 63 6f 72 30 2e  0 + 99 * - cor0.
31410 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
31420 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
31430 30 35 34 0d 0a 2d 31 33 36 37 0d 0a 2d 32 35 37  054..-1367..-257
31440 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
31450 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
31460 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20   + ( - col2 ) * 
31470 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
31480 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
31490 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 36 0d 0a 2d  ..----..-2916..-
314a0 33 32 34 39 0d 0a 2d 39 32 31 36 0d 0a 0d 0a 71  3249..-9216....q
314b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
314c0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 35  SELECT ALL + + 5
314d0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
314e0 61 62 32 2c 20 74 61 62 30 2c 20 74 61 62 31 20  ab2, tab0, tab1 
314f0 41 53 20 63 6f 72 30 2c 20 74 61 62 31 0d 0a 2d  AS cor0, tab1..-
31500 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68  ---..81 values h
31510 61 73 68 69 6e 67 20 74 6f 20 36 39 33 32 63 39  ashing to 6932c9
31520 39 31 31 31 30 64 32 35 36 64 33 66 39 32 66 33  91110d256d3f92f3
31530 65 39 35 33 38 66 38 30 34 30 0d 0a 0d 0a 6f 6e  e9538f8040....on
31540 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
31550 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
31560 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
31570 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
31580 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31590 20 6c 61 62 65 6c 2d 31 33 32 39 0d 0a 53 45 4c   label-1329..SEL
315a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53  ECT DISTINCT CAS
315b0 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47  T( + col2 AS SIG
315c0 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52  NED ) AS col1 FR
315d0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab2..----..2
315e0 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 73 6b 69  6..27..38....ski
315f0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
31600 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
31610 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
31620 6c 2d 31 33 32 39 0d 0a 53 45 4c 45 43 54 20 44  l-1329..SELECT D
31630 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 2b  ISTINCT CAST ( +
31640 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
31650 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
31660 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a  tab2..----..26..
31670 32 37 0d 0a 33 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  27..38....onlyif
31680 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
31690 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
316a0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
316b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
316c0 6c 61 62 65 6c 2d 31 33 33 30 0d 0a 53 45 4c 45  label-1330..SELE
316d0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20  CT ALL - col0 + 
316e0 2b 20 33 35 20 44 49 56 20 63 6f 6c 32 20 63 6f  + 35 DIV col2 co
316f0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
31700 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d  cor0..----..-23.
31710 0a 2d 38 39 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  .-89..0....skipi
31720 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
31730 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
31740 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
31750 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
31760 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
31770 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
31780 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
31790 72 74 20 6c 61 62 65 6c 2d 31 33 33 30 0d 0a 53  rt label-1330..S
317a0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
317b0 20 2b 20 2b 20 33 35 20 2f 20 63 6f 6c 32 20 63   + + 35 / col2 c
317c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
317d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   cor0..----..-23
317e0 0d 0a 2d 38 39 0d 0a 30 0d 0a 0d 0a 71 75 65 72  ..-89..0....quer
317f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31800 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 37 36 20  ECT + col1 * 76 
31810 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
31820 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
31830 2d 2d 2d 0d 0a 36 35 36 30 0d 0a 37 30 30 35 0d  ---..6560..7005.
31840 0a 37 34 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .7407....query I
31850 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31860 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d   + cor0.col2 * -
31870 20 39 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53   92 FROM tab0 AS
31880 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30   cor0..----..-30
31890 33 36 0d 0a 2d 37 35 34 34 0d 0a 2d 39 32 0d 0a  36..-7544..-92..
318a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
318b0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30  t..SELECT + tab0
318c0 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c  .col0 * cor0.col
318d0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
318e0 61 62 30 2c 20 74 61 62 32 2c 20 74 61 62 30 20  ab0, tab2, tab0 
318f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
31900 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
31910 20 74 6f 20 63 61 61 33 65 36 34 36 39 34 33 32   to caa3e6469432
31920 36 32 34 61 31 36 62 64 33 30 38 34 66 35 63 36  624a16bd3084f5c6
31930 64 65 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  de58....query I 
31940 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31950 2b 20 2d 20 36 35 20 46 52 4f 4d 20 74 61 62 30  + - 65 FROM tab0
31960 2c 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  , tab2, tab0 AS 
31970 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
31980 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
31990 20 34 63 61 39 33 63 34 32 61 39 31 63 37 64 66   4ca93c42a91c7df
319a0 66 39 31 37 65 37 62 37 30 39 30 62 61 39 65 35  f917e7b7090ba9e5
319b0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
319c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
319d0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   + cor0.col0 * c
319e0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 * + col2 FRO
319f0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31a00 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 31 39 30 30  ----..1225..1900
31a10 38 0d 0a 36 34 39 35 32 32 0d 0a 0d 0a 71 75 65  8..649522....que
31a20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31a30 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
31a40 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  + col2 * + col2 
31a50 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
31a60 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
31a70 0a 30 0d 0a 31 30 35 36 0d 0a 36 36 34 32 0d 0a  .0..1056..6642..
31a80 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
31a90 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
31aa0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
31ab0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
31ac0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
31ad0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31ae0 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 28 20  CT + col0 + + ( 
31af0 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col2 + + col1 * 
31b00 2d 20 63 6f 6c 32 20 29 20 63 6f 6c 30 20 46 52  - col2 ) col0 FR
31b10 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
31b20 0a 2d 2d 2d 2d 0d 0a 2d 31 34 33 30 0d 0a 2d 35  .----..-1430..-5
31b30 32 39 0d 0a 2d 38 30 33 0d 0a 0d 0a 73 6b 69 70  29..-803....skip
31b40 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
31b50 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
31b60 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
31b70 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
31b80 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
31b90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
31ba0 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b  TINCT + col0 * +
31bb0 20 36 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   62 col2 FROM ta
31bc0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
31bd0 0d 0a 34 33 34 0d 0a 34 38 33 36 0d 0a 34 38 39  ..434..4836..489
31be0 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
31bf0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
31c00 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
31c10 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
31c20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
31c30 2d 31 33 33 39 0d 0a 53 45 4c 45 43 54 20 2d 20  -1339..SELECT - 
31c40 2d 20 63 6f 6c 31 20 44 49 56 20 36 39 20 46 52  - col1 DIV 69 FR
31c50 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
31c60 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
31c70 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
31c80 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
31c90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31ca0 20 6c 61 62 65 6c 2d 31 33 33 39 0d 0a 53 45 4c   label-1339..SEL
31cb0 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2f 20 36  ECT - - col1 / 6
31cc0 39 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  9 FROM tab1 AS c
31cd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
31ce0 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .0....skipif pos
31cf0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
31d00 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
31d10 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
31d20 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
31d30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31d40 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c  SELECT + ( + col
31d50 30 20 2b 20 2d 20 37 36 20 29 20 2a 20 63 6f 6c  0 + - 76 ) * col
31d60 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0 col0 FROM tab2
31d70 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 33 0d 0a 31 35  ..----..-483..15
31d80 36 0d 0a 32 33 37 0d 0a 0d 0a 73 6b 69 70 69 66  6..237....skipif
31d90 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
31da0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
31db0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
31dc0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
31dd0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
31de0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
31df0 30 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  0 - - cor0.col0 
31e00 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
31e10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
31e20 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
31e30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31e40 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b   DISTINCT col1 +
31e50 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 2a 20 2b   col1 - col0 * +
31e60 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
31e70 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
31e80 34 30 37 36 0d 0a 2d 36 33 37 34 0d 0a 34 33 0d  4076..-6374..43.
31e90 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
31ea0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
31eb0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
31ec0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
31ed0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
31ee0 33 34 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  343..SELECT - - 
31ef0 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2d 20  col2 + + col1 - 
31f00 36 35 20 44 49 56 20 2d 20 36 34 20 41 53 20 63  65 DIV - 64 AS c
31f10 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
31f20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d   cor0..----..56.
31f30 0a 35 39 0d 0a 38 36 0d 0a 0d 0a 73 6b 69 70 69  .59..86....skipi
31f40 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
31f50 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
31f60 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
31f70 31 33 34 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  1343..SELECT - -
31f80 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2d   col2 + + col1 -
31f90 20 36 35 20 2f 20 2d 20 36 34 20 41 53 20 63 6f   65 / - 64 AS co
31fa0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
31fb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a  cor0..----..56..
31fc0 35 39 0d 0a 38 36 0d 0a 0d 0a 71 75 65 72 79 20  59..86....query 
31fd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31fe0 54 20 2d 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c  T - + col2 - col
31ff0 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  2 * col1 AS col0
32000 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
32010 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 34 0d  r0..----..-1344.
32020 0a 2d 31 34 35 38 0d 0a 2d 36 32 37 0d 0a 0d 0a  .-1458..-627....
32030 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
32040 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
32050 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
32060 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
32070 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34 35  wsort label-1345
32080 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
32090 54 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56 20 63  T - + col2 DIV c
320a0 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  or0.col0 + - col
320b0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
320c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
320d0 33 34 0d 0a 2d 38 32 0d 0a 0d 0a 73 6b 69 70 69  34..-82....skipi
320e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
320f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
32100 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
32110 31 33 34 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  1345..SELECT DIS
32120 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2f  TINCT - + col2 /
32130 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
32140 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
32150 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
32160 0a 2d 33 34 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65  .-34..-82....que
32170 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32180 4c 45 43 54 20 41 4c 4c 20 35 36 20 46 52 4f 4d  LECT ALL 56 FROM
32190 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
321a0 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
321b0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
321c0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 35  es hashing to b5
321d0 62 61 34 62 34 34 65 33 64 65 61 64 63 65 31 65  ba4b44e3deadce1e
321e0 64 62 33 30 65 37 36 64 66 36 31 32 30 30 0d 0a  db30e76df61200..
321f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32200 74 0d 0a 53 45 4c 45 43 54 20 31 35 20 2a 20 63  t..SELECT 15 * c
32210 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
32220 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 35 0d 0a 34  r0..----..255..4
32230 36 35 0d 0a 38 38 35 0d 0a 0d 0a 71 75 65 72 79  65..885....query
32240 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32250 43 54 20 2b 20 2d 20 34 38 20 2d 20 2b 20 63 6f  CT + - 48 - + co
32260 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
32270 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34 0d  cor0..----..-74.
32280 0a 2d 37 35 0d 0a 2d 38 36 0d 0a 0d 0a 6f 6e 6c  .-75..-86....onl
32290 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
322a0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
322b0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
322c0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
322d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
322e0 6c 61 62 65 6c 2d 31 33 34 39 0d 0a 53 45 4c 45  label-1349..SELE
322f0 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2b 20  CT + - col2 + + 
32300 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45  CAST( NULL AS DE
32310 43 49 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62  CIMAL ) FROM tab
32320 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
32330 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
32340 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
32350 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
32360 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
32370 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34 39 0d 0a  ort label-1349..
32380 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
32390 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + + CAST ( NULL 
323a0 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74  AS REAL ) FROM t
323b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
323c0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
323d0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
323e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
323f0 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 37 20  LL + col2 + + 7 
32400 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  * - col0 AS col1
32410 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
32420 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d  r0..----..-22..-
32430 35 31 35 0d 0a 2d 35 32 30 0d 0a 0d 0a 71 75 65  515..-520....que
32440 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32450 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20  LECT - + col0 + 
32460 39 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  9 FROM tab2 AS c
32470 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 39 0d 0a  or0..----..-69..
32480 2d 37 30 0d 0a 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  -70..2....onlyif
32490 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
324a0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
324b0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
324c0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
324d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
324e0 65 6c 2d 31 33 35 32 0d 0a 53 45 4c 45 43 54 20  el-1352..SELECT 
324f0 2d 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53  - + col0 * - CAS
32500 54 28 20 2b 20 37 32 20 41 53 20 53 49 47 4e 45  T( + 72 AS SIGNE
32510 44 20 29 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  D ) + col2 AS co
32520 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
32530 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 31  cor0..----..1761
32540 0d 0a 32 35 32 31 0d 0a 36 34 39 30 0d 0a 0d 0a  ..2521..6490....
32550 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
32560 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
32570 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
32580 61 62 65 6c 2d 31 33 35 32 0d 0a 53 45 4c 45 43  abel-1352..SELEC
32590 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43  T - + col0 * - C
325a0 41 53 54 20 28 20 2b 20 37 32 20 41 53 20 49 4e  AST ( + 72 AS IN
325b0 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 32 20 41  TEGER ) + col2 A
325c0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
325d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
325e0 31 37 36 31 0d 0a 32 35 32 31 0d 0a 36 34 39 30  1761..2521..6490
325f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32600 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
32610 6c 30 20 2a 20 2b 20 28 20 63 6f 6c 30 20 29 20  l0 * + ( col0 ) 
32620 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  + - col0 AS col1
32630 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
32640 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d 0a 2d  r0..----..-56..-
32650 36 31 36 32 0d 0a 2d 36 33 32 30 0d 0a 0d 0a 71  6162..-6320....q
32660 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32670 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
32680 31 39 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  19 + - col2 FROM
32690 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
326a0 2d 2d 2d 0d 0a 2d 31 37 37 33 0d 0a 2d 34 38 39  ---..-1773..-489
326b0 0d 0a 2d 36 36 36 0d 0a 0d 0a 71 75 65 72 79 20  ..-666....query 
326c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
326d0 54 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20  T + tab0.col2 + 
326e0 33 34 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  34 * col2 FROM t
326f0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 35 0d  ab0..----..1155.
32700 0a 32 38 37 30 0d 0a 33 35 0d 0a 0d 0a 71 75 65  .2870..35....que
32710 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32720 4c 45 43 54 20 2b 20 39 31 20 2a 20 63 6f 6c 32  LECT + 91 * col2
32730 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
32740 0a 2d 2d 2d 2d 0d 0a 32 33 36 36 0d 0a 32 34 35  .----..2366..245
32750 37 0d 0a 33 34 35 38 0d 0a 0d 0a 71 75 65 72 79  7..3458....query
32760 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32770 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
32780 20 2a 20 39 38 20 46 52 4f 4d 20 74 61 62 31 0d   * 98 FROM tab1.
32790 0a 2d 2d 2d 2d 0d 0a 35 32 39 32 0d 0a 35 35 38  .----..5292..558
327a0 36 0d 0a 39 34 30 38 0d 0a 0d 0a 6f 6e 6c 79 69  6..9408....onlyi
327b0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
327c0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
327d0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
327e0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
327f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
32800 62 65 6c 2d 31 33 35 38 0d 0a 53 45 4c 45 43 54  bel-1358..SELECT
32810 20 41 4c 4c 20 2b 20 2b 20 36 34 20 2a 20 63 6f   ALL + + 64 * co
32820 6c 32 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  l2 + CAST( NULL 
32830 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20  AS SIGNED ) * - 
32840 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
32850 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
32860 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
32870 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
32880 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
32890 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
328a0 20 6c 61 62 65 6c 2d 31 33 35 38 0d 0a 53 45 4c   label-1358..SEL
328b0 45 43 54 20 41 4c 4c 20 2b 20 2b 20 36 34 20 2a  ECT ALL + + 64 *
328c0 20 63 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 4e   col2 + CAST ( N
328d0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
328e0 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
328f0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
32900 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
32910 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
32920 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
32930 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30  ISTINCT - - cor0
32940 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
32950 4f 4d 20 74 61 62 32 20 63 6f 72 30 20 43 52 4f  OM tab2 cor0 CRO
32960 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20  SS JOIN tab0 AS 
32970 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37  cor1..----..7..7
32980 38 0d 0a 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  8..79....onlyif 
32990 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
329a0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
329b0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
329c0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
329d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
329e0 6c 2d 31 33 36 30 0d 0a 53 45 4c 45 43 54 20 2d  l-1360..SELECT -
329f0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44   CAST( NULL AS D
32a00 45 43 49 4d 41 4c 20 29 20 2b 20 33 36 20 63 6f  ECIMAL ) + 36 co
32a10 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
32a20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
32a30 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
32a40 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
32a50 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
32a60 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
32a70 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
32a80 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
32a90 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
32aa0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
32ab0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
32ac0 36 30 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  60..SELECT - CAS
32ad0 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c  T ( NULL AS REAL
32ae0 20 29 20 2b 20 33 36 20 63 6f 6c 30 20 46 52 4f   ) + 36 col0 FRO
32af0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
32b00 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
32b10 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
32b20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32b30 54 20 28 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  T ( - col0 + col
32b40 32 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  2 ) FROM tab2..-
32b50 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d 0a 32  ---..-41..-52..2
32b60 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
32b70 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
32b80 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
32b90 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
32ba0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
32bb0 2d 31 33 36 32 0d 0a 53 45 4c 45 43 54 20 41 4c  -1362..SELECT AL
32bc0 4c 20 37 37 20 44 49 56 20 63 6f 6c 30 20 2d 20  L 77 DIV col0 - 
32bd0 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  ( col2 ) FROM ta
32be0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
32bf0 0d 0a 2d 31 36 0d 0a 2d 32 36 0d 0a 2d 33 38 0d  ..-16..-26..-38.
32c00 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
32c10 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
32c20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32c30 74 20 6c 61 62 65 6c 2d 31 33 36 32 0d 0a 53 45  t label-1362..SE
32c40 4c 45 43 54 20 41 4c 4c 20 37 37 20 2f 20 63 6f  LECT ALL 77 / co
32c50 6c 30 20 2d 20 28 20 63 6f 6c 32 20 29 20 46 52  l0 - ( col2 ) FR
32c60 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
32c70 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 32 36 0d  .----..-16..-26.
32c80 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-38....query I 
32c90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32ca0 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  ALL - col0 + - c
32cb0 6f 6c 31 20 2a 20 33 32 20 46 52 4f 4d 20 74 61  ol1 * 32 FROM ta
32cc0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
32cd0 0d 0a 2d 33 38 34 0d 0a 2d 34 39 36 0d 0a 2d 38  ..-384..-496..-8
32ce0 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
32cf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
32d00 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20  STINCT - - col1 
32d10 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  + col1 + cor0.co
32d20 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
32d30 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
32d40 0a 31 30 36 0d 0a 35 35 0d 0a 38 34 0d 0a 0d 0a  .106..55..84....
32d50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32d60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 36 34  .SELECT ALL - 64
32d70 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46   * col2 + col2 F
32d80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
32d90 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39 0d 0a 2d  ..----..-2079..-
32da0 35 31 36 36 0d 0a 2d 36 33 0d 0a 0d 0a 71 75 65  5166..-63....que
32db0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32dc0 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
32dd0 30 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 39  0 + - col1 + + 9
32de0 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  9 AS col1 FROM t
32df0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
32e00 2d 0d 0a 33 37 0d 0a 33 37 0d 0a 39 37 0d 0a 0d  -..37..37..97...
32e10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32e20 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
32e30 54 20 2b 20 33 35 20 2d 20 63 6f 72 30 2e 63 6f  T + 35 - cor0.co
32e40 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
32e50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
32e60 2d 2d 0d 0a 2d 35 34 0d 0a 30 0d 0a 31 31 0d 0a  --..-54..0..11..
32e70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32e80 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 38 37  t..SELECT - + 87
32e90 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   + cor0.col2 AS 
32ea0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
32eb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
32ec0 0d 0a 2d 35 34 0d 0a 2d 38 36 0d 0a 0d 0a 71 75  ..-54..-86....qu
32ed0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32ee0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
32ef0 20 34 31 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63   41 + col0 * + c
32f00 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
32f10 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
32f20 2d 2d 2d 0d 0a 32 31 30 35 0d 0a 33 34 33 36 0d  ---..2105..3436.
32f30 0a 38 31 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .8140....onlyif 
32f40 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
32f50 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
32f60 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
32f70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
32f80 61 62 65 6c 2d 31 33 37 30 0d 0a 53 45 4c 45 43  abel-1370..SELEC
32f90 54 20 44 49 53 54 49 4e 43 54 20 2b 20 31 30 20  T DISTINCT + 10 
32fa0 2a 20 63 6f 6c 30 20 2b 20 2d 20 37 32 20 2b 20  * col0 + - 72 + 
32fb0 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20 63 6f  col0 DIV col2 co
32fc0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
32fd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 0d  cor0..----..168.
32fe0 0a 33 31 33 0d 0a 38 31 39 0d 0a 0d 0a 73 6b 69  .313..819....ski
32ff0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
33000 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
33010 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
33020 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
33030 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
33040 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
33050 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
33060 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 30 0d  sort label-1370.
33070 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
33080 20 2b 20 31 30 20 2a 20 63 6f 6c 30 20 2b 20 2d   + 10 * col0 + -
33090 20 37 32 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c   72 + col0 / col
330a0 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  2 col1 FROM tab0
330b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
330c0 31 36 38 0d 0a 33 31 33 0d 0a 38 31 39 0d 0a 0d  168..313..819...
330d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
330e0 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c  ..SELECT ( + col
330f0 31 20 29 20 2b 20 2b 20 28 20 2b 20 39 39 20 29  1 ) + + ( + 99 )
33100 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
33110 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 0d 0a 31  r0..----..116..1
33120 33 30 0d 0a 31 35 38 0d 0a 0d 0a 71 75 65 72 79  30..158....query
33130 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33140 43 54 20 44 49 53 54 49 4e 43 54 20 36 30 20 46  CT DISTINCT 60 F
33150 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20  ROM tab0, tab1, 
33160 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
33170 2d 2d 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20  --..60....query 
33180 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33190 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
331a0 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  - + col1 AS col0
331b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
331c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d  r0..----..-53..-
331d0 39 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20  9..-96....query 
331e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
331f0 54 20 44 49 53 54 49 4e 43 54 20 32 39 20 2a 20  T DISTINCT 29 * 
33200 63 6f 6c 31 20 2b 20 35 35 20 2b 20 36 38 20 41  col1 + 55 + 68 A
33210 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
33220 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33230 34 31 33 0d 0a 35 30 30 0d 0a 38 37 37 0d 0a 0d  413..500..877...
33240 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33250 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
33260 31 20 2a 20 2d 20 32 32 20 46 52 4f 4d 20 74 61  1 * - 22 FROM ta
33270 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
33280 0d 0a 2d 31 38 39 32 0d 0a 2d 32 30 30 32 0d 0a  ..-1892..-2002..
33290 2d 32 31 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -2134....query I
332a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
332b0 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 36 38 20 2b   - - col1 * 68 +
332c0 20 2d 20 28 20 2b 20 63 6f 6c 30 20 2b 20 2d 20   - ( + col0 + - 
332d0 28 20 2b 20 63 6f 6c 30 20 29 20 29 20 41 53 20  ( + col0 ) ) AS 
332e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
332f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
33300 35 36 0d 0a 32 31 30 38 0d 0a 34 30 31 32 0d 0a  56..2108..4012..
33310 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
33320 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
33330 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
33340 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
33350 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
33360 37 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  77..SELECT ALL c
33370 6f 6c 30 20 44 49 56 20 2b 20 43 41 53 54 28 20  ol0 DIV + CAST( 
33380 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29  col1 AS SIGNED )
33390 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + + col0 AS col
333a0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
333b0 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
333c0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
333d0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
333e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
333f0 6c 61 62 65 6c 2d 31 33 37 37 0d 0a 53 45 4c 45  label-1377..SELE
33400 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2f 20 2b 20  CT ALL col0 / + 
33410 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49  CAST ( col1 AS I
33420 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 63 6f 6c  NTEGER ) + + col
33430 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
33440 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33  ab0..----..24..3
33450 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..89....query I
33460 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33470 20 41 4c 4c 20 2b 20 63 6f 72 31 2e 63 6f 6c 30   ALL + cor1.col0
33480 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
33490 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63   AS cor0, tab1 c
334a0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
334b0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
334c0 37 37 38 62 35 30 35 37 35 61 39 62 39 31 34 34  778b50575a9b9144
334d0 38 31 31 39 65 65 30 65 65 31 61 39 63 34 34 66  8119ee0ee1a9c44f
334e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
334f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
33500 2e 63 6f 6c 32 20 2b 20 2b 20 39 35 20 2a 20 63  .col2 + + 95 * c
33510 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
33520 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
33530 2d 2d 2d 0d 0a 32 34 39 36 0d 0a 32 35 39 32 0d  ---..2496..2592.
33540 0a 33 36 34 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .3648....onlyif 
33550 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
33560 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
33570 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
33580 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
33590 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
335a0 6c 2d 31 33 38 30 0d 0a 53 45 4c 45 43 54 20 2d  l-1380..SELECT -
335b0 20 43 41 53 54 28 20 2b 20 33 30 20 41 53 20 53   CAST( + 30 AS S
335c0 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 31 20 46  IGNED ) * col1 F
335d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
335e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 38 30 0d 0a 2d  ..----..-2580..-
335f0 32 37 33 30 0d 0a 2d 32 39 31 30 0d 0a 0d 0a 73  2730..-2910....s
33600 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
33610 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
33620 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
33630 62 65 6c 2d 31 33 38 30 0d 0a 53 45 4c 45 43 54  bel-1380..SELECT
33640 20 2d 20 43 41 53 54 20 28 20 2b 20 33 30 20 41   - CAST ( + 30 A
33650 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f  S INTEGER ) * co
33660 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
33670 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 38  cor0..----..-258
33680 30 0d 0a 2d 32 37 33 30 0d 0a 2d 32 39 31 30 0d  0..-2730..-2910.
33690 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
336a0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
336b0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
336c0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
336d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
336e0 33 38 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  381..SELECT DIST
336f0 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 44 49  INCT - + col1 DI
33700 56 20 2d 20 37 20 41 53 20 63 6f 6c 32 20 46 52  V - 7 AS col2 FR
33710 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
33720 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 31 33 0d 0a 0d  .----..12..13...
33730 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
33740 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
33750 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
33760 6c 61 62 65 6c 2d 31 33 38 31 0d 0a 53 45 4c 45  label-1381..SELE
33770 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
33780 63 6f 6c 31 20 2f 20 2d 20 37 20 41 53 20 63 6f  col1 / - 7 AS co
33790 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
337a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a  cor0..----..12..
337b0 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  13....query I ro
337c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
337d0 63 6f 6c 32 20 2a 20 32 38 20 46 52 4f 4d 20 74  col2 * 28 FROM t
337e0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
337f0 2d 32 32 39 36 0d 0a 2d 32 38 0d 0a 2d 39 32 34  -2296..-28..-924
33800 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33810 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
33820 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 37 38 20 2a  r0.col2 + + 78 *
33830 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   - cor0.col1 AS 
33840 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
33850 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
33860 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
33870 68 69 6e 67 20 74 6f 20 61 37 38 37 66 34 62 65  hing to a787f4be
33880 62 37 32 31 34 32 61 36 35 35 37 34 61 34 61 62  b72142a65574a4ab
33890 33 66 62 32 62 39 31 62 0d 0a 0d 0a 71 75 65 72  3fb2b91b....quer
338a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
338b0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
338c0 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a   + col1 * col1 *
338d0 20 2d 20 28 20 2d 20 35 36 20 29 20 41 53 20 63   - ( - 56 ) AS c
338e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
338f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 38 38 32 0d  r0..----..37882.
33900 0a 35 36 31 30 0d 0a 39 34 37 37 0d 0a 0d 0a 71  .5610..9477....q
33910 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33920 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
33930 32 20 2b 20 2b 20 33 32 20 41 53 20 63 6f 6c 30  2 + + 32 AS col0
33940 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
33950 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 0d 0a 33  r0..----..114..3
33960 33 0d 0a 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49  3..65....query I
33970 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33980 20 2d 20 37 32 20 2a 20 2d 20 63 6f 6c 31 20 2b   - 72 * - col1 +
33990 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46   - col0 * col0 F
339a0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
339b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 33 36 0d 0a 2d  ..----..-1836..-
339c0 35 30 31 37 0d 0a 32 31 38 33 0d 0a 0d 0a 71 75  5017..2183....qu
339d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
339e0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 33 20  ELECT ALL - + 3 
339f0 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  + ( cor0.col2 ) 
33a00 2a 20 2d 20 28 20 2b 20 32 30 20 29 20 41 53 20  * - ( + 20 ) AS 
33a10 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
33a20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
33a30 36 34 33 0d 0a 2d 32 33 0d 0a 2d 36 36 33 0d 0a  643..-23..-663..
33a40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33a50 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 38 38  t..SELECT - - 88
33a60 20 2a 20 34 36 20 41 53 20 63 6f 6c 32 20 46 52   * 46 AS col2 FR
33a70 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
33a80 0a 2d 2d 2d 2d 0d 0a 34 30 34 38 0d 0a 34 30 34  .----..4048..404
33a90 38 0d 0a 34 30 34 38 0d 0a 0d 0a 71 75 65 72 79  8..4048....query
33aa0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33ab0 43 54 20 41 4c 4c 20 2d 20 35 34 20 2b 20 2d 20  CT ALL - 54 + - 
33ac0 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col1 * col1 FROM
33ad0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
33ae0 2d 2d 2d 0d 0a 2d 37 34 35 30 0d 0a 2d 38 33 33  ---..-7450..-833
33af0 35 0d 0a 2d 39 34 36 33 0d 0a 0d 0a 73 6b 69 70  5..-9463....skip
33b00 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
33b10 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
33b20 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
33b30 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
33b40 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
33b50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
33b60 6f 6c 31 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20  ol1 ) col2 FROM 
33b70 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
33b80 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71  .86..91..97....q
33b90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33ba0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20  SELECT - col1 - 
33bb0 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 41 53 20  + ( - col0 ) AS 
33bc0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
33bd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
33be0 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 6f 6e 6c  3..54..67....onl
33bf0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
33c00 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
33c10 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
33c20 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
33c30 72 74 20 6c 61 62 65 6c 2d 31 33 39 32 0d 0a 53  rt label-1392..S
33c40 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
33c50 20 2b 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 30   + col2 + ( col0
33c60 20 29 20 44 49 56 20 63 6f 6c 30 20 63 6f 6c 30   ) DIV col0 col0
33c70 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
33c80 0d 0a 31 34 34 35 0d 0a 36 37 37 0d 0a 37 33 30  ..1445..677..730
33c90 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
33ca0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
33cb0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
33cc0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
33cd0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
33ce0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
33cf0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
33d00 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
33d10 6c 2d 31 33 39 32 0d 0a 53 45 4c 45 43 54 20 41  l-1392..SELECT A
33d20 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32  LL col2 * + col2
33d30 20 2b 20 28 20 63 6f 6c 30 20 29 20 2f 20 63 6f   + ( col0 ) / co
33d40 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
33d50 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 35 0d 0a 36  2..----..1445..6
33d60 37 37 0d 0a 37 33 30 0d 0a 0d 0a 6f 6e 6c 79 69  77..730....onlyi
33d70 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
33d80 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
33d90 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
33da0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33db0 20 6c 61 62 65 6c 2d 31 33 39 33 0d 0a 53 45 4c   label-1393..SEL
33dc0 45 43 54 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c  ECT col0 DIV col
33dd0 31 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20  1 + - tab2.col1 
33de0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
33df0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a 2d 33  2..----..-13..-3
33e00 31 0d 0a 2d 35 38 0d 0a 0d 0a 73 6b 69 70 69 66  1..-58....skipif
33e10 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
33e20 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
33e30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
33e40 33 39 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  393..SELECT col0
33e50 20 2f 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 32   / col1 + - tab2
33e60 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
33e70 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
33e80 31 33 0d 0a 2d 33 31 0d 0a 2d 35 38 0d 0a 0d 0a  13..-31..-58....
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 33 39 34  wsort label-1394
33ee0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
33ef0 63 6f 6c 30 20 2b 20 36 20 44 49 56 20 2b 20 31  col0 + 6 DIV + 1
33f00 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
33f10 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31 35 38 0d  -..14..156..158.
33f20 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
33f30 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
33f40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33f50 74 20 6c 61 62 65 6c 2d 31 33 39 34 0d 0a 53 45  t label-1394..SE
33f60 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 30  LECT col0 + col0
33f70 20 2b 20 36 20 2f 20 2b 20 31 31 20 46 52 4f 4d   + 6 / + 11 FROM
33f80 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d   tab2..----..14.
33f90 0a 31 35 36 0d 0a 31 35 38 0d 0a 0d 0a 71 75 65  .156..158....que
33fa0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33fb0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
33fc0 74 61 62 31 2e 63 6f 6c 30 20 2a 20 31 38 20 2a  tab1.col0 * 18 *
33fd0 20 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab1.col1 FROM 
33fe0 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
33ff0 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
34000 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 32 30 0d 0a  ..----..-11520..
34010 2d 31 34 30 34 0d 0a 2d 31 38 37 32 30 0d 0a 0d  -1404..-18720...
34020 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34030 0d 0a 53 45 4c 45 43 54 20 2b 20 34 34 20 2b 20  ..SELECT + 44 + 
34040 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  - col1 AS col1 F
34050 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
34060 31 38 0d 0a 33 31 0d 0a 33 34 0d 0a 0d 0a 71 75  18..31..34....qu
34070 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34080 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 31  ELECT + ( + col1
34090 20 29 20 2b 20 28 20 63 6f 6c 31 20 2a 20 2d 20   ) + ( col1 * - 
340a0 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 30 20 2a 20  col1 ) + col0 * 
340b0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  - col0 FROM tab2
340c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 35 31 33 0d 0a 2d  ..----..-6513..-
340d0 39 35 30 36 0d 0a 2d 39 37 39 0d 0a 0d 0a 71 75  9506..-979....qu
340e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
340f0 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
34100 32 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 41 53  2 - tab1.col1 AS
34110 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c   col1 FROM tab1,
34120 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
34130 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
34140 73 68 69 6e 67 20 74 6f 20 30 66 36 65 63 36 62  shing to 0f6ec6b
34150 38 37 39 32 39 65 36 37 63 61 65 39 33 62 39 63  87929e67cae93b9c
34160 36 34 61 66 62 35 63 39 63 0d 0a 0d 0a 6f 6e 6c  64afb5c9c....onl
34170 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
34180 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
34190 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
341a0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
341b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
341c0 6c 61 62 65 6c 2d 31 33 39 39 0d 0a 53 45 4c 45  label-1399..SELE
341d0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
341e0 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 43 41  cor0.col2 * - CA
341f0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
34200 45 44 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63  ED ) * col0 AS c
34210 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
34220 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
34230 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
34240 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
34250 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34260 20 6c 61 62 65 6c 2d 31 33 39 39 0d 0a 53 45 4c   label-1399..SEL
34270 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
34280 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 43   cor0.col2 * - C
34290 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
342a0 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30 20 41  TEGER ) * col0 A
342b0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
342c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
342d0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
342e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
342f0 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 28 20 2b 20   - col0 * + ( + 
34300 31 31 20 29 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  11 ) - - cor0.co
34310 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
34320 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36 0d  cor0..----..-46.
34330 0a 2d 37 39 39 0d 0a 2d 38 35 32 0d 0a 0d 0a 6f  .-799..-852....o
34340 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
34350 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
34360 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
34370 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
34380 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34390 74 20 6c 61 62 65 6c 2d 31 34 30 31 0d 0a 53 45  t label-1401..SE
343a0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20  LECT ALL col0 + 
343b0 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c 32 20 41  + CAST( + col2 A
343c0 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
343d0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
343e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d  cor0..----..171.
343f0 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69  .36..57....skipi
34400 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
34410 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
34420 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
34430 31 34 30 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1401..SELECT ALL
34440 20 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54 20 28   col0 + + CAST (
34450 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   + col2 AS INTEG
34460 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ER ) AS col2 FRO
34470 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
34480 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35  ----..171..36..5
34490 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
344a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 34 20  sort..SELECT 24 
344b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
344c0 30 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  0, tab2 cor0..--
344d0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
344e0 68 69 6e 67 20 74 6f 20 62 30 64 38 33 34 65 66  hing to b0d834ef
344f0 39 65 34 33 34 36 38 30 31 62 36 61 61 61 30 65  9e4346801b6aaa0e
34500 37 34 62 32 63 38 65 66 0d 0a 0d 0a 71 75 65 72  74b2c8ef....quer
34510 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34520 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 33 20  ECT DISTINCT 43 
34530 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
34540 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
34550 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 36 0d 0a  ..----..53..56..
34560 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  69....query I ro
34570 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
34580 4c 20 2b 20 28 20 2b 20 38 30 20 29 20 2a 20 2b  L + ( + 80 ) * +
34590 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
345a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
345b0 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 32 30 38  .----..1040..208
345c0 30 0d 0a 38 30 30 0d 0a 0d 0a 71 75 65 72 79 20  0..800....query 
345d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
345e0 54 20 44 49 53 54 49 4e 43 54 20 35 31 20 2a 20  T DISTINCT 51 * 
345f0 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2b 20  - col0 + col1 + 
34600 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
34610 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
34620 39 35 0d 0a 2d 33 38 36 30 0d 0a 2d 33 39 39 35  95..-3860..-3995
34630 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34640 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
34650 2b 20 28 20 2b 20 37 20 29 20 46 52 4f 4d 20 74  + ( + 7 ) FROM t
34660 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
34670 2d 0d 0a 37 0d 0a 37 0d 0a 37 0d 0a 0d 0a 71 75  -..7..7..7....qu
34680 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34690 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
346a0 20 31 34 20 2a 20 28 20 2b 20 63 6f 6c 30 20 29   14 * ( + col0 )
346b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
346c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 36 0d 0a  r0..----..1246..
346d0 33 33 36 0d 0a 34 39 30 0d 0a 0d 0a 73 6b 69 70  336..490....skip
346e0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
346f0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
34700 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
34710 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
34720 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
34730 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
34740 54 49 4e 43 54 20 2d 20 28 20 2b 20 39 34 20 29  TINCT - ( + 94 )
34750 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
34760 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
34770 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  94....onlyif mys
34780 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
34790 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
347a0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
347b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
347c0 6c 2d 31 34 30 39 0d 0a 53 45 4c 45 43 54 20 44  l-1409..SELECT D
347d0 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20 63 6f  ISTINCT + ( + co
347e0 6c 32 20 29 20 44 49 56 20 63 6f 6c 31 20 46 52  l2 ) DIV col1 FR
347f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
34800 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 0d 0a 73  .----..0..2....s
34810 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
34820 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
34830 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
34840 62 65 6c 2d 31 34 30 39 0d 0a 53 45 4c 45 43 54  bel-1409..SELECT
34850 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20   DISTINCT + ( + 
34860 63 6f 6c 32 20 29 20 2f 20 63 6f 6c 31 20 46 52  col2 ) / col1 FR
34870 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
34880 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 0d 0a 6f  .----..0..2....o
34890 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
348a0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
348b0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
348c0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
348d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
348e0 74 20 6c 61 62 65 6c 2d 31 34 31 30 0d 0a 53 45  t label-1410..SE
348f0 4c 45 43 54 20 2b 20 39 35 20 2a 20 2d 20 63 6f  LECT + 95 * - co
34900 6c 31 20 2d 20 43 41 53 54 28 20 37 20 41 53 20  l1 - CAST( 7 AS 
34910 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20  SIGNED ) * col0 
34920 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
34930 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
34940 0a 2d 32 31 36 38 0d 0a 2d 32 39 39 34 0d 0a 2d  .-2168..-2994..-
34950 36 31 35 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  6151....skipif m
34960 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
34970 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
34980 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31  owsort label-141
34990 30 0d 0a 53 45 4c 45 43 54 20 2b 20 39 35 20 2a  0..SELECT + 95 *
349a0 20 2d 20 63 6f 6c 31 20 2d 20 43 41 53 54 20 28   - col1 - CAST (
349b0 20 37 20 41 53 20 49 4e 54 45 47 45 52 20 29 20   7 AS INTEGER ) 
349c0 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
349d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
349e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 36 38 0d 0a 2d  ..----..-2168..-
349f0 32 39 39 34 0d 0a 2d 36 31 35 31 0d 0a 0d 0a 6f  2994..-6151....o
34a00 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
34a10 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
34a20 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
34a30 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
34a40 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 31 0d  sort label-1411.
34a50 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e 63  .SELECT + tab1.c
34a60 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 41 53 20  ol2 DIV col1 AS 
34a70 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
34a80 2d 2d 2d 2d 0d 0a 32 0d 0a 35 0d 0a 37 0d 0a 0d  ----..2..5..7...
34a90 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
34aa0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
34ab0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
34ac0 6c 61 62 65 6c 2d 31 34 31 31 0d 0a 53 45 4c 45  label-1411..SELE
34ad0 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2f  CT + tab1.col2 /
34ae0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
34af0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
34b00 0d 0a 35 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20  ..5..7....query 
34b10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34b20 54 20 2d 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63  T - + col0 - + c
34b30 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
34b40 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
34b50 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 31 37 0d  ---..-104..-117.
34b60 0a 2d 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-34....query I 
34b70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34b80 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c  DISTINCT + + col
34b90 31 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  1 - col1 AS col0
34ba0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
34bb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71  r0..----..0....q
34bc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34bd0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
34be0 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  cor0.col0 * + co
34bf0 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46  l0 * cor0.col2 F
34c00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
34c10 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 33 0d 0a 31 35  ..----..1323..15
34c20 38 31 38 34 0d 0a 32 33 37 31 35 38 0d 0a 0d 0a  8184..237158....
34c30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34c40 0a 53 45 4c 45 43 54 20 2d 20 36 34 20 2b 20 2b  .SELECT - 64 + +
34c50 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20   col2 * col2 AS 
34c60 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
34c70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  S cor0..----..28
34c80 35 32 0d 0a 33 31 38 35 0d 0a 39 31 35 32 0d 0a  52..3185..9152..
34c90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34ca0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
34cb0 6c 30 20 2a 20 28 20 37 31 20 29 20 2d 20 63 6f  l0 * ( 71 ) - co
34cc0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
34cd0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
34ce0 2d 2d 0d 0a 2d 35 30 34 0d 0a 2d 35 36 31 36 0d  --..-504..-5616.
34cf0 0a 2d 35 36 38 38 0d 0a 0d 0a 71 75 65 72 79 20  .-5688....query 
34d00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34d10 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 28 20 63  T - col1 * + ( c
34d20 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53 20 63 6f  or0.col0 ) AS co
34d30 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
34d40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36  cor0..----..-206
34d50 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d  4..-3395..-8099.
34d60 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
34d70 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
34d80 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
34d90 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
34da0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
34db0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34dc0 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
34dd0 2a 20 28 20 2b 20 63 6f 6c 30 20 29 20 2d 20 63  * ( + col0 ) - c
34de0 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c  ol2 * - col0 col
34df0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
34e00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 38 30  or0..----..14080
34e10 0d 0a 31 37 31 0d 0a 37 37 34 34 0d 0a 0d 0a 71  ..171..7744....q
34e20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34e30 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
34e40 2a 20 33 35 20 46 52 4f 4d 20 74 61 62 32 20 41  * 35 FROM tab2 A
34e50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
34e60 33 33 30 0d 0a 2d 39 31 30 0d 0a 2d 39 34 35 0d  330..-910..-945.
34e70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34e80 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
34e90 31 20 2b 20 2b 20 38 35 20 46 52 4f 4d 20 74 61  1 + + 85 FROM ta
34ea0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  b0..----..-1..-1
34eb0 32 0d 0a 2d 36 0d 0a 0d 0a 71 75 65 72 79 20 49  2..-6....query I
34ec0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34ed0 20 41 4c 4c 20 2b 20 34 31 20 41 53 20 63 6f 6c   ALL + 41 AS col
34ee0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
34ef0 2d 0d 0a 34 31 0d 0a 34 31 0d 0a 34 31 0d 0a 0d  -..41..41..41...
34f00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34f10 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
34f20 54 20 2b 20 63 6f 72 31 2e 63 6f 6c 31 20 41 53  T + cor1.col1 AS
34f30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c   col0 FROM tab0,
34f40 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
34f50 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor1..----..
34f60 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 6f 6e  10..13..26....on
34f70 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
34f80 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
34f90 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
34fa0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
34fb0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32 33 0d 0a  ort label-1423..
34fc0 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
34fd0 44 49 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  DIV + col0 FROM 
34fe0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
34ff0 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  .-1..0..0....ski
35000 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
35010 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
35020 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
35030 6c 2d 31 34 32 33 0d 0a 53 45 4c 45 43 54 20 2b  l-1423..SELECT +
35040 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 30   - col2 / + col0
35050 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
35060 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d  .----..-1..0..0.
35070 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
35080 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
35090 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
350a0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
350b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
350c0 34 32 34 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  424..SELECT - + 
350d0 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 44 49  col0 + + col0 DI
350e0 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V - col0 FROM ta
350f0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
35100 37 39 0d 0a 2d 38 0d 0a 2d 38 30 0d 0a 0d 0a 73  79..-8..-80....s
35110 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
35120 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
35130 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
35140 62 65 6c 2d 31 34 32 34 0d 0a 53 45 4c 45 43 54  bel-1424..SELECT
35150 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   - + col0 + + co
35160 6c 30 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l0 / - col0 FROM
35170 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
35180 0d 0a 2d 37 39 0d 0a 2d 38 0d 0a 2d 38 30 0d 0a  ..-79..-8..-80..
35190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
351a0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 32 20 41  t..SELECT + 32 A
351b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
351c0 0d 0a 2d 2d 2d 2d 0d 0a 33 32 0d 0a 33 32 0d 0a  ..----..32..32..
351d0 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  32....query I ro
351e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
351f0 53 54 49 4e 43 54 20 2b 20 32 30 20 41 53 20 63  STINCT + 20 AS c
35200 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
35210 2d 2d 2d 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79  ---..20....query
35220 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35230 43 54 20 2b 20 28 20 28 20 63 6f 6c 32 20 29 20  CT + ( ( col2 ) 
35240 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
35250 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d  -..26..27..38...
35260 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35270 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
35280 6c 30 20 2a 20 2d 20 33 34 20 46 52 4f 4d 20 74  l0 * - 34 FROM t
35290 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
352a0 2d 31 30 32 0d 0a 2d 32 31 37 36 0d 0a 2d 32 37  -102..-2176..-27
352b0 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
352c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
352d0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
352e0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
352f0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  ab0..----..0....
35300 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
35310 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
35320 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 37 20 46   cor0.col2 * 7 F
35330 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
35340 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
35350 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  , tab0 AS cor1..
35360 2d 2d 2d 2d 0d 0a 32 33 31 0d 0a 35 37 34 0d 0a  ----..231..574..
35370 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
35380 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
35390 32 20 2b 20 34 34 20 46 52 4f 4d 20 74 61 62 31  2 + 44 FROM tab1
353a0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 0d 0a 31 34 30  ..----..101..140
353b0 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..98....query I 
353c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
353d0 2b 20 2d 20 32 39 20 46 52 4f 4d 20 74 61 62 31  + - 29 FROM tab1
353e0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
353f0 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
35400 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
35410 73 68 69 6e 67 20 74 6f 20 30 63 63 39 64 64 61  shing to 0cc9dda
35420 64 39 33 66 63 37 38 33 30 35 35 35 31 38 61 65  d93fc783055518ae
35430 34 62 36 62 65 30 35 34 62 0d 0a 0d 0a 71 75 65  4b6be054b....que
35440 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35450 4c 45 43 54 20 2d 20 28 20 28 20 2d 20 63 6f 6c  LECT - ( ( - col
35460 32 20 29 20 29 20 2a 20 2d 20 37 36 20 2b 20 2d  2 ) ) * - 76 + -
35470 20 33 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d   3 * - col2 FROM
35480 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
35490 2d 2d 2d 0d 0a 2d 33 39 34 32 0d 0a 2d 34 31 36  ---..-3942..-416
354a0 31 0d 0a 2d 37 30 30 38 0d 0a 0d 0a 71 75 65 72  1..-7008....quer
354b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
354c0 45 43 54 20 41 4c 4c 20 2b 20 31 39 20 41 53 20  ECT ALL + 19 AS 
354d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20  col1 FROM tab0, 
354e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
354f0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
35500 68 69 6e 67 20 74 6f 20 33 64 61 63 33 30 64 63  hing to 3dac30dc
35510 38 32 63 39 65 35 61 63 62 62 64 33 61 35 63 35  82c9e5acbbd3a5c5
35520 64 31 61 65 65 65 31 31 0d 0a 0d 0a 73 6b 69 70  d1aeee11....skip
35530 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
35540 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
35550 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
35560 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
35570 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
35580 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
35590 54 49 4e 43 54 20 2d 20 2b 20 37 36 20 2a 20 2d  TINCT - + 76 * -
355a0 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
355b0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
355c0 2d 2d 0d 0a 31 39 37 36 0d 0a 32 30 35 32 0d 0a  --..1976..2052..
355d0 32 38 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2888....query I 
355e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
355f0 44 49 53 54 49 4e 43 54 20 2d 20 39 32 20 2b 20  DISTINCT - 92 + 
35600 2b 20 33 39 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  + 39 * col1 FROM
35610 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
35620 2d 2d 2d 0d 0a 32 39 38 0d 0a 34 31 35 0d 0a 39  ---..298..415..9
35630 32 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  22....onlyif mys
35640 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
35650 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
35660 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
35670 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
35680 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
35690 34 33 37 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  437..SELECT CAST
356a0 28 20 2d 20 33 34 20 41 53 20 53 49 47 4e 45 44  ( - 34 AS SIGNED
356b0 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63   ) * - col1 AS c
356c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
356d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35   cor0..----..105
356e0 34 0d 0a 32 30 30 36 0d 0a 35 37 38 0d 0a 0d 0a  4..2006..578....
356f0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
35700 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
35710 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
35720 61 62 65 6c 2d 31 34 33 37 0d 0a 53 45 4c 45 43  abel-1437..SELEC
35730 54 20 43 41 53 54 20 28 20 2d 20 33 34 20 41 53  T CAST ( - 34 AS
35740 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63   INTEGER ) * - c
35750 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
35760 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
35770 2d 2d 2d 0d 0a 31 30 35 34 0d 0a 32 30 30 36 0d  ---..1054..2006.
35780 0a 35 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .578....query I 
35790 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
357a0 37 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  70 * - col2 AS c
357b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
357c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
357d0 32 30 0d 0a 2d 31 38 39 30 0d 0a 2d 32 36 36 30  20..-1890..-2660
357e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
357f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
35800 49 4e 43 54 20 33 39 20 2b 20 63 6f 72 30 2e 63  INCT 39 + cor0.c
35810 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20  ol0 + - col1 AS 
35820 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
35830 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 0d 0a  or0..----..106..
35840 31 36 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20  16..93....query 
35850 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35860 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 63  T DISTINCT - ( c
35870 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 30 20 41  ol1 ) + + col0 A
35880 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
35890 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   cor0..----..-23
358a0 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72  ..54..67....quer
358b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
358c0 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  ECT cor0.col1 + 
358d0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
358e0 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
358f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
35900 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
35910 38 32 66 65 66 31 39 37 65 33 62 34 31 33 35 38  82fef197e3b41358
35920 63 35 38 65 32 34 66 32 64 62 32 66 32 65 31 0d  c58e24f2db2f2e1.
35930 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35940 72 74 0d 0a 53 45 4c 45 43 54 20 35 36 20 2a 20  rt..SELECT 56 * 
35950 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
35960 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
35970 2d 2d 2d 2d 0d 0a 31 37 33 36 0d 0a 33 33 30 34  ----..1736..3304
35980 0d 0a 39 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..952....query I
35990 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
359a0 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30   - col2 * - col0
359b0 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 46   + - tab0.col1 F
359c0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
359d0 2d 36 32 0d 0a 37 30 36 0d 0a 37 32 30 37 0d 0a  -62..706..7207..
359e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
359f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
35a00 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 28 20 2d 20   - - col0 * ( - 
35a10 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46  col1 ) AS col1 F
35a20 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
35a30 2d 31 31 32 30 0d 0a 2d 37 30 34 0d 0a 2d 38 31  -1120..-704..-81
35a40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35a50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 35  ort..SELECT + 35
35a60 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
35a70 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
35a80 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 33 31 31 35 0d  -..-1225..-3115.
35a90 0a 2d 38 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-840....query I
35aa0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35ab0 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 2a 20 36   col1 - col2 * 6
35ac0 39 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  9 FROM tab1..---
35ad0 2d 0d 0a 2d 33 37 30 30 0d 0a 2d 33 39 32 33 0d  -..-3700..-3923.
35ae0 0a 2d 36 36 31 31 0d 0a 0d 0a 71 75 65 72 79 20  .-6611....query 
35af0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35b00 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  T col2 * + col0 
35b10 2a 20 2b 20 37 31 20 2b 20 63 6f 6c 31 20 46 52  * + 71 + col1 FR
35b20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
35b30 0a 2d 2d 2d 2d 0d 0a 32 35 38 32 0d 0a 35 31 38  .----..2582..518
35b40 32 34 39 0d 0a 35 36 33 31 38 0d 0a 0d 0a 71 75  249..56318....qu
35b50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35b60 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63  ELECT col0 * + c
35b70 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 31 33 20  or0.col0 + + 13 
35b80 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
35b90 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
35ba0 0a 32 32 0d 0a 34 31 30 39 0d 0a 36 34 31 33 0d  .22..4109..6413.
35bb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35bc0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
35bd0 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 31 35 20  0 * + col0 * 15 
35be0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
35bf0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 31 35 0d  0..----..118815.
35c00 0a 31 38 33 37 35 0d 0a 38 36 34 30 0d 0a 0d 0a  .18375..8640....
35c10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
35c20 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30  .SELECT + - cor0
35c30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c  .col0 FROM tab0,
35c40 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
35c50 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
35c60 73 68 69 6e 67 20 74 6f 20 33 30 30 30 33 33 37  shing to 3000337
35c70 64 64 33 66 31 31 65 39 63 66 64 35 61 33 31 32  dd3f11e9cfd5a312
35c80 62 30 31 65 66 33 66 38 62 0d 0a 0d 0a 71 75 65  b01ef3f8b....que
35c90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35ca0 4c 45 43 54 20 63 6f 6c 32 20 2b 20 39 35 20 2a  LECT col2 + 95 *
35cb0 20 2d 20 32 32 20 2a 20 63 6f 6c 32 20 46 52 4f   - 22 * col2 FRO
35cc0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
35cd0 2d 2d 2d 2d 0d 0a 2d 31 31 32 38 30 36 0d 0a 2d  ----..-112806..-
35ce0 31 31 39 30 37 33 0d 0a 2d 32 30 30 35 34 34 0d  119073..-200544.
35cf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35d00 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
35d10 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63  ol1 + - col0 * c
35d20 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
35d30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
35d40 0d 0a 2d 36 30 32 35 0d 0a 2d 36 32 32 34 0d 0a  ..-6025..-6224..
35d50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35d60 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
35d70 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 34 20  cor0.col2 + + 4 
35d80 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
35d90 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 0d 0a 35 0d 0a  0..----..37..5..
35da0 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  86....query I ro
35db0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
35dc0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
35dd0 2d 20 31 32 20 46 52 4f 4d 20 74 61 62 31 20 41  - 12 FROM tab1 A
35de0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
35df0 35 32 0d 0a 36 34 38 0d 0a 36 38 34 0d 0a 0d 0a  52..648..684....
35e00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
35e10 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
35e20 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 2b   col0 * col0 * +
35e30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
35e40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
35e50 31 32 0d 0a 34 37 34 34 39 33 0d 0a 34 39 33 30  12..474493..4930
35e60 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  22....query I ro
35e70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
35e80 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 37 31  cor0.col2 + - 71
35e90 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
35ea0 62 30 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74  b0, tab0 cor0, t
35eb0 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
35ec0 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
35ed0 68 69 6e 67 20 74 6f 20 62 39 37 39 61 32 37 39  hing to b979a279
35ee0 62 64 64 39 39 63 36 30 61 64 36 34 31 33 62 64  bdd99c60ad6413bd
35ef0 62 37 37 61 62 36 64 31 0d 0a 0d 0a 71 75 65 72  b77ab6d1....quer
35f00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35f10 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
35f20 30 20 2a 20 28 20 28 20 2b 20 63 6f 6c 32 20 29  0 * ( ( + col2 )
35f30 20 2a 20 2d 20 63 6f 6c 30 20 29 20 41 53 20 63   * - col0 ) AS c
35f40 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
35f50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d  r0..----..-1225.
35f60 0a 2d 31 39 30 30 38 0d 0a 2d 36 34 39 35 32 32  .-19008..-649522
35f70 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
35f80 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
35f90 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
35fa0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
35fb0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
35fc0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35  owsort label-145
35fd0 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  8..SELECT ALL + 
35fe0 2b 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 28  + col1 + - CAST(
35ff0 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45   + col0 AS SIGNE
36000 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  D ) AS col0 FROM
36010 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
36020 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32  ---..-19..-62..2
36030 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
36040 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
36050 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
36060 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 38 0d 0a  ort label-1458..
36070 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
36080 6f 6c 31 20 2b 20 2d 20 43 41 53 54 20 28 20 2b  ol1 + - CAST ( +
36090 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
360a0 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
360b0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
360c0 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34  --..-19..-62..24
360d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
360e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
360f0 63 6f 6c 30 20 2a 20 2d 20 35 37 20 46 52 4f 4d  col0 * - 57 FROM
36100 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
36110 2d 2d 2d 0d 0a 31 33 36 38 0d 0a 31 39 39 35 0d  ---..1368..1995.
36120 0a 35 30 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .5073....query I
36130 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36140 20 2b 20 33 39 20 41 53 20 63 6f 6c 31 20 46 52   + 39 AS col1 FR
36150 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
36160 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
36170 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
36180 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
36190 65 64 32 65 62 64 39 64 65 66 33 65 32 63 33 38  ed2ebd9def3e2c38
361a0 61 61 34 36 63 62 33 61 66 36 30 66 65 32 32 39  aa46cb3af60fe229
361b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
361c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
361d0 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 37 36  col1 * col2 * 76
361e0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
361f0 0a 2d 2d 2d 2d 0d 0a 32 31 35 36 38 38 0d 0a 35  .----..215688..5
36200 36 37 31 31 32 0d 0a 37 33 37 32 0d 0a 0d 0a 71  67112..7372....q
36210 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36220 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72  SELECT ALL - cor
36230 30 2e 63 6f 6c 31 20 2b 20 2d 20 32 35 20 41 53  0.col1 + - 25 AS
36240 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
36250 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31  cor0..----..-111
36260 0d 0a 2d 31 31 36 0d 0a 2d 31 32 32 0d 0a 0d 0a  ..-116..-122....
36270 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36280 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
36290 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30   + col2 * + cor0
362a0 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20  .col2 + col2 AS 
362b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
362c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 32 0d  or0..----..1122.
362d0 0a 32 0d 0a 36 38 30 36 0d 0a 0d 0a 71 75 65 72  .2..6806....quer
362e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
362f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
36300 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63  ol0 * + col0 * c
36310 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
36320 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 31 39 30 30 38  ---..1225..19008
36330 0d 0a 36 34 39 35 32 32 0d 0a 0d 0a 71 75 65 72  ..649522....quer
36340 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36350 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
36360 20 2b 20 31 34 20 2a 20 63 6f 72 30 2e 63 6f 6c   + 14 * cor0.col
36370 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  2 + - cor0.col1 
36380 2a 20 34 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  * 42 AS col0 FRO
36390 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
363a0 2d 2d 2d 2d 0d 0a 2d 32 35 38 33 0d 0a 2d 33 30  ----..-2583..-30
363b0 36 34 0d 0a 2d 33 39 36 33 0d 0a 0d 0a 71 75 65  64..-3963....que
363c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
363d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
363e0 2d 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 31 20  - col0 + ( col1 
363f0 2a 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  * col1 ) FROM ta
36400 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36410 0d 0a 33 35 35 39 0d 0a 33 36 38 0d 0a 39 36 38  ..3559..368..968
36420 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36430 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20  ort..SELECT ( - 
36440 37 20 29 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  7 ) + + col0 * c
36450 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
36460 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
36470 0d 0a 31 33 33 36 0d 0a 32 31 30 0d 0a 34 35 39  ..1336..210..459
36480 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
36490 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
364a0 20 28 20 2b 20 38 32 20 29 20 2a 20 63 6f 6c 32   ( + 82 ) * col2
364b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
364c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 30 36 0d  r0..----..-2706.
364d0 0a 2d 36 37 32 34 0d 0a 2d 38 32 0d 0a 0d 0a 71  .-6724..-82....q
364e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
364f0 53 45 4c 45 43 54 20 34 32 20 2b 20 63 6f 6c 32  SELECT 42 + col2
36500 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
36510 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
36520 0d 0a 31 32 34 0d 0a 34 33 0d 0a 37 35 0d 0a 0d  ..124..43..75...
36530 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
36540 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
36550 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
36560 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
36570 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37  owsort label-147
36580 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  0..SELECT ALL + 
36590 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20  + cor0.col2 DIV 
365a0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
365b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
365c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  r0..----..0..1..
365d0 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  18....skipif mys
365e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
365f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
36600 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 30 0d  sort label-1470.
36610 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
36620 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2b 20 63 6f  cor0.col2 / + co
36630 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
36640 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
36650 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a  ----..0..1..18..
36660 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36670 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
36680 43 54 20 34 39 20 2b 20 28 20 2b 20 63 6f 6c 32  CT 49 + ( + col2
36690 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
366a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
366b0 2d 2d 0d 0a 37 35 0d 0a 37 36 0d 0a 38 37 0d 0a  --..75..76..87..
366c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
366d0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
366e0 6c 31 20 2a 20 2b 20 33 39 20 41 53 20 63 6f 6c  l1 * + 39 AS col
366f0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
36700 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 34  or0..----..-1014
36710 0d 0a 2d 33 39 30 0d 0a 2d 35 30 37 0d 0a 0d 0a  ..-390..-507....
36720 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36730 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
36740 20 2b 20 2d 20 32 38 20 2a 20 2b 20 63 6f 6c 31   + - 28 * + col1
36750 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
36760 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 0d 0a  r0..----..-280..
36770 2d 33 36 34 0d 0a 2d 37 32 38 0d 0a 0d 0a 6f 6e  -364..-728....on
36780 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
36790 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
367a0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
367b0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
367c0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 34 0d 0a  ort label-1474..
367d0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44 49  SELECT - col2 DI
367e0 56 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 38 32 20  V + col2 - + 82 
367f0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
36800 0a 2d 38 33 0d 0a 2d 38 33 0d 0a 2d 38 33 0d 0a  .-83..-83..-83..
36810 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
36820 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
36830 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36840 20 6c 61 62 65 6c 2d 31 34 37 34 0d 0a 53 45 4c   label-1474..SEL
36850 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63  ECT - col2 / + c
36860 6f 6c 32 20 2d 20 2b 20 38 32 20 46 52 4f 4d 20  ol2 - + 82 FROM 
36870 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 33 0d  tab0..----..-83.
36880 0a 2d 38 33 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65  .-83..-83....que
36890 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
368a0 4c 45 43 54 20 63 6f 6c 31 20 2b 20 37 36 20 46  LECT col1 + 76 F
368b0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
368c0 31 36 32 0d 0a 31 36 37 0d 0a 31 37 33 0d 0a 0d  162..167..173...
368d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
368e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
368f0 54 20 2b 20 2d 20 36 33 20 2a 20 63 6f 72 30 2e  T + - 63 * cor0.
36900 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col0 + col1 FROM
36910 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
36920 2d 2d 2d 0d 0a 2d 34 31 30 0d 0a 2d 34 38 35 35  ---..-410..-4855
36930 0d 0a 2d 34 39 36 30 0d 0a 0d 0a 71 75 65 72 79  ..-4960....query
36940 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36950 43 54 20 2d 20 38 32 20 2a 20 2b 20 63 6f 6c 31  CT - 82 * + col1
36960 20 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 2d 20   + ( col1 ) * - 
36970 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
36980 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
36990 34 39 32 34 0d 0a 2d 38 30 35 31 0d 0a 2d 39 38  4924..-8051..-98
369a0 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
369b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
369c0 28 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c  ( col1 ) * - col
369d0 30 20 2b 20 2d 20 37 38 20 46 52 4f 4d 20 74 61  0 + - 78 FROM ta
369e0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
369f0 0d 0a 2d 31 34 32 31 0d 0a 2d 32 39 35 0d 0a 2d  ..-1421..-295..-
36a00 34 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4680....query I 
36a10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36a20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c  ALL + col1 - col
36a30 30 20 2a 20 36 31 20 46 52 4f 4d 20 74 61 62 30  0 * 61 FROM tab0
36a40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36a50 2d 31 33 37 38 0d 0a 2d 32 30 33 38 0d 0a 2d 35  -1378..-2038..-5
36a60 33 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  338....query I r
36a70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
36a80 20 2d 20 39 37 20 2a 20 2d 20 63 6f 6c 31 20 2b   - 97 * - col1 +
36a90 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63 6f   ( + col1 ) * co
36aa0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
36ab0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
36ac0 0a 31 30 33 32 35 0d 0a 32 39 39 32 0d 0a 33 32  .10325..2992..32
36ad0 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  24....query I ro
36ae0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37 36  wsort..SELECT 76
36af0 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31   * col1 + - col1
36b00 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
36b10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 35 0d 0a  r0..----..1275..
36b20 32 33 32 35 0d 0a 34 34 32 35 0d 0a 0d 0a 71 75  2325..4425....qu
36b30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36b40 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
36b50 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol2 * cor0.col1 
36b60 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52  * col0 + col2 FR
36b70 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
36b80 0a 2d 2d 2d 2d 0d 0a 33 33 39 36 0d 0a 36 36 34  .----..3396..664
36b90 32 30 30 0d 0a 36 38 31 34 35 0d 0a 0d 0a 73 6b  200..68145....sk
36ba0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
36bb0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
36bc0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
36bd0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
36be0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
36bf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
36c00 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b  ISTINCT - col0 +
36c10 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63   cor0.col0 * + c
36c20 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  or0.col1 * col0 
36c30 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
36c40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
36c50 36 30 31 38 0d 0a 31 35 31 32 0d 0a 33 35 38 38  6018..1512..3588
36c60 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  78....query I ro
36c70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
36c80 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20  + col2 + - col2 
36c90 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
36ca0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
36cb0 0d 0a 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35 0d  ..36..7380..825.
36cc0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
36cd0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
36ce0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
36cf0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
36d00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
36d10 34 38 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  485..SELECT ALL 
36d20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c  + - col2 DIV col
36d30 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
36d40 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
36d50 2d 0d 0a 2d 32 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  -..-2..0..0....s
36d60 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
36d70 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
36d80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
36d90 62 65 6c 2d 31 34 38 35 0d 0a 53 45 4c 45 43 54  bel-1485..SELECT
36da0 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2f 20   ALL + - col2 / 
36db0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
36dc0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
36dd0 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d 0a 30 0d 0a  ----..-2..0..0..
36de0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
36df0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
36e00 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
36e10 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
36e20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
36e30 38 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  86..SELECT DISTI
36e40 4e 43 54 20 2d 20 2d 20 35 33 20 44 49 56 20 63  NCT - - 53 DIV c
36e50 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f  ol0 + + col1 FRO
36e60 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
36e70 2d 2d 2d 2d 0d 0a 38 38 0d 0a 39 31 0d 0a 39 38  ----..88..91..98
36e80 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
36e90 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
36ea0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
36eb0 72 74 20 6c 61 62 65 6c 2d 31 34 38 36 0d 0a 53  rt label-1486..S
36ec0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
36ed0 20 2d 20 35 33 20 2f 20 63 6f 6c 30 20 2b 20 2b   - 53 / col0 + +
36ee0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
36ef0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
36f00 38 0d 0a 39 31 0d 0a 39 38 0d 0a 0d 0a 73 6b 69  8..91..98....ski
36f10 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
36f20 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
36f30 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
36f40 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
36f50 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
36f60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
36f70 4c 20 2d 20 35 34 20 2d 20 74 61 62 32 2e 63 6f  L - 54 - tab2.co
36f80 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l1 col2 FROM tab
36f90 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 0d 0a 2d  2..----..-113..-
36fa0 37 31 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72 79  71..-85....query
36fb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36fc0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
36fd0 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  l2 * + col1 + - 
36fe0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
36ff0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
37000 2d 0d 0a 30 0d 0a 32 37 35 32 0d 0a 37 33 37 31  -..0..2752..7371
37010 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37020 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
37030 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  col2 * - col0 * 
37040 28 20 63 6f 6c 32 20 29 20 2d 20 63 6f 6c 32 20  ( col2 ) - col2 
37050 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
37060 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
37070 0a 2d 32 36 31 36 39 0d 0a 2d 33 36 0d 0a 2d 35  .-26169..-36..-5
37080 39 38 35 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49  98518....query I
37090 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
370a0 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b 20 63   tab2.col2 * + c
370b0 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  or0.col0 AS col0
370c0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
370d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
370e0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
370f0 20 74 6f 20 31 66 63 66 38 63 65 39 62 65 30 64   to 1fcf8ce9be0d
37100 62 31 39 62 33 38 38 33 63 33 36 32 64 31 30 34  b19b3883c362d104
37110 31 64 62 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1dbe....query I 
37120 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37130 44 49 53 54 49 4e 43 54 20 34 35 20 46 52 4f 4d  DISTINCT 45 FROM
37140 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
37150 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
37160 31 0d 0a 2d 2d 2d 2d 0d 0a 34 35 0d 0a 0d 0a 71  1..----..45....q
37170 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37180 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
37190 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 72 30 2e  + col2 - - cor0.
371a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
371b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
371c0 38 31 34 0d 0a 2d 36 32 0d 0a 2d 37 33 37 33 0d  814..-62..-7373.
371d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
371e0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
371f0 4e 43 54 20 2d 20 34 20 46 52 4f 4d 20 74 61 62  NCT - 4 FROM tab
37200 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  1, tab0 AS cor0,
37210 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
37220 2d 2d 2d 0d 0a 2d 34 0d 0a 0d 0a 71 75 65 72 79  ---..-4....query
37230 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37240 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f 72 30 2e  CT ALL - ( cor0.
37250 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31  col1 ) FROM tab1
37260 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
37270 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
37280 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
37290 73 68 69 6e 67 20 74 6f 20 62 32 33 34 37 39 38  shing to b234798
372a0 64 34 37 30 36 33 31 34 62 61 31 34 65 61 61 64  d4706314ba14eaad
372b0 35 33 39 64 30 61 61 38 38 0d 0a 0d 0a 71 75 65  539d0aa88....que
372c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
372d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
372e0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  + cor0.col1 + + 
372f0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
37300 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37310 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a 36  ----..118..34..6
37320 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
37330 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
37340 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  0 * - col2 + col
37350 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  1 * col1 AS col1
37360 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
37370 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 34 38 0d  r0..----..-3548.
37380 0a 2d 37 35 31 31 0d 0a 35 31 34 0d 0a 0d 0a 71  .-7511..514....q
37390 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
373a0 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e  SELECT - + cor0.
373b0 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  col1 * - col0 * 
373c0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 72 30  cor0.col2 + cor0
373d0 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20  .col2 FROM tab2 
373e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
373f0 31 39 36 37 38 0d 0a 35 31 30 37 32 0d 0a 35 38  19678..51072..58
37400 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  86....query I ro
37410 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
37420 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20  STINCT - - col0 
37430 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20  * col2 + - col2 
37440 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
37450 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
37460 0a 31 30 38 0d 0a 33 35 39 31 0d 0a 37 35 38 34  .108..3591..7584
37470 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37480 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
37490 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c 30  cor0.col0 - col0
374a0 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
374b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
374c0 0a 2d 37 30 0d 0a 2d 37 33 38 37 0d 0a 2d 38 31  .-70..-7387..-81
374d0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
374e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
374f0 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a   - col2 * col0 *
37500 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b   - col0 + col0 +
37510 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46   col1 * + col2 F
37520 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
37530 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 37 39 36 0d 0a  ..----..159796..
37540 32 31 36 37 0d 0a 32 33 37 38 38 33 0d 0a 0d 0a  2167..237883....
37550 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37560 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
37570 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 32  l1 * + tab0.col2
37580 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   + col2 * + col2
37590 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
375a0 0d 0a 31 34 31 38 36 0d 0a 33 39 32 37 0d 0a 39  ..14186..3927..9
375b0 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  8....skipif post
375c0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
375d0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
375e0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
375f0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
37600 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37610 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61 62 31  ELECT ALL - tab1
37620 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 63  .col1 + - col2 c
37630 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
37640 2d 2d 2d 0d 0a 2d 31 30 39 0d 0a 2d 36 37 0d 0a  ---..-109..-67..
37650 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -80....query I r
37660 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
37670 20 63 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c   col1 + tab1.col
37680 31 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20  1 * - tab1.col1 
37690 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
376a0 31 20 57 48 45 52 45 20 4e 55 4c 4c 20 3c 3d 20  1 WHERE NULL <= 
376b0 63 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c 31  col1 + tab1.col1
376c0 20 2b 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d   + col0..----...
376d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
376e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
376f0 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  T + col1 + + col
37700 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  0 * col2 AS col0
37710 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
37720 20 28 20 4e 55 4c 4c 20 29 20 4e 4f 54 20 42 45   ( NULL ) NOT BE
37730 54 57 45 45 4e 20 2b 20 63 6f 6c 31 20 2a 20 2d  TWEEN + col1 * -
37740 20 63 6f 6c 30 20 41 4e 44 20 63 6f 6c 30 20 2a   col0 AND col0 *
37750 20 2b 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 0d   + col1..----...
37760 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37770 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
37780 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e  T - col2 + cor0.
37790 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f  col1 * col2 + co
377a0 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l1 * col0 FROM t
377b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
377c0 2d 0d 0a 31 31 35 33 0d 0a 31 34 32 38 0d 0a 32  -..1153..1428..2
377d0 31 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  192....query I r
377e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
377f0 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63  ol2 * col0 + + c
37800 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b  ol2 - + col2 * +
37810 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f   col2 * col2 FRO
37820 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37830 2d 2d 2d 2d 0d 0a 2d 31 35 35 32 32 0d 0a 2d 31  ----..-15522..-1
37840 39 34 36 37 0d 0a 2d 35 31 38 33 32 0d 0a 0d 0a  9467..-51832....
37850 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
37860 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
37870 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
37880 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
37890 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
378a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
378b0 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f   ALL - col0 * co
378c0 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
378d0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  2 cor0..----..-4
378e0 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32 34 31 0d  9..-6084..-6241.
378f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37900 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
37910 4e 43 54 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  NCT - col0 FROM 
37920 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20 4e  tab1 WHERE NOT N
37930 55 4c 4c 20 3e 3d 20 28 20 4e 55 4c 4c 20 29 0d  ULL >= ( NULL ).
37940 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
37950 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37960 20 34 32 20 2d 20 2d 20 63 6f 6c 30 20 41 53 20   42 - - col0 AS 
37970 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
37980 2d 2d 2d 2d 0d 0a 31 30 36 0d 0a 31 32 32 0d 0a  ----..106..122..
37990 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  45....query I ro
379a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
379b0 53 54 49 4e 43 54 20 63 6f 6c 30 20 46 52 4f 4d  STINCT col0 FROM
379c0 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20   tab1 WHERE NOT 
379d0 28 20 4e 4f 54 20 28 20 4e 55 4c 4c 20 29 20 49  ( NOT ( NULL ) I
379e0 4e 20 28 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  N ( + col2 * + c
379f0 6f 6c 32 20 29 20 29 20 41 4e 44 20 4e 4f 54 20  ol2 ) ) AND NOT 
37a00 2b 20 63 6f 6c 30 20 49 4e 20 28 20 2b 20 63 6f  + col0 IN ( + co
37a10 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l1 )..----....qu
37a20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37a30 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20  ELECT ALL - - ( 
37a40 63 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 32 20  col2 ) + + col2 
37a50 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
37a60 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
37a70 0a 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a  .108..114..192..
37a80 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
37a90 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
37aa0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
37ab0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
37ac0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
37ad0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37ae0 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a  CT col1 * col0 *
37af0 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30   - col1 + + col0
37b00 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
37b10 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37 34 38 30 0d 0a  .----..-177480..
37b20 2d 33 32 39 32 38 30 0d 0a 2d 37 33 36 39 32 30  -329280..-736920
37b30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37b40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
37b50 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col1 * + col1 + 
37b60 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
37b70 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37b80 2d 2d 2d 2d 0d 0a 33 32 37 0d 0a 33 35 30 37 0d  ----..327..3507.
37b90 0a 39 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .988....query I 
37ba0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37bb0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
37bc0 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72  * + col0 + + cor
37bd0 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
37be0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37bf0 2d 34 30 38 36 0d 0a 2d 36 33 38 37 0d 0a 31 37  -4086..-6387..17
37c00 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37c10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
37c20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30  cor0.col1 + col0
37c30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
37c40 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
37c50 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d  ..137..38..96...
37c60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37c70 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74  ..SELECT ALL + t
37c80 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  ab2.col2 AS col2
37c90 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
37ca0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 4e   col0 * - col0 N
37cb0 4f 54 20 49 4e 20 28 20 63 6f 6c 31 20 29 0d 0a  OT IN ( col1 )..
37cc0 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38  ----..26..27..38
37cd0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
37ce0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
37cf0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
37d00 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
37d10 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
37d20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37d30 4c 45 43 54 20 63 6f 6c 32 20 2b 20 74 61 62 31  LECT col2 + tab1
37d40 2e 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20  .col2 col0 FROM 
37d50 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d  tab1..----..108.
37d60 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d 0a 71 75 65  .114..192....que
37d70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37d80 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
37d90 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  l2 + col0 * + co
37da0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
37db0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a  tab0..----..36..
37dc0 37 33 38 30 0d 0a 38 32 35 0d 0a 0d 0a 71 75 65  7380..825....que
37dd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37de0 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f  LECT ALL tab1.co
37df0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45  l0 FROM tab1 WHE
37e00 52 45 20 28 20 4e 55 4c 4c 20 29 20 3c 20 28 20  RE ( NULL ) < ( 
37e10 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  NULL )..----....
37e20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37e30 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
37e40 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  l2 + col2 * - co
37e50 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
37e60 2d 2d 0d 0a 2d 31 34 38 32 0d 0a 2d 37 30 32 0d  --..-1482..-702.
37e70 0a 2d 37 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .-756....query I
37e80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37e90 20 2b 20 63 6f 6c 30 20 2b 20 74 61 62 30 2e 63   + col0 + tab0.c
37ea0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol2 * + col2 FRO
37eb0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab0..----..11
37ec0 31 33 0d 0a 33 36 0d 0a 36 38 31 33 0d 0a 0d 0a  13..36..6813....
37ed0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37ee0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
37ef0 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 74   col1 * col1 * t
37f00 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  ab0.col2 AS col1
37f10 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
37f20 0d 0a 32 34 33 39 38 32 0d 0a 36 37 38 39 35 31  ..243982..678951
37f30 0d 0a 39 33 31 32 0d 0a 0d 0a 71 75 65 72 79 20  ..9312....query 
37f40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37f50 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
37f60 31 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52  1 FROM tab1 WHER
37f70 45 20 4e 55 4c 4c 20 3c 20 2d 20 63 6f 6c 32 0d  E NULL < - col2.
37f80 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
37f90 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
37fa0 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52  CT DISTINCT * FR
37fb0 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f  OM tab0 WHERE NO
37fc0 54 20 63 6f 6c 30 20 4e 4f 54 20 42 45 54 57 45  T col0 NOT BETWE
37fd0 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 2d 20 63 6f  EN NULL AND - co
37fe0 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79  l1..----....only
37ff0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
38000 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
38010 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
38020 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38030 74 20 6c 61 62 65 6c 2d 31 35 32 35 0d 0a 53 45  t label-1525..SE
38040 4c 45 43 54 20 2b 20 37 39 20 44 49 56 20 2b 20  LECT + 79 DIV + 
38050 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
38060 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
38070 2d 0d 0a 30 0d 0a 32 0d 0a 33 0d 0a 0d 0a 73 6b  -..0..2..3....sk
38080 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
38090 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
380a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
380b0 65 6c 2d 31 35 32 35 0d 0a 53 45 4c 45 43 54 20  el-1525..SELECT 
380c0 2b 20 37 39 20 2f 20 2b 20 63 6f 72 30 2e 63 6f  + 79 / + cor0.co
380d0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
380e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32  cor0..----..0..2
380f0 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..3....query I r
38100 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
38110 4c 4c 20 2d 20 63 6f 72 31 2e 63 6f 6c 30 20 46  LL - cor1.col0 F
38120 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41  ROM tab1, tab2 A
38130 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  S cor0, tab2 AS 
38140 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
38150 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
38160 20 63 38 32 64 66 31 64 65 33 63 62 36 36 36 32   c82df1de3cb6662
38170 32 34 36 39 30 61 38 33 66 33 64 37 39 30 64 37  24690a83f3d790d7
38180 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
38190 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
381a0 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b  TINCT - col2 + +
381b0 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20   col1 * col1 AS 
381c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
381d0 2d 2d 2d 2d 0d 0a 34 33 0d 0a 36 32 32 0d 0a 37  ----..43..622..7
381e0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
381f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
38200 6f 6c 30 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c  ol0 * - tab1.col
38210 30 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52  0 FROM tab1 WHER
38220 45 20 4e 4f 54 20 2b 20 63 6f 6c 31 20 3c 20 4e  E NOT + col1 < N
38230 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c  ULL..----....onl
38240 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
38250 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
38260 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
38270 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
38280 72 74 20 6c 61 62 65 6c 2d 31 35 32 39 0d 0a 53  rt label-1529..S
38290 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b  ELECT + col2 + +
382a0 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 2d   cor0.col1 DIV -
382b0 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 46   col2 - + col1 F
382c0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
382d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 39  ..----..-10..-19
382e0 33 0d 0a 2d 35 35 0d 0a 0d 0a 73 6b 69 70 69 66  3..-55....skipif
382f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
38300 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
38310 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
38320 35 32 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  529..SELECT + co
38330 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l2 + + cor0.col1
38340 20 2f 20 2d 20 63 6f 6c 32 20 2d 20 2b 20 63 6f   / - col2 - + co
38350 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
38360 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d  cor0..----..-10.
38370 0a 2d 31 39 33 0d 0a 2d 35 35 0d 0a 0d 0a 71 75  .-193..-55....qu
38380 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38390 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c  ELECT col1 * col
383a0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
383b0 6f 72 30 20 57 48 45 52 45 20 4e 4f 54 20 63 6f  or0 WHERE NOT co
383c0 6c 32 20 2f 20 63 6f 6c 31 20 3c 20 28 20 4e 55  l2 / col1 < ( NU
383d0 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  LL )..----....qu
383e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
383f0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
38400 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41   * col1 * col1 A
38410 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
38420 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 33 36 30 35 36 0d  ..----..-636056.
38430 0a 2d 37 35 33 35 37 31 0d 0a 2d 39 31 32 36 37  .-753571..-91267
38440 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  3....skipif post
38450 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
38460 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
38470 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
38480 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
38490 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
384a0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b  ELECT ALL col1 +
384b0 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
384c0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a  tab2..----..55..
384d0 35 38 0d 0a 38 35 0d 0a 0d 0a 73 6b 69 70 69 66  58..85....skipif
384e0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
384f0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
38500 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
38510 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
38520 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
38530 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74  rt..SELECT ALL t
38540 61 62 30 2e 63 6f 6c 30 20 63 6f 6c 31 20 46 52  ab0.col0 col1 FR
38550 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f  OM tab0 WHERE NO
38560 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  T col2 + col2 * 
38570 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  + col0 * + col2 
38580 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f 6c 32 20  NOT IN ( + col2 
38590 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
385a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
385b0 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 31  CT DISTINCT tab1
385c0 2e 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e 63  .col0 + - tab1.c
385d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
385e0 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ---..0....query 
385f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38600 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
38610 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  2 + - col2 AS co
38620 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45  l0 FROM tab2 WHE
38630 52 45 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 30  RE + col1 / col0
38640 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   + + col0 + + co
38650 6c 30 20 4e 4f 54 20 49 4e 20 28 20 63 6f 6c 32  l0 NOT IN ( col2
38660 20 2a 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 29   * col1 / col0 )
38670 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 0d 0a 2d 35 34  ..----..-52..-54
38680 0d 0a 2d 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-76....query I
38690 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
386a0 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 63 6f 6c   tab1.col2 * col
386b0 32 20 2d 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  2 - + col2 FROM 
386c0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 36 32  tab1..----..2862
386d0 0d 0a 33 31 39 32 0d 0a 39 31 32 30 0d 0a 0d 0a  ..3192..9120....
386e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
386f0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 41 53 20  .SELECT col0 AS 
38700 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 57  col2 FROM tab0 W
38710 48 45 52 45 20 4e 4f 54 20 2b 20 63 6f 6c 31 20  HERE NOT + col1 
38720 3c 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d  <> NULL..----...
38730 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38740 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
38750 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 57 48  ol0 FROM tab0 WH
38760 45 52 45 20 4e 55 4c 4c 20 3c 20 28 20 2d 20 63  ERE NULL < ( - c
38770 6f 6c 30 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c  ol0 + col2 / col
38780 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  0 )..----....que
38790 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
387a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
387b0 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2a 20  col1 * + col1 * 
387c0 2b 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63  + tab0.col2 AS c
387d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
387e0 2d 2d 2d 0d 0a 32 34 34 30 36 38 0d 0a 36 37 39  ---..244068..679
387f0 30 34 32 0d 0a 39 34 30 39 0d 0a 0d 0a 71 75 65  042..9409....que
38800 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38810 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  LECT + col0 + - 
38820 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63  col0 + col0 AS c
38830 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
38840 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a  ---..3..64..80..
38850 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38860 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
38870 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53  col1 * + col2 AS
38880 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
38890 57 48 45 52 45 20 4e 4f 54 20 28 20 4e 55 4c 4c  WHERE NOT ( NULL
388a0 20 29 20 42 45 54 57 45 45 4e 20 28 20 4e 55 4c   ) BETWEEN ( NUL
388b0 4c 20 29 20 41 4e 44 20 2b 20 63 6f 6c 32 0d 0a  L ) AND + col2..
388c0 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
388d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
388e0 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  col2 + + col2 * 
388f0 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
38900 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 32 0d 0a 2d  ..----..-1152..-
38910 31 33 35 30 0d 0a 2d 35 31 33 0d 0a 0d 0a 71 75  1350..-513....qu
38920 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38930 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
38940 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a   col0 * - col2 *
38950 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
38960 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32 0d 0a  .----..-119652..
38970 2d 35 31 30 33 34 0d 0a 2d 35 38 35 39 0d 0a 0d  -51034..-5859...
38980 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
38990 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
389a0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
389b0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
389c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34  owsort label-154
389d0 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
389e0 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2b  CT - tab0.col0 +
389f0 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20 63   col0 DIV col2 c
38a00 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
38a10 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 38 38 0d 0a 30  ---..-24..-88..0
38a20 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
38a30 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
38a40 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
38a50 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
38a60 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
38a70 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
38a80 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
38a90 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
38aa0 6c 2d 31 35 34 34 0d 0a 53 45 4c 45 43 54 20 44  l-1544..SELECT D
38ab0 49 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e 63  ISTINCT - tab0.c
38ac0 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c  ol0 + col0 / col
38ad0 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  2 col2 FROM tab0
38ae0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 38 38  ..----..-24..-88
38af0 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
38b00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
38b10 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f  ol2 + + col1 FRO
38b20 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54  M tab0 WHERE NOT
38b30 20 4e 55 4c 4c 20 3e 20 4e 55 4c 4c 0d 0a 2d 2d   NULL > NULL..--
38b40 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
38b50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
38b60 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
38b70 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  + col0 * - col1 
38b80 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
38b90 0a 2d 31 30 34 0d 0a 2d 31 30 35 33 0d 0a 2d 36  .-104..-1053..-6
38ba0 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  50....query I ro
38bb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
38bc0 53 54 49 4e 43 54 20 63 6f 6c 30 20 46 52 4f 4d  STINCT col0 FROM
38bd0 20 74 61 62 30 20 57 48 45 52 45 20 2b 20 63 6f   tab0 WHERE + co
38be0 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 4e 4f 54 20  l2 * - col0 NOT 
38bf0 49 4e 20 28 20 74 61 62 30 2e 63 6f 6c 32 20 2f  IN ( tab0.col2 /
38c00 20 74 61 62 30 2e 63 6f 6c 30 20 29 0d 0a 2d 2d   tab0.col0 )..--
38c10 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a  --..24..35..89..
38c20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38c30 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
38c40 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 74 61 62   tab2.col1 * tab
38c50 32 2e 63 6f