sqllogictest
Hex Artifact Content
Not logged in

Artifact a41d87a2eb39fcbd7ab47925c5a68df0cd4f9ef1:


0000: 68 61 73 68 2d 74 68 72 65 73 68 6f 6c 64 20 38  hash-threshold 8
0010: 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b  ....statement ok
0020: 0d 0a 43 52 45 41 54 45 20 54 41 42 4c 45 20 74  ..CREATE TABLE t
0030: 61 62 30 28 63 6f 6c 30 20 49 4e 54 45 47 45 52  ab0(col0 INTEGER
0040: 2c 20 63 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20  , col1 INTEGER, 
0050: 63 6f 6c 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d  col2 INTEGER)...
0060: 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43  .statement ok..C
0070: 52 45 41 54 45 20 54 41 42 4c 45 20 74 61 62 31  REATE TABLE tab1
0080: 28 63 6f 6c 30 20 49 4e 54 45 47 45 52 2c 20 63  (col0 INTEGER, c
0090: 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c  ol1 INTEGER, col
00a0: 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74  2 INTEGER)....st
00b0: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43 52 45 41  atement ok..CREA
00c0: 54 45 20 54 41 42 4c 45 20 74 61 62 32 28 63 6f  TE TABLE tab2(co
00d0: 6c 30 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 31  l0 INTEGER, col1
00e0: 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 32 20 49   INTEGER, col2 I
00f0: 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74 61 74 65  NTEGER)....state
0100: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0110: 49 4e 54 4f 20 74 61 62 30 20 56 41 4c 55 45 53  INTO tab0 VALUES
0120: 28 38 39 2c 39 31 2c 38 32 29 0d 0a 0d 0a 73 74  (89,91,82)....st
0130: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45  atement ok..INSE
0140: 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56 41 4c  RT INTO tab0 VAL
0150: 55 45 53 28 33 35 2c 39 37 2c 31 29 0d 0a 0d 0a  UES(35,97,1)....
0160: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
0170: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56  SERT INTO tab0 V
0180: 41 4c 55 45 53 28 32 34 2c 38 36 2c 33 33 29 0d  ALUES(24,86,33).
0190: 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d  ...statement ok.
01a0: 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 61 62  .INSERT INTO tab
01b0: 31 20 56 41 4c 55 45 53 28 36 34 2c 31 30 2c 35  1 VALUES(64,10,5
01c0: 37 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20  7)....statement 
01d0: 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20  ok..INSERT INTO 
01e0: 74 61 62 31 20 56 41 4c 55 45 53 28 33 2c 32 36  tab1 VALUES(3,26
01f0: 2c 35 34 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e  ,54)....statemen
0200: 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54  t ok..INSERT INT
0210: 4f 20 74 61 62 31 20 56 41 4c 55 45 53 28 38 30  O tab1 VALUES(80
0220: 2c 31 33 2c 39 36 29 0d 0a 0d 0a 73 74 61 74 65  ,13,96)....state
0230: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0240: 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55 45 53  INTO tab2 VALUES
0250: 28 37 2c 33 31 2c 32 37 29 0d 0a 0d 0a 73 74 61  (7,31,27)....sta
0260: 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52  tement ok..INSER
0270: 54 20 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55  T INTO tab2 VALU
0280: 45 53 28 37 39 2c 31 37 2c 33 38 29 0d 0a 0d 0a  ES(79,17,38)....
0290: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
02a0: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 32 20 56  SERT INTO tab2 V
02b0: 41 4c 55 45 53 28 37 38 2c 35 39 2c 32 36 29 0d  ALUES(78,59,26).
02c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
02d0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
02e0: 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 35  ol1 * col1 + + 5
02f0: 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  8 AS col2 FROM t
0300: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
0310: 31 35 38 0d 0a 32 32 37 0d 0a 37 33 34 0d 0a 0d  158..227..734...
0320: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0330: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 36 33 20  ..SELECT + + 63 
0340: 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * - col2 AS col2
0350: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
0360: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39 0d  r0..----..-2079.
0370: 0a 2d 35 31 36 36 0d 0a 2d 36 33 0d 0a 0d 0a 6f  .-5166..-63....o
0380: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
0390: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
03a0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
03b0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
03c0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 0d 0a 53 45  sort label-2..SE
03d0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
03e0: 63 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f  col2 DIV cor0.co
03f0: 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 32 31  l0 + col0 * - 21
0400: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
0410: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 34 0d  r0..----..-1344.
0420: 0a 2d 31 36 38 31 0d 0a 2d 38 31 0d 0a 0d 0a 73  .-1681..-81....s
0430: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
0440: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
0450: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
0460: 62 65 6c 2d 32 0d 0a 53 45 4c 45 43 54 20 41 4c  bel-2..SELECT AL
0470: 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20  L - cor0.col2 / 
0480: 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30  cor0.col0 + col0
0490: 20 2a 20 2d 20 32 31 20 46 52 4f 4d 20 74 61 62   * - 21 FROM tab
04a0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
04b0: 0a 2d 31 33 34 34 0d 0a 2d 31 36 38 31 0d 0a 2d  .-1344..-1681..-
04c0: 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
04d0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
04e0: 39 36 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  96 FROM tab2 cor
04f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 36 0d 0a 39 36 0d  0..----..96..96.
0500: 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .96....query I r
0510: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
0520: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a  ISTINCT + col2 *
0530: 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 46   col0 + + col0 F
0540: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
0550: 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31  ..----..165..371
0560: 32 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79  2..7760....query
0570: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0580: 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  CT + col0 + - co
0590: 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  l0 * + col0 AS c
05a0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
05b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
05c0: 39 30 0d 0a 2d 35 35 32 0d 0a 2d 37 38 33 32 0d  90..-552..-7832.
05d0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
05e0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
05f0: 4e 43 54 20 2b 20 35 35 20 2b 20 63 6f 6c 32 20  NCT + 55 + col2 
0600: 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  * + col0 + - col
0610: 30 20 2a 20 2b 20 35 33 20 2a 20 63 6f 6c 32 20  0 * + 53 * col2 
0620: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
0630: 2d 2d 2d 2d 0d 0a 2d 31 38 39 36 34 31 0d 0a 2d  ----..-189641..-
0640: 33 39 39 33 30 35 0d 0a 2d 38 33 36 39 0d 0a 0d  399305..-8369...
0650: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0660: 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 33 35 20  ..SELECT ( + 35 
0670: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
0680: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
0690: 2d 0d 0a 33 35 0d 0a 33 35 0d 0a 33 35 0d 0a 0d  -..35..35..35...
06a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
06b0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
06c0: 20 63 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 6c 30   col0 + + ( col0
06d0: 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) * col1 FROM t
06e0: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
06f0: 31 32 36 34 0d 0a 32 31 30 0d 0a 34 35 32 34 0d  1264..210..4524.
0700: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
0710: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
0720: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
0730: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
0740: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
0750: 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
0760: 31 20 44 49 56 20 38 31 20 41 53 20 63 6f 6c 30  1 DIV 81 AS col0
0770: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
0780: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
0790: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
07a0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
07b0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
07c0: 6f 72 74 20 6c 61 62 65 6c 2d 39 0d 0a 53 45 4c  ort label-9..SEL
07d0: 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 38  ECT + - col1 / 8
07e0: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
07f0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
0800: 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e  -..0..0..0....on
0810: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
0820: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
0830: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
0840: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
0850: 6f 72 74 20 6c 61 62 65 6c 2d 31 30 0d 0a 53 45  ort label-10..SE
0860: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 44 49  LECT ALL col0 DI
0870: 56 20 2d 20 36 20 41 53 20 63 6f 6c 30 20 46 52  V - 6 AS col0 FR
0880: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
0890: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d  .----..-10..-13.
08a0: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
08b0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
08c0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
08d0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 0d 0a 53  sort label-10..S
08e0: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2f  ELECT ALL col0 /
08f0: 20 2d 20 36 20 41 53 20 63 6f 6c 30 20 46 52 4f   - 6 AS col0 FRO
0900: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
0910: 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a  ----..-10..-13..
0920: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
0930: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
0940: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
0950: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
0960: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
0970: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
0980: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
0990: 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
09a0: 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31  SIGNED ) AS col1
09b0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
09c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
09d0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
09e0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
09f0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
0a00: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
0a10: 65 6c 2d 31 31 0d 0a 53 45 4c 45 43 54 20 2b 20  el-11..SELECT + 
0a20: 63 6f 6c 31 20 2d 20 43 41 53 54 20 28 20 4e 55  col1 - CAST ( NU
0a30: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
0a40: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
0a50: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
0a60: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
0a70: 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
0a80: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
0a90: 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31   - col0 * + col1
0aa0: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
0ab0: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
0ac0: 33 32 36 0d 0a 2d 31 38 36 0d 0a 2d 34 35 34 33  326..-186..-4543
0ad0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
0ae0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
0af0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
0b00: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
0b10: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
0b20: 31 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  13..SELECT + col
0b30: 30 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 44  0 + ( + col0 ) D
0b40: 49 56 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  IV + col2 FROM t
0b50: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
0b60: 2d 0d 0a 32 34 0d 0a 37 30 0d 0a 39 30 0d 0a 0d  -..24..70..90...
0b70: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
0b80: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
0b90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
0ba0: 6c 61 62 65 6c 2d 31 33 0d 0a 53 45 4c 45 43 54  label-13..SELECT
0bb0: 20 2b 20 63 6f 6c 30 20 2b 20 28 20 2b 20 63 6f   + col0 + ( + co
0bc0: 6c 30 20 29 20 2f 20 2b 20 63 6f 6c 32 20 46 52  l0 ) / + col2 FR
0bd0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
0be0: 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 37 30 0d 0a 39  .----..24..70..9
0bf0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
0c00: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
0c10: 54 49 4e 43 54 20 2b 20 34 36 20 41 53 20 63 6f  TINCT + 46 AS co
0c20: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
0c30: 2d 2d 0d 0a 34 36 0d 0a 0d 0a 73 6b 69 70 69 66  --..46....skipif
0c40: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
0c50: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
0c60: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
0c70: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
0c80: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
0c90: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38  rt..SELECT ALL 8
0ca0: 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0 col0 FROM tab2
0cb0: 0d 0a 2d 2d 2d 2d 0d 0a 38 30 0d 0a 38 30 0d 0a  ..----..80..80..
0cc0: 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
0cd0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
0ce0: 35 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  50 + - col0 * + 
0cf0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
0d00: 2d 2d 2d 2d 0d 0a 2d 37 33 34 38 0d 0a 2d 38 34  ----..-7348..-84
0d10: 32 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72 79 20  2..-85....query 
0d20: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
0d30: 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 35 20 2b  T ALL col0 + 5 +
0d40: 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 63 6f 6c   tab1.col0 * col
0d50: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
0d60: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 35 0d  ab1..----..1125.
0d70: 0a 37 30 39 0d 0a 38 36 0d 0a 0d 0a 71 75 65 72  .709..86....quer
0d80: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0d90: 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63  ECT ALL col0 * c
0da0: 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 * cor0.col2 
0db0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
0dc0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 30 37 36 0d  0..----..114076.
0dd0: 0a 35 31 30 33 0d 0a 35 32 37 32 38 0d 0a 0d 0a  .5103..52728....
0de0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0df0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2d  .SELECT - col2 -
0e00: 20 2b 20 36 34 20 41 53 20 63 6f 6c 31 20 46 52   + 64 AS col1 FR
0e10: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
0e20: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 0d 0a 2d 31 32  .----..-118..-12
0e30: 31 0d 0a 2d 31 36 30 0d 0a 0d 0a 71 75 65 72 79  1..-160....query
0e40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0e50: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
0e60: 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a  r0.col1 + col2 *
0e70: 20 2b 20 39 35 20 46 52 4f 4d 20 74 61 62 30 20   + 95 FROM tab0 
0e80: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
0e90: 32 0d 0a 33 30 34 39 0d 0a 37 36 39 39 0d 0a 0d  2..3049..7699...
0ea0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0eb0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
0ec0: 2b 20 31 38 20 46 52 4f 4d 20 74 61 62 32 20 41  + 18 FROM tab2 A
0ed0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
0ee0: 30 0d 0a 2d 38 0d 0a 2d 39 0d 0a 0d 0a 71 75 65  0..-8..-9....que
0ef0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0f00: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
0f10: 63 6f 6c 31 20 2b 20 2b 20 33 39 20 46 52 4f 4d  col1 + + 39 FROM
0f20: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   tab2..----..-20
0f30: 0d 0a 32 32 0d 0a 38 0d 0a 0d 0a 73 6b 69 70 69  ..22..8....skipi
0f40: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
0f50: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
0f60: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
0f70: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
0f80: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
0f90: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
0fa0: 6c 32 20 2b 20 39 32 20 63 6f 6c 30 20 46 52 4f  l2 + 92 col0 FRO
0fb0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
0fc0: 2d 2d 2d 2d 0d 0a 31 34 36 0d 0a 31 34 39 0d 0a  ----..146..149..
0fd0: 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  188....query I r
0fe0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
0ff0: 20 36 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   66 AS col1 FROM
1000: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
1010: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
1020: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32  ues hashing to 2
1030: 39 37 39 34 39 31 35 62 35 38 35 65 65 61 38 34  9794915b585eea84
1040: 38 61 64 36 37 30 30 37 35 34 35 32 63 38 38 0d  8ad670075452c88.
1050: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1060: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1070: 20 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   6 AS col1 FROM 
1080: 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
1090: 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
10a0: 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  b1, tab2 AS cor1
10b0: 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
10c0: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 34 66  s hashing to 44f
10d0: 32 33 33 64 31 62 33 38 30 34 65 30 30 64 39 34  233d1b3804e00d94
10e0: 33 36 63 30 61 34 31 64 31 65 32 63 38 0d 0a 0d  36c0a41d1e2c8...
10f0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1100: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1110: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1120: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1130: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 0d  owsort label-26.
1140: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30  .SELECT + + col0
1150: 20 44 49 56 20 2d 20 33 35 20 63 6f 6c 32 20 46   DIV - 35 col2 F
1160: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
1170: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a  ---..-1..-2..0..
1180: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1190: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
11a0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
11b0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
11c0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
11d0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
11e0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
11f0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1200: 32 36 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  26..SELECT + + c
1210: 6f 6c 30 20 2f 20 2d 20 33 35 20 63 6f 6c 32 20  ol0 / - 35 col2 
1220: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
1230: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d  ----..-1..-2..0.
1240: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1250: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1260: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1270: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1280: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
1290: 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  7..SELECT + col2
12a0: 20 2a 20 28 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   * ( col1 * - co
12b0: 6c 30 20 29 20 2b 20 63 6f 6c 31 20 44 49 56 20  l0 ) + col1 DIV 
12c0: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
12d0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
12e0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 31 0d  ..----..-119651.
12f0: 0a 2d 35 31 30 33 33 0d 0a 2d 35 38 35 38 0d 0a  .-51033..-5858..
1300: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1310: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1320: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1330: 20 6c 61 62 65 6c 2d 32 37 0d 0a 53 45 4c 45 43   label-27..SELEC
1340: 54 20 2b 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c  T + col2 * ( col
1350: 31 20 2a 20 2d 20 63 6f 6c 30 20 29 20 2b 20 63  1 * - col0 ) + c
1360: 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20  ol1 / + col1 AS 
1370: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1380: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1390: 31 39 36 35 31 0d 0a 2d 35 31 30 33 33 0d 0a 2d  19651..-51033..-
13a0: 35 38 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5858....query I 
13b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13c0: 2b 20 34 33 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 43 AS col1 FRO
13d0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
13e0: 2d 2d 2d 2d 0d 0a 34 33 0d 0a 34 33 0d 0a 34 33  ----..43..43..43
13f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1400: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1410: 2b 20 34 38 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 48 AS col1 FRO
1420: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 38  M tab1..----..48
1430: 0d 0a 34 38 0d 0a 34 38 0d 0a 0d 0a 71 75 65 72  ..48..48....quer
1440: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1450: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1460: 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 32  ol2 + + col2 + 2
1470: 38 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  8 * col2 FROM ta
1480: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1490: 0d 0a 31 36 32 30 0d 0a 31 37 31 30 0d 0a 32 38  ..1620..1710..28
14a0: 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  80....onlyif mys
14b0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
14c0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
14d0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
14e0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
14f0: 6c 2d 33 31 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-31..SELECT DIS
1500: 54 49 4e 43 54 20 63 6f 6c 32 20 44 49 56 20 63  TINCT col2 DIV c
1510: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
1520: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
1530: 0d 0a 30 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..3....skipif
1540: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1550: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1560: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
1570: 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
1580: 43 54 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 41  CT col2 / col0 A
1590: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
15a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
15b0: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
15c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
15d0: 20 35 38 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f   58 + + col1 FRO
15e0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
15f0: 2d 2d 2d 2d 0d 0a 31 34 34 0d 0a 31 34 39 0d 0a  ----..144..149..
1600: 31 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  155....query I r
1610: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1620: 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  LL + col1 * + co
1630: 6c 30 20 2b 20 28 20 2b 20 63 6f 6c 32 20 2b 20  l0 + ( + col2 + 
1640: 2b 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c  + col1 ) * + col
1650: 32 20 2a 20 39 20 46 52 4f 4d 20 74 61 62 32 20  2 * 9 FROM tab2 
1660: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1670: 34 33 31 31 0d 0a 32 30 31 35 33 0d 0a 32 34 34  4311..20153..244
1680: 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
1690: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
16a0: 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  5 AS col0 FROM t
16b0: 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab2 AS cor0 CROS
16c0: 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63  S JOIN tab1 AS c
16d0: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
16e0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
16f0: 34 36 36 35 66 62 62 34 37 64 35 62 31 37 64 61  4665fbb47d5b17da
1700: 30 31 31 62 63 61 35 36 37 31 39 35 62 32 31 0d  011bca567195b21.
1710: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1720: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 37 20  rt..SELECT + 17 
1730: 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
1740: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
1750: 34 37 0d 0a 2d 36 33 0d 0a 31 34 0d 0a 0d 0a 71  47..-63..14....q
1760: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1770: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1780: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  col0 + + col1 + 
1790: 28 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  ( col0 + - col0 
17a0: 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) * col0 FROM ta
17b0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
17c0: 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a  ..29..74..93....
17d0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
17e0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
17f0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1800: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1810: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 0d 0a  wsort label-37..
1820: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1830: 31 20 44 49 56 20 63 6f 6c 30 20 2b 20 36 32 20  1 DIV col0 + 62 
1840: 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  * - col1 * col2 
1850: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1860: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 33 34 30 0d  0..----..-35340.
1870: 0a 2d 37 37 33 37 36 0d 0a 2d 38 37 30 35 36 0d  .-77376..-87056.
1880: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1890: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
18a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18b0: 74 20 6c 61 62 65 6c 2d 33 37 0d 0a 53 45 4c 45  t label-37..SELE
18c0: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2f 20  CT ALL - col1 / 
18d0: 63 6f 6c 30 20 2b 20 36 32 20 2a 20 2d 20 63 6f  col0 + 62 * - co
18e0: 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
18f0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1900: 2d 0d 0a 2d 33 35 33 34 30 0d 0a 2d 37 37 33 37  -..-35340..-7737
1910: 36 0d 0a 2d 38 37 30 35 36 0d 0a 0d 0a 71 75 65  6..-87056....que
1920: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1930: 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c  LECT ALL + ( col
1940: 31 20 29 20 2a 20 2b 20 28 20 63 6f 72 30 2e 63  1 ) * + ( cor0.c
1950: 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol2 ) FROM tab0 
1960: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1970: 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d  838..7462..97...
1980: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1990: 0d 0a 53 45 4c 45 43 54 20 2d 20 31 20 2a 20 2d  ..SELECT - 1 * -
19a0: 20 63 6f 6c 30 20 2b 20 2d 20 33 39 20 2a 20 63   col0 + - 39 * c
19b0: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
19c0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
19d0: 2d 2d 2d 0d 0a 2d 31 30 31 31 0d 0a 2d 33 32 36  ---..-1011..-326
19e0: 0d 0a 2d 34 32 37 0d 0a 0d 0a 71 75 65 72 79 20  ..-427....query 
19f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a00: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
1a10: 30 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72  0 * col0 + + cor
1a20: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
1a30: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1a40: 2d 31 31 39 30 0d 0a 2d 35 35 32 0d 0a 2d 37 38  -1190..-552..-78
1a50: 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  32....query I ro
1a60: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1a70: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
1a80: 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 2a 20  col2 - + col0 * 
1a90: 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col1 * col1 FROM
1aa0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1ab0: 2d 2d 2d 0d 0a 2d 31 37 37 34 34 37 0d 0a 2d 33  ---..-177447..-3
1ac0: 32 39 32 37 39 0d 0a 2d 37 33 36 38 33 38 0d 0a  29279..-736838..
1ad0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ae0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
1af0: 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63  - ( col2 ) * + c
1b00: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
1b10: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a  r0..----..2916..
1b20: 33 32 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a 71 75  3249..9216....qu
1b30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b40: 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a  ELECT - + col2 *
1b50: 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46   - col0 * col2 F
1b60: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1b70: 0d 0a 2d 2d 2d 2d 0d 0a 32 36 31 33 36 0d 0a 33  ..----..26136..3
1b80: 35 0d 0a 35 39 38 34 33 36 0d 0a 0d 0a 71 75 65  5..598436....que
1b90: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ba0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
1bb0: 2a 20 2d 20 39 20 2b 20 63 6f 6c 31 20 46 52 4f  * - 9 + col1 FRO
1bc0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1bd0: 2d 2d 2d 2d 0d 0a 32 37 34 0d 0a 32 39 33 0d 0a  ----..274..293..
1be0: 33 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  359....query I r
1bf0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1c00: 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 38 32 20 41   + col2 * - 82 A
1c10: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
1c20: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c30: 32 37 30 36 0d 0a 36 37 32 34 0d 0a 38 32 0d 0a  2706..6724..82..
1c40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c50: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1c60: 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  CT - cor0.col2 +
1c70: 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30   + col2 * - col0
1c80: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1c90: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1ca0: 0d 0a 2d 33 36 0d 0a 2d 37 33 38 30 0d 0a 2d 38  ..-36..-7380..-8
1cb0: 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  25....query I ro
1cc0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1cd0: 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 31 20 29 20  col1 * ( col1 ) 
1ce0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1cf0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1d00: 0a 2d 32 38 39 0d 0a 2d 33 34 38 31 0d 0a 2d 39  .-289..-3481..-9
1d10: 36 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  61....skipif pos
1d20: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1d30: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1d40: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1d50: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
1d60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d70: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1d80: 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 36  2 + - col1 * + 6
1d90: 33 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  3 col2 FROM tab1
1da0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1db0: 2d 31 36 39 32 0d 0a 2d 36 38 37 0d 0a 2d 39 31  -1692..-687..-91
1dc0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
1dd0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1de0: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b   - col1 * col2 +
1df0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1e00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30  cor0..----..-150
1e10: 38 0d 0a 2d 36 30 38 0d 0a 2d 38 31 30 0d 0a 0d  8..-608..-810...
1e20: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1e30: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1e40: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1e50: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1e60: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 0d  owsort label-50.
1e70: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32  .SELECT + + col2
1e80: 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20 2b 20   DIV - col0 + + 
1e90: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1ea0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
1eb0: 0d 0a 32 38 0d 0a 35 39 0d 0a 0d 0a 73 6b 69 70  ..28..59....skip
1ec0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1ed0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1ee0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1ef0: 2d 35 30 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  -50..SELECT + + 
1f00: 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 2b 20  col2 / - col0 + 
1f10: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
1f20: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f30: 31 37 0d 0a 32 38 0d 0a 35 39 0d 0a 0d 0a 73 6b  17..28..59....sk
1f40: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1f50: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1f60: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1f70: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1f80: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1f90: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1fa0: 49 53 54 49 4e 43 54 20 32 33 20 2a 20 63 6f 6c  ISTINCT 23 * col
1fb0: 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  1 col2 FROM tab1
1fc0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 30   cor0..----..230
1fd0: 0d 0a 32 39 39 0d 0a 35 39 38 0d 0a 0d 0a 6f 6e  ..299..598....on
1fe0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1ff0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2000: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2010: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2020: 6f 72 74 20 6c 61 62 65 6c 2d 35 32 0d 0a 53 45  ort label-52..SE
2030: 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c  LECT ALL + ( col
2040: 32 20 29 20 44 49 56 20 63 6f 6c 30 20 41 53 20  2 ) DIV col0 AS 
2050: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
2060: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
2070: 0a 30 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..3....skipif 
2080: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2090: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
20a0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32  rowsort label-52
20b0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28  ..SELECT ALL + (
20c0: 20 63 6f 6c 32 20 29 20 2f 20 63 6f 6c 30 20 41   col2 ) / col0 A
20d0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
20e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20f0: 30 0d 0a 30 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79  0..0..3....query
2100: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2110: 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  CT - - col0 * - 
2120: 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  ( - col1 ) AS co
2130: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
2140: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34  cor0..----..2064
2150: 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a  ..3395..8099....
2160: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2170: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a  .SELECT - col1 *
2180: 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20   col1 + col2 AS 
2190: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
21a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
21b0: 33 36 33 0d 0a 2d 38 31 39 39 0d 0a 2d 39 34 30  363..-8199..-940
21c0: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
21d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
21e0: 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 63 6f   ( + col1 ) + co
21f0: 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 * col0 AS col
2200: 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
2210: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 37 33 38  ..----..132..738
2220: 39 0d 0a 38 37 38 0d 0a 0d 0a 71 75 65 72 79 20  9..878....query 
2230: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2240: 54 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20 28  T DISTINCT ( + (
2250: 20 63 6f 6c 31 20 29 20 29 20 2a 20 2d 20 63 6f   col1 ) ) * - co
2260: 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 32 20 29 20  l0 * - ( col2 ) 
2270: 2b 20 2d 20 32 31 20 46 52 4f 4d 20 74 61 62 31  + - 21 FROM tab1
2280: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor0..----..364
2290: 35 39 0d 0a 34 31 39 31 0d 0a 39 39 38 31 39 0d  59..4191..99819.
22a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22b0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
22c0: 6f 6c 32 20 2d 20 35 37 20 2a 20 2b 20 63 6f 72  ol2 - 57 * + cor
22d0: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
22e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
22f0: 32 38 0d 0a 2d 35 31 33 0d 0a 2d 36 34 35 0d 0a  28..-513..-645..
2300: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2310: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
2320: 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  l0 * col1 * - co
2330: 6c 31 20 2b 20 33 39 20 41 53 20 63 6f 6c 32 20  l1 + 39 AS col2 
2340: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2350: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37 34 36 35  0..----..-177465
2360: 0d 0a 2d 33 32 39 32 37 36 0d 0a 2d 37 33 36 39  ..-329276..-7369
2370: 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
2380: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2390: 4c 20 63 6f 6c 31 20 2a 20 37 37 20 46 52 4f 4d  L col1 * 77 FROM
23a0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
23b0: 2d 2d 2d 0d 0a 31 33 30 39 0d 0a 32 33 38 37 0d  ---..1309..2387.
23c0: 0a 34 35 34 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .4543....onlyif 
23d0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
23e0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
23f0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2400: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2410: 61 62 65 6c 2d 36 30 0d 0a 53 45 4c 45 43 54 20  abel-60..SELECT 
2420: 44 49 53 54 49 4e 43 54 20 2b 20 35 34 20 44 49  DISTINCT + 54 DI
2430: 56 20 36 39 20 41 53 20 63 6f 6c 31 20 46 52 4f  V 69 AS col1 FRO
2440: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2450: 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ----..0....skipi
2460: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2470: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2480: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2490: 36 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  60..SELECT DISTI
24a0: 4e 43 54 20 2b 20 35 34 20 2f 20 36 39 20 41 53  NCT + 54 / 69 AS
24b0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
24c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
24d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
24f0: 36 20 2b 20 2b 20 32 30 20 46 52 4f 4d 20 74 61  6 + + 20 FROM ta
2500: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b0 cor0..----..2
2510: 36 0d 0a 32 36 0d 0a 32 36 0d 0a 0d 0a 71 75 65  6..26..26....que
2520: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2530: 4c 45 43 54 20 41 4c 4c 20 34 31 20 2b 20 63 6f  LECT ALL 41 + co
2540: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
2550: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d  tab0..----..130.
2560: 0a 36 35 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79  .65..76....query
2570: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2580: 43 54 20 63 6f 6c 30 20 2a 20 34 30 20 2b 20 2d  CT col0 * 40 + -
2590: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
25a0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
25b0: 35 35 30 0d 0a 33 31 38 37 0d 0a 39 34 0d 0a 0d  550..3187..94...
25c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25d0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72  ..SELECT ALL cor
25e0: 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  0.col0 * col0 + 
25f0: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
2600: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2610: 2d 2d 2d 2d 0d 0a 35 36 0d 0a 36 31 36 32 0d 0a  ----..56..6162..
2620: 36 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6320....query I 
2630: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2640: 2d 20 39 38 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  - 98 + - cor0.co
2650: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
2660: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2670: 2d 2d 0d 0a 2d 31 31 35 0d 0a 2d 31 32 39 0d 0a  --..-115..-129..
2680: 2d 31 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -157....query I 
2690: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26a0: 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 28 20 2b  DISTINCT - - ( +
26b0: 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 31   col0 ) * + col1
26c0: 20 2b 20 33 35 20 2a 20 2b 20 63 6f 6c 31 20 2a   + 35 * + col1 *
26d0: 20 36 38 20 46 52 4f 4d 20 74 61 62 31 20 63 6f   68 FROM tab1 co
26e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 34 34 30 0d  r0..----..24440.
26f0: 0a 33 31 39 38 30 0d 0a 36 31 39 35 38 0d 0a 0d  .31980..61958...
2700: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2710: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2720: 54 20 34 33 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  T 43 + - cor0.co
2730: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
2740: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36 0d  cor0..----..-46.
2750: 0a 31 39 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20  .19..8....query 
2760: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2770: 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63  T ALL + col1 * c
2780: 6f 6c 32 20 2b 20 2d 20 36 35 20 2d 20 63 6f 6c  ol2 + - 65 - col
2790: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
27a0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
27b0: 2d 0d 0a 32 37 34 30 0d 0a 33 31 0d 0a 37 33 31  -..2740..31..731
27c0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
27d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
27e0: 20 34 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63   4 * - col0 AS c
27f0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2800: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
2810: 30 0d 0a 2d 33 35 36 0d 0a 2d 39 36 0d 0a 0d 0a  0..-356..-96....
2820: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2830: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34 32  .SELECT ALL + 42
2840: 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20   * + ( - col1 ) 
2850: 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20 46 52 4f  + - ( col2 ) FRO
2860: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab0..----..-3
2870: 36 34 35 0d 0a 2d 33 39 30 34 0d 0a 2d 34 30 37  645..-3904..-407
2880: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
2890: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
28a0: 6f 72 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or1.col0 AS col1
28b0: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
28c0: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63   AS cor0, tab2 c
28d0: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
28e0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
28f0: 31 65 31 66 31 30 39 35 33 65 62 38 65 66 66 65  1e1f10953eb8effe
2900: 39 62 32 30 65 37 34 36 66 38 61 37 66 64 38 33  9b20e746f8a7fd83
2910: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2920: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2930: 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  - col0 * col0 + 
2940: 74 61 62 31 2e 63 6f 6c 32 20 2b 20 35 30 20 46  tab1.col2 + 50 F
2950: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2960: 2d 33 39 38 39 0d 0a 2d 36 32 35 34 0d 0a 39 35  -3989..-6254..95
2970: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2980: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2990: 38 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  82 + col0 FROM t
29a0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 0d 0a  ab2..----..160..
29b0: 31 36 31 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79  161..89....query
29c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29d0: 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  CT - col1 * + co
29e0: 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l2 * - col2 FROM
29f0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
2a00: 0d 0a 31 31 39 38 30 38 0d 0a 33 32 34 39 30 0d  ..119808..32490.
2a10: 0a 37 35 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20  .75816....query 
2a20: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a30: 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72  T + col0 * + cor
2a40: 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e  0.col2 + + cor0.
2a50: 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63  col1 * col0 AS c
2a60: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2a70: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 36   cor0..----..406
2a80: 0d 0a 34 33 34 35 0d 0a 36 36 33 30 0d 0a 0d 0a  ..4345..6630....
2a90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2aa0: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
2ab0: 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30   * - col0 + col0
2ac0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2ad0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 34 0d  r0..----..-1264.
2ae0: 0a 2d 32 31 30 0d 0a 2d 34 35 32 34 0d 0a 0d 0a  .-210..-4524....
2af0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b00: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2b10: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
2b20: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2b30: 30 20 57 48 45 52 45 20 28 20 4e 55 4c 4c 20 29  0 WHERE ( NULL )
2b40: 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e   BETWEEN NULL AN
2b50: 44 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  D - col0 + col1 
2b60: 2a 20 63 6f 6c 30 20 4f 52 20 4e 4f 54 20 28 20  * col0 OR NOT ( 
2b70: 4e 55 4c 4c 20 29 20 4e 4f 54 20 49 4e 20 28 20  NULL ) NOT IN ( 
2b80: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32  cor0.col2 * col2
2b90: 20 2a 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d   * col1 )..----.
2ba0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2bb0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
2bc0: 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  1 * + cor0.col0 
2bd0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2be0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2bf0: 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a  .1040..640..78..
2c00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c10: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
2c20: 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30  r0.col1 * + col0
2c30: 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + + col0 AS col
2c40: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2c50: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 38 0d  or0..----..2088.
2c60: 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d 0a 71  .3430..8188....q
2c70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c80: 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 30  SELECT tab0.col0
2c90: 20 2b 20 63 6f 6c 31 20 2a 20 74 61 62 30 2e 63   + col1 * tab0.c
2ca0: 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 + col0 AS co
2cb0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
2cc0: 2d 2d 0d 0a 37 34 34 34 0d 0a 38 34 35 39 0d 0a  --..7444..8459..
2cd0: 39 34 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9479....query I 
2ce0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2cf0: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
2d00: 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  + col2 * + col0 
2d10: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2d20: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 37 33  0..----..132..73
2d30: 38 39 0d 0a 38 37 38 0d 0a 0d 0a 71 75 65 72 79  89..878....query
2d40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d50: 43 54 20 2b 20 35 34 20 2b 20 63 6f 6c 30 20 46  CT + 54 + col0 F
2d60: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
2d70: 2d 2d 2d 0d 0a 31 31 38 0d 0a 31 33 34 0d 0a 35  ---..118..134..5
2d80: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2d90: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2da0: 6f 6c 32 20 2b 20 32 39 20 2a 20 2b 20 63 6f 6c  ol2 + 29 * + col
2db0: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
2dc0: 2d 0d 0a 31 31 34 30 0d 0a 37 38 30 0d 0a 38 31  -..1140..780..81
2dd0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2de0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2df0: 6f 6c 31 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 30  ol1 + + ( - col0
2e00: 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
2e10: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d  tab1..----..-29.
2e20: 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d 0a 73 6b 69  .-74..-93....ski
2e30: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2e40: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2e50: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2e60: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2e70: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2e80: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2e90: 53 54 49 4e 43 54 20 33 37 20 2a 20 63 6f 6c 31  STINCT 37 * col1
2ea0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
2eb0: 0a 2d 2d 2d 2d 0d 0a 33 31 38 32 0d 0a 33 33 36  .----..3182..336
2ec0: 37 0d 0a 33 35 38 39 0d 0a 0d 0a 71 75 65 72 79  7..3589....query
2ed0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ee0: 43 54 20 2b 20 32 31 20 2b 20 63 6f 6c 31 20 46  CT + 21 + col1 F
2ef0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2f00: 33 31 0d 0a 33 34 0d 0a 34 37 0d 0a 0d 0a 71 75  31..34..47....qu
2f10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f20: 45 4c 45 43 54 20 41 4c 4c 20 34 34 20 2a 20 2d  ELECT ALL 44 * -
2f30: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
2f40: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
2f50: 31 30 35 36 0d 0a 2d 31 35 34 30 0d 0a 2d 33 39  1056..-1540..-39
2f60: 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
2f70: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2f80: 53 54 49 4e 43 54 20 2b 20 33 38 20 46 52 4f 4d  STINCT + 38 FROM
2f90: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
2fa0: 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..38....query I 
2fb0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2fc0: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  - cor0.col1 + co
2fd0: 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l0 * + col0 FROM
2fe0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2ff0: 2d 2d 2d 0d 0a 31 31 32 38 0d 0a 34 39 30 0d 0a  ---..1128..490..
3000: 37 38 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7830....query I 
3010: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3020: 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72  + + col0 * - cor
3030: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  0.col1 FROM tab2
3040: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3050: 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36  -1343..-217..-46
3060: 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
3070: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
3080: 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f  STINCT - cor0.co
3090: 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  l1 + + col1 * + 
30a0: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
30b0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
30c0: 2d 2d 2d 2d 0d 0a 31 30 32 37 0d 0a 35 32 0d 0a  ----..1027..52..
30d0: 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  630....query I r
30e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
30f0: 4c 4c 20 2d 20 31 33 20 46 52 4f 4d 20 74 61 62  LL - 13 FROM tab
3100: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
3110: 33 0d 0a 2d 31 33 0d 0a 2d 31 33 0d 0a 0d 0a 71  3..-13..-13....q
3120: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3130: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
3140: 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  + col1 * - col2 
3150: 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  * col0 FROM tab2
3160: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3170: 2d 31 31 39 36 35 32 0d 0a 2d 35 31 30 33 34 0d  -119652..-51034.
3180: 0a 2d 35 38 35 39 0d 0a 0d 0a 71 75 65 72 79 20  .-5859....query 
3190: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31a0: 54 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  T + col1 AS col1
31b0: 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
31c0: 20 4e 55 4c 4c 20 3e 3d 20 4e 55 4c 4c 0d 0a 2d   NULL >= NULL..-
31d0: 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ---....skipif po
31e0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
31f0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
3200: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
3210: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
3220: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3230: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
3240: 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2b 20 63   tab2.col2 + + c
3250: 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
3260: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35 34  b2..----..52..54
3270: 0d 0a 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..76....skipif p
3280: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
3290: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
32a0: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
32b0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
32c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32d0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
32e0: 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col1 col0 FROM t
32f0: 61 62 30 20 57 48 45 52 45 20 2d 20 63 6f 6c 31  ab0 WHERE - col1
3300: 20 2f 20 2d 20 63 6f 6c 32 20 49 4e 20 28 20 63   / - col2 IN ( c
3310: 6f 6c 31 20 2f 20 2d 20 74 61 62 30 2e 63 6f 6c  ol1 / - tab0.col
3320: 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69  0 )..----....ski
3330: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
3340: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
3350: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
3360: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
3370: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
3380: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
3390: 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 63 6f 6c 32  col0 * col2 col2
33a0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
33b0: 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38  ..162..3648..768
33c0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
33d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
33e0: 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 32 20  TINCT tab1.col2 
33f0: 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  - + col1 AS col2
3400: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
3410: 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a  ..28..47..83....
3420: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3430: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b  .SELECT + col2 +
3440: 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62 32 2e 63   col1 * - tab2.c
3450: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
3460: 2d 2d 2d 0d 0a 2d 32 35 31 0d 0a 2d 33 34 35 35  ---..-251..-3455
3470: 0d 0a 2d 39 33 34 0d 0a 0d 0a 71 75 65 72 79 20  ..-934....query 
3480: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3490: 54 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2d 20  T tab0.col0 * - 
34a0: 74 61 62 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30  tab0.col1 + col0
34b0: 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   * - col1 + - co
34c0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
34d0: 2d 2d 0d 0a 2d 31 36 32 38 30 0d 0a 2d 34 31 36  --..-16280..-416
34e0: 31 0d 0a 2d 36 37 39 31 0d 0a 0d 0a 71 75 65 72  1..-6791....quer
34f0: 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
3500: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a  ELECT DISTINCT *
3510: 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
3520: 20 4e 55 4c 4c 20 3d 20 2b 20 63 6f 6c 31 0d 0a   NULL = + col1..
3530: 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
3540: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3550: 2b 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20 63  + tab1.col0 AS c
3560: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 57 48  ol1 FROM tab1 WH
3570: 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3e 20 4e  ERE NOT NULL > N
3580: 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ULL..----....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 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
35b0: 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l1 * col0 * - co
35c0: 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  l1 + + col2 * - 
35d0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
35e0: 2d 2d 2d 2d 0d 0a 2d 31 37 38 32 39 36 0d 0a 2d  ----..-178296..-
35f0: 33 32 39 33 35 30 0d 0a 2d 37 34 34 33 30 37 0d  329350..-744307.
3600: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3610: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
3620: 2a 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  * tab0.col0 AS c
3630: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 57 48  ol0 FROM tab0 WH
3640: 45 52 45 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  ERE - col0 * - c
3650: 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  ol2 + col0 * + c
3660: 6f 6c 32 20 2d 20 63 6f 6c 31 20 3e 20 28 20 63  ol2 - col1 > ( c
3670: 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 35 37 36  ol1 )..----..576
3680: 0d 0a 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20  ..7921....query 
3690: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36a0: 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20  T col2 * col1 * 
36b0: 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2b 20  - col0 + col1 + 
36c0: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20  + col0 * col0 * 
36d0: 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
36e0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 38 39 39 36  ..----..-1368996
36f0: 0d 0a 2d 34 36 31 37 33 0d 0a 2d 38 31 38 35 30  ..-46173..-81850
3700: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3710: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
3720: 6c 32 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30  l2 + col0 / col0
3730: 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45   FROM tab0 WHERE
3740: 20 4e 55 4c 4c 20 3e 3d 20 4e 55 4c 4c 0d 0a 2d   NULL >= NULL..-
3750: 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
3760: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74  owsort..SELECT t
3770: 61 62 30 2e 63 6f 6c 31 20 2b 20 74 61 62 30 2e  ab0.col1 + tab0.
3780: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
3790: 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32 0d 0a  ----..172..182..
37a0: 31 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  194....onlyif my
37b0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
37c0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
37d0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
37e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
37f0: 65 6c 2d 31 30 38 0d 0a 53 45 4c 45 43 54 20 44  el-108..SELECT D
3800: 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 44 49 56  ISTINCT col2 DIV
3810: 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   - col1 AS col1 
3820: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
3830: 0a 2d 32 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-2..0....skipif
3840: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
3850: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
3860: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
3870: 30 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  08..SELECT DISTI
3880: 4e 43 54 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c  NCT col2 / - col
3890: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
38a0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30  ab2..----..-2..0
38b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
38c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
38d0: 49 4e 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 30  INCT + tab1.col0
38e0: 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
38f0: 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
3900: 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d 0a  -..-16..-51..7..
3910: 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
3920: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
3930: 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 28 20  OM tab0 WHERE ( 
3940: 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 29 20  - col0 * col1 ) 
3950: 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f 6c 30 20  NOT IN ( + col0 
3960: 29 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  )..----..9 value
3970: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 38 61  s hashing to 38a
3980: 31 36 37 33 65 32 65 30 39 64 36 39 34 63 38 63  1673e2e09d694c8c
3990: 65 63 34 35 63 37 39 37 30 33 34 61 37 0d 0a 0d  ec45c797034a7...
39a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
39b0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
39c0: 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  - col1 + - col2 
39d0: 2a 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2d 20  * tab0.col2 + - 
39e0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
39f0: 2d 2d 2d 2d 0d 0a 2d 31 34 39 30 35 0d 0a 2d 33  ----..-14905..-3
3a00: 31 38 36 0d 0a 2d 33 33 39 37 0d 0a 0d 0a 71 75  186..-3397....qu
3a10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3a20: 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63  ELECT col0 * + c
3a30: 6f 6c 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 + col1 FROM 
3a40: 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20 4e  tab1 WHERE NOT N
3a50: 55 4c 4c 20 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  ULL > NULL..----
3a60: 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f  ....query III ro
3a70: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
3a80: 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61  STINCT * FROM ta
3a90: 62 30 20 57 48 45 52 45 20 4e 4f 54 20 2d 20 63  b0 WHERE NOT - c
3aa0: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 3d 20 28  ol0 + + col0 = (
3ab0: 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   NULL )..----...
3ac0: 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
3ad0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
3ae0: 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  NCT * FROM tab0 
3af0: 57 48 45 52 45 20 28 20 2d 20 63 6f 6c 31 20 2a  WHERE ( - col1 *
3b00: 20 2d 20 63 6f 6c 32 20 29 20 3e 20 4e 55 4c 4c   - col2 ) > NULL
3b10: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
3b20: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3b30: 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  T + - col2 + col
3b40: 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  2 * cor0.col0 FR
3b50: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
3b60: 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 33 35 39 31  .----..108..3591
3b70: 0d 0a 37 35 38 34 0d 0a 0d 0a 71 75 65 72 79 20  ..7584....query 
3b80: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3b90: 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T + col2 * + col
3ba0: 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 + - col0 AS co
3bb0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
3bc0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 31 34  cor0..----..2814
3bd0: 0d 0a 36 32 0d 0a 37 33 37 33 0d 0a 0d 0a 71 75  ..62..7373....qu
3be0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3bf0: 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
3c00: 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  2 * + col0 + + c
3c10: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
3c20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
3c30: 32 0d 0a 2d 31 39 35 30 0d 0a 2d 32 39 32 33 0d  2..-1950..-2923.
3c40: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3c50: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
3c60: 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e  0.col1 * + cor0.
3c70: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col0 * - col1 FR
3c80: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
3c90: 0a 2d 2d 2d 2d 0d 0a 31 37 37 35 30 34 0d 0a 33  .----..177504..3
3ca0: 32 39 33 31 35 0d 0a 37 33 37 30 30 39 0d 0a 0d  29315..737009...
3cb0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
3cc0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
3cd0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
3ce0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
3cf0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39  owsort label-119
3d00: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
3d10: 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  DIV cor0.col0 + 
3d20: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
3d30: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3d40: 38 35 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b  85..91..97....sk
3d50: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
3d60: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
3d70: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
3d80: 65 6c 2d 31 31 39 0d 0a 53 45 4c 45 43 54 20 2d  el-119..SELECT -
3d90: 20 63 6f 6c 32 20 2f 20 63 6f 72 30 2e 63 6f 6c   col2 / cor0.col
3da0: 30 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  0 + + 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 38 35 0d 0a 39 31 0d 0a 39 37 0d 0a  --..85..91..97..
3dd0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3de0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
3df0: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c  .col0 FROM tab0,
3e00: 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
3e10: 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 0d 0a 2d  OSS JOIN tab2..-
3e20: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
3e30: 61 73 68 69 6e 67 20 74 6f 20 37 37 38 62 35 30  ashing to 778b50
3e40: 35 37 35 61 39 62 39 31 34 34 38 31 31 39 65 65  575a9b91448119ee
3e50: 30 65 65 31 61 39 63 34 34 66 0d 0a 0d 0a 6f 6e  0ee1a9c44f....on
3e60: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
3e70: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
3e80: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
3e90: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
3ea0: 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 0d 0a 53  ort label-121..S
3eb0: 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c  ELECT col2 * col
3ec0: 30 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b  0 + - col0 DIV +
3ed0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
3ee0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
3ef0: 36 32 0d 0a 33 36 34 37 0d 0a 37 36 38 30 0d 0a  62..3647..7680..
3f00: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
3f10: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
3f20: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3f30: 20 6c 61 62 65 6c 2d 31 32 31 0d 0a 53 45 4c 45   label-121..SELE
3f40: 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b  CT col2 * col0 +
3f50: 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 32   - col0 / + col2
3f60: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
3f70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33  r0..----..162..3
3f80: 36 34 37 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65  647..7680....que
3f90: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3fa0: 4c 45 43 54 20 41 4c 4c 20 32 20 2a 20 28 20 2d  LECT ALL 2 * ( -
3fb0: 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62   col0 ) FROM tab
3fc0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
3fd0: 0a 2d 31 32 38 0d 0a 2d 31 36 30 0d 0a 2d 36 0d  .-128..-160..-6.
3fe0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
3ff0: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
4000: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
4010: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
4020: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
4030: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 0d  wsort label-123.
4040: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54  .SELECT ALL CAST
4050: 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  ( col1 AS SIGNED
4060: 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) * col1 FROM t
4070: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
4080: 32 38 39 0d 0a 33 34 38 31 0d 0a 39 36 31 0d 0a  289..3481..961..
4090: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
40a0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
40b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
40c0: 20 6c 61 62 65 6c 2d 31 32 33 0d 0a 53 45 4c 45   label-123..SELE
40d0: 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 63 6f  CT ALL CAST ( co
40e0: 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
40f0: 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  * col1 FROM tab2
4100: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39   cor0..----..289
4110: 0d 0a 33 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a 6f  ..3481..961....o
4120: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
4130: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
4140: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
4150: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
4160: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34 0d 0a  sort label-124..
4170: 53 45 4c 45 43 54 20 2d 20 38 37 20 44 49 56 20  SELECT - 87 DIV 
4180: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
4190: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
41a0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30  ..----..-1..0..0
41b0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
41c0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
41d0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
41e0: 72 74 20 6c 61 62 65 6c 2d 31 32 34 0d 0a 53 45  rt label-124..SE
41f0: 4c 45 43 54 20 2d 20 38 37 20 2f 20 2b 20 63 6f  LECT - 87 / + co
4200: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
4210: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
4220: 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a  --..-1..0..0....
4230: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4240: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
4250: 20 2d 20 2d 20 37 32 20 46 52 4f 4d 20 74 61 62   - - 72 FROM tab
4260: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
4270: 0a 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .72....query I r
4280: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
4290: 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 35 33  LL - col1 + + 53
42a0: 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
42b0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
42c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 36 0d 0a 31  0..----..1186..1
42d0: 37 35 38 0d 0a 34 36 32 36 0d 0a 0d 0a 6f 6e 6c  758..4626....onl
42e0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
42f0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
4300: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
4310: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
4320: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
4330: 6c 61 62 65 6c 2d 31 32 37 0d 0a 53 45 4c 45 43  label-127..SELEC
4340: 54 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20  T CAST( col1 AS 
4350: 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c  SIGNED ) * - col
4360: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
4370: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33  or0..----..-1343
4380: 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d  ..-217..-4602...
4390: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
43a0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
43b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
43c0: 6c 61 62 65 6c 2d 31 32 37 0d 0a 53 45 4c 45 43  label-127..SELEC
43d0: 54 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53  T CAST ( col1 AS
43e0: 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63   INTEGER ) * - c
43f0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
4400: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
4410: 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d  43..-217..-4602.
4420: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
4430: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
4440: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
4450: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
4460: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
4470: 32 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  28..SELECT DISTI
4480: 4e 43 54 20 2b 20 34 37 20 44 49 56 20 2b 20 35  NCT + 47 DIV + 5
4490: 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  1 col1 FROM tab1
44a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
44b0: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
44c0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
44d0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
44e0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
44f0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
4500: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
4510: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
4520: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
4530: 65 6c 2d 31 32 38 0d 0a 53 45 4c 45 43 54 20 44  el-128..SELECT D
4540: 49 53 54 49 4e 43 54 20 2b 20 34 37 20 2f 20 2b  ISTINCT + 47 / +
4550: 20 35 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   51 col1 FROM ta
4560: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
4570: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
4580: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
4590: 20 35 36 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63   56 + col0 * - c
45a0: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
45b0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
45c0: 2d 2d 2d 0d 0a 2d 32 31 38 0d 0a 2d 33 37 30 34  ---..-218..-3704
45d0: 0d 0a 2d 37 37 33 36 0d 0a 0d 0a 71 75 65 72 79  ..-7736....query
45e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
45f0: 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 31  CT DISTINCT tab1
4600: 2e 63 6f 6c 32 20 2a 20 38 34 20 41 53 20 63 6f  .col2 * 84 AS co
4610: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
4620: 2d 2d 0d 0a 34 35 33 36 0d 0a 34 37 38 38 0d 0a  --..4536..4788..
4630: 38 30 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8064....onlyif m
4640: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
4650: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
4660: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
4670: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
4680: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4690: 2d 31 33 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -131..SELECT ALL
46a0: 20 2d 20 43 41 53 54 28 20 28 20 2b 20 63 6f 6c   - CAST( ( + col
46b0: 32 20 29 20 41 53 20 53 49 47 4e 45 44 20 29 20  2 ) AS SIGNED ) 
46c0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
46d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32  0..----..-26..-2
46e0: 37 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70 69 66  7..-38....skipif
46f0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
4700: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
4710: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
4720: 33 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  31..SELECT ALL -
4730: 20 43 41 53 54 20 28 20 28 20 2b 20 63 6f 6c 32   CAST ( ( + col2
4740: 20 29 20 41 53 20 49 4e 54 45 47 45 52 20 29 20   ) AS INTEGER ) 
4750: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
4760: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32  0..----..-26..-2
4770: 37 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20  7..-38....query 
4780: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4790: 54 20 41 4c 4c 20 2d 20 2b 20 28 20 2b 20 63 6f  T ALL - + ( + co
47a0: 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  l0 ) * - col1 * 
47b0: 28 20 34 39 20 2a 20 2b 20 63 6f 6c 30 20 29 20  ( 49 * + col0 ) 
47c0: 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + + col2 * - col
47d0: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
47e0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
47f0: 2d 0d 0a 32 34 32 36 31 37 35 0d 0a 33 35 33 31  -..2426175..3531
4800: 33 30 31 35 0d 0a 35 38 32 32 34 32 34 0d 0a 0d  3015..5822424...
4810: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
4820: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
4830: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
4840: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
4850: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
4860: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4870: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 35 33 20  T DISTINCT - 53 
4880: 2a 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d  * col2 col2 FROM
4890: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
48a0: 0d 0a 2d 32 38 36 32 0d 0a 2d 33 30 32 31 0d 0a  ..-2862..-3021..
48b0: 2d 35 30 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -5088....query I
48c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
48d0: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a   - col1 * col2 *
48e0: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
48f0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
4900: 0a 32 32 35 39 39 0d 0a 32 34 35 34 38 0d 0a 33  .22599..24548..3
4910: 39 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9884....query I 
4920: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4930: 41 4c 4c 20 28 20 2b 20 39 30 20 29 20 41 53 20  ALL ( + 90 ) AS 
4940: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
4950: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 30  S cor0..----..90
4960: 0d 0a 39 30 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72  ..90..90....quer
4970: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4980: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
4990: 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 37 35 20  ol1 * col2 + 75 
49a0: 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  * + cor0.col1 FR
49b0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
49c0: 0a 2d 2d 2d 2d 0d 0a 31 39 32 31 0d 0a 33 31 36  .----..1921..316
49d0: 32 0d 0a 35 39 35 39 0d 0a 0d 0a 71 75 65 72 79  2..5959....query
49e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
49f0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
4a00: 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col0 * + cor0.co
4a10: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
4a20: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35  cor0..----..1225
4a30: 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a 71  ..576..7921....q
4a40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4a50: 53 45 4c 45 43 54 20 41 4c 4c 20 37 32 20 2b 20  SELECT ALL 72 + 
4a60: 63 6f 6c 30 20 2a 20 2d 20 32 33 20 41 53 20 63  col0 * - 23 AS c
4a70: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
4a80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39   cor0..----..-19
4a90: 37 35 0d 0a 2d 34 38 30 0d 0a 2d 37 33 33 0d 0a  75..-480..-733..
4aa0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
4ab0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
4ac0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
4ad0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
4ae0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
4af0: 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
4b00: 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  CT + - cor0.col0
4b10: 20 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 32   DIV col1 + col2
4b20: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 28 20   + - col2 * + ( 
4b30: 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46  col1 ) AS col0 F
4b40: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
4b50: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 35 0d 0a 2d  ..----..-2805..-
4b60: 37 33 38 30 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69  7380..-96....ski
4b70: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
4b80: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
4b90: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
4ba0: 6c 2d 31 33 39 0d 0a 53 45 4c 45 43 54 20 44 49  l-139..SELECT DI
4bb0: 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e  STINCT + - cor0.
4bc0: 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 2b 20 63 6f  col0 / col1 + co
4bd0: 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  l2 + - col2 * + 
4be0: 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30  ( col1 ) AS col0
4bf0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
4c00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 35 0d  r0..----..-2805.
4c10: 0a 2d 37 33 38 30 0d 0a 2d 39 36 0d 0a 0d 0a 71  .-7380..-96....q
4c20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4c30: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
4c40: 6f 6c 32 20 2a 20 2d 20 33 33 20 46 52 4f 4d 20  ol2 * - 33 FROM 
4c50: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
4c60: 0a 2d 31 32 35 34 0d 0a 2d 38 35 38 0d 0a 2d 38  .-1254..-858..-8
4c70: 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  91....onlyif mys
4c80: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
4c90: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
4ca0: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
4cb0: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
4cc0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
4cd0: 34 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  41..SELECT - col
4ce0: 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  2 * col0 * - col
4cf0: 31 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53  1 + col1 + - CAS
4d00: 54 28 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41  T( col1 + col1 A
4d10: 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
4d20: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
4d30: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 37  cor0..----..3647
4d40: 30 0d 0a 34 31 38 36 0d 0a 39 39 38 32 37 0d 0a  0..4186..99827..
4d50: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
4d60: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
4d70: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4d80: 20 6c 61 62 65 6c 2d 31 34 31 0d 0a 53 45 4c 45   label-141..SELE
4d90: 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30  CT - col2 * col0
4da0: 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   * - col1 + col1
4db0: 20 2b 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 31   + - CAST ( col1
4dc0: 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   + col1 AS INTEG
4dd0: 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  ER ) AS col1 FRO
4de0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
4df0: 2d 2d 2d 2d 0d 0a 33 36 34 37 30 0d 0a 34 31 38  ----..36470..418
4e00: 36 0d 0a 39 39 38 32 37 0d 0a 0d 0a 71 75 65 72  6..99827....quer
4e10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4e20: 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63  ECT ALL col0 + c
4e30: 6f 6c 30 20 2a 20 28 20 2b 20 63 6f 6c 31 20 29  ol0 * ( + col1 )
4e40: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
4e50: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
4e60: 0d 0a 31 31 32 30 0d 0a 37 30 34 0d 0a 38 31 0d  ..1120..704..81.
4e70: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4e80: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
4e90: 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  NCT cor0.col2 * 
4ea0: 36 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  6 + + cor0.col2 
4eb0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
4ec0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
4ed0: 0a 32 33 31 0d 0a 35 37 34 0d 0a 37 0d 0a 0d 0a  .231..574..7....
4ee0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4ef0: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63  .SELECT col2 + c
4f00: 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f  ol2 + + col1 FRO
4f10: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
4f20: 2d 2d 2d 2d 0d 0a 31 32 34 0d 0a 31 33 34 0d 0a  ----..124..134..
4f30: 32 30 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  205....onlyif my
4f40: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
4f50: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
4f60: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
4f70: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
4f80: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
4f90: 31 34 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  145..SELECT DIST
4fa0: 49 4e 43 54 20 63 6f 6c 32 20 2b 20 43 41 53 54  INCT col2 + CAST
4fb0: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
4fc0: 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c   ) * col2 AS col
4fd0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
4fe0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
4ff0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
5000: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
5010: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5020: 74 20 6c 61 62 65 6c 2d 31 34 35 0d 0a 53 45 4c  t label-145..SEL
5030: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
5040: 32 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  2 + CAST ( NULL 
5050: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63  AS INTEGER ) * c
5060: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
5070: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
5080: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ---..NULL....onl
5090: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
50a0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
50b0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
50c0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
50d0: 72 74 20 6c 61 62 65 6c 2d 31 34 36 0d 0a 53 45  rt label-146..SE
50e0: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 44 49 56 20  LECT + col2 DIV 
50f0: 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col1 + - col0 * 
5100: 2d 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  - col2 col1 FROM
5110: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
5120: 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a  ---..189..2028..
5130: 33 30 30 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  3004....skipif p
5140: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
5150: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
5160: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
5170: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
5180: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
5190: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
51a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
51b0: 6c 61 62 65 6c 2d 31 34 36 0d 0a 53 45 4c 45 43  label-146..SELEC
51c0: 54 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20  T + col2 / col1 
51d0: 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  + - col0 * - col
51e0: 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  2 col1 FROM tab2
51f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
5200: 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 34 0d  189..2028..3004.
5210: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5220: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
5230: 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 31 30 20  ol0 + col0 * 10 
5240: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
5250: 0a 33 33 0d 0a 37 30 34 0d 0a 38 38 30 0d 0a 0d  .33..704..880...
5260: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5270: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
5280: 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 28 20 63  T + col2 + - ( c
5290: 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63  ol1 * col1 + - c
52a0: 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol0 ) AS col1 FR
52b0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
52c0: 31 37 32 0d 0a 2d 33 33 37 37 0d 0a 2d 39 32 37  172..-3377..-927
52d0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
52e0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
52f0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
5300: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
5310: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
5320: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39  owsort label-149
5330: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
5340: 6f 6c 32 20 2b 20 2d 20 43 41 53 54 28 20 4e 55  ol2 + - CAST( NU
5350: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  LL AS SIGNED ) F
5360: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
5370: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
5380: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
5390: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
53a0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
53b0: 72 74 20 6c 61 62 65 6c 2d 31 34 39 0d 0a 53 45  rt label-149..SE
53c0: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
53d0: 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + - CAST ( NULL 
53e0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
53f0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab1..----..NU
5400: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
5410: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
5420: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
5430: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
5440: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
5450: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
5460: 30 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 32  0..SELECT - tab2
5470: 2e 63 6f 6c 31 20 2a 20 2b 20 74 61 62 32 2e 63  .col1 * + tab2.c
5480: 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 30 20 2d  ol0 DIV + col0 -
5490: 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2b 20   - col2 * + ( + 
54a0: 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f  tab2.col2 * - co
54b0: 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 29 20 41 53  l0 + + col2 ) AS
54c0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
54d0: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 36 34 39 0d 0a  .----..-112649..
54e0: 2d 34 34 30 35 0d 0a 2d 35 32 31 31 31 0d 0a 0d  -4405..-52111...
54f0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
5500: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
5510: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
5520: 6c 61 62 65 6c 2d 31 35 30 0d 0a 53 45 4c 45 43  label-150..SELEC
5530: 54 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20  T - tab2.col1 * 
5540: 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2f 20 2b 20  + tab2.col0 / + 
5550: 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 2a 20  col0 - - col2 * 
5560: 2b 20 28 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20  + ( + tab2.col2 
5570: 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  * - col0 + + col
5580: 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  2 ) AS col0 FROM
5590: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   tab2..----..-11
55a0: 32 36 34 39 0d 0a 2d 34 34 30 35 0d 0a 2d 35 32  2649..-4405..-52
55b0: 31 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  111....query I r
55c0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
55d0: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b  ISTINCT + col2 +
55e0: 20 38 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   80 FROM tab0..-
55f0: 2d 2d 2d 0d 0a 31 31 33 0d 0a 31 36 32 0d 0a 38  ---..113..162..8
5600: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
5610: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
5620: 30 20 2a 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a  0 * + ( col2 ) *
5630: 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   - col1 + + col1
5640: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
5650: 0d 0a 2d 33 36 34 37 30 0d 0a 2d 34 31 38 36 0d  ..-36470..-4186.
5660: 0a 2d 39 39 38 32 37 0d 0a 0d 0a 73 6b 69 70 69  .-99827....skipi
5670: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
5680: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
5690: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
56a0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
56b0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
56c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
56d0: 2d 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 32 20  - col1 * ( col2 
56e0: 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  ) col2 FROM tab0
56f0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d  ..----..-2838..-
5700: 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65  7462..-97....que
5710: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5720: 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  LECT - col2 + co
5730: 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l0 * col0 * - co
5740: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
5750: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 30  tab2..----..-370
5760: 0d 0a 2d 34 37 34 35 37 38 0d 0a 2d 34 39 33 30  ..-474578..-4930
5770: 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  77....query I ro
5780: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
5790: 4c 20 63 6f 6c 30 20 2b 20 2d 20 31 30 20 2a 20  L col0 + - 10 * 
57a0: 33 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  30 AS col2 FROM 
57b0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
57c0: 2d 2d 0d 0a 2d 32 31 31 0d 0a 2d 32 36 35 0d 0a  --..-211..-265..
57d0: 2d 32 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -276....query I 
57e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
57f0: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
5800: 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  + + col1 * col0 
5810: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
5820: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
5830: 0a 31 31 33 36 0d 0a 31 33 32 0d 0a 36 39 37 0d  .1136..132..697.
5840: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5850: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
5860: 4e 43 54 20 63 6f 6c 31 20 2a 20 28 20 2d 20 63  NCT col1 * ( - c
5870: 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol2 ) FROM tab2 
5880: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
5890: 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37  1534..-646..-837
58a0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
58b0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
58c0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
58d0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
58e0: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
58f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5900: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
5910: 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  + col0 + - col2 
5920: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
5930: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
5940: 37 31 0d 0a 2d 33 36 0d 0a 2d 35 37 0d 0a 0d 0a  71..-36..-57....
5950: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5960: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 31 35  .SELECT ALL - 15
5970: 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   * cor0.col1 FRO
5980: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
5990: 2d 2d 2d 2d 0d 0a 2d 31 35 30 0d 0a 2d 31 39 35  ----..-150..-195
59a0: 0d 0a 2d 33 39 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-390....query 
59b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
59c0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
59d0: 30 20 2a 20 2d 20 28 20 63 6f 6c 31 20 29 20 2b  0 * - ( col1 ) +
59e0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
59f0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
5a00: 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 30 35 33  .----..104..1053
5a10: 0d 0a 36 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..650....query I
5a20: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5a30: 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
5a40: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63  ol2 * - col1 + c
5a50: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
5a60: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
5a70: 37 35 0d 0a 2d 36 32 39 0d 0a 2d 38 30 36 0d 0a  75..-629..-806..
5a80: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
5a90: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
5aa0: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
5ab0: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
5ac0: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
5ad0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 32 0d 0a  sort label-162..
5ae0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53  SELECT ALL - CAS
5af0: 54 28 20 2b 20 63 6f 6c 31 20 41 53 20 53 49 47  T( + col1 AS SIG
5b00: 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f  NED ) * col0 FRO
5b10: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
5b20: 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a  040..-640..-78..
5b30: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
5b40: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
5b50: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5b60: 20 6c 61 62 65 6c 2d 31 36 32 0d 0a 53 45 4c 45   label-162..SELE
5b70: 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28 20  CT ALL - CAST ( 
5b80: 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  + col1 AS INTEGE
5b90: 52 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  R ) * col0 FROM 
5ba0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34  tab1..----..-104
5bb0: 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a  0..-640..-78....
5bc0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5bd0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
5be0: 20 28 20 2b 20 37 34 20 29 20 2a 20 63 6f 6c 31   ( + 74 ) * col1
5bf0: 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
5c00: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32 37 33 36 0d  0..----..152736.
5c10: 0a 32 35 31 32 33 30 0d 0a 35 39 39 33 32 36 0d  .251230..599326.
5c20: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5c30: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
5c40: 4e 43 54 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b  NCT ( col0 ) * +
5c50: 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
5c60: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
5c70: 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37  --..1040..640..7
5c80: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
5c90: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
5ca0: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
5cb0: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
5cc0: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
5cd0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36  rowsort label-16
5ce0: 35 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  5..SELECT - CAST
5cf0: 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  ( col2 AS SIGNED
5d00: 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c   ) * col2 AS col
5d10: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
5d20: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
5d30: 31 30 38 39 0d 0a 2d 36 37 32 34 0d 0a 0d 0a 73  1089..-6724....s
5d40: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
5d50: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
5d60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
5d70: 62 65 6c 2d 31 36 35 0d 0a 53 45 4c 45 43 54 20  bel-165..SELECT 
5d80: 2d 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53  - CAST ( col2 AS
5d90: 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c   INTEGER ) * col
5da0: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
5db0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
5dc0: 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d 36  -..-1..-1089..-6
5dd0: 37 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  724....onlyif my
5de0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
5df0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
5e00: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
5e10: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
5e20: 65 6c 2d 31 36 36 0d 0a 53 45 4c 45 43 54 20 41  el-166..SELECT A
5e30: 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b  LL col1 * col2 +
5e40: 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31   - col0 DIV col1
5e50: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
5e60: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
5e70: 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37  ..2838..7462..97
5e80: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
5e90: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
5ea0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
5eb0: 72 74 20 6c 61 62 65 6c 2d 31 36 36 0d 0a 53 45  rt label-166..SE
5ec0: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20  LECT ALL col1 * 
5ed0: 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2f 20  col2 + - col0 / 
5ee0: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
5ef0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
5f00: 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32  ----..2838..7462
5f10: 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
5f20: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5f30: 2b 20 63 6f 6c 32 20 2b 20 2b 20 74 61 62 31 2e  + col2 + + tab1.
5f40: 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  col2 - col0 * - 
5f50: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
5f60: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab1..----..12
5f70: 33 32 0d 0a 31 38 36 0d 0a 37 35 34 0d 0a 0d 0a  32..186..754....
5f80: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5f90: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 30  .SELECT ALL tab0
5fa0: 2e 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c  .col2 + tab0.col
5fb0: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
5fc0: 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d  -..119..173..98.
5fd0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5fe0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
5ff0: 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20  0.col0 + col0 * 
6000: 2b 20 28 20 31 37 20 29 20 41 53 20 63 6f 6c 32  + ( 17 ) AS col2
6010: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
6020: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32 0d 0a  r0..----..1152..
6030: 31 34 34 30 0d 0a 35 34 0d 0a 0d 0a 71 75 65 72  1440..54....quer
6040: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6050: 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30  ECT ALL - - col0
6060: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41   * - cor0.col1 A
6070: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
6080: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6090: 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36  -1343..-217..-46
60a0: 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
60b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
60c0: 4c 20 2d 20 2d 20 33 35 20 41 53 20 63 6f 6c 30  L - - 35 AS col0
60d0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
60e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 33 35  r0..----..35..35
60f0: 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..35....query I 
6100: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6110: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
6120: 63 6f 6c 32 20 2a 20 2d 20 30 20 46 52 4f 4d 20  col2 * - 0 FROM 
6130: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
6140: 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
6150: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
6160: 2d 20 63 6f 6c 31 20 2b 20 37 33 20 2a 20 2d 20  - col1 + 73 * - 
6170: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
6180: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
6190: 36 36 36 0d 0a 2d 32 34 35 38 0d 0a 2d 36 34 30  666..-2458..-640
61a0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
61b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
61c0: 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d 20 28  TINCT col1 * - (
61d0: 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 30   col1 ) + - col0
61e0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
61f0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
6200: 0d 0a 2d 31 36 34 0d 0a 2d 32 34 39 0d 0a 2d 36  ..-164..-249..-6
6210: 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
6220: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
6230: 4c 20 2d 20 63 6f 6c 31 20 2a 20 28 20 2b 20 63  L - col1 * ( + c
6240: 6f 6c 30 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c  ol0 ) * cor0.col
6250: 30 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  0 + - col0 AS co
6260: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
6270: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38  cor0..----..-118
6280: 38 36 30 0d 0a 2d 34 39 35 36 30 0d 0a 2d 37 32  860..-49560..-72
6290: 30 39 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0900....query I 
62a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
62b0: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
62c0: 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 41 53 20 63  col2 - col2 AS c
62d0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
62e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
62f0: 34 0d 0a 2d 32 0d 0a 2d 36 36 0d 0a 0d 0a 6f 6e  4..-2..-66....on
6300: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
6310: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
6320: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
6330: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
6340: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6350: 20 6c 61 62 65 6c 2d 31 37 37 0d 0a 53 45 4c 45   label-177..SELE
6360: 43 54 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54  CT col1 + - CAST
6370: 28 20 2d 20 38 39 20 2a 20 63 6f 6c 31 20 2b 20  ( - 89 * col1 + 
6380: 2d 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  - col1 AS SIGNED
6390: 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
63a0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 33  cor0..----..1183
63b0: 0d 0a 32 33 36 36 0d 0a 39 31 30 0d 0a 0d 0a 73  ..2366..910....s
63c0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
63d0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
63e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
63f0: 62 65 6c 2d 31 37 37 0d 0a 53 45 4c 45 43 54 20  bel-177..SELECT 
6400: 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 20 28 20  col1 + - CAST ( 
6410: 2d 20 38 39 20 2a 20 63 6f 6c 31 20 2b 20 2d 20  - 89 * col1 + - 
6420: 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
6430: 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
6440: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 33 0d  or0..----..1183.
6450: 0a 32 33 36 36 0d 0a 39 31 30 0d 0a 0d 0a 71 75  .2366..910....qu
6460: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6470: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b  ELECT ALL col1 +
6480: 20 2d 20 35 31 20 46 52 4f 4d 20 74 61 62 30 20   - 51 FROM tab0 
6490: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
64a0: 35 0d 0a 34 30 0d 0a 34 36 0d 0a 0d 0a 6f 6e 6c  5..40..46....onl
64b0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
64c0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
64d0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
64e0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
64f0: 72 74 20 6c 61 62 65 6c 2d 31 37 39 0d 0a 53 45  rt label-179..SE
6500: 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20  LECT + + col0 + 
6510: 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f  cor0.col2 DIV co
6520: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
6530: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  cor0..----..24..
6540: 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69 66  35..89....skipif
6550: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
6560: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
6570: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
6580: 37 39 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  79..SELECT + + c
6590: 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ol0 + cor0.col2 
65a0: 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  / col1 FROM tab0
65b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
65c0: 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75  24..35..89....qu
65d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
65e0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
65f0: 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   - + col1 AS col
6600: 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
6610: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 32 36  ..----..-20..-26
6620: 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-52....query I
6630: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6640: 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2a 20   ALL - + col2 * 
6650: 63 6f 6c 31 20 2b 20 2b 20 28 20 2b 20 63 6f 6c  col1 + + ( + col
6660: 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  0 ) FROM tab0 AS
6670: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
6680: 31 34 0d 0a 2d 36 32 0d 0a 2d 37 33 37 33 0d 0a  14..-62..-7373..
6690: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
66a0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
66b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
66c0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
66d0: 54 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20  T col1 * + CAST 
66e0: 28 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 52  ( cor0.col1 AS R
66f0: 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30 20  EAL ) FROM tab0 
6700: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
6710: 33 39 36 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d  396..8281..9409.
6720: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6730: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
6740: 30 20 2b 20 2b 20 31 20 41 53 20 63 6f 6c 32 20  0 + + 1 AS col2 
6750: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
6760: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 33  0..----..-23..-3
6770: 34 0d 0a 2d 38 38 0d 0a 0d 0a 73 6b 69 70 69 66  4..-88....skipif
6780: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
6790: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
67a0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
67b0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
67c0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
67d0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
67e0: 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 63   cor0.col1 + + c
67f0: 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol1 col2 FROM ta
6800: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
6810: 0d 0a 32 30 0d 0a 32 36 0d 0a 35 32 0d 0a 0d 0a  ..20..26..52....
6820: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6830: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
6840: 20 2b 20 63 6f 6c 31 20 2d 20 34 38 20 41 53 20   + col1 - 48 AS 
6850: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
6860: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38  S cor0..----..38
6870: 0d 0a 34 33 0d 0a 34 39 0d 0a 0d 0a 71 75 65 72  ..43..49....quer
6880: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6890: 45 43 54 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b  ECT + ( col1 ) +
68a0: 20 34 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   41 FROM tab1..-
68b0: 2d 2d 2d 0d 0a 35 31 0d 0a 35 34 0d 0a 36 37 0d  ---..51..54..67.
68c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
68d0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
68e0: 4e 43 54 20 2b 20 33 37 20 2a 20 63 6f 6c 32 20  NCT + 37 * col2 
68f0: 2d 20 2b 20 34 39 20 46 52 4f 4d 20 74 61 62 31  - + 49 FROM tab1
6900: 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 39 0d 0a 32 30  ..----..1949..20
6910: 36 30 0d 0a 33 35 30 33 0d 0a 0d 0a 71 75 65 72  60..3503....quer
6920: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6930: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
6940: 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol0 - col2 * col
6950: 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
6960: 2d 0d 0a 2d 31 39 36 0d 0a 2d 32 31 30 36 0d 0a  -..-196..-2106..
6970: 2d 33 30 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  -3081....skipif 
6980: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
6990: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
69a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
69b0: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
69c0: 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54 20 28 20  col2 + - CAST ( 
69d0: 31 34 20 41 53 20 52 45 41 4c 20 29 20 2a 20 63  14 AS REAL ) * c
69e0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
69f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
6a00: 36 36 0d 0a 2d 31 33 0d 0a 2d 34 32 39 0d 0a 0d  66..-13..-429...
6a10: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6a20: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
6a30: 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  T + cor0.col1 + 
6a40: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  - cor0.col1 AS c
6a50: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
6a60: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
6a70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6a80: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
6a90: 43 54 20 2b 20 28 20 63 6f 6c 30 20 29 20 2d 20  CT + ( col0 ) - 
6aa0: 33 20 2a 20 32 35 20 2a 20 63 6f 6c 31 20 46 52  3 * 25 * col1 FR
6ab0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
6ac0: 31 31 39 36 0d 0a 2d 32 33 31 38 0d 0a 2d 34 33  1196..-2318..-43
6ad0: 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  47....query I ro
6ae0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
6af0: 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  L + cor0.col0 * 
6b00: 2d 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  - tab0.col0 AS c
6b10: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol2 FROM tab0, t
6b20: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
6b30: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
6b40: 69 6e 67 20 74 6f 20 63 35 31 62 33 32 64 66 35  ing to c51b32df5
6b50: 38 36 33 35 35 31 62 62 34 64 61 64 33 66 64 64  863551bb4dad3fdd
6b60: 63 64 36 35 36 32 30 0d 0a 0d 0a 71 75 65 72 79  cd65620....query
6b70: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6b80: 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a  CT col2 + col2 *
6b90: 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20   - tab0.col0 AS 
6ba0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
6bb0: 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 32 31 36  ----..-34..-7216
6bc0: 0d 0a 2d 37 35 39 0d 0a 0d 0a 71 75 65 72 79 20  ..-759....query 
6bd0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6be0: 54 20 41 4c 4c 20 28 20 2d 20 63 6f 6c 32 20 2b  T ALL ( - col2 +
6bf0: 20 28 20 63 6f 6c 31 20 29 20 29 20 46 52 4f 4d   ( col1 ) ) FROM
6c00: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d   tab0..----..53.
6c10: 0a 39 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  .9..96....onlyif
6c20: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
6c30: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
6c40: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
6c50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6c60: 6c 61 62 65 6c 2d 31 39 35 0d 0a 53 45 4c 45 43  label-195..SELEC
6c70: 54 20 31 31 20 44 49 56 20 2b 20 63 6f 6c 32 20  T 11 DIV + col2 
6c80: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
6c90: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
6ca0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
6cb0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
6cc0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
6cd0: 72 74 20 6c 61 62 65 6c 2d 31 39 35 0d 0a 53 45  rt label-195..SE
6ce0: 4c 45 43 54 20 31 31 20 2f 20 2b 20 63 6f 6c 32  LECT 11 / + col2
6cf0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
6d00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
6d10: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
6d20: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
6d30: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
6d40: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
6d50: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
6d60: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39  rowsort label-19
6d70: 36 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  6..SELECT cor0.c
6d80: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 43  ol1 * - col2 * C
6d90: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
6da0: 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c 32 20 46  IMAL ) AS col2 F
6db0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
6dc0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
6dd0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
6de0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
6df0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
6e00: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
6e10: 2d 31 39 36 0d 0a 53 45 4c 45 43 54 20 63 6f 72  -196..SELECT cor
6e20: 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  0.col1 * - col2 
6e30: 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  * CAST ( NULL AS
6e40: 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 32 20   REAL ) AS col2 
6e50: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
6e60: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
6e70: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ULL..NULL....onl
6e80: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
6e90: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
6ea0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
6eb0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
6ec0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6ed0: 6c 61 62 65 6c 2d 31 39 37 0d 0a 53 45 4c 45 43  label-197..SELEC
6ee0: 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  T CAST( NULL AS 
6ef0: 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32  SIGNED ) AS col2
6f00: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
6f10: 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
6f20: 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
6f30: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
6f40: 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34  ng to cd7a7901e4
6f50: 37 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32  7c15155404aff0d2
6f60: 31 36 66 65 30 62 0d 0a 0d 0a 73 6b 69 70 69 66  16fe0b....skipif
6f70: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
6f80: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
6f90: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
6fa0: 39 37 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20  97..SELECT CAST 
6fb0: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
6fc0: 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  R ) AS col2 FROM
6fd0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
6fe0: 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53  OSS JOIN tab0 AS
6ff0: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
7000: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
7010: 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31   cd7a7901e47c151
7020: 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30  55404aff0d216fe0
7030: 62 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  b....onlyif mysq
7040: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
7050: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
7060: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
7070: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
7080: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39  rowsort label-19
7090: 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  8..SELECT + col1
70a0: 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   * CAST( NULL AS
70b0: 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
70c0: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
70d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
70e0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
70f0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
7100: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
7110: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
7120: 62 65 6c 2d 31 39 38 0d 0a 53 45 4c 45 43 54 20  bel-198..SELECT 
7130: 2b 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20  + col1 * CAST ( 
7140: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
7150: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
7160: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
7170: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
7180: 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
7190: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
71a0: 49 53 54 49 4e 43 54 20 28 20 2d 20 74 61 62 32  ISTINCT ( - tab2
71b0: 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62  .col2 ) FROM tab
71c0: 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c  2, tab1 AS cor0,
71d0: 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
71e0: 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d  ---..-26..-27..-
71f0: 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
7200: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
7210: 4c 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 33 33  L tab2.col0 * 33
7220: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
7230: 0d 0a 32 33 31 0d 0a 32 35 37 34 0d 0a 32 36 30  ..231..2574..260
7240: 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
7250: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
7260: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
7270: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
7280: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
7290: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30  rowsort label-20
72a0: 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  1..SELECT - col2
72b0: 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20   * - CAST( NULL 
72c0: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
72d0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
72e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
72f0: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
7300: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
7310: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
7320: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7330: 6c 61 62 65 6c 2d 32 30 31 0d 0a 53 45 4c 45 43  label-201..SELEC
7340: 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53  T - col2 * - CAS
7350: 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
7360: 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52  GER ) AS col0 FR
7370: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
7380: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
7390: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
73a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
73b0: 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31  CT ALL cor0.col1
73c0: 20 2b 20 2b 20 32 38 20 41 53 20 63 6f 6c 32 20   + + 28 AS col2 
73d0: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
73e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
73f0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
7400: 62 32 65 66 30 61 30 62 36 62 61 64 66 33 32 62  b2ef0a0b6badf32b
7410: 37 64 39 62 35 66 31 34 65 62 63 38 65 36 39 61  7d9b5f14ebc8e69a
7420: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7430: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
7440: 2b 20 2d 20 36 32 20 2a 20 63 6f 6c 32 20 2b 20  + - 62 * col2 + 
7450: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32  cor0.col0 * col2
7460: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
7470: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
7480: 33 31 38 36 0d 0a 31 31 34 0d 0a 31 37 32 38 0d  3186..114..1728.
7490: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
74a0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
74b0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
74c0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
74d0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
74e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
74f0: 45 43 54 20 41 4c 4c 20 2d 20 28 20 35 38 20 29  ECT ALL - ( 58 )
7500: 20 2d 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46   - + col2 col1 F
7510: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
7520: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 0d 0a 2d 35  ..----..-140..-5
7530: 39 0d 0a 2d 39 31 0d 0a 0d 0a 71 75 65 72 79 20  9..-91....query 
7540: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7550: 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 63  T ALL + col0 + c
7560: 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
7570: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
7580: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d  cor0..----..196.
7590: 0a 32 31 30 36 0d 0a 33 30 38 31 0d 0a 0d 0a 6f  .2106..3081....o
75a0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
75b0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
75c0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
75d0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
75e0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30 36 0d 0a  sort label-206..
75f0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d  SELECT ALL - ( -
7600: 20 63 6f 6c 32 20 29 20 44 49 56 20 2d 20 63 6f   col2 ) DIV - co
7610: 72 30 2e 63 6f 6c 32 20 2b 20 36 39 20 63 6f 6c  r0.col2 + 69 col
7620: 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
7630: 0d 0a 2d 2d 2d 2d 0d 0a 36 38 0d 0a 36 38 0d 0a  ..----..68..68..
7640: 36 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  68....skipif pos
7650: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
7660: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
7670: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
7680: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
7690: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
76a0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
76b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
76c0: 62 65 6c 2d 32 30 36 0d 0a 53 45 4c 45 43 54 20  bel-206..SELECT 
76d0: 41 4c 4c 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29  ALL - ( - col2 )
76e0: 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   / - cor0.col2 +
76f0: 20 36 39 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   69 col0 FROM ta
7700: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  b1 cor0..----..6
7710: 38 0d 0a 36 38 0d 0a 36 38 0d 0a 0d 0a 6f 6e 6c  8..68..68....onl
7720: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
7730: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
7740: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
7750: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
7760: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7770: 6c 61 62 65 6c 2d 32 30 37 0d 0a 53 45 4c 45 43  label-207..SELEC
7780: 54 20 2b 20 43 41 53 54 28 20 28 20 2d 20 63 6f  T + CAST( ( - co
7790: 6c 31 20 29 20 41 53 20 53 49 47 4e 45 44 20 29  l1 ) AS SIGNED )
77a0: 20 2a 20 39 39 20 2b 20 36 32 20 41 53 20 63 6f   * 99 + 62 AS co
77b0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
77c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 35  cor0..----..-845
77d0: 32 0d 0a 2d 38 39 34 37 0d 0a 2d 39 35 34 31 0d  2..-8947..-9541.
77e0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
77f0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
7800: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7810: 74 20 6c 61 62 65 6c 2d 32 30 37 0d 0a 53 45 4c  t label-207..SEL
7820: 45 43 54 20 2b 20 43 41 53 54 20 28 20 28 20 2d  ECT + CAST ( ( -
7830: 20 63 6f 6c 31 20 29 20 41 53 20 49 4e 54 45 47   col1 ) AS INTEG
7840: 45 52 20 29 20 2a 20 39 39 20 2b 20 36 32 20 41  ER ) * 99 + 62 A
7850: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
7860: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7870: 2d 38 34 35 32 0d 0a 2d 38 39 34 37 0d 0a 2d 39  -8452..-8947..-9
7880: 35 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  541....query III
7890: 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
78a0: 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c  ECT * FROM tab0,
78b0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 57 48   tab2 AS cor0 WH
78c0: 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c 3e 20  ERE NOT NULL <> 
78d0: 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a  ( NULL )..----..
78e0: 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 20 72  ..query IIIIII r
78f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
7900: 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74  ISTINCT * FROM t
7910: 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
7920: 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 3e 20 4e  0 WHERE NULL > N
7930: 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ULL..----....que
7940: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7950: 4c 45 43 54 20 2d 20 35 36 20 2a 20 63 6f 6c 31  LECT - 56 * col1
7960: 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30   + - col1 * col0
7970: 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
7980: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
7990: 2d 0d 0a 2d 31 39 38 34 0d 0a 2d 32 33 31 32 0d  -..-1984..-2312.
79a0: 0a 2d 37 39 36 35 0d 0a 0d 0a 71 75 65 72 79 20  .-7965....query 
79b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
79c0: 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 36  T ALL col2 * + 6
79d0: 33 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  3 FROM tab1..---
79e0: 2d 0d 0a 33 34 30 32 0d 0a 33 35 39 31 0d 0a 36  -..3402..3591..6
79f0: 30 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  048....query I r
7a00: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
7a10: 20 2b 20 37 38 20 2b 20 2d 20 74 61 62 30 2e 63   + 78 + - tab0.c
7a20: 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol1 ) AS col2 FR
7a30: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
7a40: 31 33 0d 0a 2d 31 39 0d 0a 2d 38 0d 0a 0d 0a 71  13..-19..-8....q
7a50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7a60: 53 45 4c 45 43 54 20 2d 20 74 61 62 31 2e 63 6f  SELECT - tab1.co
7a70: 6c 31 20 2b 20 2b 20 28 20 74 61 62 31 2e 63 6f  l1 + + ( tab1.co
7a80: 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l2 ) AS col0 FRO
7a90: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38  M tab1..----..28
7aa0: 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 6f 6e 6c 79  ..47..83....only
7ab0: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
7ac0: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
7ad0: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
7ae0: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
7af0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
7b00: 61 62 65 6c 2d 32 31 34 0d 0a 53 45 4c 45 43 54  abel-214..SELECT
7b10: 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54   DISTINCT - CAST
7b20: 28 20 2b 20 63 6f 6c 31 20 2b 20 74 61 62 32 2e  ( + col1 + tab2.
7b30: 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
7b40: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
7b50: 0d 0a 2d 35 35 0d 0a 2d 35 38 0d 0a 2d 38 35 0d  ..-55..-58..-85.
7b60: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
7b70: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
7b80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7b90: 74 20 6c 61 62 65 6c 2d 32 31 34 0d 0a 53 45 4c  t label-214..SEL
7ba0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43  ECT DISTINCT - C
7bb0: 41 53 54 20 28 20 2b 20 63 6f 6c 31 20 2b 20 74  AST ( + col1 + t
7bc0: 61 62 32 2e 63 6f 6c 32 20 41 53 20 49 4e 54 45  ab2.col2 AS INTE
7bd0: 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 0d  GER ) FROM tab2.
7be0: 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d 35 38 0d  .----..-55..-58.
7bf0: 0a 2d 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-85....onlyif m
7c00: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
7c10: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
7c20: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
7c30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
7c40: 62 65 6c 2d 32 31 35 0d 0a 53 45 4c 45 43 54 20  bel-215..SELECT 
7c50: 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 44 49  - col1 * col1 DI
7c60: 56 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e  V col0 + - tab1.
7c70: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
7c80: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab1..----..-2
7c90: 37 39 0d 0a 2d 35 38 0d 0a 2d 39 38 0d 0a 0d 0a  79..-58..-98....
7ca0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
7cb0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
7cc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
7cd0: 61 62 65 6c 2d 32 31 35 0d 0a 53 45 4c 45 43 54  abel-215..SELECT
7ce0: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2f   - col1 * col1 /
7cf0: 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e 63   col0 + - tab1.c
7d00: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
7d10: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37   tab1..----..-27
7d20: 39 0d 0a 2d 35 38 0d 0a 2d 39 38 0d 0a 0d 0a 71  9..-58..-98....q
7d30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7d40: 53 45 4c 45 43 54 20 2d 20 2d 20 33 32 20 41 53  SELECT - - 32 AS
7d50: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c   col1 FROM tab1,
7d60: 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
7d70: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or0..----..27 va
7d80: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
7d90: 63 66 34 66 30 31 61 63 39 37 65 62 38 33 34 34  cf4f01ac97eb8344
7da0: 35 62 31 37 32 31 66 33 61 65 32 38 39 36 31 61  5b1721f3ae28961a
7db0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7dc0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
7dd0: 49 4e 43 54 20 2b 20 37 37 20 46 52 4f 4d 20 74  INCT + 77 FROM t
7de0: 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab1, tab1 AS cor
7df0: 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
7e00: 0a 2d 2d 2d 2d 0d 0a 37 37 0d 0a 0d 0a 71 75 65  .----..77....que
7e10: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7e20: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
7e30: 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 28 20  l2 * col1 + - ( 
7e40: 2d 20 39 33 20 29 20 46 52 4f 4d 20 74 61 62 30  - 93 ) FROM tab0
7e50: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7e60: 31 39 30 0d 0a 32 39 33 31 0d 0a 37 35 35 35 0d  190..2931..7555.
7e70: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7e80: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
7e90: 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 37 30 20  NCT col1 + - 70 
7ea0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
7eb0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 33  0..----..-11..-3
7ec0: 39 0d 0a 2d 35 33 0d 0a 0d 0a 71 75 65 72 79 20  9..-53....query 
7ed0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7ee0: 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e  T col2 + + cor0.
7ef0: 63 6f 6c 30 20 2a 20 2b 20 28 20 63 6f 72 30 2e  col0 * + ( cor0.
7f00: 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31  col1 ) FROM tab1
7f10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7f20: 31 31 33 36 0d 0a 31 33 32 0d 0a 36 39 37 0d 0a  1136..132..697..
7f30: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7f40: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
7f50: 43 54 20 2d 20 63 6f 6c 32 20 2b 20 35 20 46 52  CT - col2 + 5 FR
7f60: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
7f70: 2d 2d 0d 0a 2d 34 39 0d 0a 2d 35 32 0d 0a 2d 39  --..-49..-52..-9
7f80: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
7f90: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
7fa0: 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d  TINCT + col0 * -
7fb0: 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63   col1 * col1 + c
7fc0: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
7fd0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
7fe0: 0d 0a 2d 31 33 35 30 37 0d 0a 2d 32 30 30 32 0d  ..-13507..-2002.
7ff0: 0a 2d 36 33 39 30 0d 0a 0d 0a 71 75 65 72 79 20  .-6390....query 
8000: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8010: 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 38  T ALL col1 * + 8
8020: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
8030: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
8040: 2d 0d 0a 31 30 35 33 0d 0a 32 31 30 36 0d 0a 38  -..1053..2106..8
8050: 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
8060: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
8070: 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  L - + cor0.col0 
8080: 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  - + col1 * cor0.
8090: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
80a0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
80b0: 2d 2d 2d 2d 0d 0a 2d 37 34 32 30 0d 0a 2d 38 33  ----..-7420..-83
80c0: 37 30 0d 0a 2d 39 34 34 34 0d 0a 0d 0a 71 75 65  70..-9444....que
80d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
80e0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
80f0: 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l1 * + cor0.col2
8100: 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46   + col1 * col0 F
8110: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
8120: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 34 0d 0a 31 39  ..----..1054..19
8130: 38 39 0d 0a 36 31 33 36 0d 0a 0d 0a 71 75 65 72  89..6136....quer
8140: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8150: 45 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20  ECT - cor1.col1 
8160: 2a 20 63 6f 72 31 2e 63 6f 6c 32 20 41 53 20 63  * cor1.col2 AS c
8170: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
8180: 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
8190: 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
81a0: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
81b0: 6e 67 20 74 6f 20 36 62 64 32 37 37 62 38 33 32  ng to 6bd277b832
81c0: 30 61 65 36 66 38 63 33 66 65 35 39 33 34 31 31  0ae6f8c3fe593411
81d0: 64 32 64 63 66 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  d2dcf6....onlyif
81e0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
81f0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
8200: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
8210: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
8220: 6c 61 62 65 6c 2d 32 32 37 0d 0a 53 45 4c 45 43  label-227..SELEC
8230: 54 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20  T cor0.col2 DIV 
8240: 2b 20 33 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  + 3 FROM tab2, t
8250: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
8260: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
8270: 69 6e 67 20 74 6f 20 30 61 35 31 37 39 30 61 36  ing to 0a51790a6
8280: 38 39 30 64 31 38 37 39 39 38 33 31 30 62 35 66  890d187998310b5f
8290: 64 37 31 37 38 31 30 0d 0a 0d 0a 73 6b 69 70 69  d717810....skipi
82a0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
82b0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
82c0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
82d0: 32 32 37 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  227..SELECT cor0
82e0: 2e 63 6f 6c 32 20 2f 20 2b 20 33 20 46 52 4f 4d  .col2 / + 3 FROM
82f0: 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
8300: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
8310: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30  ues hashing to 0
8320: 61 35 31 37 39 30 61 36 38 39 30 64 31 38 37 39  a51790a6890d1879
8330: 39 38 33 31 30 62 35 66 64 37 31 37 38 31 30 0d  98310b5fd717810.
8340: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8350: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
8360: 20 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32   2 * + cor0.col2
8370: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
8380: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32  r0..----..164..2
8390: 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..66....query I 
83a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
83b0: 2d 20 2b 20 35 32 20 2a 20 2d 20 63 6f 6c 31 20  - + 52 * - col1 
83c0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
83d0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
83e0: 0a 31 33 35 32 0d 0a 35 32 30 0d 0a 36 37 36 0d  .1352..520..676.
83f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8400: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 37 20  rt..SELECT - 27 
8410: 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  + + col1 + col0 
8420: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
8430: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  0 cor0..----..10
8440: 35 0d 0a 31 35 33 0d 0a 38 33 0d 0a 0d 0a 71 75  5..153..83....qu
8450: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8460: 45 4c 45 43 54 20 2b 20 2d 20 28 20 2b 20 63 6f  ELECT + - ( + co
8470: 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 30 20 41 53  l0 ) + - col0 AS
8480: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
8490: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
84a0: 31 37 38 0d 0a 2d 34 38 0d 0a 2d 37 30 0d 0a 0d  178..-48..-70...
84b0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
84c0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
84d0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
84e0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
84f0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 32  owsort label-232
8500: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 28 20 63  ..SELECT - - ( c
8510: 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 2b 20 63  ol2 ) + col0 + c
8520: 6f 6c 32 20 44 49 56 20 2b 20 35 38 20 46 52 4f  ol2 DIV + 58 FRO
8530: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
8540: 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 37 0d 0a  ----..121..177..
8550: 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  57....skipif mys
8560: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
8570: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
8580: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 32 0d 0a  sort label-232..
8590: 53 45 4c 45 43 54 20 2d 20 2d 20 28 20 63 6f 6c  SELECT - - ( col
85a0: 32 20 29 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  2 ) + col0 + col
85b0: 32 20 2f 20 2b 20 35 38 20 46 52 4f 4d 20 74 61  2 / + 58 FROM ta
85c0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
85d0: 0d 0a 31 32 31 0d 0a 31 37 37 0d 0a 35 37 0d 0a  ..121..177..57..
85e0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
85f0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
8600: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
8610: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
8620: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
8630: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8640: 43 54 20 2d 20 36 35 20 2b 20 2d 20 28 20 2d 20  CT - 65 + - ( - 
8650: 63 6f 6c 30 20 29 20 63 6f 6c 30 20 46 52 4f 4d  col0 ) col0 FROM
8660: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
8670: 2d 2d 2d 0d 0a 2d 35 38 0d 0a 31 33 0d 0a 31 34  ---..-58..13..14
8680: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
8690: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
86a0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
86b0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
86c0: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
86d0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 34  owsort label-234
86e0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
86f0: 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  ( + cor0.col1 ) 
8700: 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
8710: 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
8720: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
8730: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
8740: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
8750: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
8760: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
8770: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 34 0d 0a  sort label-234..
8780: 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 28 20  SELECT col0 + ( 
8790: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20  + cor0.col1 ) + 
87a0: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
87b0: 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
87c0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
87d0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
87e0: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
87f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 38  wsort..SELECT 48
8800: 20 2a 20 2b 20 31 36 20 41 53 20 63 6f 6c 30 20   * + 16 AS col0 
8810: 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20  FROM tab2, tab0 
8820: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
8830: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
8840: 74 6f 20 31 61 34 32 63 37 63 66 36 37 34 65 37  to 1a42c7cf674e7
8850: 34 32 39 34 32 64 64 65 35 62 66 30 35 61 36 33  42942dde5bf05a63
8860: 36 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  671....query I r
8870: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
8880: 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 28 20 2b 20  LL + col1 * ( + 
8890: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col2 * - col0 + 
88a0: 74 61 62 30 2e 63 6f 6c 30 20 29 20 41 53 20 63  tab0.col0 ) AS c
88b0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
88c0: 2d 2d 2d 0d 0a 2d 36 35 36 30 31 39 0d 0a 2d 36  ---..-656019..-6
88d0: 36 30 34 38 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  6048..0....query
88e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
88f0: 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31  CT col0 * - col1
8900: 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + - col1 AS col
8910: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
8920: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 35 30  or0..----..-2150
8930: 0d 0a 2d 33 34 39 32 0d 0a 2d 38 31 39 30 0d 0a  ..-3492..-8190..
8940: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8950: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 39 20 2b  t..SELECT - 79 +
8960: 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46   + col1 * col1 F
8970: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
8980: 0d 0a 2d 2d 2d 2d 0d 0a 37 33 31 37 0d 0a 38 32  ..----..7317..82
8990: 30 32 0d 0a 39 33 33 30 0d 0a 0d 0a 71 75 65 72  02..9330....quer
89a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
89b0: 45 43 54 20 2b 20 31 34 20 2a 20 2d 20 33 38 20  ECT + 14 * - 38 
89c0: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
89d0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
89e0: 2d 34 34 33 0d 0a 2d 34 39 37 0d 0a 2d 35 30 38  -443..-497..-508
89f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8a00: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
8a10: 2d 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20  - col0 ) + col0 
8a20: 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
8a30: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
8a40: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 30 0d 0a 35 35  ..----..1190..55
8a50: 32 0d 0a 37 38 33 32 0d 0a 0d 0a 6f 6e 6c 79 69  2..7832....onlyi
8a60: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
8a70: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
8a80: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
8a90: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
8aa0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
8ab0: 62 65 6c 2d 32 34 31 0d 0a 53 45 4c 45 43 54 20  bel-241..SELECT 
8ac0: 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c 31 20 41  + CAST( - col1 A
8ad0: 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c  S SIGNED ) + col
8ae0: 31 20 2a 20 2d 20 37 35 20 2b 20 2b 20 63 6f 6c  1 * - 75 + + col
8af0: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
8b00: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
8b10: 2d 0d 0a 2d 31 32 37 35 0d 0a 2d 32 33 32 35 0d  -..-1275..-2325.
8b20: 0a 2d 34 34 32 35 0d 0a 0d 0a 73 6b 69 70 69 66  .-4425....skipif
8b30: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
8b40: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
8b50: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
8b60: 34 31 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  41..SELECT + CAS
8b70: 54 20 28 20 2d 20 63 6f 6c 31 20 41 53 20 49 4e  T ( - col1 AS IN
8b80: 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 31 20 2a  TEGER ) + col1 *
8b90: 20 2d 20 37 35 20 2b 20 2b 20 63 6f 6c 31 20 41   - 75 + + col1 A
8ba0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
8bb0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8bc0: 2d 31 32 37 35 0d 0a 2d 32 33 32 35 0d 0a 2d 34  -1275..-2325..-4
8bd0: 34 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  425....query I r
8be0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74  owsort..SELECT t
8bf0: 61 62 32 2e 63 6f 6c 30 20 2b 20 31 33 20 41 53  ab2.col0 + 13 AS
8c00: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
8c10: 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 39 31 0d 0a 39  .----..20..91..9
8c20: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
8c30: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 36  sort..SELECT ( 6
8c40: 31 20 29 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  1 ) FROM tab0, t
8c50: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
8c60: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
8c70: 69 6e 67 20 74 6f 20 30 37 31 34 39 39 30 35 61  ing to 07149905a
8c80: 37 32 62 64 38 37 35 35 33 33 38 31 66 33 34 64  72bd87553381f34d
8c90: 31 39 65 64 32 39 30 0d 0a 0d 0a 71 75 65 72 79  19ed290....query
8ca0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8cb0: 43 54 20 44 49 53 54 49 4e 43 54 20 38 31 20 46  CT DISTINCT 81 F
8cc0: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
8cd0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor0..----..81
8ce0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8cf0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
8d00: 20 2b 20 28 20 2d 20 33 34 20 29 20 46 52 4f 4d   + ( - 34 ) FROM
8d10: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31   tab1..----..-31
8d20: 0d 0a 33 30 0d 0a 34 36 0d 0a 0d 0a 71 75 65 72  ..30..46....quer
8d30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8d40: 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 38 36 20  ECT - col1 * 86 
8d50: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
8d60: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
8d70: 0a 2d 31 31 31 38 0d 0a 2d 32 32 33 36 0d 0a 2d  .-1118..-2236..-
8d80: 38 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  860....onlyif my
8d90: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
8da0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
8db0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
8dc0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
8dd0: 65 6c 2d 32 34 37 0d 0a 53 45 4c 45 43 54 20 63  el-247..SELECT c
8de0: 6f 6c 30 20 2a 20 63 6f 6c 30 20 44 49 56 20 35  ol0 * col0 DIV 5
8df0: 38 20 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20  8 + + col1 col0 
8e00: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
8e10: 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 32 32 37 0d 0a  ----..118..227..
8e20: 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  95....skipif pos
8e30: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
8e40: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
8e50: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
8e60: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
8e70: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
8e80: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
8e90: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
8ea0: 62 65 6c 2d 32 34 37 0d 0a 53 45 4c 45 43 54 20  bel-247..SELECT 
8eb0: 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2f 20 35 38  col0 * col0 / 58
8ec0: 20 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46   + + col1 col0 F
8ed0: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
8ee0: 2d 2d 2d 0d 0a 31 31 38 0d 0a 32 32 37 0d 0a 39  ---..118..227..9
8ef0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
8f00: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
8f10: 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 36  TINCT + col1 + 6
8f20: 37 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  7 FROM tab1 cor0
8f30: 0d 0a 2d 2d 2d 2d 0d 0a 37 37 0d 0a 38 30 0d 0a  ..----..77..80..
8f40: 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  93....onlyif mys
8f50: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
8f60: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
8f70: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
8f80: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
8f90: 6c 2d 32 34 39 0d 0a 53 45 4c 45 43 54 20 44 49  l-249..SELECT DI
8fa0: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20  STINCT - col1 * 
8fb0: 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f  + col2 + cor0.co
8fc0: 6c 30 20 2a 20 63 6f 6c 31 20 44 49 56 20 2b 20  l0 * col1 DIV + 
8fd0: 38 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  81 AS col2 FROM 
8fe0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
8ff0: 2d 2d 0d 0a 2d 31 34 37 38 0d 0a 2d 36 33 30 0d  --..-1478..-630.
9000: 0a 2d 38 33 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-835....skipif 
9010: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
9020: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
9030: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34  rowsort label-24
9040: 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
9050: 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  CT - col1 * + co
9060: 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  l2 + cor0.col0 *
9070: 20 63 6f 6c 31 20 2f 20 2b 20 38 31 20 41 53 20   col1 / + 81 AS 
9080: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
9090: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
90a0: 34 37 38 0d 0a 2d 36 33 30 0d 0a 2d 38 33 35 0d  478..-630..-835.
90b0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
90c0: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
90d0: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
90e0: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
90f0: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
9100: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 30 0d  wsort label-250.
9110: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
9120: 6c 30 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c  l0 * - CAST( NUL
9130: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  L AS SIGNED ) + 
9140: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
9150: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
9160: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
9170: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
9180: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
9190: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
91a0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
91b0: 35 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  50..SELECT ALL -
91c0: 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54 20 28   col0 * - CAST (
91d0: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
91e0: 20 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   ) + col0 AS col
91f0: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
9200: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
9210: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f  .NULL..NULL....o
9220: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
9230: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
9240: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
9250: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
9260: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 31 0d 0a  sort label-251..
9270: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
9280: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20  + cor0.col1 DIV 
9290: 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f  - ( + col2 ) FRO
92a0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
92b0: 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ----..0....skipi
92c0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
92d0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
92e0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
92f0: 32 35 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  251..SELECT DIST
9300: 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  INCT + cor0.col1
9310: 20 2f 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20   / - ( + col2 ) 
9320: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
9330: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  0..----..0....qu
9340: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9350: 45 4c 45 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f  ELECT ALL ( + co
9360: 6c 32 20 29 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  l2 ) * col0 + co
9370: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
9380: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
9390: 2d 2d 0d 0a 32 30 38 37 0d 0a 32 32 30 0d 0a 33  --..2087..220..3
93a0: 30 31 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  019....onlyif my
93b0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
93c0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
93d0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
93e0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
93f0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
9400: 32 35 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  253..SELECT DIST
9410: 49 4e 43 54 20 2d 20 43 41 53 54 28 20 2d 20 34  INCT - CAST( - 4
9420: 34 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  4 AS SIGNED ) * 
9430: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
9440: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
9450: 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 32 0d 0a 33 36  ..----..1452..36
9460: 30 38 0d 0a 34 34 0d 0a 0d 0a 73 6b 69 70 69 66  08..44....skipif
9470: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
9480: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
9490: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
94a0: 35 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  53..SELECT DISTI
94b0: 4e 43 54 20 2d 20 43 41 53 54 20 28 20 2d 20 34  NCT - CAST ( - 4
94c0: 34 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  4 AS INTEGER ) *
94d0: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
94e0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
94f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 32 0d 0a 33  0..----..1452..3
9500: 36 30 38 0d 0a 34 34 0d 0a 0d 0a 71 75 65 72 79  608..44....query
9510: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9520: 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  CT + + col1 + + 
9530: 36 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  62 AS col2 FROM 
9540: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
9550: 2d 2d 0d 0a 31 32 31 0d 0a 37 39 0d 0a 39 33 0d  --..121..79..93.
9560: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
9570: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
9580: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
9590: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
95a0: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
95b0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 35 0d  wsort label-255.
95c0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41  .SELECT ALL - CA
95d0: 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  ST( col0 AS SIGN
95e0: 45 44 20 29 20 2a 20 2b 20 63 6f 6c 30 20 46 52  ED ) * + col0 FR
95f0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
9600: 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38  .----..-49..-608
9610: 34 0d 0a 2d 36 32 34 31 0d 0a 0d 0a 73 6b 69 70  4..-6241....skip
9620: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
9630: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
9640: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
9650: 2d 32 35 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -255..SELECT ALL
9660: 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41   - CAST ( col0 A
9670: 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20  S INTEGER ) * + 
9680: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
9690: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
96a0: 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32 34 31 0d  9..-6084..-6241.
96b0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
96c0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 34 20  rt..SELECT - 34 
96d0: 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
96e0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
96f0: 0d 0a 2d 31 31 34 0d 0a 2d 33 37 0d 0a 2d 39 38  ..-114..-37..-98
9700: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
9710: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
9720: 49 4e 43 54 20 2d 20 2b 20 33 34 20 2b 20 2b 20  INCT - + 34 + + 
9730: 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  col0 + col2 * co
9740: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
9750: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d  cor0..----..162.
9760: 0a 32 30 37 32 0d 0a 33 30 34 37 0d 0a 0d 0a 71  .2072..3047....q
9770: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9780: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
9790: 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e  + col2 + - cor0.
97a0: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52  col2 * - col2 FR
97b0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
97c0: 0a 2d 2d 2d 2d 0d 0a 31 34 38 32 0d 0a 37 30 32  .----..1482..702
97d0: 0d 0a 37 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..756....query I
97e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
97f0: 20 41 4c 4c 20 2b 20 2d 20 35 37 20 41 53 20 63   ALL + - 57 AS c
9800: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
9810: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37   cor0..----..-57
9820: 0d 0a 2d 35 37 0d 0a 2d 35 37 0d 0a 0d 0a 6f 6e  ..-57..-57....on
9830: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
9840: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
9850: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
9860: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
9870: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9880: 20 6c 61 62 65 6c 2d 32 36 30 0d 0a 53 45 4c 45   label-260..SELE
9890: 43 54 20 41 4c 4c 20 43 41 53 54 28 20 4e 55 4c  CT ALL CAST( NUL
98a0: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  L AS SIGNED ) * 
98b0: 33 35 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  35 + col1 AS col
98c0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
98d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
98e0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
98f0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
9900: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
9910: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9920: 62 65 6c 2d 32 36 30 0d 0a 53 45 4c 45 43 54 20  bel-260..SELECT 
9930: 41 4c 4c 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  ALL CAST ( NULL 
9940: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 33  AS INTEGER ) * 3
9950: 35 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  5 + col1 AS col1
9960: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
9970: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
9980: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
9990: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
99a0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
99b0: 20 2d 20 63 6f 6c 30 20 2a 20 39 32 20 46 52 4f   - col0 * 92 FRO
99c0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
99d0: 2d 2d 2d 2d 0d 0a 2d 36 34 34 0d 0a 2d 37 31 37  ----..-644..-717
99e0: 36 0d 0a 2d 37 32 36 38 0d 0a 0d 0a 6f 6e 6c 79  6..-7268....only
99f0: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
9a00: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
9a10: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
9a20: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
9a30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
9a40: 61 62 65 6c 2d 32 36 32 0d 0a 53 45 4c 45 43 54  abel-262..SELECT
9a50: 20 43 41 53 54 28 20 63 6f 72 30 2e 63 6f 6c 31   CAST( cor0.col1
9a60: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b   AS SIGNED ) + +
9a70: 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63   cor0.col1 * - c
9a80: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
9a90: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
9aa0: 0d 0a 2d 31 33 32 36 0d 0a 2d 31 38 36 0d 0a 2d  ..-1326..-186..-
9ab0: 34 35 34 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  4543....skipif m
9ac0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
9ad0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
9ae0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 32  owsort label-262
9af0: 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20  ..SELECT CAST ( 
9b00: 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 49 4e 54  cor0.col1 AS INT
9b10: 45 47 45 52 20 29 20 2b 20 2b 20 63 6f 72 30 2e  EGER ) + + cor0.
9b20: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53  col1 * - col0 AS
9b30: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
9b40: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32  cor0..----..-132
9b50: 36 0d 0a 2d 31 38 36 0d 0a 2d 34 35 34 33 0d 0a  6..-186..-4543..
9b60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9b70: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 33 20 2a  t..SELECT - 53 *
9b80: 20 33 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   32 AS col2 FROM
9b90: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
9ba0: 2d 2d 2d 0d 0a 2d 31 36 39 36 0d 0a 2d 31 36 39  ---..-1696..-169
9bb0: 36 0d 0a 2d 31 36 39 36 0d 0a 0d 0a 71 75 65 72  6..-1696....quer
9bc0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9bd0: 45 43 54 20 41 4c 4c 20 32 38 20 2b 20 63 6f 6c  ECT ALL 28 + col
9be0: 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 33  0 * + col0 * + 3
9bf0: 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  3 AS col1 FROM t
9c00: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
9c10: 31 39 30 33 36 0d 0a 32 36 31 34 32 31 0d 0a 34  19036..261421..4
9c20: 30 34 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0453....query I 
9c30: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9c40: 44 49 53 54 49 4e 43 54 20 2d 20 37 32 20 2a 20  DISTINCT - 72 * 
9c50: 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
9c60: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
9c70: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31 39 32  or0..----..-6192
9c80: 0d 0a 2d 36 35 35 32 0d 0a 2d 36 39 38 34 0d 0a  ..-6552..-6984..
9c90: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
9ca0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
9cb0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
9cc0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
9cd0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36  rowsort label-26
9ce0: 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  6..SELECT + col2
9cf0: 20 44 49 56 20 74 61 62 32 2e 63 6f 6c 30 20 2b   DIV tab2.col0 +
9d00: 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f   tab2.col0 AS co
9d10: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
9d20: 2d 2d 0d 0a 31 30 0d 0a 37 38 0d 0a 37 39 0d 0a  --..10..78..79..
9d30: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
9d40: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
9d50: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9d60: 20 6c 61 62 65 6c 2d 32 36 36 0d 0a 53 45 4c 45   label-266..SELE
9d70: 43 54 20 2b 20 63 6f 6c 32 20 2f 20 74 61 62 32  CT + col2 / tab2
9d80: 2e 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63 6f 6c  .col0 + tab2.col
9d90: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
9da0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 37  ab2..----..10..7
9db0: 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  8..79....query I
9dc0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9dd0: 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 39 38 20 2b   ALL col1 * 98 +
9de0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
9df0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
9e00: 30 34 34 0d 0a 31 33 35 34 0d 0a 32 35 35 31 0d  044..1354..2551.
9e10: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9e20: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31  rt..SELECT ALL 1
9e30: 39 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  9 + col2 * + col
9e40: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
9e50: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
9e60: 2d 0d 0a 31 31 36 0d 0a 32 38 35 37 0d 0a 37 34  -..116..2857..74
9e70: 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
9e80: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
9e90: 53 54 49 4e 43 54 20 2b 20 2b 20 28 20 2d 20 63  STINCT + + ( - c
9ea0: 6f 6c 32 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 ) + cor0.col
9eb0: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
9ec0: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
9ed0: 2d 32 38 0d 0a 2d 34 37 0d 0a 2d 38 33 0d 0a 0d  -28..-47..-83...
9ee0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9ef0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
9f00: 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 34 36 20  or0.col0 * + 46 
9f10: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
9f20: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
9f30: 0a 33 32 32 0d 0a 33 35 38 38 0d 0a 33 36 33 34  .322..3588..3634
9f40: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
9f50: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
9f60: 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20 2d 20 63  - + ( col1 ) - c
9f70: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
9f80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
9f90: 39 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a  9..-173..-98....
9fa0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9fb0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d  .SELECT - col1 -
9fc0: 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2b 20   - col1 * + ( + 
9fd0: 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32  col0 ) FROM tab2
9fe0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9ff0: 31 33 32 36 0d 0a 31 38 36 0d 0a 34 35 34 33 0d  1326..186..4543.
a000: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a010: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
a020: 2a 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c  * - col1 - - col
a030: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
a040: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
a050: 2d 0d 0a 2d 32 34 0d 0a 2d 35 38 33 0d 0a 2d 39  -..-24..-583..-9
a060: 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  44....query I ro
a070: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
a080: 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  L + - cor0.col2 
a090: 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e  * col0 + + cor0.
a0a0: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
a0b0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
a0c0: 2d 2d 2d 2d 0d 0a 2d 37 30 36 0d 0a 2d 37 32 30  ----..-706..-720
a0d0: 37 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  7..62....query I
a0e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a0f0: 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   - + col1 * - co
a100: 6c 30 20 2b 20 33 37 20 41 53 20 63 6f 6c 31 20  l0 + 37 AS col1 
a110: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
a120: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 30 0d 0a 32  0..----..1380..2
a130: 35 34 0d 0a 34 36 33 39 0d 0a 0d 0a 71 75 65 72  54..4639....quer
a140: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a150: 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 39 20  ECT DISTINCT 99 
a160: 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53  * col1 - col0 AS
a170: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
a180: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
a190: 34 39 30 0d 0a 38 39 32 30 0d 0a 39 35 36 38 0d  490..8920..9568.
a1a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a1b0: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
a1c0: 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20  * col0 + col2 * 
a1d0: 36 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  62 FROM tab1 AS 
a1e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 32 36  cor0..----..3426
a1f0: 0d 0a 34 31 37 34 0d 0a 36 39 39 32 0d 0a 0d 0a  ..4174..6992....
a200: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a210: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
a220: 20 2b 20 35 30 20 2a 20 2d 20 63 6f 6c 31 20 46   + 50 * - col1 F
a230: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
a240: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 30 0d 0a 2d  ..----..-1300..-
a250: 35 30 30 0d 0a 2d 36 35 30 0d 0a 0d 0a 71 75 65  500..-650....que
a260: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a270: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
a280: 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53  ( cor0.col2 ) AS
a290: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
a2a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
a2b0: 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a  54..-57..-96....
a2c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a2d0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
a2e0: 20 2b 20 33 20 2b 20 2b 20 63 6f 6c 31 20 41 53   + 3 + + col1 AS
a2f0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
a300: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a  cor0..----..13..
a310: 31 36 0d 0a 32 39 0d 0a 0d 0a 71 75 65 72 79 20  16..29....query 
a320: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a330: 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20 63  T ALL col0 + + c
a340: 6f 72 30 2e 63 6f 6c 32 20 2a 20 35 35 20 46 52  or0.col2 * 55 FR
a350: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
a360: 0a 2d 2d 2d 2d 0d 0a 32 39 37 33 0d 0a 33 31 39  .----..2973..319
a370: 39 0d 0a 35 33 36 30 0d 0a 0d 0a 71 75 65 72 79  9..5360....query
a380: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a390: 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20  CT ALL - - col0 
a3a0: 2d 20 2b 20 63 6f 6c 30 20 2a 20 36 39 20 41 53  - + col0 * 69 AS
a3b0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
a3c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
a3d0: 32 30 34 0d 0a 2d 34 33 35 32 0d 0a 2d 35 34 34  204..-4352..-544
a3e0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
a3f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
a400: 54 49 4e 43 54 20 32 35 20 2a 20 63 6f 6c 31 20  TINCT 25 * col1 
a410: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
a420: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  0 cor0..----..21
a430: 35 30 0d 0a 32 32 37 35 0d 0a 32 34 32 35 0d 0a  50..2275..2425..
a440: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
a450: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
a460: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
a470: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
a480: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
a490: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a4a0: 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20  CT ALL - - col2 
a4b0: 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  * + col2 col2 FR
a4c0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
a4d0: 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37 36  .----..1444..676
a4e0: 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..729....query I
a4f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a500: 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 2a 20 2b   col2 - col0 * +
a510: 20 37 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   79 AS col2 FROM
a520: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
a530: 2d 2d 2d 0d 0a 2d 31 38 33 0d 0a 2d 34 39 39 39  ---..-183..-4999
a540: 0d 0a 2d 36 32 32 34 0d 0a 0d 0a 71 75 65 72 79  ..-6224....query
a550: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a560: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
a570: 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f 72 30 2e  ( col1 ) * cor0.
a580: 63 6f 6c 31 20 2a 20 33 35 20 41 53 20 63 6f 6c  col1 * 35 AS col
a590: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
a5a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 36 36  or0..----..-2366
a5b0: 30 0d 0a 2d 33 35 30 30 0d 0a 2d 35 39 31 35 0d  0..-3500..-5915.
a5c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a5d0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34  rt..SELECT ALL 4
a5e0: 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  4 AS col1 FROM t
a5f0: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
a600: 34 34 0d 0a 34 34 0d 0a 34 34 0d 0a 0d 0a 6f 6e  44..44..44....on
a610: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
a620: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
a630: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
a640: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
a650: 6f 72 74 20 6c 61 62 65 6c 2d 32 38 38 0d 0a 53  ort label-288..S
a660: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
a670: 20 63 6f 6c 32 20 44 49 56 20 2b 20 31 31 20 2b   col2 DIV + 11 +
a680: 20 32 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53   23 FROM tab1 AS
a690: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d   cor0..----..15.
a6a0: 0a 31 38 0d 0a 31 39 0d 0a 0d 0a 73 6b 69 70 69  .18..19....skipi
a6b0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
a6c0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
a6d0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
a6e0: 32 38 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  288..SELECT DIST
a6f0: 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2b 20  INCT - col2 / + 
a700: 31 31 20 2b 20 32 33 20 46 52 4f 4d 20 74 61 62  11 + 23 FROM tab
a710: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a720: 0a 31 35 0d 0a 31 38 0d 0a 31 39 0d 0a 0d 0a 6f  .15..18..19....o
a730: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
a740: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
a750: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
a760: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
a770: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a780: 74 20 6c 61 62 65 6c 2d 32 38 39 0d 0a 53 45 4c  t label-289..SEL
a790: 45 43 54 20 41 4c 4c 20 2b 20 33 30 20 2a 20 2d  ECT ALL + 30 * -
a7a0: 20 63 6f 6c 30 20 2d 20 2d 20 43 41 53 54 28 20   col0 - - CAST( 
a7b0: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
a7c0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
a7d0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
a7e0: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
a7f0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
a800: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
a810: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38 39 0d 0a  sort label-289..
a820: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 33 30 20  SELECT ALL + 30 
a830: 2a 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 43 41 53  * - col0 - - CAS
a840: 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
a850: 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 0d  GER ) FROM tab2.
a860: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
a870: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
a880: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
a890: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
a8a0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
a8b0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
a8c0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
a8d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
a8e0: 63 6f 6c 31 20 2b 20 34 34 20 63 6f 6c 32 20 46  col1 + 44 col2 F
a8f0: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
a900: 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 37 30 0d  ---..54..57..70.
a910: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a920: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
a930: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b   - cor0.col0 * +
a940: 20 28 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f   ( col0 ) + - co
a950: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
a960: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  cor0..----..-17.
a970: 0a 34 30 38 36 0d 0a 36 33 38 37 0d 0a 0d 0a 71  .4086..6387....q
a980: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a990: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e  SELECT + + cor0.
a9a0: 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63  col1 + col1 AS c
a9b0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
a9c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d   cor0..----..20.
a9d0: 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79  .26..52....query
a9e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a9f0: 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20  CT ALL + col1 + 
aa00: 2d 20 33 36 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 36 AS col2 FRO
aa10: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
aa20: 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 35 0d 0a 32  ----..-19..-5..2
aa30: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
aa40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
aa50: 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2d 20 63  TINCT - col2 - c
aa60: 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 37 31 20  or0.col2 * - 71 
aa70: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
aa80: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 31 30 0d 0a 35  0..----..2310..5
aa90: 37 34 30 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79  740..70....query
aaa0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
aab0: 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  CT - cor0.col0 *
aac0: 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63   col1 + - cor0.c
aad0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
aae0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
aaf0: 39 37 0d 0a 2d 33 33 39 36 0d 0a 2d 38 31 38 31  97..-3396..-8181
ab00: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ab10: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
ab20: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  cor0.col0 * + co
ab30: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
ab40: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d  cor0..----..-35.
ab50: 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a  .-7298..-792....
ab60: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ab70: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
ab80: 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   + + col2 + - co
ab90: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
aba0: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
abb0: 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 71  .28..47..83....q
abc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
abd0: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
abe0: 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
abf0: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
ac00: 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a  119..173..98....
ac10: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
ac20: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
ac30: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
ac40: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
ac50: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 39 39 0d  wsort label-299.
ac60: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
ac70: 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31   col1 DIV - col1
ac80: 20 2b 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20   + + ( col1 ) + 
ac90: 39 36 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  96 FROM tab2 AS 
aca0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 0d  cor0..----..112.
acb0: 0a 31 32 36 0d 0a 31 35 34 0d 0a 0d 0a 73 6b 69  .126..154....ski
acc0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
acd0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
ace0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
acf0: 6c 2d 32 39 39 0d 0a 53 45 4c 45 43 54 20 44 49  l-299..SELECT DI
ad00: 53 54 49 4e 43 54 20 63 6f 6c 31 20 2f 20 2d 20  STINCT col1 / - 
ad10: 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f 6c 31 20  col1 + + ( col1 
ad20: 29 20 2b 20 39 36 20 46 52 4f 4d 20 74 61 62 32  ) + 96 FROM tab2
ad30: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ad40: 31 31 32 0d 0a 31 32 36 0d 0a 31 35 34 0d 0a 0d  112..126..154...
ad50: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ad60: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
ad70: 54 20 2d 20 63 6f 6c 32 20 2a 20 37 38 20 41 53  T - col2 * 78 AS
ad80: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
ad90: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
ada0: 32 35 37 34 0d 0a 2d 36 33 39 36 0d 0a 2d 37 38  2574..-6396..-78
adb0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
adc0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
add0: 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  + - cor0.col2 + 
ade0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
adf0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a  or0..----..-28..
ae00: 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72  -47..-83....quer
ae10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ae20: 45 43 54 20 39 33 20 2a 20 63 6f 6c 31 20 2d 20  ECT 93 * col1 - 
ae30: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
ae40: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
ae50: 31 35 30 32 0d 0a 32 38 37 36 0d 0a 35 34 30 39  1502..2876..5409
ae60: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
ae70: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
ae80: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
ae90: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
aea0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
aeb0: 33 30 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  303..SELECT DIST
aec0: 49 4e 43 54 20 2b 20 38 20 2a 20 2d 20 63 6f 6c  INCT + 8 * - col
aed0: 30 20 44 49 56 20 2b 20 74 61 62 31 2e 63 6f 6c  0 DIV + tab1.col
aee0: 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  0 + + col0 AS co
aef0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
af00: 2d 2d 0d 0a 2d 35 0d 0a 35 36 0d 0a 37 32 0d 0a  --..-5..56..72..
af10: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
af20: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
af30: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
af40: 20 6c 61 62 65 6c 2d 33 30 33 0d 0a 53 45 4c 45   label-303..SELE
af50: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 38 20  CT DISTINCT + 8 
af60: 2a 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 74 61 62  * - col0 / + tab
af70: 31 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  1.col0 + + col0 
af80: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
af90: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 35 36 0d  1..----..-5..56.
afa0: 0a 37 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .72....onlyif my
afb0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
afc0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
afd0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
afe0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
aff0: 65 6c 2d 33 30 34 0d 0a 53 45 4c 45 43 54 20 2b  el-304..SELECT +
b000: 20 36 31 20 44 49 56 20 63 6f 6c 32 20 41 53 20   61 DIV col2 AS 
b010: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
b020: 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 36 31 0d 0a  ----..0..1..61..
b030: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
b040: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
b050: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b060: 20 6c 61 62 65 6c 2d 33 30 34 0d 0a 53 45 4c 45   label-304..SELE
b070: 43 54 20 2b 20 36 31 20 2f 20 63 6f 6c 32 20 41  CT + 61 / col2 A
b080: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
b090: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 36 31  ..----..0..1..61
b0a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
b0b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
b0c0: 49 4e 43 54 20 2b 20 37 38 20 2a 20 2b 20 63 6f  INCT + 78 * + co
b0d0: 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l1 + col0 FROM t
b0e0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 34 0d  ab1..----..1094.
b0f0: 0a 32 30 33 31 0d 0a 38 34 34 0d 0a 0d 0a 6f 6e  .2031..844....on
b100: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
b110: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
b120: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
b130: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
b140: 6f 72 74 20 6c 61 62 65 6c 2d 33 30 36 0d 0a 53  ort label-306..S
b150: 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63  ELECT - col2 + c
b160: 6f 6c 32 20 44 49 56 20 28 20 2d 20 37 35 20 2a  ol2 DIV ( - 75 *
b170: 20 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f 6c   col0 + tab1.col
b180: 32 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  2 ) FROM tab1..-
b190: 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d  ---..-54..-57..-
b1a0: 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  96....skipif mys
b1b0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
b1c0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
b1d0: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 36 0d 0a  sort label-306..
b1e0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
b1f0: 63 6f 6c 32 20 2f 20 28 20 2d 20 37 35 20 2a 20  col2 / ( - 75 * 
b200: 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f 6c 32  col0 + tab1.col2
b210: 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d   ) FROM tab1..--
b220: 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39  --..-54..-57..-9
b230: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
b240: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
b250: 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 74  TINCT + col0 * t
b260: 61 62 32 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  ab2.col2 * col1 
b270: 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  + + col2 AS col1
b280: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
b290: 0d 0a 31 31 39 36 37 38 0d 0a 35 31 30 37 32 0d  ..119678..51072.
b2a0: 0a 35 38 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .5886....query I
b2b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b2c0: 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   - col1 * + col1
b2d0: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
b2e0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
b2f0: 0a 2d 33 35 35 39 0d 0a 2d 33 36 38 0d 0a 2d 39  .-3559..-368..-9
b300: 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  68....query I ro
b310: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
b320: 63 6f 6c 31 20 2b 20 28 20 2d 20 33 30 20 2a 20  col1 + ( - 30 * 
b330: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53  - cor0.col2 ) AS
b340: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
b350: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
b360: 36 37 0d 0a 32 33 36 39 0d 0a 39 30 34 0d 0a 0d  67..2369..904...
b370: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b380: 0d 0a 53 45 4c 45 43 54 20 2d 20 31 36 20 2a 20  ..SELECT - 16 * 
b390: 2b 20 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f  + col0 + tab1.co
b3a0: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
b3b0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 30  tab1..----..-120
b3c0: 30 0d 0a 2d 34 35 0d 0a 2d 39 36 30 0d 0a 0d 0a  0..-45..-960....
b3d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b3e0: 0a 53 45 4c 45 43 54 20 39 35 20 41 53 20 63 6f  .SELECT 95 AS co
b3f0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
b400: 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
b410: 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
b420: 72 31 2c 20 74 61 62 32 20 63 6f 72 32 2c 20 74  r1, tab2 cor2, t
b430: 61 62 30 20 41 53 20 63 6f 72 33 0d 0a 2d 2d 2d  ab0 AS cor3..---
b440: 2d 0d 0a 32 34 33 20 76 61 6c 75 65 73 20 68 61  -..243 values ha
b450: 73 68 69 6e 67 20 74 6f 20 61 39 36 66 36 33 64  shing to a96f63d
b460: 66 37 66 30 35 61 36 63 39 62 34 62 35 66 66 39  f7f05a6c9b4b5ff9
b470: 61 31 37 36 62 34 34 39 34 0d 0a 0d 0a 71 75 65  a176b4494....que
b480: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b490: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
b4a0: 2d 20 63 6f 6c 30 20 2a 20 2d 20 39 37 20 2d 20  - col0 * - 97 - 
b4b0: 34 39 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  49 * - cor0.col0
b4c0: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
b4d0: 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 0d 0a 2d 33 30  .----..-144..-30
b4e0: 37 32 0d 0a 2d 33 38 34 30 0d 0a 0d 0a 71 75 65  72..-3840....que
b4f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b500: 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 72 30  LECT col0 * cor0
b510: 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46 52 4f  .col1 + col1 FRO
b520: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
b530: 2d 0d 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38  -..2150..3492..8
b540: 31 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  190....onlyif my
b550: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
b560: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
b570: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
b580: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
b590: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
b5a0: 33 31 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  314..SELECT ALL 
b5b0: 2d 20 63 6f 6c 32 20 2d 20 43 41 53 54 28 20 2d  - col2 - CAST( -
b5c0: 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20   col2 AS SIGNED 
b5d0: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
b5e0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
b5f0: 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
b600: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
b610: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
b620: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b630: 65 6c 2d 33 31 34 0d 0a 53 45 4c 45 43 54 20 41  el-314..SELECT A
b640: 4c 4c 20 2d 20 63 6f 6c 32 20 2d 20 43 41 53 54  LL - col2 - CAST
b650: 20 28 20 2d 20 63 6f 6c 32 20 41 53 20 49 4e 54   ( - col2 AS INT
b660: 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46  EGER ) AS col1 F
b670: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
b680: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
b690: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
b6a0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
b6b0: 20 63 6f 72 31 2e 63 6f 6c 32 20 41 53 20 63 6f   cor1.col2 AS co
b6c0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
b6d0: 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b1 AS cor0, tab1
b6e0: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
b6f0: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
b700: 67 20 74 6f 20 37 66 34 61 39 62 66 32 34 64 36  g to 7f4a9bf24d6
b710: 34 38 33 33 37 30 36 64 66 62 64 64 30 62 61 66  4833706dfbdd0baf
b720: 34 39 64 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  49d79....query I
b730: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b740: 20 2b 20 37 34 20 2b 20 2b 20 63 6f 6c 30 20 41   + 74 + + col0 A
b750: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
b760: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
b770: 31 33 38 0d 0a 31 35 34 0d 0a 37 37 0d 0a 0d 0a  138..154..77....
b780: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b790: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
b7a0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
b7b0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43  M tab2 AS cor0 C
b7c0: 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 63  ROSS JOIN tab0 c
b7d0: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33  or1..----..17..3
b7e0: 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49  1..59....query I
b7f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b800: 20 41 4c 4c 20 31 31 20 41 53 20 63 6f 6c 32 20   ALL 11 AS col2 
b810: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
b820: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
b830: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
b840: 74 6f 20 66 34 64 31 39 39 35 38 34 62 34 34 37  to f4d199584b447
b850: 33 32 66 31 61 38 39 37 65 36 36 39 31 62 34 65  32f1a897e6691b4e
b860: 61 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  a00....query I r
b870: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
b880: 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 74 61 62 30  LL + col0 + tab0
b890: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
b8a0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
b8b0: 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75  78..48..70....qu
b8c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
b8d0: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b  ELECT ALL col2 +
b8e0: 20 63 6f 6c 32 20 2a 20 74 61 62 30 2e 63 6f 6c   col2 * tab0.col
b8f0: 31 20 2b 20 28 20 74 61 62 30 2e 63 6f 6c 31 20  1 + ( tab0.col1 
b900: 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  ) * - col0 FROM 
b910: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 39  tab0..----..-329
b920: 37 0d 0a 2d 35 35 35 0d 0a 38 30 37 0d 0a 0d 0a  7..-555..807....
b930: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
b940: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
b950: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
b960: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
b970: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 31 0d  wsort label-321.
b980: 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 72 30  .SELECT + ( cor0
b990: 2e 63 6f 6c 32 20 29 20 44 49 56 20 2d 20 63 6f  .col2 ) DIV - co
b9a0: 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
b9b0: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  2 cor0..----..-2
b9c0: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
b9d0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
b9e0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
b9f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
ba00: 32 31 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63  21..SELECT + ( c
ba10: 6f 72 30 2e 63 6f 6c 32 20 29 20 2f 20 2d 20 63  or0.col2 ) / - c
ba20: 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
ba30: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
ba40: 32 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  2..0..0....skipi
ba50: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
ba60: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
ba70: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
ba80: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
ba90: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
baa0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
bab0: 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f  - - cor0.col2 co
bac0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
bad0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33  cor0..----..1..3
bae0: 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  3..82....query I
baf0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
bb00: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
bb10: 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a   + col1 + col2 *
bb20: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
bb30: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39  0 cor0..----..29
bb40: 31 0d 0a 33 30 31 30 0d 0a 37 36 34 34 0d 0a 0d  1..3010..7644...
bb50: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
bb60: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
bb70: 54 20 2d 20 33 35 20 41 53 20 63 6f 6c 32 20 46  T - 35 AS col2 F
bb80: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
bb90: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
bba0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
bbb0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
bbc0: 20 63 6f 6c 30 20 2a 20 32 30 20 2a 20 2d 20 63   col0 * 20 * - c
bbd0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
bbe0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
bbf0: 31 36 38 30 0d 0a 2d 31 32 34 38 32 30 0d 0a 2d  1680..-124820..-
bc00: 39 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  980....query I r
bc10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
bc20: 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 74 61  LL + col1 * - ta
bc30: 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  b1.col1 AS col2 
bc40: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
bc50: 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37  .-100..-169..-67
bc60: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
bc70: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
bc80: 20 34 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   47 AS col0 FROM
bc90: 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63   tab2, tab2 AS c
bca0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
bcb0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
bcc0: 66 65 31 39 32 66 32 39 36 37 39 31 65 31 65 34  fe192f296791e1e4
bcd0: 30 65 61 30 30 61 36 38 61 61 38 64 61 62 37 0d  0ea00a68aa8dab7.
bce0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
bcf0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
bd00: 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f   ( - col1 ) * co
bd10: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
bd20: 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a 36 37  --..100..169..67
bd30: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
bd40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32  sort..SELECT + 2
bd50: 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  9 AS col0 FROM t
bd60: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
bd70: 2d 0d 0a 32 39 0d 0a 32 39 0d 0a 32 39 0d 0a 0d  -..29..29..29...
bd80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
bd90: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 31  ..SELECT ALL + 1
bda0: 37 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  7 FROM tab0, tab
bdb0: 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  1, tab2 AS cor0.
bdc0: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
bdd0: 20 68 61 73 68 69 6e 67 20 74 6f 20 65 30 64 64   hashing to e0dd
bde0: 39 31 35 35 65 34 64 36 37 31 33 32 36 33 37 61  9155e4d67132637a
bdf0: 30 34 63 31 38 65 66 34 36 62 32 61 0d 0a 0d 0a  04c18ef46b2a....
be00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
be10: 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d  .SELECT col0 * -
be20: 20 63 6f 6c 31 20 2a 20 28 20 2d 20 74 61 62 32   col1 * ( - tab2
be30: 2e 63 6f 6c 30 20 2b 20 2d 20 74 61 62 32 2e 63  .col0 + - tab2.c
be40: 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 0d  ol1 ) FROM tab2.
be50: 0a 2d 2d 2d 2d 0d 0a 31 32 38 39 32 38 0d 0a 36  .----..128928..6
be60: 33 30 34 37 34 0d 0a 38 32 34 36 0d 0a 0d 0a 6f  30474..8246....o
be70: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
be80: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
be90: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
bea0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
beb0: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 32 0d 0a  sort label-332..
bec0: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
bed0: 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  DIV col1 + col1 
bee0: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
bef0: 0a 38 37 0d 0a 39 32 0d 0a 39 38 0d 0a 0d 0a 73  .87..92..98....s
bf00: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
bf10: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
bf20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
bf30: 62 65 6c 2d 33 33 32 0d 0a 53 45 4c 45 43 54 20  bel-332..SELECT 
bf40: 41 4c 4c 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20  ALL col1 / col1 
bf50: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
bf60: 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 39 32 0d 0a  ..----..87..92..
bf70: 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
bf80: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
bf90: 39 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  92 * col2 FROM t
bfa0: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 33 36  ab0..----..-3036
bfb0: 0d 0a 2d 37 35 34 34 0d 0a 2d 39 32 0d 0a 0d 0a  ..-7544..-92....
bfc0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
bfd0: 0a 53 45 4c 45 43 54 20 35 33 20 46 52 4f 4d 20  .SELECT 53 FROM 
bfe0: 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62 31  tab2, tab1, tab1
bff0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c000: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
c010: 67 20 74 6f 20 38 36 36 61 65 31 62 34 61 62 39  g to 866ae1b4ab9
c020: 65 35 62 34 30 34 33 61 63 31 62 63 66 64 34 31  e5b4043ac1bcfd41
c030: 33 61 61 61 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  3aaa6....onlyif 
c040: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
c050: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
c060: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
c070: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
c080: 61 62 65 6c 2d 33 33 35 0d 0a 53 45 4c 45 43 54  abel-335..SELECT
c090: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30   DISTINCT + cor0
c0a0: 2e 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31  .col0 DIV - col1
c0b0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
c0c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73  r0..----..0....s
c0d0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
c0e0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
c0f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
c100: 62 65 6c 2d 33 33 35 0d 0a 53 45 4c 45 43 54 20  bel-335..SELECT 
c110: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
c120: 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 46 52  col0 / - col1 FR
c130: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
c140: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .----..0....only
c150: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
c160: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
c170: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
c180: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c190: 74 20 6c 61 62 65 6c 2d 33 33 36 0d 0a 53 45 4c  t label-336..SEL
c1a0: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
c1b0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 32   - cor0.col0 + 2
c1c0: 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f  2 DIV + col1 FRO
c1d0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
c1e0: 2d 2d 2d 2d 0d 0a 34 30 39 38 0d 0a 36 34 30 31  ----..4098..6401
c1f0: 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..9....skipif my
c200: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
c210: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
c220: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 36 0d  wsort label-336.
c230: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
c240: 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l0 * - cor0.col0
c250: 20 2b 20 32 32 20 2f 20 2b 20 63 6f 6c 31 20 46   + 22 / + col1 F
c260: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
c270: 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 38 0d 0a 36 34  ..----..4098..64
c280: 30 31 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49  01..9....query I
c290: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c2a0: 20 32 34 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20   24 + cor0.col2 
c2b0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
c2c0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
c2d0: 0a 35 30 0d 0a 35 31 0d 0a 36 32 0d 0a 0d 0a 71  .50..51..62....q
c2e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c2f0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20  SELECT - col2 * 
c300: 35 33 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  53 + col0 AS col
c310: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
c320: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32 35 0d 0a 2d  ..----..-1725..-
c330: 31 38 0d 0a 2d 34 32 35 37 0d 0a 0d 0a 71 75 65  18..-4257....que
c340: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c350: 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  LECT + + col0 * 
c360: 2b 20 39 34 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 94 AS col1 FRO
c370: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
c380: 2d 2d 2d 2d 0d 0a 32 38 32 0d 0a 36 30 31 36 0d  ----..282..6016.
c390: 0a 37 35 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .7520....query I
c3a0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c3b0: 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32   - col0 + - col2
c3c0: 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   * cor0.col2 FRO
c3d0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
c3e0: 2d 2d 2d 2d 0d 0a 2d 31 31 31 33 0d 0a 2d 33 36  ----..-1113..-36
c3f0: 0d 0a 2d 36 38 31 33 0d 0a 0d 0a 71 75 65 72 79  ..-6813....query
c400: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c410: 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  CT + + col2 + - 
c420: 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  col0 + cor0.col1
c430: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
c440: 0a 2d 2d 2d 2d 0d 0a 36 33 0d 0a 38 34 0d 0a 39  .----..63..84..9
c450: 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
c460: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
c470: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
c480: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
c490: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
c4a0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34  rowsort label-34
c4b0: 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
c4c0: 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b  CT cor0.col0 + +
c4d0: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44   CAST( NULL AS D
c4e0: 45 43 49 4d 41 4c 20 29 20 2a 20 28 20 63 6f 6c  ECIMAL ) * ( col
c4f0: 31 20 2b 20 2d 20 31 31 20 29 20 2f 20 63 6f 6c  1 + - 11 ) / col
c500: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
c510: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
c520: 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
c530: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
c540: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
c550: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
c560: 33 34 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  342..SELECT DIST
c570: 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  INCT cor0.col0 +
c580: 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
c590: 53 20 52 45 41 4c 20 29 20 2a 20 28 20 63 6f 6c  S REAL ) * ( col
c5a0: 31 20 2b 20 2d 20 31 31 20 29 20 2f 20 63 6f 6c  1 + - 11 ) / col
c5b0: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
c5c0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
c5d0: 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  -..NULL....query
c5e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c5f0: 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 28 20  CT + col1 * + ( 
c600: 2b 20 39 37 20 2b 20 63 6f 6c 32 20 29 20 41 53  + 97 + col2 ) AS
c610: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
c620: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
c630: 31 31 38 30 0d 0a 31 36 32 38 39 0d 0a 39 35 30  1180..16289..950
c640: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
c650: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
c660: 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63  TINCT - + cor0.c
c670: 6f 6c 30 20 2b 20 32 34 20 2a 20 2d 20 37 30 20  ol0 + 24 * - 70 
c680: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
c690: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 38 37 0d 0a  0..----..-1687..
c6a0: 2d 31 37 35 38 0d 0a 2d 31 37 35 39 0d 0a 0d 0a  -1758..-1759....
c6b0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
c6c0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
c6d0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
c6e0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
c6f0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34 35 0d  wsort label-345.
c700: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
c710: 63 6f 6c 32 20 44 49 56 20 43 41 53 54 28 20 31  col2 DIV CAST( 1
c720: 34 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 53 49  4 * + col2 AS SI
c730: 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46  GNED ) AS col1 F
c740: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
c750: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
c760: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
c770: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
c780: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c790: 74 20 6c 61 62 65 6c 2d 33 34 35 0d 0a 53 45 4c  t label-345..SEL
c7a0: 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32  ECT ALL + - col2
c7b0: 20 2f 20 43 41 53 54 20 28 20 31 34 20 2a 20 2b   / CAST ( 14 * +
c7c0: 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
c7d0: 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
c7e0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
c7f0: 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f  --..0..0..0....o
c800: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
c810: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
c820: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
c830: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
c840: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34 36 0d 0a  sort label-346..
c850: 53 45 4c 45 43 54 20 63 6f 6c 30 20 44 49 56 20  SELECT col0 DIV 
c860: 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  - col0 + + col0 
c870: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
c880: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
c890: 0a 32 0d 0a 36 33 0d 0a 37 39 0d 0a 0d 0a 73 6b  .2..63..79....sk
c8a0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
c8b0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
c8c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
c8d0: 65 6c 2d 33 34 36 0d 0a 53 45 4c 45 43 54 20 63  el-346..SELECT c
c8e0: 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 2b  ol0 / - col0 + +
c8f0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
c900: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
c910: 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 33 0d 0a 37 39  .----..2..63..79
c920: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c930: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
c940: 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41   + + cor0.col1 A
c950: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
c960: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c970: 32 30 0d 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 71 75  20..26..52....qu
c980: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c990: 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63  ELECT - + cor0.c
c9a0: 6f 6c 32 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29  ol2 + ( + col1 )
c9b0: 20 2a 20 63 6f 6c 31 20 2a 20 32 34 20 41 53 20   * col1 * 24 AS 
c9c0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
c9d0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33  S cor0..----..23
c9e0: 30 33 37 0d 0a 36 38 39 38 0d 0a 38 33 35 31 38  037..6898..83518
c9f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ca00: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
ca10: 6c 31 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32  l1 + ( cor0.col2
ca20: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46   + cor0.col0 ) F
ca30: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
ca40: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 31 38 39  ..----..131..189
ca50: 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..83....query I 
ca60: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ca70: 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
ca80: 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2b 20  col0 * col0 + + 
ca90: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
caa0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
cab0: 32 32 30 38 0d 0a 33 30 0d 0a 35 31 32 30 38 30  2208..30..512080
cac0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
cad0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
cae0: 6c 31 20 2a 20 2d 20 28 20 63 6f 6c 32 20 2b 20  l1 * - ( col2 + 
caf0: 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32  col0 ) FROM tab2
cb00: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
cb10: 35 34 0d 0a 2d 31 39 38 39 0d 0a 2d 36 31 33 36  54..-1989..-6136
cb20: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
cb30: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
cb40: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
cb50: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
cb60: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
cb70: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35 32  owsort label-352
cb80: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
cb90: 54 20 2d 20 43 41 53 54 28 20 63 6f 6c 30 20 41  T - CAST( col0 A
cba0: 53 20 53 49 47 4e 45 44 20 29 20 2d 20 63 6f 72  S SIGNED ) - cor
cbb0: 30 2e 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 28  0.col2 * + CAST(
cbc0: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
cbd0: 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
cbe0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
cbf0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
cc00: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
cc10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cc20: 74 20 6c 61 62 65 6c 2d 33 35 32 0d 0a 53 45 4c  t label-352..SEL
cc30: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43  ECT DISTINCT - C
cc40: 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49 4e  AST ( col0 AS IN
cc50: 54 45 47 45 52 20 29 20 2d 20 63 6f 72 30 2e 63  TEGER ) - cor0.c
cc60: 6f 6c 32 20 2a 20 2b 20 43 41 53 54 20 28 20 4e  ol2 * + CAST ( N
cc70: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
cc80: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
cc90: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
cca0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
ccb0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
ccc0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
ccd0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
cce0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35  rowsort label-35
ccf0: 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 38  3..SELECT ALL 38
cd00: 20 44 49 56 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   DIV col2 + + co
cd10: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
cd20: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
cd30: 2d 2d 0d 0a 31 33 35 0d 0a 38 37 0d 0a 39 31 0d  --..135..87..91.
cd40: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
cd50: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
cd60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cd70: 74 20 6c 61 62 65 6c 2d 33 35 33 0d 0a 53 45 4c  t label-353..SEL
cd80: 45 43 54 20 41 4c 4c 20 33 38 20 2f 20 63 6f 6c  ECT ALL 38 / col
cd90: 32 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  2 + + col1 AS co
cda0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
cdb0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 0d  cor0..----..135.
cdc0: 0a 38 37 0d 0a 39 31 0d 0a 0d 0a 6f 6e 6c 79 69  .87..91....onlyi
cdd0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
cde0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
cdf0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
ce00: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
ce10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
ce20: 62 65 6c 2d 33 35 34 0d 0a 53 45 4c 45 43 54 20  bel-354..SELECT 
ce30: 41 4c 4c 20 2d 20 2b 20 43 41 53 54 28 20 4e 55  ALL - + CAST( NU
ce40: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  LL AS SIGNED ) +
ce50: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
ce60: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
ce70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
ce80: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
ce90: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
cea0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
ceb0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
cec0: 61 62 65 6c 2d 33 35 34 0d 0a 53 45 4c 45 43 54  abel-354..SELECT
ced0: 20 41 4c 4c 20 2d 20 2b 20 43 41 53 54 20 28 20   ALL - + CAST ( 
cee0: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
cef0: 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  ) + cor0.col2 AS
cf00: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
cf10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
cf20: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
cf30: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
cf40: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
cf50: 32 20 2b 20 37 32 20 46 52 4f 4d 20 74 61 62 30  2 + 72 FROM tab0
cf60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
cf70: 31 30 35 0d 0a 31 35 34 0d 0a 37 33 0d 0a 0d 0a  105..154..73....
cf80: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
cf90: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
cfa0: 20 32 36 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f   26 + col0 AS co
cfb0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
cfc0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 0d  cor0..----..106.
cfd0: 0a 32 39 0d 0a 39 30 0d 0a 0d 0a 6f 6e 6c 79 69  .29..90....onlyi
cfe0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
cff0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
d000: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
d010: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
d020: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
d030: 62 65 6c 2d 33 35 37 0d 0a 53 45 4c 45 43 54 20  bel-357..SELECT 
d040: 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49  CAST( col0 AS SI
d050: 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 32 20  GNED ) + - col2 
d060: 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
d070: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
d080: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 35 0d 0a 2d  ..----..-1365..-
d090: 35 39 38 0d 0a 2d 37 32 32 0d 0a 0d 0a 73 6b 69  598..-722....ski
d0a0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
d0b0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
d0c0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
d0d0: 6c 2d 33 35 37 0d 0a 53 45 4c 45 43 54 20 43 41  l-357..SELECT CA
d0e0: 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54  ST ( col0 AS INT
d0f0: 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c 32 20  EGER ) + - col2 
d100: 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
d110: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
d120: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 35 0d 0a 2d  ..----..-1365..-
d130: 35 39 38 0d 0a 2d 37 32 32 0d 0a 0d 0a 73 6b 69  598..-722....ski
d140: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
d150: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
d160: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
d170: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
d180: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
d190: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
d1a0: 2d 20 31 37 20 2b 20 63 6f 6c 32 20 63 6f 6c 32  - 17 + col2 col2
d1b0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
d1c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 37  r0..----..113..7
d1d0: 31 0d 0a 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49  1..74....query I
d1e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
d1f0: 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 31 20 46 52   + col0 * + 1 FR
d200: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
d210: 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30  .----..3..64..80
d220: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d230: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
d240: 35 36 20 2b 20 32 37 20 2a 20 63 6f 6c 30 20 46  56 + 27 * col0 F
d250: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
d260: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 31 37 38  ..----..137..178
d270: 34 0d 0a 32 32 31 36 0d 0a 0d 0a 71 75 65 72 79  4..2216....query
d280: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d290: 43 54 20 2d 20 63 6f 6c 32 20 2a 20 28 20 63 6f  CT - col2 * ( co
d2a0: 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  l0 + col2 * - co
d2b0: 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  l1 ) FROM tab0..
d2c0: 2d 2d 2d 2d 0d 0a 36 30 34 35 38 36 0d 0a 36 32  ----..604586..62
d2d0: 0d 0a 39 32 38 36 32 0d 0a 0d 0a 71 75 65 72 79  ..92862....query
d2e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d2f0: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 32 39 20 46  CT + col2 * 29 F
d300: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
d310: 32 33 37 38 0d 0a 32 39 0d 0a 39 35 37 0d 0a 0d  2378..29..957...
d320: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d330: 0d 0a 53 45 4c 45 43 54 20 2d 20 32 20 2b 20 63  ..SELECT - 2 + c
d340: 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  or0.col0 AS col2
d350: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
d360: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 36 32 0d  r0..----..1..62.
d370: 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .78....query I r
d380: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
d390: 49 53 54 49 4e 43 54 20 2d 20 28 20 63 6f 6c 32  ISTINCT - ( col2
d3a0: 20 29 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   ) + col2 AS col
d3b0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
d3c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
d3d0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
d3e0: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
d3f0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
d400: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
d410: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
d420: 72 74 20 6c 61 62 65 6c 2d 33 36 35 0d 0a 53 45  rt label-365..SE
d430: 4c 45 43 54 20 2d 20 2d 20 39 38 20 2b 20 63 6f  LECT - - 98 + co
d440: 6c 32 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20  l2 * CAST( NULL 
d450: 41 53 20 44 45 43 49 4d 41 4c 20 29 20 46 52 4f  AS DECIMAL ) FRO
d460: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
d470: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
d480: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
d490: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
d4a0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
d4b0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
d4c0: 36 35 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 39  65..SELECT - - 9
d4d0: 38 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54 20  8 + col2 * CAST 
d4e0: 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29  ( NULL AS REAL )
d4f0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
d500: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
d510: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
d520: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d530: 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20  ELECT cor0.col2 
d540: 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 39 38  * cor0.col0 + 98
d550: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
d560: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
d570: 0d 0a 32 31 32 36 0d 0a 32 38 37 0d 0a 33 31 30  ..2126..287..310
d580: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
d590: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
d5a0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
d5b0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
d5c0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
d5d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d5e0: 45 4c 45 43 54 20 2d 20 32 37 20 63 6f 6c 31 20  ELECT - 27 col1 
d5f0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
d600: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 2d 32  0..----..-27..-2
d610: 37 0d 0a 2d 32 37 0d 0a 0d 0a 71 75 65 72 79 20  7..-27....query 
d620: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d630: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 32 20  T DISTINCT + 52 
d640: 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  * - col1 AS col0
d650: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
d660: 0d 0a 2d 31 33 35 32 0d 0a 2d 35 32 30 0d 0a 2d  ..-1352..-520..-
d670: 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  676....query I r
d680: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
d690: 20 36 34 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 32   64 * - col0 * 2
d6a0: 33 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  3 FROM tab2 AS c
d6b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 30 34  or0..----..10304
d6c0: 0d 0a 31 31 34 38 31 36 0d 0a 31 31 36 32 38 38  ..114816..116288
d6d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d6e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
d6f0: 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  INCT + - col0 * 
d700: 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
d710: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
d720: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a  or0..----..-49..
d730: 2d 36 30 38 34 0d 0a 2d 36 32 34 31 0d 0a 0d 0a  -6084..-6241....
d740: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d750: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20  .SELECT ALL ( - 
d760: 74 61 62 32 2e 63 6f 6c 31 20 29 20 46 52 4f 4d  tab2.col1 ) FROM
d770: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   tab2..----..-17
d780: 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71 75  ..-31..-59....qu
d790: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d7a0: 45 4c 45 43 54 20 38 35 20 2a 20 63 6f 6c 30 20  ELECT 85 * col0 
d7b0: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
d7c0: 0a 32 30 34 30 0d 0a 32 39 37 35 0d 0a 37 35 36  .2040..2975..756
d7d0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
d7e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35  sort..SELECT + 5
d7f0: 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   * + col2 * + co
d800: 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63  l2 + - col1 AS c
d810: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
d820: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 32 0d 0a 33  r0..----..-92..3
d830: 33 35 32 39 0d 0a 35 33 35 39 0d 0a 0d 0a 6f 6e  3529..5359....on
d840: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
d850: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
d860: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
d870: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
d880: 6f 72 74 20 6c 61 62 65 6c 2d 33 37 34 0d 0a 53  ort label-374..S
d890: 45 4c 45 43 54 20 39 33 20 44 49 56 20 2b 20 63  ELECT 93 DIV + c
d8a0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
d8b0: 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 39 33 0d 0a 0d  ---..1..2..93...
d8c0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
d8d0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
d8e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
d8f0: 6c 61 62 65 6c 2d 33 37 34 0d 0a 53 45 4c 45 43  label-374..SELEC
d900: 54 20 39 33 20 2f 20 2b 20 63 6f 6c 32 20 46 52  T 93 / + col2 FR
d910: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
d920: 0d 0a 32 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79  ..2..93....query
d930: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d940: 43 54 20 63 6f 6c 31 20 2b 20 2b 20 74 61 62 31  CT col1 + + tab1
d950: 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20  .col1 + col2 AS 
d960: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
d970: 2d 2d 2d 2d 0d 0a 31 30 36 0d 0a 31 32 32 0d 0a  ----..106..122..
d980: 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  77....query I ro
d990: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
d9a0: 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20 2b 20  col2 ) * col2 + 
d9b0: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2b 20  col2 * col0 * + 
d9c0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
d9d0: 2d 2d 2d 2d 0d 0a 31 35 38 38 36 30 0d 0a 32 30  ----..158860..20
d9e0: 35 32 0d 0a 32 33 38 36 30 32 0d 0a 0d 0a 71 75  52..238602....qu
d9f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
da00: 45 4c 45 43 54 20 33 20 2b 20 2d 20 35 36 20 41  ELECT 3 + - 56 A
da10: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
da20: 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 35 33  ..----..-53..-53
da30: 0d 0a 2d 35 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-53....skipif 
da40: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
da50: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
da60: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
da70: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
da80: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
da90: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
daa0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
dab0: 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20  ..SELECT - CAST 
dac0: 28 20 2d 20 38 39 20 41 53 20 52 45 41 4c 20 29  ( - 89 AS REAL )
dad0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
dae0: 0a 2d 2d 2d 2d 0d 0a 38 39 0d 0a 38 39 0d 0a 38  .----..89..89..8
daf0: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
db00: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
db10: 54 49 4e 43 54 20 35 33 20 2b 20 63 6f 6c 31 20  TINCT 53 + col1 
db20: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
db30: 0a 36 33 0d 0a 36 36 0d 0a 37 39 0d 0a 0d 0a 71  .63..66..79....q
db40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
db50: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
db60: 2d 20 63 6f 6c 32 20 2a 20 37 32 20 2b 20 2d 20  - col2 * 72 + - 
db70: 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
db80: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
db90: 34 30 39 0d 0a 2d 35 39 38 36 0d 0a 2d 37 33 0d  409..-5986..-73.
dba0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
dbb0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
dbc0: 4e 43 54 20 2b 20 2d 20 37 33 20 2a 20 2b 20 63  NCT + - 73 * + c
dbd0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
dbe0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
dbf0: 34 31 0d 0a 2d 32 32 36 33 0d 0a 2d 34 33 30 37  41..-2263..-4307
dc00: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
dc10: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
dc20: 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  INCT col1 + - co
dc30: 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
dc40: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
dc50: 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d  .-54..-67..23...
dc60: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
dc70: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
dc80: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
dc90: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
dca0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
dcb0: 6f 72 74 20 6c 61 62 65 6c 2d 33 38 33 0d 0a 53  ort label-383..S
dcc0: 45 4c 45 43 54 20 2d 20 39 33 20 2a 20 63 6f 72  ELECT - 93 * cor
dcd0: 30 2e 63 6f 6c 32 20 2b 20 43 41 53 54 28 20 4e  0.col2 + CAST( N
dce0: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
dcf0: 2b 20 2b 20 31 36 20 2a 20 63 6f 6c 31 20 63 6f  + + 16 * col1 co
dd00: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
dd10: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
dd20: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
dd30: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
dd40: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
dd50: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
dd60: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
dd70: 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
dd80: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
dd90: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
dda0: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 33 0d 0a  sort label-383..
ddb0: 53 45 4c 45 43 54 20 2d 20 39 33 20 2a 20 63 6f  SELECT - 93 * co
ddc0: 72 30 2e 63 6f 6c 32 20 2b 20 43 41 53 54 20 28  r0.col2 + CAST (
ddd0: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
dde0: 20 29 20 2b 20 2b 20 31 36 20 2a 20 63 6f 6c 31   ) + + 16 * col1
ddf0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
de00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
de10: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
de20: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
de30: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
de40: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
de50: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
de60: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
de70: 72 74 20 6c 61 62 65 6c 2d 33 38 34 0d 0a 53 45  rt label-384..SE
de80: 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  LECT col1 * + co
de90: 6c 31 20 2b 20 2d 20 43 41 53 54 28 20 2d 20 32  l1 + - CAST( - 2
dea0: 39 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20  9 AS SIGNED ) - 
deb0: 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
dec0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
ded0: 0d 0a 2d 2d 2d 2d 0d 0a 33 35 38 38 0d 0a 33 39  ..----..3588..39
dee0: 37 0d 0a 39 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  7..997....skipif
def0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
df00: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
df10: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
df20: 38 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  84..SELECT col1 
df30: 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53  * + col1 + - CAS
df40: 54 20 28 20 2d 20 32 39 20 41 53 20 49 4e 54 45  T ( - 29 AS INTE
df50: 47 45 52 20 29 20 2d 20 2d 20 63 6f 6c 30 20 41  GER ) - - col0 A
df60: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
df70: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
df80: 33 35 38 38 0d 0a 33 39 37 0d 0a 39 39 37 0d 0a  3588..397..997..
df90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
dfa0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
dfb0: 33 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 33  3 * - col1 * + 3
dfc0: 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  4 FROM tab0 AS c
dfd0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 37 37 32  or0..----..-8772
dfe0: 0d 0a 2d 39 32 38 32 0d 0a 2d 39 38 39 34 0d 0a  ..-9282..-9894..
dff0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e000: 74 0d 0a 53 45 4c 45 43 54 20 31 31 20 46 52 4f  t..SELECT 11 FRO
e010: 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74 61  M tab0, tab2, ta
e020: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
e030: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
e040: 69 6e 67 20 74 6f 20 36 39 31 31 36 37 33 37 66  ing to 69116737f
e050: 33 66 35 37 65 32 65 33 32 37 33 66 36 64 62 62  3f57e2e3273f6dbb
e060: 30 34 64 30 33 36 63 0d 0a 0d 0a 71 75 65 72 79  04d036c....query
e070: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e080: 43 54 20 2d 20 34 35 20 46 52 4f 4d 20 74 61 62  CT - 45 FROM tab
e090: 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  2, tab2 AS cor0.
e0a0: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
e0b0: 68 61 73 68 69 6e 67 20 74 6f 20 37 31 31 36 30  hashing to 71160
e0c0: 61 62 66 30 39 35 38 39 36 39 35 33 37 39 61 37  abf09589695379a7
e0d0: 30 35 35 38 37 32 36 66 30 62 61 0d 0a 0d 0a 71  0558726f0ba....q
e0e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e0f0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
e100: 2d 20 63 6f 6c 30 20 2d 20 32 31 20 2a 20 63 6f  - col0 - 21 * co
e110: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
e120: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33  tab1..----..-113
e130: 37 0d 0a 2d 31 32 36 31 0d 0a 2d 32 30 39 36 0d  7..-1261..-2096.
e140: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e150: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
e160: 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 74  ol2 + - col1 + t
e170: 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab1.col2 FROM ta
e180: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31  b1..----..104..1
e190: 37 39 0d 0a 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  79..82....onlyif
e1a0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
e1b0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
e1c0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
e1d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
e1e0: 6c 61 62 65 6c 2d 33 39 30 0d 0a 53 45 4c 45 43  label-390..SELEC
e1f0: 54 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 32 20 29  T ALL - ( col2 )
e200: 20 2b 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20   + + col0 DIV - 
e210: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
e220: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
e230: 37 0d 0a 2d 32 37 0d 0a 2d 34 32 0d 0a 0d 0a 73  7..-27..-42....s
e240: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
e250: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
e260: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
e270: 62 65 6c 2d 33 39 30 0d 0a 53 45 4c 45 43 54 20  bel-390..SELECT 
e280: 41 4c 4c 20 2d 20 28 20 63 6f 6c 32 20 29 20 2b  ALL - ( col2 ) +
e290: 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31   + col0 / - col1
e2a0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
e2b0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 2d  b2..----..-27..-
e2c0: 32 37 0d 0a 2d 34 32 0d 0a 0d 0a 71 75 65 72 79  27..-42....query
e2d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e2e0: 43 54 20 2d 20 2d 20 28 20 35 37 20 29 20 2d 20  CT - - ( 57 ) - 
e2f0: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
e300: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
e310: 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 32 34 0d 0a 35  ----..-25..24..5
e320: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
e330: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
e340: 6f 6c 32 20 2a 20 2b 20 32 36 20 41 53 20 63 6f  ol2 * + 26 AS co
e350: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
e360: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30  cor0..----..-140
e370: 34 0d 0a 2d 31 34 38 32 0d 0a 2d 32 34 39 36 0d  4..-1482..-2496.
e380: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e390: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
e3a0: 20 63 6f 6c 31 20 2b 20 2d 20 37 34 20 46 52 4f   col1 + - 74 FRO
e3b0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
e3c0: 30 30 0d 0a 2d 38 34 0d 0a 2d 38 37 0d 0a 0d 0a  00..-84..-87....
e3d0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
e3e0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
e3f0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
e400: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
e410: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 34 0d  wsort label-394.
e420: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
e430: 20 35 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b   51 * + col0 + +
e440: 20 43 41 53 54 28 20 2d 20 63 6f 6c 30 20 41 53   CAST( - col0 AS
e450: 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30   SIGNED ) * col0
e460: 20 44 49 56 20 28 20 63 6f 6c 31 20 29 20 46 52   DIV ( col1 ) FR
e470: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab2..----..3
e480: 36 37 39 0d 0a 33 38 37 0d 0a 33 39 33 34 0d 0a  679..387..3934..
e490: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
e4a0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
e4b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e4c0: 20 6c 61 62 65 6c 2d 33 39 34 0d 0a 53 45 4c 45   label-394..SELE
e4d0: 43 54 20 2b 20 63 6f 6c 31 20 2b 20 35 31 20 2a  CT + col1 + 51 *
e4e0: 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54   + col0 + + CAST
e4f0: 20 28 20 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54   ( - col0 AS INT
e500: 45 47 45 52 20 29 20 2a 20 63 6f 6c 30 20 2f 20  EGER ) * col0 / 
e510: 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  ( col1 ) FROM ta
e520: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 37 39 0d 0a  b2..----..3679..
e530: 33 38 37 0d 0a 33 39 33 34 0d 0a 0d 0a 71 75 65  387..3934....que
e540: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
e550: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
e560: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  + + cor0.col1 AS
e570: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
e580: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d  cor0..----..118.
e590: 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79  .34..62....query
e5a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e5b0: 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20  CT ALL - - col2 
e5c0: 2b 20 63 6f 6c 31 20 2a 20 2d 20 35 35 20 41 53  + col1 * - 55 AS
e5d0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
e5e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37  cor0..----..-137
e5f0: 36 0d 0a 2d 34 39 33 0d 0a 2d 36 31 39 0d 0a 0d  6..-493..-619...
e600: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
e610: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
e620: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
e630: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
e640: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
e650: 6f 72 74 20 6c 61 62 65 6c 2d 33 39 37 0d 0a 53  ort label-397..S
e660: 45 4c 45 43 54 20 2b 20 2d 20 28 20 63 6f 6c 30  ELECT + - ( col0
e670: 20 29 20 2b 20 2d 20 43 41 53 54 28 20 4e 55 4c   ) + - CAST( NUL
e680: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
e690: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
e6a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
e6b0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
e6c0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
e6d0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
e6e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e6f0: 74 20 6c 61 62 65 6c 2d 33 39 37 0d 0a 53 45 4c  t label-397..SEL
e700: 45 43 54 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29  ECT + - ( col0 )
e710: 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   + - CAST ( NULL
e720: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
e730: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
e740: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
e750: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
e760: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e770: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
e780: 20 33 36 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d   36 + - col1 * -
e790: 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f   col0 * col0 FRO
e7a0: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
e7b0: 2d 0d 0a 31 30 36 30 36 31 0d 0a 31 34 38 33 0d  -..106061..1483.
e7c0: 0a 33 35 38 39 32 30 0d 0a 0d 0a 6f 6e 6c 79 69  .358920....onlyi
e7d0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
e7e0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
e7f0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
e800: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e810: 20 6c 61 62 65 6c 2d 33 39 39 0d 0a 53 45 4c 45   label-399..SELE
e820: 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 30 20  CT ALL ( + col0 
e830: 29 20 44 49 56 20 38 30 20 46 52 4f 4d 20 74 61  ) DIV 80 FROM ta
e840: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
e850: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
e860: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
e870: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
e880: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
e890: 6c 2d 33 39 39 0d 0a 53 45 4c 45 43 54 20 41 4c  l-399..SELECT AL
e8a0: 4c 20 28 20 2b 20 63 6f 6c 30 20 29 20 2f 20 38  L ( + col0 ) / 8
e8b0: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
e8c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
e8d0: 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
e8e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
e8f0: 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20  ( cor0.col2 ) + 
e900: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
e910: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
e920: 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a  ----..104..117..
e930: 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
e940: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
e950: 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  L col2 + col2 * 
e960: 2d 20 34 30 20 46 52 4f 4d 20 74 61 62 32 20 41  - 40 FROM tab2 A
e970: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
e980: 30 31 34 0d 0a 2d 31 30 35 33 0d 0a 2d 31 34 38  014..-1053..-148
e990: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
e9a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
e9b0: 54 49 4e 43 54 20 2b 20 31 34 20 2b 20 63 6f 6c  TINCT + 14 + col
e9c0: 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
e9d0: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 33 38 0d  ..----..103..38.
e9e0: 0a 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .49....query I r
e9f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
ea00: 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30  LL + col1 * cor0
ea10: 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a  .col2 + + col0 *
ea20: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
ea30: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
ea40: 0a 2d 34 35 35 30 0d 0a 2d 35 35 39 35 0d 0a 37  .-4550..-5595..7
ea50: 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  88....query IIII
ea60: 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  IIIIIIIIIII rows
ea70: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
ea80: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  OM tab2 AS cor0 
ea90: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c  CROSS JOIN tab2,
eaa0: 20 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74   tab1 AS cor1, t
eab0: 61 62 30 20 41 53 20 63 6f 72 32 2c 20 74 61 62  ab0 AS cor2, tab
eac0: 30 20 63 6f 72 33 0d 0a 2d 2d 2d 2d 0d 0a 33 36  0 cor3..----..36
ead0: 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  45 values hashin
eae0: 67 20 74 6f 20 37 38 30 37 37 37 32 37 36 30 31  g to 78077727601
eaf0: 63 30 35 36 61 64 30 64 34 66 34 63 31 31 63 38  c056ad0d4f4c11c8
eb00: 64 61 66 66 62 0d 0a 0d 0a 73 6b 69 70 69 66 20  daffb....skipif 
eb10: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
eb20: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
eb30: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
eb40: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
eb50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
eb60: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
eb70: 63 6f 6c 31 20 2a 20 35 39 20 2b 20 2b 20 32 32  col1 * 59 + + 22
eb80: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
eb90: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 35  cor0..----..1025
eba0: 0d 0a 31 38 35 31 0d 0a 33 35 30 33 0d 0a 0d 0a  ..1851..3503....
ebb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ebc0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
ebd0: 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 32 31 20 46   + + col2 * 21 F
ebe0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
ebf0: 0d 0a 2d 2d 2d 2d 0d 0a 31 38 30 34 0d 0a 32 32  ..----..1804..22
ec00: 0d 0a 37 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..726....query I
ec10: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ec20: 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b   + col0 * col1 +
ec30: 20 2d 20 63 6f 6c 32 20 2a 20 28 20 35 32 20 29   - col2 * ( 52 )
ec40: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
ec50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 32 34 0d  r0..----..-2324.
ec60: 0a 2d 32 37 33 30 0d 0a 2d 33 39 35 32 0d 0a 0d  .-2730..-3952...
ec70: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
ec80: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
ec90: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
eca0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
ecb0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 38  owsort label-408
ecc0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
ecd0: 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  DIV + col1 + col
ece0: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
ecf0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
ed00: 2d 0d 0a 31 33 0d 0a 33 31 0d 0a 35 38 0d 0a 0d  -..13..31..58...
ed10: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
ed20: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
ed30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
ed40: 6c 61 62 65 6c 2d 34 30 38 0d 0a 53 45 4c 45 43  label-408..SELEC
ed50: 54 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c  T - col0 / + col
ed60: 31 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  1 + col1 AS col2
ed70: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
ed80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 33 31  r0..----..13..31
ed90: 0d 0a 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..58....query I 
eda0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
edb0: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
edc0: 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col0 + + cor0.co
edd0: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
ede0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
edf0: 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  --..0....query I
ee00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ee10: 20 41 4c 4c 20 2b 20 33 39 20 2b 20 63 6f 72 30   ALL + 39 + cor0
ee20: 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 46  .col2 + - col2 F
ee30: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
ee40: 0d 0a 2d 2d 2d 2d 0d 0a 33 39 0d 0a 33 39 0d 0a  ..----..39..39..
ee50: 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  39....query I ro
ee60: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
ee70: 53 54 49 4e 43 54 20 28 20 2d 20 34 36 20 29 20  STINCT ( - 46 ) 
ee80: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
ee90: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  1 cor0..----..-4
eea0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
eeb0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
eec0: 20 2b 20 36 37 20 2a 20 39 20 41 53 20 63 6f 6c   + 67 * 9 AS col
eed0: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
eee0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 33 0d 0a  or0..----..603..
eef0: 36 30 33 0d 0a 36 30 33 0d 0a 0d 0a 71 75 65 72  603..603....quer
ef00: 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49  y IIIIIIIIIIIIII
ef10: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
ef20: 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  T * FROM tab2, t
ef30: 61 62 30 20 63 6f 72 30 2c 20 74 61 62 31 20 41  ab0 cor0, tab1 A
ef40: 53 20 63 6f 72 31 2c 20 74 61 62 30 2c 20 74 61  S cor1, tab0, ta
ef50: 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d  b2 AS cor2..----
ef60: 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61  ..3645 values ha
ef70: 73 68 69 6e 67 20 74 6f 20 64 61 38 33 64 33 65  shing to da83d3e
ef80: 65 61 65 62 39 65 32 34 61 33 63 62 31 34 62 62  eaeb9e24a3cb14bb
ef90: 37 30 35 38 37 35 37 64 64 0d 0a 0d 0a 71 75 65  7058757dd....que
efa0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
efb0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
efc0: 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  * - col1 + col2 
efd0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
efe0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 0d 0a 32 36  0..----..157..26
eff0: 35 0d 0a 37 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  5..730....onlyif
f000: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
f010: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
f020: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
f030: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
f040: 6c 61 62 65 6c 2d 34 31 35 0d 0a 53 45 4c 45 43  label-415..SELEC
f050: 54 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 31 20 29  T ALL ( + col1 )
f060: 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30   + col0 DIV col0
f070: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
f080: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
f090: 0d 0a 31 38 0d 0a 33 32 0d 0a 36 30 0d 0a 0d 0a  ..18..32..60....
f0a0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
f0b0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
f0c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
f0d0: 61 62 65 6c 2d 34 31 35 0d 0a 53 45 4c 45 43 54  abel-415..SELECT
f0e0: 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 31 20 29 20   ALL ( + col1 ) 
f0f0: 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 41 53  + col0 / col0 AS
f100: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
f110: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
f120: 38 0d 0a 33 32 0d 0a 36 30 0d 0a 0d 0a 71 75 65  8..32..60....que
f130: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f140: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
f150: 2d 20 63 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 6c  - col2 + - ( col
f160: 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  2 ) FROM tab0 AS
f170: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
f180: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f190: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 39 20 2a  t..SELECT - 19 *
f1a0: 20 2d 20 33 20 41 53 20 63 6f 6c 31 20 46 52 4f   - 3 AS col1 FRO
f1b0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
f1c0: 2d 2d 2d 2d 0d 0a 35 37 0d 0a 35 37 0d 0a 35 37  ----..57..57..57
f1d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f1e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
f1f0: 2b 20 63 6f 6c 32 20 2a 20 34 32 20 2a 20 2d 20  + col2 * 42 * - 
f200: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
f210: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
f220: 2d 2d 2d 2d 0d 0a 2d 31 35 33 32 31 36 0d 0a 2d  ----..-153216..-
f230: 33 32 32 35 36 30 0d 0a 2d 36 38 30 34 0d 0a 0d  322560..-6804...
f240: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f250: 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 32 20  ..SELECT ( col2 
f260: 29 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ) + col2 * - col
f270: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
f280: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 36 32  or0..----..-2862
f290: 0d 0a 2d 33 31 39 32 0d 0a 2d 39 31 32 30 0d 0a  ..-3192..-9120..
f2a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f2b0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28 20  t..SELECT - + ( 
f2c0: 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 31 20  col2 ) * - col1 
f2d0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
f2e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37  0..----..2838..7
f2f0: 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79  462..97....query
f300: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
f310: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
f320: 20 2d 20 2d 20 39 38 20 41 53 20 63 6f 6c 31 20   - - 98 AS col1 
f330: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
f340: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 37  0..----..105..17
f350: 36 0d 0a 31 37 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  6..177....onlyif
f360: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
f370: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
f380: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
f390: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
f3a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
f3b0: 65 6c 2d 34 32 32 0d 0a 53 45 4c 45 43 54 20 41  el-422..SELECT A
f3c0: 4c 4c 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 72  LL + CAST( - cor
f3d0: 30 2e 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  0.col2 AS SIGNED
f3e0: 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
f3f0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
f400: 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32  --..-1..-33..-82
f410: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
f420: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
f430: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
f440: 72 74 20 6c 61 62 65 6c 2d 34 32 32 0d 0a 53 45  rt label-422..SE
f450: 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20  LECT ALL + CAST 
f460: 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  ( - cor0.col2 AS
f470: 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
f480: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
f490: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
f4a0: 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72  -33..-82....quer
f4b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f4c0: 45 43 54 20 34 20 2b 20 2b 20 36 30 20 2a 20 2b  ECT 4 + + 60 * +
f4d0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
f4e0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
f4f0: 35 36 34 0d 0a 36 30 34 0d 0a 37 38 34 0d 0a 0d  564..604..784...
f500: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f510: 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72  ..SELECT - + cor
f520: 30 2e 63 6f 6c 31 20 2b 20 2d 20 38 33 20 41 53  0.col1 + - 83 AS
f530: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
f540: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
f550: 31 30 39 0d 0a 2d 39 33 0d 0a 2d 39 36 0d 0a 0d  109..-93..-96...
f560: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f570: 0d 0a 53 45 4c 45 43 54 20 37 35 20 2a 20 2b 20  ..SELECT 75 * + 
f580: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
f590: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
f5a0: 30 30 0d 0a 32 36 32 35 0d 0a 36 36 37 35 0d 0a  00..2625..6675..
f5b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f5c0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
f5d0: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 34 35  CT - col0 * + 45
f5e0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
f5f0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
f600: 0d 0a 2d 31 33 35 0d 0a 2d 32 38 38 30 0d 0a 2d  ..-135..-2880..-
f610: 33 36 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3600....query I 
f620: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f630: 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 37 31 20  DISTINCT + + 71 
f640: 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  * col1 FROM tab2
f650: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
f660: 31 32 30 37 0d 0a 32 32 30 31 0d 0a 34 31 38 39  1207..2201..4189
f670: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f680: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
f690: 2b 20 2d 20 37 35 20 41 53 20 63 6f 6c 32 20 46  + - 75 AS col2 F
f6a0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
f6b0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 35 0d 0a 2d 37 35  ..----..-75..-75
f6c0: 0d 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-75....query I
f6d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f6e0: 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 32   ALL col0 * col2
f6f0: 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + + col0 FROM t
f700: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a  ab1..----..165..
f710: 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a 73 6b  3712..7760....sk
f720: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
f730: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
f740: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
f750: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
f760: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
f770: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32  owsort..SELECT 2
f780: 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  4 col1 FROM tab1
f790: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
f7a0: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
f7b0: 61 73 68 69 6e 67 20 74 6f 20 62 30 64 38 33 34  ashing to b0d834
f7c0: 65 66 39 65 34 33 34 36 38 30 31 62 36 61 61 61  ef9e4346801b6aaa
f7d0: 30 65 37 34 62 32 63 38 65 66 0d 0a 0d 0a 6f 6e  0e74b2c8ef....on
f7e0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
f7f0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
f800: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
f810: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
f820: 6f 72 74 20 6c 61 62 65 6c 2d 34 33 31 0d 0a 53  ort label-431..S
f830: 45 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20 31  ELECT col1 DIV 1
f840: 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  6 AS col2 FROM t
f850: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 0d 0a 35 0d  ab0..----..5..5.
f860: 0a 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .6....skipif mys
f870: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
f880: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
f890: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33 31 0d 0a  sort label-431..
f8a0: 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20 31 36  SELECT col1 / 16
f8b0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
f8c0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 0d 0a 35 0d 0a  b0..----..5..5..
f8d0: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
f8e0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
f8f0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
f900: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
f910: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
f920: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f930: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
f940: 20 36 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   61 col2 FROM ta
f950: 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
f960: 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31 0d 0a 0d 0a 71  ..----..-61....q
f970: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
f980: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
f990: 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  - col0 + cor0.co
f9a0: 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  l1 * + col2 AS c
f9b0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
f9c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
f9d0: 32 38 0d 0a 2d 34 35 39 0d 0a 32 32 36 32 0d 0a  28..-459..2262..
f9e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f9f0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
fa00: 6c 32 20 2b 20 37 35 20 46 52 4f 4d 20 74 61 62  l2 + 75 FROM tab
fa10: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
fa20: 0a 31 30 31 0d 0a 31 30 32 0d 0a 31 31 33 0d 0a  .101..102..113..
fa30: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
fa40: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
fa50: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
fa60: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
fa70: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
fa80: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33 35 0d 0a  sort label-435..
fa90: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
faa0: 2b 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28  + col2 * - CAST(
fab0: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
fac0: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
fad0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
fae0: 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
faf0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
fb00: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
fb10: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
fb20: 34 33 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  435..SELECT DIST
fb30: 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  INCT + col2 * - 
fb40: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
fb50: 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32  NTEGER ) AS col2
fb60: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
fb70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
fb80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fb90: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
fba0: 6c 32 20 2a 20 39 30 20 46 52 4f 4d 20 74 61 62  l2 * 90 FROM tab
fbb0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
fbc0: 0a 2d 32 39 37 30 0d 0a 2d 37 33 38 30 0d 0a 2d  .-2970..-7380..-
fbd0: 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  90....onlyif mys
fbe0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
fbf0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
fc00: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
fc10: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
fc20: 6c 2d 34 33 37 0d 0a 53 45 4c 45 43 54 20 63 6f  l-437..SELECT co
fc30: 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31  l2 DIV cor0.col1
fc40: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
fc50: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 32 0d 0a  .----..0..0..2..
fc60: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
fc70: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
fc80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
fc90: 20 6c 61 62 65 6c 2d 34 33 37 0d 0a 53 45 4c 45   label-437..SELE
fca0: 43 54 20 63 6f 6c 32 20 2f 20 63 6f 72 30 2e 63  CT col2 / cor0.c
fcb0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
fcc0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
fcd0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
fce0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 34 20  sort..SELECT 94 
fcf0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
fd00: 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
fd10: 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
fd20: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
fd30: 67 20 74 6f 20 62 30 66 66 62 37 35 32 37 66 34  g to b0ffb7527f4
fd40: 66 62 66 34 34 66 33 30 39 34 35 65 31 63 63 62  fbf44f30945e1ccb
fd50: 35 38 63 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  58c24....query I
fd60: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
fd70: 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2b 20   ALL + + col0 + 
fd80: 2d 20 34 34 20 46 52 4f 4d 20 74 61 62 30 20 41  - 44 FROM tab0 A
fd90: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
fda0: 30 0d 0a 2d 39 0d 0a 34 35 0d 0a 0d 0a 73 6b 69  0..-9..45....ski
fdb0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
fdc0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
fdd0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
fde0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
fdf0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
fe00: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
fe10: 4c 20 74 61 62 31 2e 63 6f 6c 30 20 63 6f 6c 31  L tab1.col0 col1
fe20: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
fe30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
fe40: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
fe50: 20 64 64 31 38 62 39 33 32 36 33 61 36 63 64 34   dd18b93263a6cd4
fe60: 32 35 66 63 37 63 63 38 34 64 39 31 33 37 38 37  25fc7cc84d913787
fe70: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
fe80: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
fe90: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b   col0 * + col1 +
fea0: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46   col0 * + col1 F
feb0: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
fec0: 2d 2d 2d 0d 0a 31 32 38 30 0d 0a 31 35 36 0d 0a  ---..1280..156..
fed0: 32 30 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2080....query I 
fee0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
fef0: 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 74  ALL - col0 + + t
ff00: 61 62 32 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  ab2.col2 * col0 
ff10: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
ff20: 0a 31 38 32 0d 0a 31 39 35 30 0d 0a 32 39 32 33  .182..1950..2923
ff30: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ff40: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
ff50: 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31  cor0.col1 + col1
ff60: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
ff70: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
ff80: 0d 0a 31 37 32 0d 0a 31 38 32 0d 0a 31 39 34 0d  ..172..182..194.
ff90: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
ffa0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
ffb0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
ffc0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
ffd0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
ffe0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
fff0: 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  ECT + col2 * - c
10000 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol0 col2 FROM ta
10010 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
10020 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38  162..-3648..-768
10030 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
10040 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
10050 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 72  ol1 * col0 + cor
10060 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0.col2 FROM tab1
10070 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10080 2d 32 34 0d 0a 2d 35 38 33 0d 0a 2d 39 34 34 0d  -24..-583..-944.
10090 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
100a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 30 20 2a  rt..SELECT + 0 *
100b0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d   + cor0.col2 + -
100c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
100d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
100e0 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a  24..-35..-89....
100f0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
10100 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
10110 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
10120 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
10130 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 37 0d  wsort label-447.
10140 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
10150 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f   + + col2 DIV co
10160 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c 32  l0 + - col0 col2
10170 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
10180 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d  .----..0..1..18.
10190 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
101a0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
101b0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
101c0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
101d0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
101e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
101f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
10200 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10210 2d 34 34 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -447..SELECT - -
10220 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2f   col0 + + col2 /
10230 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 63   col0 + - col0 c
10240 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
10250 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  r0..----..0..1..
10260 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  18....query I ro
10270 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
10280 31 30 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  10 * col1 * - co
10290 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
102a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
102b0 2d 2d 0d 0a 2d 31 33 34 33 30 0d 0a 2d 32 31 37  --..-13430..-217
102c0 30 0d 0a 2d 34 36 30 32 30 0d 0a 0d 0a 73 6b 69  0..-46020....ski
102d0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
102e0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
102f0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
10300 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
10310 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
10320 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
10330 4c 20 2b 20 31 31 20 63 6f 6c 32 20 46 52 4f 4d  L + 11 col2 FROM
10340 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d   tab2..----..11.
10350 0a 31 31 0d 0a 31 31 0d 0a 0d 0a 6f 6e 6c 79 69  .11..11....onlyi
10360 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
10370 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
10380 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
10390 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
103a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
103b0 62 65 6c 2d 34 35 30 0d 0a 53 45 4c 45 43 54 20  bel-450..SELECT 
103c0 2d 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  - - CAST( NULL A
103d0 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 33  S SIGNED ) + + 3
103e0 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  7 AS col2 FROM t
103f0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
10400 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
10410 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
10420 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
10430 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
10440 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35 30 0d  wsort label-450.
10450 0a 53 45 4c 45 43 54 20 2d 20 2d 20 43 41 53 54  .SELECT - - CAST
10460 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
10470 45 52 20 29 20 2b 20 2b 20 33 37 20 41 53 20 63  ER ) + + 37 AS c
10480 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
10490 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
104a0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
104b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
104c0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
104d0 2b 20 33 36 20 2a 20 63 6f 6c 32 20 41 53 20 63  + 36 * col2 AS c
104e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
104f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30   cor0..----..100
10500 33 0d 0a 31 33 38 35 0d 0a 39 39 35 0d 0a 0d 0a  3..1385..995....
10510 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10520 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 20  .SELECT ALL + 9 
10530 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
10540 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  1, tab0 AS cor0.
10550 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
10560 68 61 73 68 69 6e 67 20 74 6f 20 30 33 62 39 33  hashing to 03b93
10570 62 35 33 31 30 37 65 33 36 63 66 37 64 35 32 34  b53107e36cf7d524
10580 65 34 38 63 35 30 39 62 31 37 62 0d 0a 0d 0a 71  e48c509b17b....q
10590 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
105a0 53 45 4c 45 43 54 20 41 4c 4c 20 33 39 20 2a 20  SELECT ALL 39 * 
105b0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
105c0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
105d0 31 30 31 34 0d 0a 33 39 30 0d 0a 35 30 37 0d 0a  1014..390..507..
105e0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
105f0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
10600 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
10610 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
10620 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35  rowsort label-45
10630 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  4..SELECT col0 +
10640 20 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30   - col1 DIV col0
10650 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
10660 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
10670 0d 0a 33 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73  ..3..78..79....s
10680 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
10690 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
106a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
106b0 62 65 6c 2d 34 35 34 0d 0a 53 45 4c 45 43 54 20  bel-454..SELECT 
106c0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2f 20  col0 + - col1 / 
106d0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
106e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
106f0 2d 2d 2d 2d 0d 0a 33 0d 0a 37 38 0d 0a 37 39 0d  ----..3..78..79.
10700 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
10710 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
10720 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
10730 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
10740 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
10750 35 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  55..SELECT col1 
10760 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  DIV - col0 AS co
10770 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
10780 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 33 0d 0a  --..-1..-2..-3..
10790 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
107a0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
107b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
107c0 20 6c 61 62 65 6c 2d 34 35 35 0d 0a 53 45 4c 45   label-455..SELE
107d0 43 54 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 30  CT col1 / - col0
107e0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
107f0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32  b0..----..-1..-2
10800 0d 0a 2d 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-3....query I 
10810 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10820 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20  - col0 * col1 + 
10830 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  + cor0.col2 AS c
10840 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
10850 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 35 0d  r0..----..-1305.
10860 0a 2d 31 39 30 0d 0a 2d 34 35 37 36 0d 0a 0d 0a  .-190..-4576....
10870 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10880 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63  .SELECT col0 * c
10890 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63  ol1 * - col2 + c
108a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
108b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33   cor0..----..-33
108c0 36 30 0d 0a 2d 36 36 34 30 32 39 0d 0a 2d 36 38  60..-664029..-68
108d0 30 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  088....query I r
108e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
108f0 20 63 6f 6c 31 20 2a 20 2b 20 74 61 62 31 2e 63   col1 * + tab1.c
10900 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 + col0 AS co
10910 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
10920 2d 2d 0d 0a 2d 31 31 36 38 0d 0a 2d 31 34 30 31  --..-1168..-1401
10930 0d 0a 2d 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20  ..-506....query 
10940 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10950 54 20 63 6f 6c 32 20 2a 20 2b 20 74 61 62 30 2e  T col2 * + tab0.
10960 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col2 * col2 FROM
10970 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
10980 33 35 39 33 37 0d 0a 35 35 31 33 36 38 0d 0a 0d  35937..551368...
10990 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
109a0 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f  rt..SELECT * FRO
109b0 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54  M tab2 WHERE NOT
109c0 20 4e 55 4c 4c 20 49 4e 20 28 20 63 6f 6c 32 20   NULL IN ( col2 
109d0 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
109e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
109f0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20  CT ALL - col0 + 
10a00 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2d 20  + tab1.col0 * - 
10a10 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20 63  col0 + col2 AS c
10a20 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
10a30 2d 2d 2d 0d 0a 2d 34 31 30 33 0d 0a 2d 36 33 38  ---..-4103..-638
10a40 34 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49  4..42....query I
10a50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10a60 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a   + col0 * col1 *
10a70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
10a80 0a 2d 2d 2d 2d 0d 0a 31 33 35 32 30 0d 0a 32 30  .----..13520..20
10a90 32 38 0d 0a 36 34 30 30 0d 0a 0d 0a 71 75 65 72  28..6400....quer
10aa0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10ab0 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72  ECT col0 + - cor
10ac0 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0.col2 FROM tab2
10ad0 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20 4e   AS cor0 WHERE N
10ae0 4f 54 20 28 20 4e 55 4c 4c 20 29 20 42 45 54 57  OT ( NULL ) BETW
10af0 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 28 20 4e  EEN NULL AND ( N
10b00 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ULL )..----....q
10b10 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
10b20 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
10b30 74 61 62 31 20 41 53 20 63 6f 72 30 20 57 48 45  tab1 AS cor0 WHE
10b40 52 45 20 28 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  RE ( + col2 + - 
10b50 63 6f 6c 30 20 29 20 3e 20 28 20 63 6f 6c 32 20  col0 ) > ( col2 
10b60 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
10b70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
10b80 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30  CT col2 + - col0
10b90 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + - col1 * + co
10ba0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
10bb0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 37 0d 0a 2d  0..----..-107..-
10bc0 31 35 33 0d 0a 2d 36 32 35 0d 0a 0d 0a 71 75 65  153..-625....que
10bd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10be0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20  LECT ALL col0 * 
10bf0 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  - col2 AS col2 F
10c00 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
10c10 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38  ---..-162..-3648
10c20 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79  ..-7680....query
10c30 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
10c40 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20  LECT ALL * FROM 
10c50 74 61 62 32 20 41 53 20 63 6f 72 30 20 57 48 45  tab2 AS cor0 WHE
10c60 52 45 20 4e 55 4c 4c 20 3d 20 28 20 4e 55 4c 4c  RE NULL = ( NULL
10c70 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70   )..----....skip
10c80 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
10c90 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
10ca0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
10cb0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
10cc0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
10cd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
10ce0 6f 6c 30 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20  ol0 + col2 col1 
10cf0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
10d00 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d  .104..117..34...
10d10 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
10d20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
10d30 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
10d40 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
10d50 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 39  owsort label-469
10d60 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
10d70 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 74 61 62  T + col0 DIV tab
10d80 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  2.col1 AS col0 F
10d90 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
10da0 30 0d 0a 31 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69  0..1..4....skipi
10db0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
10dc0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
10dd0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
10de0 34 36 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  469..SELECT DIST
10df0 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2f 20 74 61  INCT + col0 / ta
10e00 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  b2.col1 AS col0 
10e10 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
10e20 0a 30 0d 0a 31 0d 0a 34 0d 0a 0d 0a 6f 6e 6c 79  .0..1..4....only
10e30 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
10e40 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
10e50 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
10e60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10e70 74 20 6c 61 62 65 6c 2d 34 37 30 0d 0a 53 45 4c  t label-470..SEL
10e80 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63  ECT + - col1 * c
10e90 6f 6c 31 20 44 49 56 20 2d 20 63 6f 72 30 2e 63  ol1 DIV - cor0.c
10ea0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
10eb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31  r0..----..17..31
10ec0 0d 0a 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..59....skipif m
10ed0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
10ee0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
10ef0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 30  owsort label-470
10f00 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
10f10 31 20 2a 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 72  1 * col1 / - cor
10f20 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  0.col1 FROM tab2
10f30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d   cor0..----..17.
10f40 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79  .31..59....query
10f50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
10f60 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
10f70 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20  r0.col1 AS col1 
10f80 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
10f90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d  cor0..----..-10.
10fa0 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65  .-13..-26....que
10fb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10fc0 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
10fd0 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  l0 + + col2 AS c
10fe0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
10ff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
11000 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 73 6b 69  ..117..34....ski
11010 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
11020 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
11030 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
11040 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
11050 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
11060 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
11070 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 32  l0 * + col2 col2
11080 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
11090 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32  r0..----..35..72
110a0 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79  98..792....query
110b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
110c0 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20  CT cor0.col1 AS 
110d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20  col0 FROM tab2, 
110e0 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30 0d  tab0, tab0 cor0.
110f0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
11100 20 68 61 73 68 69 6e 67 20 74 6f 20 32 64 36 64   hashing to 2d6d
11110 33 30 33 31 64 66 65 39 30 65 30 63 30 32 64 62  3031dfe90e0c02db
11120 31 33 61 61 36 33 39 39 33 62 66 64 0d 0a 0d 0a  13aa63993bfd....
11130 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11140 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
11150 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 63   col1 + col1 + c
11160 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
11170 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36   cor0..----..196
11180 0d 0a 32 32 39 0d 0a 32 37 31 0d 0a 0d 0a 71 75  ..229..271....qu
11190 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
111a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
111b0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 72   cor0.col0 * cor
111c0 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  0.col1 + + col2 
111d0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
111e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 35 0d 0a  0..----..-1305..
111f0 2d 31 39 30 0d 0a 2d 34 35 37 36 0d 0a 0d 0a 71  -190..-4576....q
11200 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11210 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11220 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20  - col0 * col2 + 
11230 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52  - col1 * col0 FR
11240 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
11250 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 39 37 0d 0a 2d  .----..-15397..-
11260 32 38 35 36 0d 0a 2d 33 34 33 30 0d 0a 0d 0a 73  2856..-3430....s
11270 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
11280 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
11290 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
112a0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
112b0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
112c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
112d0 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  ALL col2 * + col
112e0 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0 col1 FROM tab1
112f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11300 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d  162..3648..7680.
11310 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11320 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
11330 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 41   col1 * - col2 A
11340 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
11350 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
11360 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a  38..-7462..-97..
11370 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11380 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
11390 6c 30 20 2a 20 2b 20 28 20 2b 20 63 6f 6c 32 20  l0 * + ( + col2 
113a0 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
113b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
113c0 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36  -..162..3648..76
113d0 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
113e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
113f0 4c 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 63  L + + col1 - - c
11400 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
11410 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
11420 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a  ..29..74..93....
11430 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
11440 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
11450 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
11460 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
11470 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 38 32 0d  wsort label-482.
11480 0a 53 45 4c 45 43 54 20 2b 20 39 37 20 44 49 56  .SELECT + 97 DIV
11490 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   - cor0.col2 AS 
114a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
114b0 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
114c0 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  N tab0 AS cor1..
114d0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
114e0 61 73 68 69 6e 67 20 74 6f 20 36 30 66 64 64 36  ashing to 60fdd6
114f0 39 32 34 62 62 37 36 33 64 36 61 63 61 30 30 62  924bb763d6aca00b
11500 61 37 34 39 33 35 65 66 34 62 0d 0a 0d 0a 73 6b  a74935ef4b....sk
11510 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
11520 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
11530 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
11540 65 6c 2d 34 38 32 0d 0a 53 45 4c 45 43 54 20 2b  el-482..SELECT +
11550 20 39 37 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c   97 / - cor0.col
11560 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
11570 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab1 AS cor0 CROS
11580 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63  S JOIN tab0 AS c
11590 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
115a0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36  ues hashing to 6
115b0 30 66 64 64 36 39 32 34 62 62 37 36 33 64 36 61  0fdd6924bb763d6a
115c0 63 61 30 30 62 61 37 34 39 33 35 65 66 34 62 0d  ca00ba74935ef4b.
115d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
115e0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
115f0 4e 43 54 20 2d 20 2b 20 38 32 20 2b 20 2d 20 35  NCT - + 82 + - 5
11600 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
11610 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
11620 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
11630 2d 0d 0a 2d 31 33 34 0d 0a 0d 0a 71 75 65 72 79  -..-134....query
11640 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11650 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  CT + - col2 * - 
11660 28 20 32 34 20 29 20 46 52 4f 4d 20 74 61 62 30  ( 24 ) FROM tab0
11670 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11680 31 39 36 38 0d 0a 32 34 0d 0a 37 39 32 0d 0a 0d  1968..24..792...
11690 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
116a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
116b0 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  T + col0 + col1 
116c0 2a 20 35 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  * 5 * col0 FROM 
116d0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
116e0 0a 31 30 39 32 0d 0a 32 33 30 38 38 0d 0a 36 37  .1092..23088..67
116f0 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  94....onlyif mys
11700 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
11710 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
11720 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
11730 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11740 6c 2d 34 38 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-486..SELECT DI
11750 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20  STINCT - col0 + 
11760 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 44 49 56  + ( - col2 ) DIV
11770 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
11780 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 33 35 0d  .----..-25..-35.
11790 0a 2d 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-89....skipif m
117a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
117b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
117c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 38 36  owsort label-486
117d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
117e0 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2d  T - col0 + + ( -
117f0 20 63 6f 6c 32 20 29 20 2f 20 63 6f 6c 30 20 46   col2 ) / col0 F
11800 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
11810 2d 32 35 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d  -25..-35..-89...
11820 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11830 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
11840 54 20 2b 20 63 6f 6c 31 20 2b 20 34 30 20 46 52  T + col1 + 40 FR
11850 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab2..----..5
11860 37 0d 0a 37 31 0d 0a 39 39 0d 0a 0d 0a 71 75 65  7..71..99....que
11870 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11880 4c 45 43 54 20 63 6f 6c 32 20 2a 20 38 35 20 46  LECT col2 * 85 F
11890 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
118a0 32 32 31 30 0d 0a 32 32 39 35 0d 0a 33 32 33 30  2210..2295..3230
118b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
118c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
118d0 62 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a  b0.col1 + col0 *
118e0 20 63 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f 6c   col0 * tab0.col
118f0 32 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  2 + col1 AS col2
11900 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
11910 0d 0a 31 34 31 39 0d 0a 31 39 31 38 30 0d 0a 36  ..1419..19180..6
11920 34 39 37 30 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  49704....onlyif 
11930 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
11940 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
11950 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
11960 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
11970 61 62 65 6c 2d 34 39 30 0d 0a 53 45 4c 45 43 54  abel-490..SELECT
11980 20 63 6f 6c 31 20 2b 20 32 38 20 44 49 56 20 2b   col1 + 28 DIV +
11990 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 28   col1 + col0 * (
119a0 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   + col2 ) AS col
119b0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
119c0 2d 0d 0a 32 30 38 37 0d 0a 32 32 30 0d 0a 33 30  -..2087..220..30
119d0 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  20....skipif mys
119e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
119f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
11a00 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 30 0d 0a  sort label-490..
11a10 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 32 38  SELECT col1 + 28
11a20 20 2f 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   / + col1 + col0
11a30 20 2a 20 28 20 2b 20 63 6f 6c 32 20 29 20 41 53   * ( + col2 ) AS
11a40 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
11a50 0a 2d 2d 2d 2d 0d 0a 32 30 38 37 0d 0a 32 32 30  .----..2087..220
11a60 0d 0a 33 30 32 30 0d 0a 0d 0a 71 75 65 72 79 20  ..3020....query 
11a70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11a80 54 20 74 61 62 31 2e 63 6f 6c 30 20 2d 20 2b 20  T tab1.col0 - + 
11a90 63 6f 6c 32 20 2a 20 2b 20 30 20 2a 20 63 6f 6c  col2 * + 0 * col
11aa0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
11ab0 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a  -..3..64..80....
11ac0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11ad0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 35 37  .SELECT ALL + 57
11ae0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
11af0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
11b00 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
11b10 20 36 31 64 61 37 30 63 36 32 34 61 64 36 30 36   61da70c624ad606
11b20 30 34 61 36 36 38 66 37 66 38 66 32 39 33 39 32  04a668f7f8f29392
11b30 61 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  a....onlyif mysq
11b40 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
11b50 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
11b60 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
11b70 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
11b80 2d 34 39 33 0d 0a 53 45 4c 45 43 54 20 74 61 62  -493..SELECT tab
11b90 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  0.col0 + - col2 
11ba0 44 49 56 20 74 61 62 30 2e 63 6f 6c 31 20 41 53  DIV tab0.col1 AS
11bb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
11bc0 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38  .----..24..35..8
11bd0 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
11be0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
11bf0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
11c00 6f 72 74 20 6c 61 62 65 6c 2d 34 39 33 0d 0a 53  ort label-493..S
11c10 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 30 20  ELECT tab0.col0 
11c20 2b 20 2d 20 63 6f 6c 32 20 2f 20 74 61 62 30 2e  + - col2 / tab0.
11c30 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
11c40 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  M tab0..----..24
11c50 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72  ..35..89....quer
11c60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11c70 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
11c80 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol1 * col1 + col
11c90 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
11ca0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 31 30  ab0..----..-7310
11cb0 0d 0a 2d 38 31 39 30 0d 0a 2d 39 33 31 32 0d 0a  ..-8190..-9312..
11cc0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
11cd0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
11ce0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
11cf0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
11d00 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
11d10 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 35 0d 0a  sort label-495..
11d20 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
11d30 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
11d40 53 49 47 4e 45 44 20 29 20 2f 20 63 6f 6c 31 20  SIGNED ) / col1 
11d50 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
11d60 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
11d70 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
11d80 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
11d90 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
11da0 6f 72 74 20 6c 61 62 65 6c 2d 34 39 35 0d 0a 53  ort label-495..S
11db0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d  ELECT + col2 * -
11dc0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
11dd0 49 4e 54 45 47 45 52 20 29 20 2f 20 63 6f 6c 31  INTEGER ) / col1
11de0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
11df0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
11e00 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  LL....onlyif mys
11e10 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
11e20 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
11e30 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
11e40 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11e50 6c 2d 34 39 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-496..SELECT DI
11e60 53 54 49 4e 43 54 20 2d 20 74 61 62 32 2e 63 6f  STINCT - tab2.co
11e70 6c 31 20 44 49 56 20 63 6f 6c 30 20 2b 20 2b 20  l1 DIV col0 + + 
11e80 63 6f 6c 32 20 2a 20 2b 20 31 37 20 46 52 4f 4d  col2 * + 17 FROM
11e90 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 34 32   tab2..----..442
11ea0 0d 0a 34 35 35 0d 0a 36 34 36 0d 0a 0d 0a 73 6b  ..455..646....sk
11eb0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
11ec0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
11ed0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
11ee0 65 6c 2d 34 39 36 0d 0a 53 45 4c 45 43 54 20 44  el-496..SELECT D
11ef0 49 53 54 49 4e 43 54 20 2d 20 74 61 62 32 2e 63  ISTINCT - tab2.c
11f00 6f 6c 31 20 2f 20 63 6f 6c 30 20 2b 20 2b 20 63  ol1 / col0 + + c
11f10 6f 6c 32 20 2a 20 2b 20 31 37 20 46 52 4f 4d 20  ol2 * + 17 FROM 
11f20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 34 32 0d  tab2..----..442.
11f30 0a 34 35 35 0d 0a 36 34 36 0d 0a 0d 0a 71 75 65  .455..646....que
11f40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11f50 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20  LECT ALL col2 + 
11f60 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  col1 * - col0 * 
11f70 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
11f80 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
11f90 2d 31 31 38 38 32 34 0d 0a 2d 34 39 35 30 33 0d  -118824..-49503.
11fa0 0a 2d 37 32 30 37 32 39 0d 0a 0d 0a 71 75 65 72  .-720729....quer
11fb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11fc0 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 2d  ECT ALL col1 + -
11fd0 20 32 36 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20   26 + col2 FROM 
11fe0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 0d  tab0..----..147.
11ff0 0a 37 32 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79  .72..93....query
12000 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12010 43 54 20 41 4c 4c 20 2d 20 2b 20 37 30 20 2a 20  CT ALL - + 70 * 
12020 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  - cor0.col2 FROM
12030 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
12040 2d 2d 2d 0d 0a 32 33 31 30 0d 0a 35 37 34 30 0d  ---..2310..5740.
12050 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .70....query I r
12060 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
12070 20 2d 20 31 39 20 2a 20 63 6f 6c 32 20 46 52 4f   - 19 * col2 FRO
12080 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
12090 2d 0d 0a 34 39 34 0d 0a 35 31 33 0d 0a 37 32 32  -..494..513..722
120a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
120b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
120c0 49 4e 43 54 20 28 20 63 6f 72 30 2e 63 6f 6c 30  INCT ( cor0.col0
120d0 20 29 20 2a 20 2d 20 31 32 20 46 52 4f 4d 20 74   ) * - 12 FROM t
120e0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
120f0 2d 0d 0a 2d 31 30 36 38 0d 0a 2d 32 38 38 0d 0a  -..-1068..-288..
12100 2d 34 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -420....query I 
12110 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12120 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
12130 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  - col1 + + col2 
12140 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12150 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 32 0d 0a  0..----..-1152..
12160 2d 31 33 35 30 0d 0a 2d 35 31 33 0d 0a 0d 0a 71  -1350..-513....q
12170 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12180 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
12190 2b 20 39 38 20 2a 20 63 6f 6c 30 20 2b 20 2b 20  + 98 * col0 + + 
121a0 32 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  26 AS col0 FROM 
121b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
121c0 2d 2d 0d 0a 33 32 30 0d 0a 36 32 39 38 0d 0a 37  --..320..6298..7
121d0 38 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  866....query I r
121e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
121f0 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c 31  ISTINCT ( + col1
12200 20 29 20 2b 20 63 6f 6c 31 20 2a 20 33 37 20 41   ) + col1 * 37 A
12210 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
12220 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 36   cor0..----..326
12230 38 0d 0a 33 34 35 38 0d 0a 33 36 38 36 0d 0a 0d  8..3458..3686...
12240 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12250 0d 0a 53 45 4c 45 43 54 20 32 37 20 41 53 20 63  ..SELECT 27 AS c
12260 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
12270 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 37  r0..----..27..27
12280 0d 0a 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..27....query I 
12290 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
122a0 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 2b  - ( + col1 ) * +
122b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
122c0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32  .----..-1343..-2
122d0 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65  17..-4602....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 41 4c 4c 20 2d 20 74 61 62 30 2e  LECT ALL - tab0.
12300 63 6f 6c 31 20 2b 20 74 61 62 30 2e 63 6f 6c 30  col1 + tab0.col0
12310 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
12320 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
12330 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
12340 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
12350 68 61 73 68 69 6e 67 20 74 6f 20 63 64 32 65 64  hashing to cd2ed
12360 30 66 38 66 32 38 62 64 66 37 39 66 62 39 36 63  0f8f28bdf79fb96c
12370 63 37 30 38 64 65 35 63 35 66 66 0d 0a 0d 0a 6f  c708de5c5ff....o
12380 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
12390 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
123a0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
123b0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
123c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
123d0 74 20 6c 61 62 65 6c 2d 35 30 38 0d 0a 53 45 4c  t label-508..SEL
123e0 45 43 54 20 2b 20 43 41 53 54 28 20 28 20 63 6f  ECT + CAST( ( co
123f0 6c 30 20 29 20 41 53 20 53 49 47 4e 45 44 20 29  l0 ) AS SIGNED )
12400 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 74 61 62 31   * + col0 + tab1
12410 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
12420 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
12430 32 0d 0a 34 31 36 30 0d 0a 36 34 38 30 0d 0a 0d  2..4160..6480...
12440 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
12450 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
12460 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
12470 6c 61 62 65 6c 2d 35 30 38 0d 0a 53 45 4c 45 43  label-508..SELEC
12480 54 20 2b 20 43 41 53 54 20 28 20 28 20 63 6f 6c  T + CAST ( ( col
12490 30 20 29 20 41 53 20 49 4e 54 45 47 45 52 20 29  0 ) AS INTEGER )
124a0 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 74 61 62 31   * + col0 + tab1
124b0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
124c0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
124d0 32 0d 0a 34 31 36 30 0d 0a 36 34 38 30 0d 0a 0d  2..4160..6480...
124e0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
124f0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
12500 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
12510 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
12520 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 39  owsort label-509
12530 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74  ..SELECT ALL - t
12540 61 62 31 2e 63 6f 6c 32 20 44 49 56 20 34 34 20  ab1.col2 DIV 44 
12550 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
12560 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  1..----..-1..-1.
12570 0a 2d 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .-2....skipif my
12580 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
12590 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
125a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 39 0d  wsort label-509.
125b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61  .SELECT ALL - ta
125c0 62 31 2e 63 6f 6c 32 20 2f 20 34 34 20 41 53 20  b1.col2 / 44 AS 
125d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
125e0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 32  ----..-1..-1..-2
125f0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
12600 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
12610 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
12620 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
12630 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
12640 35 31 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  510..SELECT DIST
12650 49 4e 43 54 20 2d 20 31 34 20 44 49 56 20 36 39  INCT - 14 DIV 69
12660 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
12670 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
12680 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
12690 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..0....skipif 
126a0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
126b0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
126c0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
126d0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
126e0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
126f0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
12700 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12710 20 6c 61 62 65 6c 2d 35 31 30 0d 0a 53 45 4c 45   label-510..SELE
12720 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31 34  CT DISTINCT - 14
12730 20 2f 20 36 39 20 63 6f 6c 31 20 46 52 4f 4d 20   / 69 col1 FROM 
12740 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20  tab1 cor0 CROSS 
12750 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72  JOIN tab1 AS cor
12760 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  1..----..0....qu
12770 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12780 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34  ELECT DISTINCT 4
12790 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30   FROM tab0, tab0
127a0 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63   cor0, tab0 AS c
127b0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 0d 0a  or1..----..4....
127c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
127d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 33 20 2a  .SELECT ALL 23 *
127e0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
127f0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
12800 34 37 32 0d 0a 31 38 34 30 0d 0a 36 39 0d 0a 0d  472..1840..69...
12810 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12820 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
12830 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  T + col2 + col1 
12840 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  * col2 FROM tab1
12850 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12860 31 33 34 34 0d 0a 31 34 35 38 0d 0a 36 32 37 0d  1344..1458..627.
12870 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12880 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
12890 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  NCT - cor0.col1 
128a0 2a 20 63 6f 6c 30 20 2b 20 32 30 20 2b 20 2d 20  * col0 + 20 + - 
128b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
128c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
128d0 31 30 30 0d 0a 2d 36 31 0d 0a 2d 36 38 34 0d 0a  100..-61..-684..
128e0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
128f0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
12900 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
12910 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
12920 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31  rowsort label-51
12930 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
12940 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63  CT cor0.col0 + c
12950 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol2 DIV cor0.col
12960 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
12970 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a  ..----..24..35..
12980 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  89....skipif mys
12990 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
129a0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
129b0 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 35 0d 0a  sort label-515..
129c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
129d0 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32  cor0.col0 + col2
129e0 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   / cor0.col1 FRO
129f0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
12a00 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
12a10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12a20 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
12a30 2b 20 63 6f 6c 30 20 2a 20 2d 20 38 31 20 46 52  + col0 * - 81 FR
12a40 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
12a50 0a 2d 2d 2d 2d 0d 0a 2d 32 39 37 0d 0a 2d 35 32  .----..-297..-52
12a60 34 31 0d 0a 2d 36 35 37 36 0d 0a 0d 0a 71 75 65  41..-6576....que
12a70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12a80 4c 45 43 54 20 2d 20 39 33 20 2a 20 63 6f 6c 32  LECT - 93 * col2
12a90 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   * - col0 + col2
12aa0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
12ab0 0d 0a 33 32 35 36 0d 0a 36 37 38 37 39 36 0d 0a  ..3256..678796..
12ac0 37 33 36 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  73689....skipif 
12ad0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
12ae0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
12af0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
12b00 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
12b10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12b20 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
12b30 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c  CT cor0.col2 col
12b40 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
12b50 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  0 AS cor0, tab0 
12b60 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor1..----..1
12b70 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72  ..33..82....quer
12b80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12b90 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 31 20  ECT DISTINCT 41 
12ba0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
12bb0 31 0d 0a 2d 2d 2d 2d 0d 0a 34 31 0d 0a 0d 0a 71  1..----..41....q
12bc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12bd0 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 74 61 62  SELECT + ( - tab
12be0 32 2e 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c  2.col1 ) + - col
12bf0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
12c00 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a  ab2..----..-55..
12c10 2d 35 38 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72  -58..-85....quer
12c20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12c30 45 43 54 20 41 4c 4c 20 37 31 20 2b 20 2d 20 63  ECT ALL 71 + - c
12c40 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 * col0 FROM 
12c50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
12c60 2d 2d 0d 0a 2d 31 39 39 33 0d 0a 2d 33 33 32 34  --..-1993..-3324
12c70 0d 0a 2d 38 30 32 38 0d 0a 0d 0a 71 75 65 72 79  ..-8028....query
12c80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12c90 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  CT + + col1 * - 
12ca0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
12cb0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
12cc0 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a  -..-1343..-217..
12cd0 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -4602....query I
12ce0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12cf0 20 63 6f 6c 31 20 2b 20 33 39 20 2a 20 2b 20 35   col1 + 39 * + 5
12d00 38 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  8 * + col2 FROM 
12d10 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
12d20 2d 2d 0d 0a 31 38 35 35 37 35 0d 0a 32 33 35 39  --..185575..2359
12d30 0d 0a 37 34 37 33 32 0d 0a 0d 0a 6f 6e 6c 79 69  ..74732....onlyi
12d40 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
12d50 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
12d60 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
12d70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12d80 20 6c 61 62 65 6c 2d 35 32 34 0d 0a 53 45 4c 45   label-524..SELE
12d90 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  CT - cor0.col0 +
12da0 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30   - col0 DIV col0
12db0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
12dc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 36  r0..----..-4..-6
12dd0 35 0d 0a 2d 38 31 0d 0a 0d 0a 73 6b 69 70 69 66  5..-81....skipif
12de0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
12df0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
12e00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
12e10 32 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  24..SELECT - cor
12e20 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  0.col0 + - col0 
12e30 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  / col0 FROM tab1
12e40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12e50 2d 34 0d 0a 2d 36 35 0d 0a 2d 38 31 0d 0a 0d 0a  -4..-65..-81....
12e60 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
12e70 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
12e80 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
12e90 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
12ea0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
12eb0 72 74 20 6c 61 62 65 6c 2d 35 32 35 0d 0a 53 45  rt label-525..SE
12ec0 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
12ed0 2a 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20  * CAST( col0 AS 
12ee0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
12ef0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
12f00 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30  ..2064..3395..80
12f10 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  99....skipif mys
12f20 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
12f30 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
12f40 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32 35 0d 0a  sort label-525..
12f50 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
12f60 31 20 2a 20 43 41 53 54 20 28 20 63 6f 6c 30 20  1 * CAST ( col0 
12f70 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
12f80 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
12f90 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35  ----..2064..3395
12fa0 0d 0a 38 30 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..8099....onlyif
12fb0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
12fc0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
12fd0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
12fe0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
12ff0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
13000 65 6c 2d 35 32 36 0d 0a 53 45 4c 45 43 54 20 2d  el-526..SELECT -
13010 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 43 41 53   cor0.col1 + CAS
13020 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45  T( col1 AS SIGNE
13030 44 20 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  D ) * - col0 FRO
13040 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
13050 2d 2d 2d 2d 0d 0a 2d 32 31 35 30 0d 0a 2d 33 34  ----..-2150..-34
13060 39 32 0d 0a 2d 38 31 39 30 0d 0a 0d 0a 73 6b 69  92..-8190....ski
13070 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
13080 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
13090 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
130a0 6c 2d 35 32 36 0d 0a 53 45 4c 45 43 54 20 2d 20  l-526..SELECT - 
130b0 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 43 41 53 54  cor0.col1 + CAST
130c0 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   ( col1 AS INTEG
130d0 45 52 20 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52  ER ) * - col0 FR
130e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
130f0 0a 2d 2d 2d 2d 0d 0a 2d 32 31 35 30 0d 0a 2d 33  .----..-2150..-3
13100 34 39 32 0d 0a 2d 38 31 39 30 0d 0a 0d 0a 71 75  492..-8190....qu
13110 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13120 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
13130 20 38 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   80 AS col2 FROM
13140 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
13150 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 30 0d 0a  or0..----..-80..
13160 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13170 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 37 20  t..SELECT + - 7 
13180 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
13190 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  0 AS cor0 CROSS 
131a0 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72  JOIN tab0 AS cor
131b0 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
131c0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 61 39  s hashing to ba9
131d0 34 30 63 64 36 36 65 32 31 65 39 34 65 39 35 61  40cd66e21e94e95a
131e0 61 64 61 35 66 32 38 65 31 66 61 66 35 0d 0a 0d  ada5f28e1faf5...
131f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13200 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
13210 30 20 2a 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  0 * ( - cor0.col
13220 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
13230 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
13240 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39  ---..-2064..-339
13250 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72  5..-8099....quer
13260 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13270 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 36  ECT + + col2 + 6
13280 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  8 AS col0 FROM t
13290 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
132a0 2d 0d 0a 31 30 31 0d 0a 31 35 30 0d 0a 36 39 0d  -..101..150..69.
132b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
132c0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 38  rt..SELECT - - 8
132d0 39 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  9 + + cor0.col1 
132e0 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  * col1 AS col2 F
132f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
13300 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 30 0d 0a 33 35  ..----..1050..35
13310 37 30 0d 0a 33 37 38 0d 0a 0d 0a 71 75 65 72 79  70..378....query
13320 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13330 43 54 20 41 4c 4c 20 2d 20 2b 20 28 20 2d 20 63  CT ALL - + ( - c
13340 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol0 ) AS col2 FR
13350 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
13360 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a  --..24..35..89..
13370 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13380 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
13390 43 54 20 2d 20 2d 20 34 31 20 2b 20 2d 20 63 6f  CT - - 41 + - co
133a0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
133b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
133c0 2d 2d 0d 0a 2d 32 33 0d 0a 2d 33 39 0d 0a 33 38  --..-23..-39..38
133d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
133e0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
133f0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
13400 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
13410 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
13420 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13430 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20  LECT ALL col0 * 
13440 31 31 20 2a 20 63 6f 6c 30 20 63 6f 6c 30 20 46  11 * col0 col0 F
13450 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
13460 0d 0a 2d 2d 2d 2d 0d 0a 34 35 30 35 36 0d 0a 37  ..----..45056..7
13470 30 34 30 30 0d 0a 39 39 0d 0a 0d 0a 6f 6e 6c 79  0400..99....only
13480 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
13490 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
134a0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
134b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
134c0 74 20 6c 61 62 65 6c 2d 35 33 35 0d 0a 53 45 4c  t label-535..SEL
134d0 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32  ECT ALL - + col2
134e0 20 2b 20 32 30 20 44 49 56 20 63 6f 6c 30 20 2d   + 20 DIV col0 -
134f0 20 2d 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d   - ( col2 ) FROM
13500 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
13510 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 36 0d 0a 0d 0a  ---..0..0..6....
13520 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
13530 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..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 33 35 0d 0a 53 45 4c 45 43 54  abel-535..SELECT
13560 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2b 20   ALL - + col2 + 
13570 32 30 20 2f 20 63 6f 6c 30 20 2d 20 2d 20 28 20  20 / col0 - - ( 
13580 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31  col2 ) FROM tab1
13590 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
135a0 30 0d 0a 30 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79  0..0..6....query
135b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
135c0 43 54 20 2b 20 39 39 20 41 53 20 63 6f 6c 32 20  CT + 99 AS col2 
135d0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
135e0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 39 0d 0a 39 39 0d  0..----..99..99.
135f0 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .99....query I r
13600 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
13610 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20 35 37  ISTINCT - ( - 57
13620 20 29 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   ) + col1 AS col
13630 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
13640 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 0d 0a  or0..----..116..
13650 37 34 0d 0a 38 38 0d 0a 0d 0a 71 75 65 72 79 20  74..88....query 
13660 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13670 54 20 2d 20 36 32 20 2b 20 28 20 2d 20 63 6f 6c  T - 62 + ( - col
13680 32 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29  2 + + ( - col2 )
13690 20 2a 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   * col2 ) FROM t
136a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
136b0 2d 0d 0a 2d 31 31 38 34 0d 0a 2d 36 34 0d 0a 2d  -..-1184..-64..-
136c0 36 38 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6868....query I 
136d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
136e0 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 35 31 20  DISTINCT + - 51 
136f0 2a 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  * ( col2 ) AS co
13700 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
13710 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 38  cor0..----..-168
13720 33 0d 0a 2d 34 31 38 32 0d 0a 2d 35 31 0d 0a 0d  3..-4182..-51...
13730 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13740 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
13750 63 6f 6c 32 20 2a 20 28 20 63 6f 72 30 2e 63 6f  col2 * ( cor0.co
13760 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l0 ) AS col2 FRO
13770 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
13780 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32  ----..-189..-202
13790 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65 72  8..-3002....quer
137a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
137b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
137c0 30 20 2b 20 2b 20 38 38 20 41 53 20 63 6f 6c 30  0 + + 88 AS col0
137d0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
137e0 0a 2d 2d 2d 2d 0d 0a 31 36 36 0d 0a 31 36 37 0d  .----..166..167.
137f0 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .95....query I r
13800 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
13810 4c 4c 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 31 20  LL + + ( - col1 
13820 29 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  ) - col2 AS col0
13830 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
13840 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d  r0..----..-55..-
13850 35 38 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72 79  58..-85....query
13860 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13870 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  CT + cor0.col1 +
13880 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
13890 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d  cor0..----..137.
138a0 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  .38..96....query
138b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
138c0 43 54 20 34 20 46 52 4f 4d 20 74 61 62 31 2c 20  CT 4 FROM tab1, 
138d0 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
138e0 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
138f0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
13900 69 6e 67 20 74 6f 20 37 33 30 64 66 66 37 38 65  ing to 730dff78e
13910 38 33 31 31 32 33 37 34 39 36 31 65 61 37 31 31  83112374961ea711
13920 66 39 38 65 62 61 61 0d 0a 0d 0a 71 75 65 72 79  f98ebaa....query
13930 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13940 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  CT - - cor0.col0
13950 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a   * col2 + col1 *
13960 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
13970 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
13980 33 32 0d 0a 31 34 37 36 30 0d 0a 33 36 33 30 0d  32..14760..3630.
13990 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
139a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
139b0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b  ol2 * + col1 + +
139c0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
139d0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
139e0 2d 2d 0d 0a 31 33 32 38 0d 0a 31 34 30 37 0d 0a  --..1328..1407..
139f0 36 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  634....onlyif my
13a00 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
13a10 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
13a20 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
13a30 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
13a40 65 6c 2d 35 34 37 0d 0a 53 45 4c 45 43 54 20 2d  el-547..SELECT -
13a50 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 31   col0 DIV + col1
13a60 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
13a70 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
13a80 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
13a90 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
13aa0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
13ab0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
13ac0 6c 2d 35 34 37 0d 0a 53 45 4c 45 43 54 20 2d 20  l-547..SELECT - 
13ad0 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 31 20 41 53  col0 / + col1 AS
13ae0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
13af0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
13b00 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
13b10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13b20 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c  T ALL + cor0.col
13b30 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  0 * + col0 + col
13b40 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
13b50 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 32 0d 0a 36 36  ..----..1322..66
13b60 32 0d 0a 38 30 31 32 0d 0a 0d 0a 71 75 65 72 79  2..8012....query
13b70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13b80 43 54 20 44 49 53 54 49 4e 43 54 20 39 31 20 2b  CT DISTINCT 91 +
13b90 20 63 6f 6c 31 20 2a 20 74 61 62 31 2e 63 6f 6c   col1 * tab1.col
13ba0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
13bb0 2d 0d 0a 31 39 31 0d 0a 32 36 30 0d 0a 37 36 37  -..191..260..767
13bc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13bd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
13be0 49 4e 43 54 20 31 30 20 41 53 20 63 6f 6c 32 20  INCT 10 AS col2 
13bf0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
13c00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
13c10 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
13c20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 33  sort..SELECT ( 3
13c30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
13c40 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 33  tab2..----..3..3
13c50 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..3....skipif po
13c60 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
13c70 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
13c80 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
13c90 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
13ca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13cb0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28 20 63 6f  .SELECT + + ( co
13cc0 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 32 20 63 6f  l1 ) + - col2 co
13cd0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
13ce0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d  cor0..----..-21.
13cf0 0a 33 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20  .33..4....query 
13d00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13d10 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 36 33 20  T - col0 + + 63 
13d20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
13d30 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
13d40 0d 0a 31 35 36 30 0d 0a 31 36 39 34 0d 0a 32 33  ..1560..1694..23
13d50 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  15....query I ro
13d60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
13d70 2d 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 30 20  - col2 * ( col0 
13d80 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ) + col1 FROM ta
13d90 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
13da0 0d 0a 31 33 32 0d 0a 37 33 38 39 0d 0a 38 37 38  ..132..7389..878
13db0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13dc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
13dd0 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + + col1 * + co
13de0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
13df0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
13e00 2d 2d 0d 0a 32 30 38 38 0d 0a 33 34 33 30 0d 0a  --..2088..3430..
13e10 38 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8188....query I 
13e20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13e30 31 33 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  13 * + col1 + + 
13e40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
13e50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30  S cor0..----..30
13e60 30 0d 0a 34 31 30 0d 0a 38 34 35 0d 0a 0d 0a 71  0..410..845....q
13e70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13e80 53 45 4c 45 43 54 20 2d 20 2b 20 31 36 20 46 52  SELECT - + 16 FR
13e90 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
13ea0 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 31 36 0d  .----..-16..-16.
13eb0 0a 2d 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-16....onlyif m
13ec0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
13ed0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
13ee0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
13ef0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
13f00 62 65 6c 2d 35 35 38 0d 0a 53 45 4c 45 43 54 20  bel-558..SELECT 
13f10 2d 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  - - col2 DIV - c
13f20 6f 6c 31 20 2b 20 30 20 46 52 4f 4d 20 74 61 62  ol1 + 0 FROM tab
13f30 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
13f40 0a 2d 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 73  .-2..-5..-7....s
13f50 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
13f60 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
13f70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
13f80 62 65 6c 2d 35 35 38 0d 0a 53 45 4c 45 43 54 20  bel-558..SELECT 
13f90 2d 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c  - - col2 / - col
13fa0 31 20 2b 20 30 20 46 52 4f 4d 20 74 61 62 31 20  1 + 0 FROM tab1 
13fb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
13fc0 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 6f 6e 6c  2..-5..-7....onl
13fd0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
13fe0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
13ff0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
14000 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
14010 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
14020 6c 61 62 65 6c 2d 35 35 39 0d 0a 53 45 4c 45 43  label-559..SELEC
14030 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20 63  T DISTINCT ( - c
14040 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 2b 20 43  or0.col2 ) + + C
14050 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
14060 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52  NED ) AS col2 FR
14070 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
14080 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
14090 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
140a0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
140b0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
140c0 6f 72 74 20 6c 61 62 65 6c 2d 35 35 39 0d 0a 53  ort label-559..S
140d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
140e0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b   - cor0.col2 ) +
140f0 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
14100 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
14110 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
14120 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
14130 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  -..NULL....query
14140 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14150 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  CT - cor0.col1 *
14160 20 36 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   62 AS col2 FROM
14170 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
14180 2d 2d 2d 0d 0a 2d 31 36 31 32 0d 0a 2d 36 32 30  ---..-1612..-620
14190 0d 0a 2d 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20  ..-806....query 
141a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
141b0 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 28 20 28  T + - col2 + ( (
141c0 20 2b 20 63 6f 6c 30 20 29 20 29 20 2a 20 63 6f   + col0 ) ) * co
141d0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
141e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 33 31  cor0..----..2031
141f0 0d 0a 33 33 39 34 0d 0a 38 30 31 37 0d 0a 0d 0a  ..3394..8017....
14200 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
14210 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
14220 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14230 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20  SELECT - + col0 
14240 2a 20 43 41 53 54 20 28 20 2d 20 34 37 20 41 53  * CAST ( - 47 AS
14250 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62   REAL ) FROM tab
14260 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
14270 0a 31 34 31 0d 0a 33 30 30 38 0d 0a 33 37 36 30  .141..3008..3760
14280 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
14290 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
142a0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
142b0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
142c0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
142d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 36 33  owsort label-563
142e0 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28  ..SELECT + CAST(
142f0 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
14300 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
14310 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
14320 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
14330 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64  es hashing to cd
14340 37 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34  7a7901e47c151554
14350 30 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a  04aff0d216fe0b..
14360 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
14370 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
14380 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14390 20 6c 61 62 65 6c 2d 35 36 33 0d 0a 53 45 4c 45   label-563..SELE
143a0 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT + CAST ( NULL
143b0 20 41 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f   AS REAL ) AS co
143c0 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l0 FROM tab2, ta
143d0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
143e0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
143f0 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34  ng to cd7a7901e4
14400 37 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32  7c15155404aff0d2
14410 31 36 66 65 30 62 0d 0a 0d 0a 6f 6e 6c 79 69 66  16fe0b....onlyif
14420 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
14430 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
14440 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
14450 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
14460 6c 61 62 65 6c 2d 35 36 34 0d 0a 53 45 4c 45 43  label-564..SELEC
14470 54 20 28 20 74 61 62 30 2e 63 6f 6c 31 20 29 20  T ( tab0.col1 ) 
14480 44 49 56 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20  DIV - tab0.col0 
14490 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
144a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
144b0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
144c0 74 6f 20 63 62 66 61 38 64 65 38 66 65 62 32 31  to cbfa8de8feb21
144d0 32 66 65 33 31 61 31 35 32 38 62 39 65 35 32 36  2fe31a1528b9e526
144e0 31 64 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  1db....skipif my
144f0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
14500 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
14510 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 36 34 0d  wsort label-564.
14520 0a 53 45 4c 45 43 54 20 28 20 74 61 62 30 2e 63  .SELECT ( tab0.c
14530 6f 6c 31 20 29 20 2f 20 2d 20 74 61 62 30 2e 63  ol1 ) / - tab0.c
14540 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
14550 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
14560 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
14570 69 6e 67 20 74 6f 20 63 62 66 61 38 64 65 38 66  ing to cbfa8de8f
14580 65 62 32 31 32 66 65 33 31 61 31 35 32 38 62 39  eb212fe31a1528b9
14590 65 35 32 36 31 64 62 0d 0a 0d 0a 71 75 65 72 79  e5261db....query
145a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
145b0 43 54 20 2d 20 63 6f 6c 30 20 2a 20 36 34 20 41  CT - col0 * 64 A
145c0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
145d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
145e0 2d 34 34 38 0d 0a 2d 34 39 39 32 0d 0a 2d 35 30  -448..-4992..-50
145f0 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  56....query I ro
14600 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
14610 4c 20 2b 20 38 36 20 46 52 4f 4d 20 74 61 62 30  L + 86 FROM tab0
14620 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab2 cor0..---
14630 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
14640 69 6e 67 20 74 6f 20 32 64 38 63 33 61 30 64 31  ing to 2d8c3a0d1
14650 39 65 61 35 31 34 34 37 66 38 33 63 64 31 38 62  9ea51447f83cd18b
14660 34 39 66 65 65 31 39 0d 0a 0d 0a 71 75 65 72 79  49fee19....query
14670 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14680 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
14690 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63  col1 * col0 AS c
146a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
146b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 33   cor0..----..203
146c0 31 0d 0a 33 33 39 34 0d 0a 38 30 31 37 0d 0a 0d  1..3394..8017...
146d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
146e0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2b  ..SELECT ALL ( +
146f0 20 74 61 62 32 2e 63 6f 6c 32 20 29 20 2a 20 2b   tab2.col2 ) * +
14700 20 74 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab2.col2 FROM 
14710 74 61 62 32 2c 20 74 61 62 30 2c 20 74 61 62 31  tab2, tab0, tab1
14720 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
14730 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
14740 67 20 74 6f 20 31 31 31 64 66 33 31 61 37 36 37  g to 111df31a767
14750 33 62 36 64 66 30 62 64 30 31 64 66 61 38 37 66  3b6df0bd01dfa87f
14760 61 36 30 61 38 0d 0a 0d 0a 71 75 65 72 79 20 49  a60a8....query I
14770 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14780 20 44 49 53 54 49 4e 43 54 20 38 37 20 2a 20 2b   DISTINCT 87 * +
14790 20 33 37 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c   37 * - tab1.col
147a0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
147b0 2d 0d 0a 2d 33 32 31 39 30 0d 0a 2d 34 31 38 34  -..-32190..-4184
147c0 37 0d 0a 2d 38 33 36 39 34 0d 0a 0d 0a 71 75 65  7..-83694....que
147d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
147e0 4c 45 43 54 20 39 36 20 2b 20 63 6f 6c 32 20 2a  LECT 96 + col2 *
147f0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   - col1 AS col1 
14800 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
14810 0a 2d 31 31 35 32 0d 0a 2d 31 33 30 38 0d 0a 2d  .-1152..-1308..-
14820 34 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  474....query I r
14830 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
14840 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2d   col0 + col1 * -
14850 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f   tab0.col1 AS co
14860 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
14870 2d 2d 0d 0a 2d 37 34 32 30 0d 0a 2d 38 33 37 30  --..-7420..-8370
14880 0d 0a 2d 39 34 34 34 0d 0a 0d 0a 71 75 65 72 79  ..-9444....query
14890 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
148a0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 33 32  CT DISTINCT - 32
148b0 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
148c0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
148d0 0a 2d 31 32 31 36 0d 0a 2d 38 33 32 0d 0a 2d 38  .-1216..-832..-8
148e0 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
148f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
14900 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  2 + col2 AS col0
14910 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
14920 0d 0a 2d 31 0d 0a 33 31 0d 0a 38 30 0d 0a 0d 0a  ..-1..31..80....
14930 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14940 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 38 20 41  .SELECT ALL 48 A
14950 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
14960 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab2 cor0..---
14970 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
14980 69 6e 67 20 74 6f 20 38 62 30 39 63 63 32 63 39  ing to 8b09cc2c9
14990 39 63 32 31 30 32 30 33 36 31 36 32 64 30 36 33  9c2102036162d063
149a0 65 30 65 35 61 34 62 0d 0a 0d 0a 71 75 65 72 79  e0e5a4b....query
149b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
149c0 43 54 20 2d 20 33 20 2a 20 2d 20 63 6f 6c 32 20  CT - 3 * - col2 
149d0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
149e0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 36 0d 0a 33 0d  0..----..246..3.
149f0 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .99....query I r
14a00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
14a10 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 63  ISTINCT col1 + c
14a20 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20  ol0 * tab0.col2 
14a30 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
14a40 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 37 33  0..----..132..73
14a50 38 39 0d 0a 38 37 38 0d 0a 0d 0a 71 75 65 72 79  89..878....query
14a60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14a70 43 54 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f  CT ( col2 ) * co
14a80 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
14a90 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d  tab2..----..189.
14aa0 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71  .2028..3002....q
14ab0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14ac0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
14ad0 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 36 38  col2 * col0 * 68
14ae0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
14af0 0d 0a 31 31 30 31 36 0d 0a 32 34 38 30 36 34 0d  ..11016..248064.
14b00 0a 35 32 32 32 34 30 0d 0a 0d 0a 71 75 65 72 79  .522240....query
14b10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14b20 43 54 20 2b 20 63 6f 6c 32 20 2a 20 36 36 20 2a  CT + col2 * 66 *
14b30 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
14b40 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
14b50 0a 2d 34 34 33 37 38 34 0d 0a 2d 36 36 0d 0a 2d  .-443784..-66..-
14b60 37 31 38 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49  71874....query I
14b70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14b80 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2a 20   ALL - - col0 * 
14b90 2b 20 37 36 20 46 52 4f 4d 20 74 61 62 32 20 41  + 76 FROM tab2 A
14ba0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33  S cor0..----..53
14bb0 32 0d 0a 35 39 32 38 0d 0a 36 30 30 34 0d 0a 0d  2..5928..6004...
14bc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14bd0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
14be0 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  or0.col0 * - col
14bf0 32 20 2b 20 34 31 20 41 53 20 63 6f 6c 30 20 46  2 + 41 AS col0 F
14c00 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
14c10 2d 2d 2d 0d 0a 2d 37 32 35 37 0d 0a 2d 37 35 31  ---..-7257..-751
14c20 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..6....query I r
14c30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
14c40 20 35 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20   50 + cor0.col0 
14c50 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  * col2 FROM tab2
14c60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
14c70 32 30 37 38 0d 0a 32 33 39 0d 0a 33 30 35 32 0d  2078..239..3052.
14c80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14c90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
14ca0 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 72 30   + col2 - + cor0
14cb0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
14cc0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
14cd0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 31  .----..-104..-11
14ce0 37 0d 0a 2d 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  7..-34....onlyif
14cf0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
14d00 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
14d10 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
14d20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
14d30 6c 61 62 65 6c 2d 35 38 34 0d 0a 53 45 4c 45 43  label-584..SELEC
14d40 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 44 49 56  T ALL + col2 DIV
14d50 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 46   col0 + + col2 F
14d60 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
14d70 2d 2d 2d 0d 0a 31 0d 0a 33 34 0d 0a 38 32 0d 0a  ---..1..34..82..
14d80 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
14d90 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
14da0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14db0 20 6c 61 62 65 6c 2d 35 38 34 0d 0a 53 45 4c 45   label-584..SELE
14dc0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2f 20  CT ALL + col2 / 
14dd0 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52  col0 + + col2 FR
14de0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
14df0 2d 2d 0d 0a 31 0d 0a 33 34 0d 0a 38 32 0d 0a 0d  --..1..34..82...
14e00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14e10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
14e20 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 + - col1 FRO
14e30 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
14e40 2d 0d 0a 2d 31 31 39 0d 0a 2d 31 37 33 0d 0a 2d  -..-119..-173..-
14e50 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
14e60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
14e70 53 54 49 4e 43 54 20 2d 20 37 38 20 2a 20 2d 20  STINCT - 78 * - 
14e80 63 6f 6c 31 20 2a 20 2b 20 37 30 20 46 52 4f 4d  col1 * + 70 FROM
14e90 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
14ea0 2d 2d 2d 0d 0a 31 34 31 39 36 30 0d 0a 35 34 36  ---..141960..546
14eb0 30 30 0d 0a 37 30 39 38 30 0d 0a 0d 0a 6f 6e 6c  00..70980....onl
14ec0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
14ed0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
14ee0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
14ef0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
14f00 72 74 20 6c 61 62 65 6c 2d 35 38 37 0d 0a 53 45  rt label-587..SE
14f10 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
14f20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 30 20  col0 DIV + col0 
14f30 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
14f40 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
14f50 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73  .-1..-1..-1....s
14f60 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
14f70 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
14f80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
14f90 62 65 6c 2d 35 38 37 0d 0a 53 45 4c 45 43 54 20  bel-587..SELECT 
14fa0 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL - cor0.col0 
14fb0 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  / + col0 AS col1
14fc0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
14fd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
14fe0 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-1....query I 
14ff0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15000 2b 20 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  + 2 * col0 FROM 
15010 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
15020 2d 2d 0d 0a 31 37 38 0d 0a 34 38 0d 0a 37 30 0d  --..178..48..70.
15030 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
15040 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
15050 20 35 35 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f   55 * col0 AS co
15060 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
15070 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 35 0d  cor0..----..385.
15080 0a 34 32 39 30 0d 0a 34 33 34 35 0d 0a 0d 0a 71  .4290..4345....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 33 39 20 2b 20 2d 20 63 6f 6c 32 20  + - 39 + - col2 
150c0 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + + col0 FROM ta
150d0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
150e0 33 32 0d 0a 2d 35 35 0d 0a 2d 39 30 0d 0a 0d 0a  32..-55..-90....
150f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15100 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
15110 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63   cor0.col1 * + c
15120 6f 6c 30 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 28  ol0 + col2 - + (
15130 20 63 6f 6c 32 20 29 20 2a 20 2b 20 38 20 2a 20   col2 ) * + 8 * 
15140 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
15150 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
15160 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 33 36 0d 0a 31  ..----..10036..1
15170 32 39 33 33 0d 0a 36 30 37 36 0d 0a 0d 0a 73 6b  2933..6076....sk
15180 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
15190 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
151a0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
151b0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
151c0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
151d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
151e0 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  LL + - col1 * co
151f0 6c 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l2 - - cor0.col0
15200 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
15210 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
15220 31 34 35 36 0d 0a 2d 35 36 37 0d 0a 2d 38 33 30  1456..-567..-830
15230 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15240 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
15250 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  INCT + cor0.col1
15260 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
15270 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
15280 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor1..----..10
15290 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72  ..13..26....quer
152a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
152b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
152c0 20 36 33 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20   63 - col2 FROM 
152d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
152e0 2d 2d 0d 0a 2d 31 31 37 0d 0a 2d 31 32 30 0d 0a  --..-117..-120..
152f0 2d 31 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -159....onlyif m
15300 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
15310 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
15320 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
15330 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
15340 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
15350 2d 35 39 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -595..SELECT ALL
15360 20 63 6f 6c 30 20 2b 20 43 41 53 54 28 20 63 6f   col0 + CAST( co
15370 72 30 2e 63 6f 6c 32 20 41 53 20 53 49 47 4e 45  r0.col2 AS SIGNE
15380 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  D ) AS col0 FROM
15390 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
153a0 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37  ---..171..36..57
153b0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
153c0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
153d0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
153e0 72 74 20 6c 61 62 65 6c 2d 35 39 35 0d 0a 53 45  rt label-595..SE
153f0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20  LECT ALL col0 + 
15400 43 41 53 54 20 28 20 63 6f 72 30 2e 63 6f 6c 32  CAST ( cor0.col2
15410 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
15420 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
15430 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
15440 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 71 75  71..36..57....qu
15450 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15460 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
15470 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + - col1 * + co
15480 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
15490 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d  0..----..-110..-
154a0 31 38 32 0d 0a 2d 37 30 32 0d 0a 0d 0a 71 75 65  182..-702....que
154b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
154c0 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  LECT + col2 * - 
154d0 63 6f 6c 32 20 2b 20 2b 20 39 36 20 2a 20 2d 20  col2 + + 96 * - 
154e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
154f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
15500 38 34 33 32 0d 0a 2d 38 31 30 30 0d 0a 2d 38 37  8432..-8100..-87
15510 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  21....query I ro
15520 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
15530 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 31 37  STINCT col1 * 17
15540 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
15550 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
15560 0d 0a 31 30 30 33 0d 0a 32 38 39 0d 0a 35 32 37  ..1003..289..527
15570 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15580 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
15590 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32  r0.col0 + + col2
155a0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
155b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
155c0 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a  ..121..176..57..
155d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
155e0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
155f0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
15600 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
15610 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30  rowsort label-60
15620 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  0..SELECT ALL + 
15630 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31 20  col2 DIV + col1 
15640 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
15650 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
15660 0a 30 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..2....skipif 
15670 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
15680 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
15690 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
156a0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
156b0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
156c0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
156d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
156e0 20 6c 61 62 65 6c 2d 36 30 30 0d 0a 53 45 4c 45   label-600..SELE
156f0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2f 20  CT ALL + col2 / 
15700 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  + col1 col0 FROM
15710 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
15720 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 32 0d 0a 0d 0a  ---..0..0..2....
15730 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
15740 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
15750 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
15760 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
15770 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
15780 72 74 20 6c 61 62 65 6c 2d 36 30 31 0d 0a 53 45  rt label-601..SE
15790 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
157a0 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 4e 55 4c  col1 + CAST( NUL
157b0 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 63 6f  L AS SIGNED ) co
157c0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
157d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
157e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
157f0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
15800 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
15810 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
15820 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
15830 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
15840 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
15850 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
15860 6c 2d 36 30 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-601..SELECT DI
15870 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
15880 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
15890 4e 54 45 47 45 52 20 29 20 63 6f 6c 31 20 46 52  NTEGER ) col1 FR
158a0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
158b0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
158c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
158d0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
158e0 2a 20 35 35 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  * 55 * + cor0.co
158f0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
15900 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
15910 2d 2d 0d 0a 33 35 35 33 30 0d 0a 34 36 30 33 35  --..35530..46035
15920 0d 0a 38 34 33 37 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..84370....onlyi
15930 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
15940 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
15950 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
15960 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
15970 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
15980 62 65 6c 2d 36 30 33 0d 0a 53 45 4c 45 43 54 20  bel-603..SELECT 
15990 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 43 41 53  ALL - col0 + CAS
159a0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
159b0 44 20 29 20 2a 20 2b 20 32 31 20 46 52 4f 4d 20  D ) * + 21 FROM 
159c0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
159d0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
159e0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
159f0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
15a00 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
15a10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30 33  owsort label-603
15a20 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
15a30 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ol0 + CAST ( NUL
15a40 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
15a50 20 2b 20 32 31 20 46 52 4f 4d 20 74 61 62 32 20   + 21 FROM tab2 
15a60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
15a70 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
15a80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
15a90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
15aa0 20 37 34 20 2a 20 36 34 20 46 52 4f 4d 20 74 61   74 * 64 FROM ta
15ab0 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b2, tab0 AS cor0
15ac0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
15ad0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
15ae0 68 61 73 68 69 6e 67 20 74 6f 20 33 34 30 66 39  hashing to 340f9
15af0 61 63 39 37 64 33 66 33 35 65 62 61 33 31 31 31  ac97d3f35eba3111
15b00 62 31 66 33 66 61 39 66 33 35 61 0d 0a 0d 0a 71  b1f3fa9f35a....q
15b10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15b20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
15b30 2d 20 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  - 7 AS col1 FROM
15b40 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d   tab0..----..-7.
15b50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
15b60 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
15b70 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 74 61 62  NCT + col1 * tab
15b80 32 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  2.col0 + + col1 
15b90 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
15ba0 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32  2..----..1360..2
15bb0 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 73 6b 69 70  48..4661....skip
15bc0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
15bd0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
15be0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
15bf0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
15c00 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
15c10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
15c20 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a   - col1 + col0 *
15c30 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20   col2 col2 FROM 
15c40 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d  tab2..----..158.
15c50 0a 31 39 36 39 0d 0a 32 39 38 35 0d 0a 0d 0a 71  .1969..2985....q
15c60 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
15c70 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
15c80 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 28  tab2 WHERE NOT (
15c90 20 4e 55 4c 4c 20 29 20 49 4e 20 28 20 63 6f 6c   NULL ) IN ( col
15ca0 30 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  0 + + col1 + col
15cb0 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  0 )..----....que
15cc0 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
15cd0 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
15ce0 62 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 4e 4f  b0 WHERE NULL NO
15cf0 54 20 49 4e 20 28 20 63 6f 6c 30 20 2d 20 2b 20  T IN ( col0 - + 
15d00 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 29 0d  col2 * - col1 ).
15d10 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69 66 20  .----....skipif 
15d20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
15d30 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
15d40 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
15d50 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
15d60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15d70 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
15d80 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  CT - col2 * col2
15d90 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 74   + tab1.col0 + t
15da0 61 62 31 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52  ab1.col2 col1 FR
15db0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
15dc0 32 38 35 39 0d 0a 2d 33 31 32 38 0d 0a 2d 39 30  2859..-3128..-90
15dd0 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  40....skipif pos
15de0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
15df0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
15e00 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
15e10 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
15e20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15e30 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20  SELECT col0 * - 
15e40 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 63 6f  col2 * - col0 co
15e50 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
15e60 2d 2d 0d 0a 32 33 33 34 37 32 0d 0a 34 38 36 0d  --..233472..486.
15e70 0a 36 31 34 34 30 30 0d 0a 0d 0a 71 75 65 72 79  .614400....query
15e80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15e90 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41  CT col1 * col1 A
15ea0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
15eb0 20 57 48 45 52 45 20 63 6f 6c 31 20 2f 20 63 6f   WHERE col1 / co
15ec0 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  l0 + + col1 * co
15ed0 6c 32 20 4e 4f 54 20 42 45 54 57 45 45 4e 20 28  l2 NOT BETWEEN (
15ee0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 29   - col1 + col1 )
15ef0 20 41 4e 44 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d   AND col0..----.
15f00 0a 32 38 39 0d 0a 33 34 38 31 0d 0a 39 36 31 0d  .289..3481..961.
15f10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
15f20 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
15f30 4e 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20  NCT - tab2.col2 
15f40 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  - col2 AS col0 F
15f50 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
15f60 2d 35 32 0d 0a 2d 35 34 0d 0a 2d 37 36 0d 0a 0d  -52..-54..-76...
15f70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15f80 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
15f90 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  + col1 + - col1 
15fa0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
15fb0 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 71  .26..27..38....q
15fc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15fd0 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 30 2e  SELECT ALL tab0.
15fe0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col0 * - col0 + 
15ff0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
16000 2d 2d 2d 2d 0d 0a 2d 31 31 39 30 0d 0a 2d 35 35  ----..-1190..-55
16010 32 0d 0a 2d 37 38 33 32 0d 0a 0d 0a 71 75 65 72  2..-7832....quer
16020 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16030 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74  ECT DISTINCT - t
16040 61 62 31 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  ab1.col1 * + col
16050 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  1 + col0 AS col0
16060 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
16070 0d 0a 2d 33 36 0d 0a 2d 36 37 33 0d 0a 2d 38 39  ..-36..-673..-89
16080 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16090 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
160a0 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 74 61  l1 * - col0 * ta
160b0 62 31 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30  b1.col1 + - col0
160c0 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   * col1 AS col0 
160d0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
160e0 0a 31 32 34 38 30 0d 0a 31 39 35 30 0d 0a 35 37  .12480..1950..57
160f0 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
16100 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
16110 53 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 30  STINCT tab1.col0
16120 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   * col1 AS col1 
16130 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
16140 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a  .1040..640..78..
16150 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16160 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
16170 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 46   * + tab2.col2 F
16180 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e  ROM tab2 WHERE N
16190 4f 54 20 4e 55 4c 4c 20 42 45 54 57 45 45 4e 20  OT NULL BETWEEN 
161a0 28 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 29 20  ( col1 * col1 ) 
161b0 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a  AND NULL..----..
161c0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
161d0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
161e0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
161f0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
16200 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32  rowsort label-62
16210 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
16220 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31  CT col2 * - col1
16230 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   * - col2 + col1
16240 20 44 49 56 20 2b 20 63 6f 6c 32 20 46 52 4f 4d   DIV + col2 FROM
16250 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   tab1..----..119
16260 38 30 38 0d 0a 33 32 34 39 30 0d 0a 37 35 38 31  808..32490..7581
16270 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
16280 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
16290 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
162a0 6f 72 74 20 6c 61 62 65 6c 2d 36 32 30 0d 0a 53  ort label-620..S
162b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
162c0 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2d  ol2 * - col1 * -
162d0 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20 2b   col2 + col1 / +
162e0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
162f0 0a 2d 2d 2d 2d 0d 0a 31 31 39 38 30 38 0d 0a 33  .----..119808..3
16300 32 34 39 30 0d 0a 37 35 38 31 36 0d 0a 0d 0a 71  2490..75816....q
16310 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16320 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
16330 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
16340 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 55 4c  M tab2 WHERE NUL
16350 4c 20 3e 20 2b 20 63 6f 6c 32 0d 0a 2d 2d 2d 2d  L > + col2..----
16360 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
16370 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
16380 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
16390 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
163a0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
163b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
163c0 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 74 61  LECT + col1 + ta
163d0 62 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 63  b0.col2 * col2 c
163e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
163f0 2d 2d 2d 0d 0a 31 31 37 35 0d 0a 36 38 31 35 0d  ---..1175..6815.
16400 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .98....query I r
16410 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
16420 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 46  ISTINCT - col1 F
16430 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 28  ROM tab1 WHERE (
16440 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 29   + col1 + col1 )
16450 20 3d 20 28 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   = ( col1 * + co
16460 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l0 )..----....qu
16470 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16480 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63  ELECT col1 + - c
16490 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 + col1 FROM 
164a0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d  tab2..----..-45.
164b0 0a 34 30 0d 0a 35 35 0d 0a 0d 0a 6f 6e 6c 79 69  .40..55....onlyi
164c0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
164d0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
164e0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
164f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16500 20 6c 61 62 65 6c 2d 36 32 35 0d 0a 53 45 4c 45   label-625..SELE
16510 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
16520 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20  l1 + - col2 DIV 
16530 74 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab1.col2 AS col
16540 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
16550 2d 0d 0a 31 32 0d 0a 32 35 0d 0a 39 0d 0a 0d 0a  -..12..25..9....
16560 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
16570 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
16580 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16590 61 62 65 6c 2d 36 32 35 0d 0a 53 45 4c 45 43 54  abel-625..SELECT
165a0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
165b0 20 2b 20 2d 20 63 6f 6c 32 20 2f 20 74 61 62 31   + - col2 / tab1
165c0 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52  .col2 AS col0 FR
165d0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
165e0 32 0d 0a 32 35 0d 0a 39 0d 0a 0d 0a 71 75 65 72  2..25..9....quer
165f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16600 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  ECT + col0 + col
16610 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 * + col2 AS co
16620 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
16630 2d 2d 0d 0a 31 36 31 32 0d 0a 37 32 35 0d 0a 38  --..1612..725..8
16640 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  44....onlyif mys
16650 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
16660 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
16670 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
16680 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
16690 6c 2d 36 32 37 0d 0a 53 45 4c 45 43 54 20 63 6f  l-627..SELECT co
166a0 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  l1 + - col0 * co
166b0 72 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30  r0.col2 DIV col0
166c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
166d0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
166e0 32 31 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a 73 6b 69  21..33..4....ski
166f0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
16700 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
16710 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
16720 6c 2d 36 32 37 0d 0a 53 45 4c 45 43 54 20 63 6f  l-627..SELECT co
16730 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  l1 + - col0 * co
16740 72 30 2e 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 41  r0.col2 / col0 A
16750 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
16760 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   cor0..----..-21
16770 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79  ..33..4....query
16780 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16790 43 54 20 41 4c 4c 20 2d 20 37 32 20 2b 20 2d 20  CT ALL - 72 + - 
167a0 34 35 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  45 FROM tab2..--
167b0 2d 2d 0d 0a 2d 31 31 37 0d 0a 2d 31 31 37 0d 0a  --..-117..-117..
167c0 2d 31 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -117....query I 
167d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
167e0 2d 20 63 6f 6c 31 20 2b 20 36 32 20 2b 20 2b 20  - col1 + 62 + + 
167f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
16800 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 35 33 0d 0a 39  ----..-34..53..9
16810 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16820 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
16830 49 4e 43 54 20 2b 20 31 38 20 2b 20 63 6f 6c 30  INCT + 18 + col0
16840 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
16850 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
16860 0a 31 37 34 0d 0a 31 37 36 0d 0a 33 32 0d 0a 0d  .174..176..32...
16870 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16880 0d 0a 53 45 4c 45 43 54 20 32 39 20 2a 20 2d 20  ..SELECT 29 * - 
16890 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
168a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
168b0 35 36 36 0d 0a 2d 31 36 35 33 0d 0a 2d 32 37 38  566..-1653..-278
168c0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
168d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
168e0 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b   col2 * col0 + +
168f0 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   ( col1 ) AS col
16900 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
16910 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 37 0d  or0..----..2087.
16920 0a 32 32 30 0d 0a 33 30 31 39 0d 0a 0d 0a 71 75  .220..3019....qu
16930 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16940 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b  ELECT + + col1 +
16950 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f   - col1 + + ( co
16960 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
16970 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
16980 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36  ----..10..13..26
16990 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
169a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 20 2a 20  ort..SELECT 6 * 
169b0 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col1 * col1 FROM
169c0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34 33   tab0..----..443
169d0 37 36 0d 0a 34 39 36 38 36 0d 0a 35 36 34 35 34  76..49686..56454
169e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
169f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
16a00 2d 20 32 31 20 2b 20 28 20 2d 20 63 6f 6c 32 20  - 21 + ( - col2 
16a10 2a 20 28 20 63 6f 6c 30 20 29 20 29 20 46 52 4f  * ( col0 ) ) FRO
16a20 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  M tab0..----..-5
16a30 36 0d 0a 2d 37 33 31 39 0d 0a 2d 38 31 33 0d 0a  6..-7319..-813..
16a40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16a50 74 0d 0a 53 45 4c 45 43 54 20 28 20 74 61 62 32  t..SELECT ( tab2
16a60 2e 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62  .col0 ) FROM tab
16a70 32 2c 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  2, tab0, tab1 AS
16a80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
16a90 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
16aa0 6f 20 31 65 31 66 31 30 39 35 33 65 62 38 65 66  o 1e1f10953eb8ef
16ab0 66 65 39 62 32 30 65 37 34 36 66 38 61 37 66 64  fe9b20e746f8a7fd
16ac0 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  83....skipif pos
16ad0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
16ae0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
16af0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
16b00 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
16b10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16b20 53 45 4c 45 43 54 20 2d 20 31 34 20 63 6f 6c 30  SELECT - 14 col0
16b30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
16b40 0d 0a 2d 31 34 0d 0a 2d 31 34 0d 0a 2d 31 34 0d  ..-14..-14..-14.
16b50 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
16b60 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
16b70 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
16b80 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
16b90 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
16ba0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16bb0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
16bc0 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52  or0.col2 col2 FR
16bd0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 20  OM tab1 AS cor0 
16be0 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20  CROSS JOIN tab0 
16bf0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor1..----..5
16c00 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65  4..57..96....que
16c10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16c20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
16c30 63 6f 6c 30 20 29 20 2a 20 37 37 20 46 52 4f 4d  col0 ) * 77 FROM
16c40 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
16c50 2d 2d 2d 0d 0a 31 38 34 38 0d 0a 32 36 39 35 0d  ---..1848..2695.
16c60 0a 36 38 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .6853....onlyif 
16c70 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
16c80 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
16c90 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
16ca0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16cb0 61 62 65 6c 2d 36 34 30 0d 0a 53 45 4c 45 43 54  abel-640..SELECT
16cc0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63   cor0.col1 + - c
16cd0 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2b 20 39  or0.col0 DIV + 9
16ce0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
16cf0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
16d00 0a 31 33 0d 0a 31 38 0d 0a 35 32 0d 0a 0d 0a 73  .13..18..52....s
16d10 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
16d20 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
16d30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
16d40 62 65 6c 2d 36 34 30 0d 0a 53 45 4c 45 43 54 20  bel-640..SELECT 
16d50 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f  cor0.col1 + - co
16d60 72 30 2e 63 6f 6c 30 20 2f 20 2b 20 39 20 2b 20  r0.col0 / + 9 + 
16d70 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
16d80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
16d90 0d 0a 31 38 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72  ..18..52....quer
16da0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16db0 45 43 54 20 41 4c 4c 20 2b 20 32 33 20 2a 20 63  ECT ALL + 23 * c
16dc0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
16dd0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
16de0 0d 0a 31 38 38 36 0d 0a 32 33 0d 0a 37 35 39 0d  ..1886..23..759.
16df0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
16e00 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
16e10 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
16e20 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
16e30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
16e40 34 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  42..SELECT DISTI
16e50 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  NCT + col2 * col
16e60 30 20 2b 20 28 20 63 6f 6c 31 20 29 20 44 49 56  0 + ( col1 ) DIV
16e70 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f   + col1 col2 FRO
16e80 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
16e90 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37 32 39 39 0d 0a  ----..36..7299..
16ea0 37 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  793....skipif po
16eb0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
16ec0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
16ed0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
16ee0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
16ef0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
16f00 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
16f10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16f20 61 62 65 6c 2d 36 34 32 0d 0a 53 45 4c 45 43 54  abel-642..SELECT
16f30 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
16f40 20 2a 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 31   * col0 + ( col1
16f50 20 29 20 2f 20 2b 20 63 6f 6c 31 20 63 6f 6c 32   ) / + col1 col2
16f60 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
16f70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37 32  r0..----..36..72
16f80 39 39 0d 0a 37 39 33 0d 0a 0d 0a 71 75 65 72 79  99..793....query
16f90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16fa0 43 54 20 2b 20 37 33 20 2b 20 63 6f 6c 31 20 2b  CT + 73 + col1 +
16fb0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
16fc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
16fd0 38 33 0d 0a 32 30 35 0d 0a 32 35 33 0d 0a 0d 0a  83..205..253....
16fe0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
16ff0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
17000 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
17010 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
17020 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 34 0d  wsort label-644.
17030 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44  .SELECT + col0 D
17040 49 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a  IV col1 + col1 *
17050 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 46   col2 + - col0 F
17060 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
17070 31 31 37 34 0d 0a 31 34 30 31 0d 0a 35 31 32 0d  1174..1401..512.
17080 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
17090 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
170a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
170b0 74 20 6c 61 62 65 6c 2d 36 34 34 0d 0a 53 45 4c  t label-644..SEL
170c0 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c  ECT + col0 / col
170d0 31 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  1 + col1 * col2 
170e0 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
170f0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 34 0d 0a  b1..----..1174..
17100 31 34 30 31 0d 0a 35 31 32 0d 0a 0d 0a 71 75 65  1401..512....que
17110 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17120 4c 45 43 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f  LECT ALL tab2.co
17130 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  l1 + col0 + col1
17140 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
17150 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31  b2..----..113..1
17160 39 36 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20  96..69....query 
17170 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17180 54 20 2d 20 31 30 20 46 52 4f 4d 20 74 61 62 31  T - 10 FROM tab1
17190 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab0 cor0..---
171a0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
171b0 69 6e 67 20 74 6f 20 66 36 38 66 33 33 30 33 32  ing to f68f33032
171c0 38 34 36 65 32 31 65 65 36 62 32 63 36 36 38 66  846e21ee6b2c668f
171d0 63 31 30 33 35 35 65 0d 0a 0d 0a 71 75 65 72 79  c10355e....query
171e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
171f0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
17200 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30 20 46 52  col1 - + col0 FR
17210 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
17220 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d  --..-137..-38..-
17230 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
17240 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
17250 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  L + cor0.col2 + 
17260 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col0 * cor0.col2
17270 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
17280 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34 0d 0a  r0..----..2054..
17290 32 31 36 0d 0a 33 30 34 30 0d 0a 0d 0a 71 75 65  216..3040....que
172a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
172b0 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  LECT + col2 * - 
172c0 28 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20  ( col0 ) * col1 
172d0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
172e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32  0..----..-119652
172f0 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35 38 35 39 0d  ..-51034..-5859.
17300 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17310 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
17320 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63   - col2 * cor0.c
17330 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 * - col0 AS 
17340 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
17350 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30  or0..----..36480
17360 0d 0a 34 32 31 32 0d 0a 39 39 38 34 30 0d 0a 0d  ..4212..99840...
17370 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
17380 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
17390 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
173a0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
173b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 31  owsort label-651
173c0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
173d0 44 49 56 20 2b 20 28 20 39 33 20 29 20 46 52 4f  DIV + ( 93 ) FRO
173e0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab2..----..0.
173f0 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
17400 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
17410 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
17420 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35  rowsort label-65
17430 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  1..SELECT + col0
17440 20 2f 20 2b 20 28 20 39 33 20 29 20 46 52 4f 4d   / + ( 93 ) FROM
17450 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
17460 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
17470 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17480 41 4c 4c 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20  ALL + tab0.col2 
17490 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
174a0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
174b0 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 71  171..36..57....q
174c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
174d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
174e0 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 33 35 20  + + col0 * - 35 
174f0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
17500 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
17510 2d 2d 2d 0d 0a 2d 31 31 32 38 0d 0a 2d 33 30 32  ---..-1128..-302
17520 34 0d 0a 2d 37 35 34 0d 0a 0d 0a 6f 6e 6c 79 69  4..-754....onlyi
17530 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
17540 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
17550 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
17560 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
17570 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17580 62 65 6c 2d 36 35 34 0d 0a 53 45 4c 45 43 54 20  bel-654..SELECT 
17590 2d 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28  - col2 * - CAST(
175a0 20 2d 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45   - col2 AS SIGNE
175b0 44 20 29 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20  D ) - + col0 AS 
175c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
175d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
175e0 35 32 33 0d 0a 2d 37 33 36 0d 0a 2d 37 35 34 0d  523..-736..-754.
175f0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
17600 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
17610 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17620 74 20 6c 61 62 65 6c 2d 36 35 34 0d 0a 53 45 4c  t label-654..SEL
17630 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 43  ECT - col2 * - C
17640 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 41 53 20  AST ( - col2 AS 
17650 49 4e 54 45 47 45 52 20 29 20 2d 20 2b 20 63 6f  INTEGER ) - + co
17660 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
17670 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
17680 2d 2d 0d 0a 2d 31 35 32 33 0d 0a 2d 37 33 36 0d  --..-1523..-736.
17690 0a 2d 37 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-754....onlyif 
176a0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
176b0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
176c0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
176d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
176e0 61 62 65 6c 2d 36 35 35 0d 0a 53 45 4c 45 43 54  abel-655..SELECT
176f0 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32   + col0 + + col2
17700 20 2b 20 63 6f 6c 32 20 44 49 56 20 34 34 20 41   + col2 DIV 44 A
17710 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
17720 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17730 31 37 32 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 73  172..36..57....s
17740 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
17750 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
17760 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17770 62 65 6c 2d 36 35 35 0d 0a 53 45 4c 45 43 54 20  bel-655..SELECT 
17780 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  + col0 + + col2 
17790 2b 20 63 6f 6c 32 20 2f 20 34 34 20 41 53 20 63  + col2 / 44 AS c
177a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
177b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32   cor0..----..172
177c0 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72  ..36..57....quer
177d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
177e0 45 43 54 20 41 4c 4c 20 2d 20 37 37 20 2a 20 2d  ECT ALL - 77 * -
177f0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
17800 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
17810 0a 2d 2d 2d 2d 0d 0a 31 33 30 39 0d 0a 32 33 38  .----..1309..238
17820 37 0d 0a 34 35 34 33 0d 0a 0d 0a 73 6b 69 70 69  7..4543....skipi
17830 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
17840 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
17850 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
17860 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
17870 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
17880 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
17890 49 4e 43 54 20 2b 20 28 20 2b 20 63 6f 6c 30 20  INCT + ( + col0 
178a0 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  ) col2 FROM tab1
178b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
178c0 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65  3..64..80....que
178d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
178e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
178f0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20  + cor0.col2 * - 
17900 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 72 30 2e  ( col2 ) * cor0.
17910 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
17920 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
17930 2d 0d 0a 31 0d 0a 33 35 39 33 37 0d 0a 35 35 31  -..1..35937..551
17940 33 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  368....query I r
17950 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
17960 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63   col1 * col0 + c
17970 6f 6c 30 20 2b 20 37 36 20 46 52 4f 4d 20 74 61  ol0 + 76 FROM ta
17980 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
17990 0d 0a 31 34 39 38 0d 0a 33 30 30 0d 0a 34 37 35  ..1498..300..475
179a0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
179b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 37 20  sort..SELECT 37 
179c0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
179d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
179e0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 31 0d 0a 33 30  ..----..1221..30
179f0 33 34 0d 0a 33 37 0d 0a 0d 0a 71 75 65 72 79 20  34..37....query 
17a00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17a10 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  T + col2 * - col
17a20 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
17a30 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 34  ab2..----..-1444
17a40 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d 0a 0d 0a  ..-676..-729....
17a50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17a60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
17a70 37 36 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  76 ) FROM tab1 A
17a80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
17a90 36 0d 0a 2d 37 36 0d 0a 2d 37 36 0d 0a 0d 0a 71  6..-76..-76....q
17aa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17ab0 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 30 20  SELECT - ( col0 
17ac0 29 20 2a 20 63 6f 6c 32 20 2a 20 28 20 2b 20 63  ) * col2 * ( + c
17ad0 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 31 20 46  ol0 ) + - col1 F
17ae0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
17af0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 32 0d 0a 2d  ..----..-1322..-
17b00 31 39 30 39 34 0d 0a 2d 36 34 39 36 31 33 0d 0a  19094..-649613..
17b10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17b20 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 36 20 2b  t..SELECT - 76 +
17b30 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
17b40 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
17b50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 37 0d 0a 2d  0..----..-107..-
17b60 31 33 35 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72  135..-93....quer
17b70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17b80 45 43 54 20 41 4c 4c 20 2b 20 38 34 20 46 52 4f  ECT ALL + 84 FRO
17b90 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74 61  M tab0, tab2, ta
17ba0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
17bb0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
17bc0 69 6e 67 20 74 6f 20 65 38 63 64 36 38 33 66 65  ing to e8cd683fe
17bd0 38 63 65 61 37 37 62 34 33 32 36 64 39 62 38 30  8cea77b4326d9b80
17be0 66 32 31 63 37 34 61 0d 0a 0d 0a 6f 6e 6c 79 69  f21c74a....onlyi
17bf0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
17c00 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
17c10 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
17c20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17c30 20 6c 61 62 65 6c 2d 36 36 36 0d 0a 53 45 4c 45   label-666..SELE
17c40 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
17c50 6c 31 20 44 49 56 20 2b 20 28 20 2b 20 63 6f 6c  l1 DIV + ( + col
17c60 31 20 29 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 28  1 ) + col2 * + (
17c70 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   + col0 ) AS col
17c80 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
17c90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 0d 0a  or0..----..161..
17ca0 33 36 34 37 0d 0a 37 36 37 39 0d 0a 0d 0a 73 6b  3647..7679....sk
17cb0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
17cc0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
17cd0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
17ce0 65 6c 2d 36 36 36 0d 0a 53 45 4c 45 43 54 20 44  el-666..SELECT D
17cf0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2f  ISTINCT - col1 /
17d00 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20   + ( + col1 ) + 
17d10 63 6f 6c 32 20 2a 20 2b 20 28 20 2b 20 63 6f 6c  col2 * + ( + col
17d20 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
17d30 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
17d40 2d 2d 2d 0d 0a 31 36 31 0d 0a 33 36 34 37 0d 0a  ---..161..3647..
17d50 37 36 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7679....query I 
17d60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17d70 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 28  ALL + col0 + - (
17d80 20 2d 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   - col2 ) AS col
17d90 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
17da0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a  or0..----..121..
17db0 31 37 36 0d 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79 69  176..57....onlyi
17dc0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
17dd0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
17de0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
17df0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
17e00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17e10 62 65 6c 2d 36 36 38 0d 0a 53 45 4c 45 43 54 20  bel-668..SELECT 
17e20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
17e30 2b 20 43 41 53 54 28 20 2d 20 35 38 20 41 53 20  + CAST( - 58 AS 
17e40 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
17e50 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
17e60 0d 0a 2d 36 38 0d 0a 2d 37 31 0d 0a 2d 38 34 0d  ..-68..-71..-84.
17e70 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
17e80 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
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 36 38 0d 0a 53 45 4c  t label-668..SEL
17eb0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
17ec0 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 2d 20 35  ol1 + CAST ( - 5
17ed0 38 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  8 AS INTEGER ) F
17ee0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
17ef0 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 38 0d 0a 2d 37 31  ..----..-68..-71
17f00 0d 0a 2d 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-84....query I
17f10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17f20 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a 20   ALL + - col1 * 
17f30 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31  ( col0 ) AS col1
17f40 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
17f50 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33  .----..-2064..-3
17f60 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75  395..-8099....qu
17f70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17f80 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
17f90 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 * col1 AS col
17fa0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
17fb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d  or0..----..-289.
17fc0 0a 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a  .-3481..-961....
17fd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17fe0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 35 20 46  .SELECT ALL 45 F
17ff0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
18000 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
18010 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
18020 6f 20 36 30 62 39 66 39 33 35 65 65 38 65 34 30  o 60b9f935ee8e40
18030 34 64 31 35 35 61 32 66 35 65 39 35 31 35 63 30  4d155a2f5e9515c0
18040 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  50....query I ro
18050 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
18060 53 54 49 4e 43 54 20 63 6f 6c 30 20 2d 20 28 20  STINCT col0 - ( 
18070 28 20 2b 20 63 6f 6c 32 20 29 20 2b 20 35 31 20  ( + col2 ) + 51 
18080 2a 20 2d 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  * - col0 ) FROM 
18090 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d  tab1..----..102.
180a0 0a 33 32 37 31 0d 0a 34 30 36 34 0d 0a 0d 0a 71  .3271..4064....q
180b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
180c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
180d0 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20  - col1 + + col1 
180e0 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  * - cor0.col0 FR
180f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
18100 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 30  .----..-104..-10
18110 35 33 0d 0a 2d 36 35 30 0d 0a 0d 0a 71 75 65 72  53..-650....quer
18120 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18130 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 34 34 20  ECT col2 + + 44 
18140 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
18150 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
18160 0d 0a 2d 2d 2d 2d 0d 0a 33 37 0d 0a 36 30 0d 0a  ..----..37..60..
18170 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  95....query I ro
18180 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
18190 63 6f 6c 31 20 2b 20 2b 20 34 34 20 46 52 4f 4d  col1 + + 44 FROM
181a0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
181b0 0d 0a 35 34 0d 0a 35 37 0d 0a 37 30 0d 0a 0d 0a  ..54..57..70....
181c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
181d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
181e0 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f   tab2.col1 AS co
181f0 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
18200 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
18210 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65  7..31..59....que
18220 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18230 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
18240 35 32 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41  52 - cor0.col2 A
18250 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
18260 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
18270 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 34 34 0d 0a 2d  ----..-2..-44..-
18280 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
18290 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
182a0 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 38 39 20 46   - col2 * - 89 F
182b0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
182c0 32 39 33 37 0d 0a 37 32 39 38 0d 0a 38 39 0d 0a  2937..7298..89..
182d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
182e0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
182f0 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 28 20  tab1.col1 * - ( 
18300 74 61 62 31 2e 63 6f 6c 31 20 29 20 41 53 20 63  tab1.col1 ) AS c
18310 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
18320 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a 36  ---..100..169..6
18330 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
18340 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
18350 37 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  76 AS col0 FROM 
18360 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
18370 2d 2d 0d 0a 2d 37 36 0d 0a 2d 37 36 0d 0a 2d 37  --..-76..-76..-7
18380 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
18390 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
183a0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63   col0 * + cor0.c
183b0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
183c0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
183d0 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35 37 36 0d 0a  ---..1225..576..
183e0 37 39 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7921....onlyif m
183f0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
18400 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
18410 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
18420 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
18430 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
18440 2d 36 38 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -682..SELECT - -
18450 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 2b 20   ( + col1 ) * + 
18460 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
18470 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
18480 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18490 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
184a0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
184b0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
184c0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
184d0 72 74 20 6c 61 62 65 6c 2d 36 38 32 0d 0a 53 45  rt label-682..SE
184e0 4c 45 43 54 20 2d 20 2d 20 28 20 2b 20 63 6f 6c  LECT - - ( + col
184f0 31 20 29 20 2a 20 2b 20 43 41 53 54 20 28 20 4e  1 ) * + CAST ( N
18500 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
18510 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
18520 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
18530 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e  NULL..NULL....on
18540 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
18550 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
18560 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
18570 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
18580 6f 72 74 20 6c 61 62 65 6c 2d 36 38 33 0d 0a 53  ort label-683..S
18590 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20  ELECT cor0.col1 
185a0 44 49 56 20 63 6f 6c 30 20 2b 20 43 41 53 54 28  DIV col0 + CAST(
185b0 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20   col0 AS SIGNED 
185c0 29 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ) * - col1 AS co
185d0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
185e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34  cor0..----..-134
185f0 33 0d 0a 2d 32 31 33 0d 0a 2d 34 36 30 32 0d 0a  3..-213..-4602..
18600 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
18610 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
18620 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18630 20 6c 61 62 65 6c 2d 36 38 33 0d 0a 53 45 4c 45   label-683..SELE
18640 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63  CT cor0.col1 / c
18650 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 63 6f 6c  ol0 + CAST ( col
18660 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  0 AS INTEGER ) *
18670 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
18680 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
18690 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a  0..----..-1343..
186a0 2d 32 31 33 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71  -213..-4602....q
186b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
186c0 53 45 4c 45 43 54 20 2d 20 32 32 20 2b 20 2d 20  SELECT - 22 + - 
186d0 63 6f 6c 32 20 2a 20 34 34 20 41 53 20 63 6f 6c  col2 * 44 AS col
186e0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
186f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 34  or0..----..-1474
18700 0d 0a 2d 33 36 33 30 0d 0a 2d 36 36 0d 0a 0d 0a  ..-3630..-66....
18710 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18720 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
18730 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2a   col0 * + col2 *
18740 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
18750 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 35 32 0d 0a 35  .----..119652..5
18760 31 30 33 34 0d 0a 35 38 35 39 0d 0a 0d 0a 71 75  1034..5859....qu
18770 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18780 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30  ELECT ALL - cor0
18790 2e 63 6f 6c 32 20 2a 20 2b 20 38 31 20 46 52 4f  .col2 * + 81 FRO
187a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43  M tab0 AS cor0 C
187b0 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41  ROSS JOIN tab1 A
187c0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor1..----..9 
187d0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
187e0 6f 20 63 39 31 30 38 62 35 62 64 37 34 62 65 65  o c9108b5bd74bee
187f0 30 64 32 35 65 31 32 32 66 36 37 64 65 62 33 33  0d25e122f67deb33
18800 31 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  1a....query I ro
18810 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
18820 53 54 49 4e 43 54 20 2d 20 2d 20 34 20 2b 20 2b  STINCT - - 4 + +
18830 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46   col0 * + col1 F
18840 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
18850 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 37 0d 0a 32 32  ..----..1347..22
18860 31 0d 0a 34 36 30 36 0d 0a 0d 0a 71 75 65 72 79  1..4606....query
18870 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18880 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20  CT ALL - + col1 
18890 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  - + col0 AS col0
188a0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
188b0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 38  .----..-137..-38
188c0 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-96....skipif 
188d0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
188e0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
188f0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
18900 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
18910 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18920 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
18930 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 63 6f  col1 + + col1 co
18940 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
18950 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
18960 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
18970 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
18980 20 2d 20 38 37 20 41 53 20 63 6f 6c 30 20 46 52   - 87 AS col0 FR
18990 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
189a0 0a 2d 2d 2d 2d 0d 0a 2d 38 37 0d 0a 2d 38 37 0d  .----..-87..-87.
189b0 0a 2d 38 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-87....onlyif m
189c0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
189d0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
189e0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
189f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
18a00 62 65 6c 2d 36 39 31 0d 0a 53 45 4c 45 43 54 20  bel-691..SELECT 
18a10 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 44 49  DISTINCT col1 DI
18a20 56 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20  V cor0.col2 + - 
18a30 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col2 + - cor0.co
18a40 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
18a50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
18a60 2d 2d 0d 0a 2d 31 37 30 0d 0a 2d 35 35 0d 0a 36  --..-170..-55..6
18a70 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
18a80 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
18a90 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
18aa0 6f 72 74 20 6c 61 62 65 6c 2d 36 39 31 0d 0a 53  ort label-691..S
18ab0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
18ac0 6f 6c 31 20 2f 20 63 6f 72 30 2e 63 6f 6c 32 20  ol1 / cor0.col2 
18ad0 2b 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72  + - col2 + - cor
18ae0 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  0.col0 AS col1 F
18af0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
18b00 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 30 0d 0a 2d 35  ..----..-170..-5
18b10 35 0d 0a 36 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  5..61....skipif 
18b20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
18b30 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
18b40 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
18b50 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
18b60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18b70 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
18b80 33 39 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 32  39 * - col0 col2
18b90 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
18ba0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 35 0d 0a  r0..----..1365..
18bb0 33 34 37 31 0d 0a 39 33 36 0d 0a 0d 0a 6f 6e 6c  3471..936....onl
18bc0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
18bd0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
18be0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
18bf0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
18c00 72 74 20 6c 61 62 65 6c 2d 36 39 33 0d 0a 53 45  rt label-693..SE
18c10 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
18c20 6c 30 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63  l0 DIV col2 AS c
18c30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
18c40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
18c50 31 0d 0a 33 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..35....skipif 
18c60 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
18c70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
18c80 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39  rowsort label-69
18c90 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
18ca0 43 54 20 63 6f 6c 30 20 2f 20 63 6f 6c 32 20 41  CT col0 / col2 A
18cb0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
18cc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18cd0 30 0d 0a 31 0d 0a 33 35 0d 0a 0d 0a 73 6b 69 70  0..1..35....skip
18ce0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
18cf0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
18d00 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
18d10 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
18d20 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
18d30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
18d40 54 49 4e 43 54 20 2b 20 38 37 20 63 6f 6c 31 20  TINCT + 87 col1 
18d50 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
18d60 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
18d70 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d   cor1..----..87.
18d80 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
18d90 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
18da0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
18db0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
18dc0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
18dd0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 35 0d  wsort label-695.
18de0 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30  .SELECT - + col0
18df0 20 2a 20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20   * - CAST( col1 
18e00 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
18e10 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
18e20 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d  ---..2064..3395.
18e30 0a 38 30 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  .8099....skipif 
18e40 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
18e50 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
18e60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39  rowsort label-69
18e70 35 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  5..SELECT - + co
18e80 6c 30 20 2a 20 2d 20 43 41 53 54 20 28 20 63 6f  l0 * - CAST ( co
18e90 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
18ea0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
18eb0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33  0..----..2064..3
18ec0 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 6f 6e 6c  395..8099....onl
18ed0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
18ee0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
18ef0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
18f00 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
18f10 72 74 20 6c 61 62 65 6c 2d 36 39 36 0d 0a 53 45  rt label-696..SE
18f20 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
18f30 2b 20 63 6f 6c 31 20 44 49 56 20 39 20 41 53 20  + col1 DIV 9 AS 
18f40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
18f50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
18f60 32 0d 0a 2d 35 36 0d 0a 2d 39 35 0d 0a 0d 0a 73  2..-56..-95....s
18f70 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
18f80 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
18f90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
18fa0 62 65 6c 2d 36 39 36 0d 0a 53 45 4c 45 43 54 20  bel-696..SELECT 
18fb0 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  ALL - col2 + col
18fc0 31 20 2f 20 39 20 41 53 20 63 6f 6c 30 20 46 52  1 / 9 AS col0 FR
18fd0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
18fe0 0a 2d 2d 2d 2d 0d 0a 2d 35 32 0d 0a 2d 35 36 0d  .----..-52..-56.
18ff0 0a 2d 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-95....query I 
19000 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19010 41 4c 4c 20 63 6f 6c 32 20 2b 20 28 20 2b 20 63  ALL col2 + ( + c
19020 6f 6c 30 20 2a 20 63 6f 6c 32 20 29 20 2b 20 38  ol0 * col2 ) + 8
19030 33 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  3 * + col0 AS co
19040 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
19050 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 36 37 0d 0a  0..----..14767..
19060 32 38 31 37 0d 0a 32 39 34 31 0d 0a 0d 0a 6f 6e  2817..2941....on
19070 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
19080 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
19090 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
190a0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
190b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
190c0 20 6c 61 62 65 6c 2d 36 39 38 0d 0a 53 45 4c 45   label-698..SELE
190d0 43 54 20 41 4c 4c 20 43 41 53 54 28 20 63 6f 6c  CT ALL CAST( col
190e0 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  0 AS SIGNED ) + 
190f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
19100 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
19110 0d 0a 31 35 36 0d 0a 31 35 38 0d 0a 0d 0a 73 6b  ..156..158....sk
19120 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
19130 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
19140 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
19150 65 6c 2d 36 39 38 0d 0a 53 45 4c 45 43 54 20 41  el-698..SELECT A
19160 4c 4c 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41  LL CAST ( col0 A
19170 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f  S INTEGER ) + co
19180 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
19190 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a  cor0..----..14..
191a0 31 35 36 0d 0a 31 35 38 0d 0a 0d 0a 6f 6e 6c 79  156..158....only
191b0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
191c0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
191d0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
191e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
191f0 74 20 6c 61 62 65 6c 2d 36 39 39 0d 0a 53 45 4c  t label-699..SEL
19200 45 43 54 20 2b 20 37 38 20 2a 20 2b 20 63 6f 72  ECT + 78 * + cor
19210 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  0.col2 + + col2 
19220 44 49 56 20 2d 20 28 20 63 6f 6c 30 20 29 20 46  DIV - ( col0 ) F
19230 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
19240 0d 0a 2d 2d 2d 2d 0d 0a 32 30 32 38 0d 0a 32 31  ..----..2028..21
19250 30 33 0d 0a 32 39 36 34 0d 0a 0d 0a 73 6b 69 70  03..2964....skip
19260 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
19270 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
19280 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
19290 2d 36 39 39 0d 0a 53 45 4c 45 43 54 20 2b 20 37  -699..SELECT + 7
192a0 38 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  8 * + cor0.col2 
192b0 2b 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 28 20 63  + + col2 / - ( c
192c0 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol0 ) FROM tab2 
192d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
192e0 30 32 38 0d 0a 32 31 30 33 0d 0a 32 39 36 34 0d  028..2103..2964.
192f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19300 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
19310 32 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63  2 * - col0 * + c
19320 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 28 20 63  ol0 + col0 * ( c
19330 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol0 ) AS col2 FR
19340 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
19350 0a 2d 2d 2d 2d 0d 0a 31 33 37 32 0d 0a 31 36 34  .----..1372..164
19360 32 36 38 0d 0a 32 34 33 33 39 39 0d 0a 0d 0a 71  268..243399....q
19370 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19380 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20  SELECT + - col0 
19390 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  + - col2 AS col0
193a0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
193b0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31 37  .----..-121..-17
193c0 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20  6..-57....query 
193d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
193e0 54 20 28 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63  T ( col2 ) * - c
193f0 6f 6c 31 20 2b 20 32 30 20 46 52 4f 4d 20 74 61  ol1 + 20 FROM ta
19400 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
19410 31 32 32 38 0d 0a 2d 31 33 38 34 0d 0a 2d 35 35  1228..-1384..-55
19420 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
19430 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
19440 6f 6c 30 20 2a 20 2d 20 39 35 20 46 52 4f 4d 20  ol0 * - 95 FROM 
19450 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 35  tab1..----..-285
19460 0d 0a 2d 36 30 38 30 0d 0a 2d 37 36 30 30 0d 0a  ..-6080..-7600..
19470 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19480 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f  t..SELECT ( + co
19490 72 30 2e 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f  r0.col2 ) + - co
194a0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
194b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d  cor0..----..-41.
194c0 0a 2d 35 32 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72  .-52..20....quer
194d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
194e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 36  ECT DISTINCT ( 6
194f0 30 20 2a 20 74 61 62 31 2e 63 6f 6c 30 20 29 20  0 * tab1.col0 ) 
19500 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
19510 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38 30 0d 0a 33 38  1..----..180..38
19520 34 30 0d 0a 34 38 30 30 0d 0a 0d 0a 71 75 65 72  40..4800....quer
19530 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19540 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62  ECT DISTINCT tab
19550 32 2e 63 6f 6c 31 20 2a 20 2b 20 74 61 62 32 2e  2.col1 * + tab2.
19560 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20  col1 FROM tab2, 
19570 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
19580 2d 2d 0d 0a 32 38 39 0d 0a 33 34 38 31 0d 0a 39  --..289..3481..9
19590 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
195a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
195b0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
195c0 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62 32 20  ab1, tab2, tab2 
195d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
195e0 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
195f0 20 74 6f 20 65 32 35 36 38 62 30 31 64 64 34 31   to e2568b01dd41
19600 31 62 35 61 32 30 36 30 36 38 36 39 37 64 30 65  1b5a206068697d0e
19610 64 30 64 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  d0d2....query I 
19620 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19630 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
19640 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52  + col0 * col1 FR
19650 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
19660 2d 2d 0d 0a 32 34 0d 0a 35 38 33 0d 0a 39 34 34  --..24..583..944
19670 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19680 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
19690 49 4e 43 54 20 2d 20 2d 20 36 31 20 2b 20 63 6f  INCT - - 61 + co
196a0 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  l2 * - col0 * + 
196b0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
196c0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
196d0 2d 2d 2d 2d 0d 0a 2d 31 31 34 30 31 35 0d 0a 2d  ----..-114015..-
196e0 35 30 34 32 0d 0a 2d 35 32 36 36 37 0d 0a 0d 0a  5042..-52667....
196f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19700 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f  .SELECT + ( + co
19710 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 29 20 41 53  l2 * + col1 ) AS
19720 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
19730 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30  .----..1248..140
19740 34 0d 0a 35 37 30 0d 0a 0d 0a 73 6b 69 70 69 66  4..570....skipif
19750 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
19760 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
19770 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
19780 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
19790 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
197a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 35 20  rt..SELECT + 35 
197b0 2a 20 2d 20 31 39 20 63 6f 6c 31 20 46 52 4f 4d  * - 19 col1 FROM
197c0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 36   tab0..----..-66
197d0 35 0d 0a 2d 36 36 35 0d 0a 2d 36 36 35 0d 0a 0d  5..-665..-665...
197e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
197f0 0d 0a 53 45 4c 45 43 54 20 2d 20 34 37 20 46 52  ..SELECT - 47 FR
19800 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
19810 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
19820 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
19830 20 36 39 34 32 61 30 64 39 35 35 38 32 37 37 61   6942a0d9558277a
19840 66 64 30 64 30 30 34 30 38 64 36 35 63 66 35 61  fd0d00408d65cf5a
19850 61 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  a....skipif post
19860 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
19870 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
19880 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
19890 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
198a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
198b0 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63  ELECT col1 + - c
198c0 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  ol2 + + col0 * c
198d0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c  ol2 * + col1 col
198e0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
198f0 2d 0d 0a 33 34 39 31 0d 0a 36 36 34 31 32 37 0d  -..3491..664127.
19900 0a 36 38 31 36 35 0d 0a 0d 0a 71 75 65 72 79 20  .68165....query 
19910 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19920 54 20 2b 20 39 34 20 2b 20 63 6f 6c 32 20 46 52  T + 94 + col2 FR
19930 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
19940 32 30 0d 0a 31 32 31 0d 0a 31 33 32 0d 0a 0d 0a  20..121..132....
19950 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19960 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 31  .SELECT ALL tab1
19970 2e 63 6f 6c 31 20 2b 20 35 34 20 41 53 20 63 6f  .col1 + 54 AS co
19980 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
19990 2d 2d 0d 0a 36 34 0d 0a 36 37 0d 0a 38 30 0d 0a  --..64..67..80..
199a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
199b0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
199c0 43 54 20 2b 20 33 39 20 2b 20 63 6f 6c 30 20 46  CT + 39 + col0 F
199d0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
199e0 31 30 33 0d 0a 31 31 39 0d 0a 34 32 0d 0a 0d 0a  103..119..42....
199f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19a00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
19a10 20 63 6f 6c 31 20 2b 20 34 20 41 53 20 63 6f 6c   col1 + 4 AS col
19a20 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
19a30 2d 0d 0a 32 31 0d 0a 33 35 0d 0a 36 33 0d 0a 0d  -..21..35..63...
19a40 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
19a50 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
19a60 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
19a70 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
19a80 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 31 38  owsort label-718
19a90 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49  ..SELECT col2 DI
19aa0 56 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  V - col2 + - col
19ab0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
19ac0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a  ab1..----..-11..
19ad0 2d 31 34 0d 0a 2d 32 37 0d 0a 0d 0a 73 6b 69 70  -14..-27....skip
19ae0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
19af0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
19b00 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
19b10 2d 37 31 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -718..SELECT col
19b20 32 20 2f 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63  2 / - col2 + - c
19b30 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
19b40 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   tab1..----..-11
19b50 0d 0a 2d 31 34 0d 0a 2d 32 37 0d 0a 0d 0a 73 6b  ..-14..-27....sk
19b60 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
19b70 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
19b80 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
19b90 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
19ba0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
19bb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
19bc0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a  ISTINCT - col2 *
19bd0 20 2d 20 33 33 20 2a 20 2b 20 36 34 20 2b 20 63   - 33 * + 64 + c
19be0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c  ol2 * + col1 col
19bf0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
19c00 2d 0d 0a 35 36 34 34 36 0d 0a 35 37 38 36 31 0d  -..56446..57861.
19c10 0a 38 30 39 30 32 0d 0a 0d 0a 71 75 65 72 79 20  .80902....query 
19c20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19c30 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 31 2e  T DISTINCT cor1.
19c40 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
19c50 4d 20 74 61 62 30 20 63 6f 72 30 20 43 52 4f 53  M tab0 cor0 CROS
19c60 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63  S JOIN tab1 AS c
19c70 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  or1..----..10..1
19c80 33 0d 0a 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  3..26....onlyif 
19c90 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
19ca0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
19cb0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
19cc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
19cd0 61 62 65 6c 2d 37 32 31 0d 0a 53 45 4c 45 43 54  abel-721..SELECT
19ce0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30   DISTINCT + cor0
19cf0 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 44  .col0 + + col1 D
19d00 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  IV col1 FROM tab
19d10 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
19d20 0a 34 0d 0a 36 35 0d 0a 38 31 0d 0a 0d 0a 73 6b  .4..65..81....sk
19d30 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
19d40 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
19d50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
19d60 65 6c 2d 37 32 31 0d 0a 53 45 4c 45 43 54 20 44  el-721..SELECT D
19d70 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63  ISTINCT + cor0.c
19d80 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 63  ol0 + + col1 / c
19d90 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
19da0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a   cor0..----..4..
19db0 36 35 0d 0a 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  65..81....onlyif
19dc0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
19dd0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
19de0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
19df0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
19e00 6c 61 62 65 6c 2d 37 32 32 0d 0a 53 45 4c 45 43  label-722..SELEC
19e10 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
19e20 31 20 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f 6c  1 DIV col1 + col
19e30 30 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  0 * col0 + - col
19e40 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
19e50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 33 33 0d  or0..----..4033.
19e60 0a 36 33 32 31 0d 0a 37 0d 0a 0d 0a 73 6b 69 70  .6321..7....skip
19e70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
19e80 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
19e90 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
19ea0 2d 37 32 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  -722..SELECT DIS
19eb0 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2f 20 63  TINCT + col1 / c
19ec0 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol1 + col0 * col
19ed0 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  0 + - col0 FROM 
19ee0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
19ef0 2d 2d 0d 0a 34 30 33 33 0d 0a 36 33 32 31 0d 0a  --..4033..6321..
19f00 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
19f10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
19f20 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 + + cor0.col
19f30 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  2 * + col2 * col
19f40 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
19f50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 31 36 39  or0..----..26169
19f60 0d 0a 33 36 0d 0a 35 39 38 35 31 38 0d 0a 0d 0a  ..36..598518....
19f70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19f80 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
19f90 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63  ol2 * + col2 + c
19fa0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
19fb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
19fc0 39 30 0d 0a 2d 33 32 33 39 0d 0a 2d 39 32 30 33  90..-3239..-9203
19fd0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
19fe0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
19ff0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1a000 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1a010 4e 43 54 20 2d 20 43 41 53 54 20 28 20 63 6f 6c  NCT - CAST ( col
1a020 30 20 41 53 20 52 45 41 4c 20 29 20 2b 20 63 6f  0 AS REAL ) + co
1a030 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41  l1 * cor0.col2 A
1a040 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
1a050 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1a060 31 34 35 36 0d 0a 35 36 37 0d 0a 38 33 30 0d 0a  1456..567..830..
1a070 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1a080 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1a090 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1a0a0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1a0b0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1a0c0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 36 0d 0a  sort label-726..
1a0d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1a0e0 2b 20 2b 20 43 41 53 54 28 20 2b 20 37 34 20 41  + + CAST( + 74 A
1a0f0 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
1a100 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1a110 2d 2d 0d 0a 37 34 0d 0a 0d 0a 73 6b 69 70 69 66  --..74....skipif
1a120 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1a130 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1a140 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1a150 32 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  26..SELECT DISTI
1a160 4e 43 54 20 2b 20 2b 20 43 41 53 54 20 28 20 2b  NCT + + CAST ( +
1a170 20 37 34 20 41 53 20 49 4e 54 45 47 45 52 20 29   74 AS INTEGER )
1a180 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1a190 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 0d 0a 0d 0a  r0..----..74....
1a1a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a1b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 30 20  .SELECT ALL - 0 
1a1c0 2b 20 2b 20 34 39 20 2a 20 2d 20 63 6f 72 30 2e  + + 49 * - cor0.
1a1d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1a1e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1a1f0 34 37 0d 0a 2d 33 31 33 36 0d 0a 2d 33 39 32 30  47..-3136..-3920
1a200 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a210 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
1a220 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46 52  ( cor0.col0 ) FR
1a230 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
1a240 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30  --..-3..-64..-80
1a250 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1a260 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1a270 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1a280 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1a290 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a2a0 37 32 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  729..SELECT DIST
1a2b0 49 4e 43 54 20 2b 20 28 20 63 6f 6c 30 20 29 20  INCT + ( col0 ) 
1a2c0 44 49 56 20 74 61 62 30 2e 63 6f 6c 31 20 41 53  DIV tab0.col1 AS
1a2d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
1a2e0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .----..0....skip
1a2f0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1a300 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1a310 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1a320 2d 37 32 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  -729..SELECT DIS
1a330 54 49 4e 43 54 20 2b 20 28 20 63 6f 6c 30 20 29  TINCT + ( col0 )
1a340 20 2f 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20   / tab0.col1 AS 
1a350 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
1a360 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  ----..0....query
1a370 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a380 43 54 20 41 4c 4c 20 2b 20 28 20 74 61 62 31 2e  CT ALL + ( tab1.
1a390 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31  col1 ) FROM tab1
1a3a0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
1a3b0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
1a3c0 61 73 68 69 6e 67 20 74 6f 20 33 36 36 65 63 35  ashing to 366ec5
1a3d0 33 39 61 66 30 66 33 37 62 64 31 35 31 39 62 63  39af0f37bd1519bc
1a3e0 35 36 38 66 33 64 36 37 37 35 0d 0a 0d 0a 6f 6e  568f3d6775....on
1a3f0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1a400 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1a410 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1a420 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1a430 6f 72 74 20 6c 61 62 65 6c 2d 37 33 31 0d 0a 53  ort label-731..S
1a440 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 44 49 56  ELECT - col0 DIV
1a450 20 2b 20 36 30 20 41 53 20 63 6f 6c 30 20 46 52   + 60 AS col0 FR
1a460 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1a470 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 30  .----..-1..-1..0
1a480 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1a490 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1a4a0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1a4b0 72 74 20 6c 61 62 65 6c 2d 37 33 31 0d 0a 53 45  rt label-731..SE
1a4c0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2f 20 2b 20  LECT - col0 / + 
1a4d0 36 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  60 AS col0 FROM 
1a4e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1a4f0 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 30 0d 0a 0d  --..-1..-1..0...
1a500 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a510 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
1a520 32 20 2b 20 28 20 63 6f 6c 30 20 29 20 2b 20 28  2 + ( col0 ) + (
1a530 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20 2d   cor0.col2 ) * -
1a540 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 46   col0 * - col0 F
1a550 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1a560 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 39 0d 0a 31 38  ..----..1259..18
1a570 39 39 39 0d 0a 36 34 39 35 32 39 0d 0a 0d 0a 71  999..649529....q
1a580 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a590 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1a5a0 2b 20 2b 20 35 31 20 2a 20 2b 20 38 38 20 2b 20  + + 51 * + 88 + 
1a5b0 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS c
1a5c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1a5d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31   cor0..----..121
1a5e0 36 38 0d 0a 34 36 35 30 0d 0a 38 31 33 36 0d 0a  68..4650..8136..
1a5f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a600 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1a610 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20 28 20 2d  ( col1 ) + - ( -
1a620 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20   col2 ) AS col1 
1a630 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1a640 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d  .119..173..98...
1a650 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a660 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
1a670 30 20 2b 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c  0 + col0 * ( col
1a680 32 20 29 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20  2 ) + + col1 AS 
1a690 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
1a6a0 2d 2d 2d 2d 0d 0a 31 36 37 0d 0a 37 34 37 38 0d  ----..167..7478.
1a6b0 0a 39 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .902....onlyif m
1a6c0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1a6d0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1a6e0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1a6f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1a700 62 65 6c 2d 37 33 36 0d 0a 53 45 4c 45 43 54 20  bel-736..SELECT 
1a710 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20 44 49 56  - ( - col0 ) DIV
1a720 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20   - tab0.col2 AS 
1a730 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
1a740 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 35 0d 0a 30  ----..-1..-35..0
1a750 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1a760 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1a770 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1a780 72 74 20 6c 61 62 65 6c 2d 37 33 36 0d 0a 53 45  rt label-736..SE
1a790 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c 30 20  LECT - ( - col0 
1a7a0 29 20 2f 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20  ) / - tab0.col2 
1a7b0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1a7c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 35  0..----..-1..-35
1a7d0 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
1a7e0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1a7f0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1a800 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1a810 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1a820 65 6c 2d 37 33 37 0d 0a 53 45 4c 45 43 54 20 2d  el-737..SELECT -
1a830 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2d   cor0.col0 DIV -
1a840 20 32 39 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   29 FROM tab1, t
1a850 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1a860 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
1a870 69 6e 67 20 74 6f 20 64 63 66 30 62 64 62 30 61  ing to dcf0bdb0a
1a880 33 33 61 39 37 63 37 33 61 38 31 63 35 62 38 32  33a97c73a81c5b82
1a890 33 38 39 39 64 34 30 0d 0a 0d 0a 73 6b 69 70 69  3899d40....skipi
1a8a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1a8b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1a8c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a8d0 37 33 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  737..SELECT - co
1a8e0 72 30 2e 63 6f 6c 30 20 2f 20 2d 20 32 39 20 46  r0.col0 / - 29 F
1a8f0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
1a900 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
1a910 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1a920 6f 20 64 63 66 30 62 64 62 30 61 33 33 61 39 37  o dcf0bdb0a33a97
1a930 63 37 33 61 38 31 63 35 62 38 32 33 38 39 39 64  c73a81c5b823899d
1a940 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  40....skipif pos
1a950 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1a960 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1a970 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1a980 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
1a990 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a9a0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61 62  SELECT ALL - tab
1a9b0 32 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 63 6f  2.col1 + col1 co
1a9c0 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
1a9d0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
1a9e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a9f0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1aa00 30 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  0 * col2 * + col
1aa10 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 + col1 FROM ta
1aa20 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1aa30 0d 0a 2d 31 31 39 35 39 33 0d 0a 2d 35 31 30 31  ..-119593..-5101
1aa40 37 0d 0a 2d 35 38 32 38 0d 0a 0d 0a 71 75 65 72  7..-5828....quer
1aa50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1aa60 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
1aa70 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  2 + cor0.col0 * 
1aa80 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col1 * - col1 FR
1aa90 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1aaa0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 32 34 0d 0a 2d  .----..-13424..-
1aab0 31 39 37 34 0d 0a 2d 36 33 34 33 0d 0a 0d 0a 71  1974..-6343....q
1aac0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1aad0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1aae0 2d 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  - col1 * cor0.co
1aaf0 6c 32 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 - col1 AS col
1ab00 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
1ab10 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 33 0d 0a 2d  ..----..-1593..-
1ab20 36 36 33 0d 0a 2d 38 36 38 0d 0a 0d 0a 71 75 65  663..-868....que
1ab30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ab40 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 28 20  LECT - col0 * ( 
1ab50 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30 20 46 52  col1 ) * col0 FR
1ab60 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1ab70 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32 35 0d 0a  .----..-118825..
1ab80 2d 34 39 35 33 36 0d 0a 2d 37 32 30 38 31 31 0d  -49536..-720811.
1ab90 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1aba0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
1abb0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
1abc0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
1abd0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
1abe0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 33 0d  wsort label-743.
1abf0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
1ac00 20 2a 20 43 41 53 54 28 20 2d 20 63 6f 6c 32 20   * CAST( - col2 
1ac10 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20  AS SIGNED ) + - 
1ac20 63 6f 6c 32 20 2b 20 36 36 20 46 52 4f 4d 20 74  col2 + 66 FROM t
1ac30 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1ac40 2d 0d 0a 2d 31 34 39 34 0d 0a 2d 36 31 38 0d 0a  -..-1494..-618..
1ac50 2d 37 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  -798....skipif m
1ac60 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1ac70 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1ac80 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 33  owsort label-743
1ac90 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
1aca0 31 20 2a 20 43 41 53 54 20 28 20 2d 20 63 6f 6c  1 * CAST ( - col
1acb0 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  2 AS INTEGER ) +
1acc0 20 2d 20 63 6f 6c 32 20 2b 20 36 36 20 46 52 4f   - col2 + 66 FRO
1acd0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1ace0 2d 2d 2d 2d 0d 0a 2d 31 34 39 34 0d 0a 2d 36 31  ----..-1494..-61
1acf0 38 0d 0a 2d 37 39 38 0d 0a 0d 0a 71 75 65 72 79  8..-798....query
1ad00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ad10 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
1ad20 6c 32 20 2b 20 2d 20 34 38 20 46 52 4f 4d 20 74  l2 + - 48 FROM t
1ad30 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1ad40 2d 0d 0a 2d 31 33 30 0d 0a 2d 34 39 0d 0a 2d 38  -..-130..-49..-8
1ad50 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1ad60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1ad70 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 28 20   + - col2 * - ( 
1ad80 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31  + col0 ) AS col1
1ad90 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1ada0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33  r0..----..162..3
1adb0 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 6f 6e 6c  648..7680....onl
1adc0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
1add0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
1ade0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
1adf0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
1ae00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1ae10 6c 61 62 65 6c 2d 37 34 36 0d 0a 53 45 4c 45 43  label-746..SELEC
1ae20 54 20 63 6f 6c 32 20 2b 20 2d 20 36 31 20 2b 20  T col2 + - 61 + 
1ae30 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col0 * - col1 * 
1ae40 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
1ae50 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32  SIGNED ) AS col2
1ae60 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1ae70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1ae80 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
1ae90 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1aea0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1aeb0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1aec0 65 6c 2d 37 34 36 0d 0a 53 45 4c 45 43 54 20 63  el-746..SELECT c
1aed0 6f 6c 32 20 2b 20 2d 20 36 31 20 2b 20 63 6f 6c  ol2 + - 61 + col
1aee0 30 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 43  0 * - col1 * + C
1aef0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
1af00 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20  TEGER ) AS col2 
1af10 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1af20 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
1af30 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....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 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1af60 2b 20 63 6f 6c 30 20 2a 20 2d 20 31 31 20 46 52  + col0 * - 11 FR
1af70 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1af80 2d 2d 0d 0a 2d 32 36 34 0d 0a 2d 33 38 35 0d 0a  --..-264..-385..
1af90 2d 39 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -979....query I 
1afa0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1afb0 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62 32 2e  DISTINCT + tab2.
1afc0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52  col0 + - col0 FR
1afd0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab2..----..0
1afe0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1aff0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1b000 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1b010 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1b020 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 63 6f 6c  ol0 + CAST ( col
1b030 31 20 41 53 20 52 45 41 4c 20 29 20 2a 20 2d 20  1 AS REAL ) * - 
1b040 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
1b050 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1b060 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 36 37 33 0d  ----..-36..-673.
1b070 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-89....query I 
1b080 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1b090 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  - col0 + cor0.co
1b0a0 6c 32 20 2a 20 33 35 20 41 53 20 63 6f 6c 32 20  l2 * 35 AS col2 
1b0b0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1b0c0 2d 2d 2d 2d 0d 0a 30 0d 0a 31 31 33 31 0d 0a 32  ----..0..1131..2
1b0d0 37 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  781....query I r
1b0e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1b0f0 6f 6c 30 20 2a 20 2b 20 35 30 20 46 52 4f 4d 20  ol0 * + 50 FROM 
1b100 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 35 30 0d  tab2..----..350.
1b110 0a 33 39 30 30 0d 0a 33 39 35 30 0d 0a 0d 0a 71  .3900..3950....q
1b120 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1b130 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e  SELECT + + cor0.
1b140 63 6f 6c 32 20 2b 20 35 33 20 41 53 20 63 6f 6c  col2 + 53 AS col
1b150 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1b160 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 39 0d 0a 38  or0..----..79..8
1b170 30 0d 0a 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  0..91....onlyif 
1b180 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1b190 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1b1a0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1b1b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b1c0 61 62 65 6c 2d 37 35 33 0d 0a 53 45 4c 45 43 54  abel-753..SELECT
1b1d0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56   + cor0.col0 DIV
1b1e0 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 2b 20   + ( col1 ) + + 
1b1f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1b200 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  S cor0..----..21
1b210 0d 0a 33 31 0d 0a 36 30 0d 0a 0d 0a 73 6b 69 70  ..31..60....skip
1b220 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1b230 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1b240 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1b250 2d 37 35 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -753..SELECT + c
1b260 6f 72 30 2e 63 6f 6c 30 20 2f 20 2b 20 28 20 63  or0.col0 / + ( c
1b270 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46  ol1 ) + + col1 F
1b280 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1b290 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 33 31 0d 0a  ..----..21..31..
1b2a0 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
1b2b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1b2c0 74 61 62 30 2e 63 6f 6c 30 20 2b 20 36 39 20 46  tab0.col0 + 69 F
1b2d0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1b2e0 31 30 34 0d 0a 31 35 38 0d 0a 39 33 0d 0a 0d 0a  104..158..93....
1b2f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b300 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32  .SELECT - + col2
1b310 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53   + ( + col1 ) AS
1b320 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1b330 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a  cor0..----..53..
1b340 39 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  9..96....onlyif 
1b350 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1b360 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1b370 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1b380 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b390 61 62 65 6c 2d 37 35 36 0d 0a 53 45 4c 45 43 54  abel-756..SELECT
1b3a0 20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   - CAST( col1 AS
1b3b0 20 53 49 47 4e 45 44 20 29 20 44 49 56 20 2b 20   SIGNED ) DIV + 
1b3c0 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
1b3d0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1b3e0 2d 38 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -8..0..0....skip
1b3f0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1b400 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1b410 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1b420 2d 37 35 36 0d 0a 53 45 4c 45 43 54 20 2d 20 43  -756..SELECT - C
1b430 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e  AST ( col1 AS IN
1b440 54 45 47 45 52 20 29 20 2f 20 2b 20 63 6f 72 30  TEGER ) / + cor0
1b450 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
1b460 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a  cor0..----..-8..
1b470 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  0..0....onlyif m
1b480 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1b490 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1b4a0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1b4b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1b4c0 62 65 6c 2d 37 35 37 0d 0a 53 45 4c 45 43 54 20  bel-757..SELECT 
1b4d0 36 37 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f  67 + col2 DIV co
1b4e0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
1b4f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1b500 2d 2d 0d 0a 36 37 0d 0a 36 37 0d 0a 36 38 0d 0a  --..67..67..68..
1b510 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1b520 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1b530 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b540 20 6c 61 62 65 6c 2d 37 35 37 0d 0a 53 45 4c 45   label-757..SELE
1b550 43 54 20 36 37 20 2b 20 63 6f 6c 32 20 2f 20 63  CT 67 + col2 / c
1b560 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
1b570 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1b580 2d 2d 2d 0d 0a 36 37 0d 0a 36 37 0d 0a 36 38 0d  ---..67..67..68.
1b590 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1b5a0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
1b5b0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
1b5c0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
1b5d0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
1b5e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35 38 0d  wsort label-758.
1b5f0 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20  .SELECT - CAST( 
1b600 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  + col1 AS SIGNED
1b610 20 29 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41   ) + col0 * - CA
1b620 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
1b630 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  ED ) FROM tab0 A
1b640 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
1b650 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
1b660 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1b670 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1b680 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b690 20 6c 61 62 65 6c 2d 37 35 38 0d 0a 53 45 4c 45   label-758..SELE
1b6a0 43 54 20 2d 20 43 41 53 54 20 28 20 2b 20 63 6f  CT - CAST ( + co
1b6b0 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
1b6c0 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54 20  + col0 * - CAST 
1b6d0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
1b6e0 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  R ) FROM tab0 AS
1b6f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1b700 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1b710 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b720 0d 0a 53 45 4c 45 43 54 20 2b 20 34 32 20 2b 20  ..SELECT + 42 + 
1b730 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col0 * col0 FROM
1b740 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1b750 2d 2d 2d 0d 0a 36 31 32 36 0d 0a 36 32 38 33 0d  ---..6126..6283.
1b760 0a 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .91....onlyif my
1b770 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1b780 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1b790 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1b7a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1b7b0 65 6c 2d 37 36 30 0d 0a 53 45 4c 45 43 54 20 2d  el-760..SELECT -
1b7c0 20 38 32 20 44 49 56 20 2b 20 63 6f 6c 30 20 46   82 DIV + col0 F
1b7d0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
1b7e0 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 32 37  ---..-1..-1..-27
1b7f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1b800 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1b810 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1b820 72 74 20 6c 61 62 65 6c 2d 37 36 30 0d 0a 53 45  rt label-760..SE
1b830 4c 45 43 54 20 2d 20 38 32 20 2f 20 2b 20 63 6f  LECT - 82 / + co
1b840 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
1b850 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  0..----..-1..-1.
1b860 0a 2d 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-27....query I 
1b870 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1b880 2d 20 2b 20 36 36 20 41 53 20 63 6f 6c 31 20 46  - + 66 AS col1 F
1b890 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1b8a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 36 0d 0a 2d 36 36  ..----..-66..-66
1b8b0 0d 0a 2d 36 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-66....onlyif 
1b8c0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1b8d0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1b8e0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1b8f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b900 61 62 65 6c 2d 37 36 32 0d 0a 53 45 4c 45 43 54  abel-762..SELECT
1b910 20 2b 20 32 32 20 44 49 56 20 2d 20 63 6f 6c 31   + 22 DIV - col1
1b920 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
1b930 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d  .----..-1..0..0.
1b940 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1b950 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1b960 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b970 74 20 6c 61 62 65 6c 2d 37 36 32 0d 0a 53 45 4c  t label-762..SEL
1b980 45 43 54 20 2b 20 32 32 20 2f 20 2d 20 63 6f 6c  ECT + 22 / - col
1b990 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
1b9a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30  ..----..-1..0..0
1b9b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b9c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1b9d0 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20 28 20  INCT col2 * - ( 
1b9e0 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  - col1 ) FROM ta
1b9f0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a  b0..----..2838..
1ba00 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  7462..97....quer
1ba10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1ba20 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 28  ECT - col2 + + (
1ba30 20 2d 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   - col0 ) FROM t
1ba40 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d  ab1..----..-121.
1ba50 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75  .-176..-57....qu
1ba60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ba70 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1ba80 20 32 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   23 AS col0 FROM
1ba90 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
1baa0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53  OSS JOIN tab1 AS
1bab0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d   cor1..----..23.
1bac0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1bad0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
1bae0 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  or0.col1 * - col
1baf0 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  1 + + col0 * col
1bb00 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
1bb10 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1bb20 2d 0d 0a 31 31 37 38 0d 0a 31 36 33 32 0d 0a 38  -..1178..1632..8
1bb30 30 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  083....query I r
1bb40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1bb50 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
1bb60 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
1bb70 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
1bb80 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1bb90 2d 0d 0a 33 33 39 35 0d 0a 36 36 34 31 31 38 0d  -..3395..664118.
1bba0 0a 36 38 31 31 32 0d 0a 0d 0a 71 75 65 72 79 20  .68112....query 
1bbb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1bbc0 54 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20  T - ( cor0.col1 
1bbd0 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ) * col1 FROM ta
1bbe0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
1bbf0 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d  100..-169..-676.
1bc00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1bc10 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1bc20 20 2b 20 34 20 46 52 4f 4d 20 74 61 62 31 20 41   + 4 FROM tab1 A
1bc30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 0d  S cor0..----..4.
1bc40 0a 34 0d 0a 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .4..4....onlyif 
1bc50 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1bc60 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1bc70 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1bc80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1bc90 61 62 65 6c 2d 37 37 30 0d 0a 53 45 4c 45 43 54  abel-770..SELECT
1bca0 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61 62 32   DISTINCT - tab2
1bcb0 2e 63 6f 6c 31 20 2a 20 38 38 20 44 49 56 20 74  .col1 * 88 DIV t
1bcc0 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab2.col0 FROM ta
1bcd0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d  b2..----..-18..-
1bce0 33 38 39 0d 0a 2d 36 36 0d 0a 0d 0a 73 6b 69 70  389..-66....skip
1bcf0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1bd00 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1bd10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1bd20 2d 37 37 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  -770..SELECT DIS
1bd30 54 49 4e 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c  TINCT - tab2.col
1bd40 31 20 2a 20 38 38 20 2f 20 74 61 62 32 2e 63 6f  1 * 88 / tab2.co
1bd50 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
1bd60 2d 2d 0d 0a 2d 31 38 0d 0a 2d 33 38 39 0d 0a 2d  --..-18..-389..-
1bd70 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  66....query I ro
1bd80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1bd90 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63 6f  STINCT col0 * co
1bda0 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  l1 * + col1 AS c
1bdb0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
1bdc0 2d 2d 2d 0d 0a 31 33 35 32 30 0d 0a 32 30 32 38  ---..13520..2028
1bdd0 0d 0a 36 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20  ..6400....query 
1bde0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1bdf0 54 20 2d 20 63 6f 6c 30 20 2b 20 35 34 20 41 53  T - col0 + 54 AS
1be00 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
1be10 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 32 36 0d  .----..-10..-26.
1be20 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .51....query I r
1be30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1be40 20 63 6f 6c 31 20 2a 20 2b 20 36 34 20 46 52 4f   col1 * + 64 FRO
1be50 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
1be60 36 36 34 0d 0a 2d 36 34 30 0d 0a 2d 38 33 32 0d  664..-640..-832.
1be70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1be80 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1be90 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2b  NCT col2 * - ( +
1bea0 20 39 34 20 2a 20 63 6f 6c 31 20 29 20 46 52 4f   94 * col1 ) FRO
1beb0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
1bec0 31 37 33 31 32 0d 0a 2d 31 33 31 39 37 36 0d 0a  17312..-131976..
1bed0 2d 35 33 35 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  -53580....onlyif
1bee0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1bef0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1bf00 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1bf10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1bf20 6c 61 62 65 6c 2d 37 37 35 0d 0a 53 45 4c 45 43  label-775..SELEC
1bf30 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 44 49 56  T ALL - col2 DIV
1bf40 20 2d 20 35 39 20 41 53 20 63 6f 6c 32 20 46 52   - 59 AS col2 FR
1bf50 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab1..----..0
1bf60 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..1....skipif
1bf70 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1bf80 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1bf90 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1bfa0 37 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  75..SELECT ALL -
1bfb0 20 63 6f 6c 32 20 2f 20 2d 20 35 39 20 41 53 20   col2 / - 59 AS 
1bfc0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
1bfd0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d  ----..0..0..1...
1bfe0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1bff0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1c000 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1c010 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1c020 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1c030 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c040 54 20 44 49 53 54 49 4e 43 54 20 36 39 20 63 6f  T DISTINCT 69 co
1c050 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
1c060 2d 2d 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20  --..69....query 
1c070 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c080 54 20 33 33 20 41 53 20 63 6f 6c 32 20 46 52 4f  T 33 AS col2 FRO
1c090 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
1c0a0 2d 0d 0a 33 33 0d 0a 33 33 0d 0a 33 33 0d 0a 0d  -..33..33..33...
1c0b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c0c0 0d 0a 53 45 4c 45 43 54 20 2d 20 38 31 20 2a 20  ..SELECT - 81 * 
1c0d0 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col1 * cor0.col2
1c0e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1c0f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 32 35  r0..----..-12425
1c100 34 0d 0a 2d 35 32 33 32 36 0d 0a 2d 36 37 37 39  4..-52326..-6779
1c110 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
1c120 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1c130 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1c140 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1c150 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1c160 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c170 45 4c 45 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c  ELECT + tab2.col
1c180 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2 col2 FROM tab2
1c190 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
1c1a0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
1c1b0 61 73 68 69 6e 67 20 74 6f 20 35 39 31 31 62 61  ashing to 5911ba
1c1c0 63 35 31 34 34 31 66 34 66 66 36 34 30 62 32 61  c51441f4ff640b2a
1c1d0 32 62 37 32 31 65 61 38 65 33 0d 0a 0d 0a 6f 6e  2b721ea8e3....on
1c1e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1c1f0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1c200 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1c210 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1c220 6f 72 74 20 6c 61 62 65 6c 2d 37 38 30 0d 0a 53  ort label-780..S
1c230 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20 31  ELECT col0 + + 1
1c240 36 20 44 49 56 20 2b 20 63 6f 6c 30 20 46 52 4f  6 DIV + col0 FRO
1c250 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 38  M tab2..----..78
1c260 0d 0a 37 39 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69  ..79..9....skipi
1c270 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1c280 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1c290 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1c2a0 37 38 30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  780..SELECT col0
1c2b0 20 2b 20 2b 20 31 36 20 2f 20 2b 20 63 6f 6c 30   + + 16 / + col0
1c2c0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1c2d0 0d 0a 37 38 0d 0a 37 39 0d 0a 39 0d 0a 0d 0a 6f  ..78..79..9....o
1c2e0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1c2f0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1c300 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1c310 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1c320 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 31 0d 0a  sort label-781..
1c330 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1c340 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 44 49 56 20  col1 + col0 DIV 
1c350 2b 20 63 6f 6c 31 20 2b 20 2b 20 36 32 20 41 53  + col1 + + 62 AS
1c360 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
1c370 0a 2d 2d 2d 2d 0d 0a 37 38 0d 0a 38 31 0d 0a 38  .----..78..81..8
1c380 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
1c390 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1c3a0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1c3b0 6f 72 74 20 6c 61 62 65 6c 2d 37 38 31 0d 0a 53  ort label-781..S
1c3c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1c3d0 6f 6c 31 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63  ol1 + col0 / + c
1c3e0 6f 6c 31 20 2b 20 2b 20 36 32 20 41 53 20 63 6f  ol1 + + 62 AS co
1c3f0 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
1c400 2d 2d 0d 0a 37 38 0d 0a 38 31 0d 0a 38 38 0d 0a  --..78..81..88..
1c410 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c420 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
1c430 20 2a 20 2b 20 37 35 20 2b 20 2d 20 33 35 20 2b   * + 75 + - 35 +
1c440 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
1c450 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1c460 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 39 0d 0a 32  0..----..1789..2
1c470 36 32 35 0d 0a 36 37 32 39 0d 0a 0d 0a 71 75 65  625..6729....que
1c480 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c490 4c 45 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 30  LECT + tab1.col0
1c4a0 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
1c4b0 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
1c4c0 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38  -..1040..640..78
1c4d0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1c4e0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1c4f0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1c500 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1c510 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1c520 37 38 34 0d 0a 53 45 4c 45 43 54 20 2d 20 32 37  784..SELECT - 27
1c530 20 44 49 56 20 2b 20 63 6f 6c 32 20 63 6f 6c 31   DIV + col2 col1
1c540 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1c550 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
1c560 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1c570 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1c580 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1c590 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1c5a0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
1c5b0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1c5c0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1c5d0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 34 0d 0a  sort label-784..
1c5e0 53 45 4c 45 43 54 20 2d 20 32 37 20 2f 20 2b 20  SELECT - 27 / + 
1c5f0 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
1c600 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab1..----..0..0.
1c610 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
1c620 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1c630 4c 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  L + - col1 + + c
1c640 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
1c650 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1c660 2d 2d 2d 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d  ---..28..47..83.
1c670 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1c680 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1c690 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1c6a0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1c6b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1c6c0 38 36 0d 0a 53 45 4c 45 43 54 20 2b 20 36 38 20  86..SELECT + 68 
1c6d0 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  DIV + col2 AS co
1c6e0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
1c6f0 2d 2d 0d 0a 30 0d 0a 32 0d 0a 36 38 0d 0a 0d 0a  --..0..2..68....
1c700 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1c710 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1c720 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1c730 61 62 65 6c 2d 37 38 36 0d 0a 53 45 4c 45 43 54  abel-786..SELECT
1c740 20 2b 20 36 38 20 2f 20 2b 20 63 6f 6c 32 20 41   + 68 / + col2 A
1c750 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1c760 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 36 38  ..----..0..2..68
1c770 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c780 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1c790 74 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab2.col2 AS col
1c7a0 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
1c7b0 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  0 AS cor0, tab0 
1c7c0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
1c7d0 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
1c7e0 20 74 6f 20 34 30 66 64 38 63 63 30 64 65 39 32   to 40fd8cc0de92
1c7f0 65 61 36 38 64 37 33 36 33 34 63 32 64 38 66 37  ea68d73634c2d8f7
1c800 35 62 66 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5bf5....query I 
1c810 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c820 2b 20 2d 20 63 6f 6c 30 20 2a 20 35 39 20 2b 20  + - col0 * 59 + 
1c830 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col1 * - cor0.co
1c840 6c 30 20 2a 20 28 20 63 6f 6c 30 20 29 20 41 53  l0 * ( col0 ) AS
1c850 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
1c860 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1c870 34 31 31 0d 0a 2d 34 34 37 33 36 0d 0a 2d 38 37  411..-44736..-87
1c880 39 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  920....query I r
1c890 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1c8a0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63  ol1 * + col0 * c
1c8b0 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
1c8c0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38   tab2..----..228
1c8d0 33 31 0d 0a 32 37 31 35 31 38 0d 0a 36 37 32 37  31..271518..6727
1c8e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c8f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30  ort..SELECT tab0
1c900 2e 63 6f 6c 32 20 2a 20 34 30 20 46 52 4f 4d 20  .col2 * 40 FROM 
1c910 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 30  tab0..----..1320
1c920 0d 0a 33 32 38 30 0d 0a 34 30 0d 0a 0d 0a 71 75  ..3280..40....qu
1c930 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c940 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b  ELECT + + col2 +
1c950 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f   col1 * col2 FRO
1c960 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1c970 2d 2d 2d 2d 0d 0a 31 33 34 34 0d 0a 31 34 35 38  ----..1344..1458
1c980 0d 0a 36 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..627....query I
1c990 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c9a0 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63   col0 + + cor0.c
1c9b0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63  ol1 * + col2 * c
1c9c0 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20 2d 20 63  or0.col1 + ( - c
1c9d0 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20  or0.col1 ) FROM 
1c9e0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1c9f0 2d 2d 0d 0a 31 31 30 34 34 0d 0a 32 35 39 32 33  --..11044..25923
1ca00 0d 0a 39 30 35 32 35 0d 0a 0d 0a 71 75 65 72 79  ..90525....query
1ca10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ca20 43 54 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f  CT - ( - cor0.co
1ca30 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
1ca40 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
1ca50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
1ca60 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1ca70 63 36 31 64 32 37 61 30 30 32 32 65 36 64 30 32  c61d27a0022e6d02
1ca80 32 33 37 31 64 63 35 38 38 31 39 61 62 32 37 32  2371dc58819ab272
1ca90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1caa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
1cab0 35 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  59 AS col2 FROM 
1cac0 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f  tab1 AS cor0 CRO
1cad0 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20  SS JOIN tab2 AS 
1cae0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
1caf0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1cb00 61 39 62 39 39 36 36 64 37 34 39 64 31 62 32 63  a9b9966d749d1b2c
1cb10 65 35 39 35 35 65 64 31 32 33 39 34 66 39 62 63  e5955ed12394f9bc
1cb20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1cb30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1cb40 2d 20 34 36 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 46 AS col0 FRO
1cb50 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43  M tab2 AS cor0 C
1cb60 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20  ROSS JOIN tab0, 
1cb70 74 61 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61  tab0 AS cor1, ta
1cb80 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d  b1 AS cor2..----
1cb90 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68  ..81 values hash
1cba0 69 6e 67 20 74 6f 20 61 65 34 64 34 34 32 66 66  ing to ae4d442ff
1cbb0 35 38 39 61 31 38 66 65 37 63 37 37 37 37 34 36  589a18fe7c777746
1cbc0 34 64 35 39 37 30 63 0d 0a 0d 0a 6f 6e 6c 79 69  4d5970c....onlyi
1cbd0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1cbe0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1cbf0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1cc00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cc10 20 6c 61 62 65 6c 2d 37 39 36 0d 0a 53 45 4c 45   label-796..SELE
1cc20 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20  CT - col2 DIV - 
1cc30 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 63 6f  col0 + + col0 co
1cc40 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1cc50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a  cor0..----..10..
1cc60 37 38 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70 69 66  78..79....skipif
1cc70 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1cc80 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1cc90 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1cca0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1ccb0 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
1ccc0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1ccd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1cce0 74 20 6c 61 62 65 6c 2d 37 39 36 0d 0a 53 45 4c  t label-796..SEL
1ccf0 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 63  ECT - col2 / - c
1cd00 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c  ol0 + + col0 col
1cd10 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1cd20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 37  or0..----..10..7
1cd30 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  8..79....query I
1cd40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1cd50 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 39 34   + - col0 - + 94
1cd60 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1cd70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 0d 0a  r0..----..-118..
1cd80 2d 31 32 39 0d 0a 2d 31 38 33 0d 0a 0d 0a 71 75  -129..-183....qu
1cd90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1cda0 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
1cdb0 31 20 2b 20 63 6f 6c 30 20 2d 20 39 38 20 46 52  1 + col0 - 98 FR
1cdc0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1cdd0 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 33 34 0d 0a 38  .----..12..34..8
1cde0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1cdf0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1ce00 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 39 39 20 46   - col1 * - 99 F
1ce10 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1ce20 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 33 0d 0a 33 30  ..----..1683..30
1ce30 36 39 0d 0a 35 38 34 31 0d 0a 0d 0a 71 75 65 72  69..5841....quer
1ce40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1ce50 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 34  ECT DISTINCT ( 4
1ce60 36 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  6 ) FROM tab1 AS
1ce70 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
1ce80 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
1ce90 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or1, tab0 AS cor
1cea0 32 0d 0a 2d 2d 2d 2d 0d 0a 34 36 0d 0a 0d 0a 71  2..----..46....q
1ceb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1cec0 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
1ced0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
1cee0 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
1cef0 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
1cf00 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
1cf10 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 66 63  s hashing to 9fc
1cf20 31 64 63 64 37 36 66 65 61 66 34 33 65 35 63 35  1dcd76feaf43e5c5
1cf30 64 63 30 36 30 61 30 32 30 31 34 63 64 0d 0a 0d  dc060a02014cd...
1cf40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cf50 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1cf60 54 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a  T + ( + col2 ) *
1cf70 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
1cf80 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1cf90 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39 0d 0a  .----..1..1089..
1cfa0 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6724....query I 
1cfb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1cfc0 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63  ALL + - col0 * c
1cfd0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2d  ol2 + - col2 + -
1cfe0 20 35 33 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20   53 * - col1 AS 
1cff0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1d000 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
1d010 35 35 37 0d 0a 33 37 33 33 0d 0a 35 31 30 35 0d  557..3733..5105.
1d020 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1d030 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1d040 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1d050 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1d060 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1d070 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d080 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
1d090 2b 20 28 20 2d 20 34 38 20 29 20 63 6f 6c 32 20  + ( - 48 ) col2 
1d0a0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
1d0b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
1d0c0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1d0d0 61 31 62 65 33 64 63 37 37 35 36 31 34 61 34 30  a1be3dc775614a40
1d0e0 39 34 31 30 66 36 33 33 64 34 34 31 61 39 33 34  9410f633d441a934
1d0f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d100 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
1d110 6c 30 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20  l0 + ( - col2 ) 
1d120 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1d130 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d  ----..-9..34..7.
1d140 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d150 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1d160 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b  NCT - + col1 + +
1d170 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41   col1 + - col1 A
1d180 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1d190 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1d1a0 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d  -10..-13..-26...
1d1b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d1c0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31 32 20  ..SELECT ALL 12 
1d1d0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
1d1e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d   cor0..----..13.
1d1f0 0a 34 35 0d 0a 39 34 0d 0a 0d 0a 73 6b 69 70 69  .45..94....skipi
1d200 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1d210 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1d220 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1d230 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1d240 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1d250 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1d260 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 31  - cor0.col0 col1
1d270 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
1d280 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
1d290 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
1d2a0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1d2b0 74 6f 20 63 38 32 64 66 31 64 65 33 63 62 36 36  to c82df1de3cb66
1d2c0 36 32 32 34 36 39 30 61 38 33 66 33 64 37 39 30  6224690a83f3d790
1d2d0 64 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  d79....skipif po
1d2e0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1d2f0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1d300 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1d310 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1d320 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d330 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
1d340 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c   + cor0.col1 col
1d350 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1d360 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37  or0..----..29..7
1d370 34 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49  4..93....query I
1d380 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1d390 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30   DISTINCT + cor0
1d3a0 2e 63 6f 6c 32 20 2b 20 2b 20 28 20 63 6f 6c 31  .col2 + + ( col1
1d3b0 20 29 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c   ) * col1 AS col
1d3c0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1d3d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 32 39 0d  or0..----..7429.
1d3e0 0a 38 33 36 33 0d 0a 39 34 31 30 0d 0a 0d 0a 71  .8363..9410....q
1d3f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d400 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 33  SELECT ALL + + 3
1d410 37 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  7 * + col1 + col
1d420 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
1d430 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1d440 2d 0d 0a 33 32 30 36 0d 0a 33 34 35 36 0d 0a 33  -..3206..3456..3
1d450 36 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  624....query I r
1d460 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1d470 49 53 54 49 4e 43 54 20 39 36 20 46 52 4f 4d 20  ISTINCT 96 FROM 
1d480 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72 30 2c  tab2, tab1 cor0,
1d490 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74   tab2 AS cor1, t
1d4a0 61 62 31 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor2..----..
1d4b0 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
1d4c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1d4d0 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  col0 + + col1 + 
1d4e0 2d 20 74 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d  - tab2.col0 FROM
1d4f0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   tab2..----..-14
1d500 31 0d 0a 2d 39 37 0d 0a 31 37 0d 0a 0d 0a 71 75  1..-97..17....qu
1d510 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d520 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1d530 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 63  ol0 - + col0 * c
1d540 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
1d550 2d 2d 2d 0d 0a 2d 35 37 36 0d 0a 2d 37 35 0d 0a  ---..-576..-75..
1d560 2d 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -960....query I 
1d570 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d580 44 49 53 54 49 4e 43 54 20 2d 20 39 31 20 41 53  DISTINCT - 91 AS
1d590 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1d5a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1d5b0 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  91....query I ro
1d5c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1d5d0 2d 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30 20  - col0 - + col0 
1d5e0 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
1d5f0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
1d600 2d 2d 2d 0d 0a 2d 34 32 0d 0a 2d 36 30 30 36 0d  ---..-42..-6006.
1d610 0a 2d 36 31 36 32 0d 0a 0d 0a 71 75 65 72 79 20  .-6162....query 
1d620 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d630 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
1d640 32 20 2b 20 38 31 20 41 53 20 63 6f 6c 30 20 46  2 + 81 AS col0 F
1d650 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
1d660 2d 2d 2d 0d 0a 31 33 35 0d 0a 31 33 38 0d 0a 31  ---..135..138..1
1d670 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  77....query I ro
1d680 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1d690 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 34 35  STINCT col1 * 45
1d6a0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b   + col0 * col1 +
1d6b0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
1d6c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1d6d0 0a 2d 2d 2d 2d 0d 0a 31 36 31 39 0d 0a 32 31 38  .----..1619..218
1d6e0 37 0d 0a 37 33 33 35 0d 0a 0d 0a 71 75 65 72 79  7..7335....query
1d6f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d700 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  CT - - cor0.col0
1d710 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20   + ( + col0 ) * 
1d720 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
1d730 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1d740 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 34 31 36 30  ..----..12..4160
1d750 0d 0a 36 34 38 30 0d 0a 0d 0a 71 75 65 72 79 20  ..6480....query 
1d760 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d770 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b  T ALL - col2 * +
1d780 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
1d790 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1d7a0 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37 36 0d 0a  -..-1444..-676..
1d7b0 2d 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -729....query I 
1d7c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d7d0 63 6f 6c 32 20 2b 20 31 36 20 41 53 20 63 6f 6c  col2 + 16 AS col
1d7e0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1d7f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 34  or0..----..17..4
1d800 39 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  9..98....onlyif 
1d810 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1d820 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1d830 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1d840 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1d850 61 62 65 6c 2d 38 32 32 0d 0a 53 45 4c 45 43 54  abel-822..SELECT
1d860 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 36 34   ALL - col2 + 64
1d870 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20 63 6f   DIV - col0 + co
1d880 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
1d890 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1d8a0 0a 35 31 0d 0a 39 0d 0a 39 35 0d 0a 0d 0a 73 6b  .51..9..95....sk
1d8b0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1d8c0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1d8d0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1d8e0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1d8f0 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
1d900 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1d910 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1d920 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32 32 0d  wsort label-822.
1d930 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
1d940 6c 32 20 2b 20 36 34 20 2f 20 2d 20 63 6f 6c 30  l2 + 64 / - col0
1d950 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   + col1 col1 FRO
1d960 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1d970 2d 2d 2d 2d 0d 0a 35 31 0d 0a 39 0d 0a 39 35 0d  ----..51..9..95.
1d980 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d990 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
1d9a0 32 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  2 - col1 * col0 
1d9b0 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
1d9c0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1d9d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32 36 0d  ..----..-118826.
1d9e0 0a 2d 34 39 35 36 39 0d 0a 2d 37 32 30 38 39 33  .-49569..-720893
1d9f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1da00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1da10 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20  INCT - - col2 * 
1da20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32  cor0.col1 * col2
1da30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   + col0 * - col2
1da40 20 2a 20 2d 20 28 20 63 6f 6c 31 20 29 20 46 52   * - ( col1 ) FR
1da50 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1da60 0a 2d 2d 2d 2d 0d 0a 31 35 39 35 33 36 0d 0a 32  .----..159536..2
1da70 38 34 35 38 0d 0a 37 35 35 38 32 0d 0a 0d 0a 71  8458..75582....q
1da80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1da90 53 45 4c 45 43 54 20 2d 20 39 20 2a 20 2b 20 63  SELECT - 9 * + c
1daa0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 * - col0 AS 
1dab0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
1dac0 2d 2d 2d 2d 0d 0a 35 37 36 30 0d 0a 37 30 32 0d  ----..5760..702.
1dad0 0a 39 33 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .9360....query I
1dae0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1daf0 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2d 20 63 6f   ALL + col2 - co
1db00 6c 30 20 2a 20 2d 20 28 20 28 20 63 6f 6c 32 20  l0 * - ( ( col2 
1db10 29 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  ) * + col0 + col
1db20 31 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  1 ) FROM tab0..-
1db30 2d 2d 2d 0d 0a 32 31 31 30 35 0d 0a 34 36 32 31  ---..21105..4621
1db40 0d 0a 36 35 37 37 30 33 0d 0a 0d 0a 71 75 65 72  ..657703....quer
1db50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1db60 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
1db70 30 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  0 - + col2 AS co
1db80 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
1db90 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d  --..-16..-51..7.
1dba0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1dbb0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
1dbc0 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 74 61 62  0 + - col0 * tab
1dbd0 32 2e 63 6f 6c 32 20 2b 20 33 31 20 2a 20 63 6f  2.col2 + 31 * co
1dbe0 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
1dbf0 2d 2d 0d 0a 2d 32 35 35 34 0d 0a 2d 32 37 37 0d  --..-2554..-277.
1dc00 0a 37 36 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .765....onlyif m
1dc10 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1dc20 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1dc30 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1dc40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1dc50 62 65 6c 2d 38 32 39 0d 0a 53 45 4c 45 43 54 20  bel-829..SELECT 
1dc60 44 49 53 54 49 4e 43 54 20 36 35 20 2a 20 63 6f  DISTINCT 65 * co
1dc70 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20  l1 DIV - col1 + 
1dc80 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  - col1 + - col1 
1dc90 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1dca0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 37 0d 0a 2d  0..----..-237..-
1dcb0 32 34 37 0d 0a 2d 32 35 39 0d 0a 0d 0a 73 6b 69  247..-259....ski
1dcc0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1dcd0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1dce0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1dcf0 6c 2d 38 32 39 0d 0a 53 45 4c 45 43 54 20 44 49  l-829..SELECT DI
1dd00 53 54 49 4e 43 54 20 36 35 20 2a 20 63 6f 6c 31  STINCT 65 * col1
1dd10 20 2f 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   / - col1 + - co
1dd20 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63  l1 + - col1 AS c
1dd30 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
1dd40 2d 2d 2d 0d 0a 2d 32 33 37 0d 0a 2d 32 34 37 0d  ---..-237..-247.
1dd50 0a 2d 32 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-259....onlyif 
1dd60 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1dd70 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1dd80 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1dd90 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1dda0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1ddb0 6c 2d 38 33 30 0d 0a 53 45 4c 45 43 54 20 2d 20  l-830..SELECT - 
1ddc0 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32  cor0.col2 * col2
1ddd0 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
1dde0 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
1ddf0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1de00 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
1de10 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
1de20 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1de30 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1de40 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 30 0d  wsort label-830.
1de50 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
1de60 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 43 41 53  ol2 * col2 + CAS
1de70 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
1de80 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20  GER ) FROM tab1 
1de90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
1dea0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
1deb0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1dec0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1ded0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1dee0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1def0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1df00 33 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  31..SELECT DISTI
1df10 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b  NCT + - col0 + +
1df20 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 44   col1 * - col2 D
1df30 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63  IV + cor0.col2 c
1df40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
1df50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39   cor0..----..-29
1df60 0d 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d 0a 73 6b  ..-74..-93....sk
1df70 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1df80 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1df90 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1dfa0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1dfb0 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
1dfc0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1dfd0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1dfe0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 31 0d  wsort label-831.
1dff0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1e000 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   + - col0 + + co
1e010 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2f 20 2b 20  l1 * - col2 / + 
1e020 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 30 20 46  cor0.col2 col0 F
1e030 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1e040 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37 34  ..----..-29..-74
1e050 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-93....query I
1e060 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e070 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
1e080 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20  ol2 * - col1 AS 
1e090 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
1e0a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1e0b0 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d  534..-646..-837.
1e0c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e0d0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 32  rt..SELECT + + 2
1e0e0 36 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 38 32 20  6 + col0 * - 82 
1e0f0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1e100 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  1 cor0..----..-2
1e110 32 30 0d 0a 2d 35 32 32 32 0d 0a 2d 36 35 33 34  20..-5222..-6534
1e120 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1e130 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1e140 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1e150 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1e160 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1e170 38 33 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  834..SELECT col0
1e180 20 44 49 56 20 2d 20 31 36 20 46 52 4f 4d 20 74   DIV - 16 FROM t
1e190 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d  ab1..----..-4..-
1e1a0 35 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  5..0....skipif m
1e1b0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1e1c0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1e1d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 34  owsort label-834
1e1e0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20  ..SELECT col0 / 
1e1f0 2d 20 31 36 20 46 52 4f 4d 20 74 61 62 31 0d 0a  - 16 FROM tab1..
1e200 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 35 0d 0a 30 0d  ----..-4..-5..0.
1e210 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e220 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1e230 20 37 32 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 63   72 + + col2 + c
1e240 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
1e250 2d 2d 2d 0d 0a 31 30 36 0d 0a 31 37 36 0d 0a 31  ---..106..176..1
1e260 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  89....skipif pos
1e270 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1e280 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1e290 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1e2a0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
1e2b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e2c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1e2d0 2d 20 38 34 20 63 6f 6c 30 20 46 52 4f 4d 20 74  - 84 col0 FROM t
1e2e0 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
1e2f0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a 0d 0a  0..----..-84....
1e300 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e310 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 20 2a 20  .SELECT ALL 9 * 
1e320 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
1e330 0d 0a 2d 2d 2d 2d 0d 0a 34 38 36 0d 0a 35 31 33  ..----..486..513
1e340 0d 0a 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..864....query I
1e350 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e360 20 41 4c 4c 20 35 30 20 2b 20 63 6f 6c 30 20 2a   ALL 50 + col0 *
1e370 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 46 52   - ( + col0 ) FR
1e380 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
1e390 34 30 34 36 0d 0a 2d 36 33 35 30 0d 0a 34 31 0d  4046..-6350..41.
1e3a0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1e3b0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1e3c0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1e3d0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1e3e0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1e3f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e400 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1e410 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol2 * cor0.col0 
1e420 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1e430 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
1e440 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d  9..2028..3002...
1e450 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1e460 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1e470 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1e480 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1e490 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1e4a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e4b0 54 20 41 4c 4c 20 31 35 20 2a 20 63 6f 72 30 2e  T ALL 15 * cor0.
1e4c0 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
1e4d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1e4e0 2d 0d 0a 32 35 35 0d 0a 34 36 35 0d 0a 38 38 35  -..255..465..885
1e4f0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1e500 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1e510 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1e520 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1e530 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1e540 38 34 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  841..SELECT col0
1e550 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 74 61 62 30   * - col2 + tab0
1e560 2e 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30  .col2 DIV - col0
1e570 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1e580 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37  ..-35..-7298..-7
1e590 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  93....skipif mys
1e5a0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1e5b0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1e5c0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34 31 0d 0a  sort label-841..
1e5d0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20  SELECT col0 * - 
1e5e0 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c 32  col2 + tab0.col2
1e5f0 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   / - col0 FROM t
1e600 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a  ab0..----..-35..
1e610 2d 37 32 39 38 0d 0a 2d 37 39 33 0d 0a 0d 0a 71  -7298..-793....q
1e620 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e630 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 36 30  SELECT col1 + 60
1e640 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1e650 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 37  b2..----..119..7
1e660 37 0d 0a 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49  7..91....query I
1e670 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e680 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2d 20   ALL + col2 * - 
1e690 28 20 37 39 20 2a 20 2d 20 63 6f 6c 32 20 29 20  ( 79 * - col2 ) 
1e6a0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1e6b0 0a 32 33 30 33 36 34 0d 0a 32 35 36 36 37 31 0d  .230364..256671.
1e6c0 0a 37 32 38 30 36 34 0d 0a 0d 0a 71 75 65 72 79  .728064....query
1e6d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e6e0 43 54 20 63 6f 6c 31 20 2d 20 2b 20 28 20 33 32  CT col1 - + ( 32
1e6f0 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
1e700 2d 2d 0d 0a 35 34 0d 0a 35 39 0d 0a 36 35 0d 0a  --..54..59..65..
1e710 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e720 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 32 2e 63  t..SELECT tab2.c
1e730 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63  ol2 * col2 + + c
1e740 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
1e750 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32   tab2..----..152
1e760 33 0d 0a 37 33 36 0d 0a 37 35 34 0d 0a 0d 0a 73  3..736..754....s
1e770 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1e780 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1e790 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1e7a0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1e7b0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1e7c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e7d0 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20  ALL tab0.col0 * 
1e7e0 2b 20 39 38 20 63 6f 6c 30 20 46 52 4f 4d 20 74  + 98 col0 FROM t
1e7f0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 35 32 0d  ab0..----..2352.
1e800 0a 33 34 33 30 0d 0a 38 37 32 32 0d 0a 0d 0a 6f  .3430..8722....o
1e810 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1e820 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1e830 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1e840 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1e850 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34 37 0d 0a  sort label-847..
1e860 53 45 4c 45 43 54 20 32 39 20 44 49 56 20 63 6f  SELECT 29 DIV co
1e870 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
1e880 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c  2, tab1 AS cor0,
1e890 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
1e8a0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
1e8b0 61 73 68 69 6e 67 20 74 6f 20 65 32 35 36 38 62  ashing to e2568b
1e8c0 30 31 64 64 34 31 31 62 35 61 32 30 36 30 36 38  01dd411b5a206068
1e8d0 36 39 37 64 30 65 64 30 64 32 0d 0a 0d 0a 73 6b  697d0ed0d2....sk
1e8e0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1e8f0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1e900 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1e910 65 6c 2d 38 34 37 0d 0a 53 45 4c 45 43 54 20 32  el-847..SELECT 2
1e920 39 20 2f 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  9 / cor0.col2 FR
1e930 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
1e940 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
1e950 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
1e960 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1e970 65 32 35 36 38 62 30 31 64 64 34 31 31 62 35 61  e2568b01dd411b5a
1e980 32 30 36 30 36 38 36 39 37 64 30 65 64 30 64 32  206068697d0ed0d2
1e990 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e9a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1e9b0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20  + cor0.col2 + - 
1e9c0 28 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  ( + col2 ) FROM 
1e9d0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1e9e0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
1e9f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ea00 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
1ea10 32 20 2b 20 2d 20 31 30 20 2d 20 2b 20 63 6f 6c  2 + - 10 - + col
1ea20 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1ea30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d 0a  or0..----..-51..
1ea40 2d 36 32 0d 0a 31 30 0d 0a 0d 0a 73 6b 69 70 69  -62..10....skipi
1ea50 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1ea60 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1ea70 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1ea80 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1ea90 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1eaa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1eab0 2d 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  - + col2 + col1 
1eac0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
1ead0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33  S cor0..----..53
1eae0 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  ..9..96....query
1eaf0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1eb00 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 31 33  CT - + col1 + 13
1eb10 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1eb20 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
1eb30 37 33 0d 0a 2d 37 38 0d 0a 2d 38 34 0d 0a 0d 0a  73..-78..-84....
1eb40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1eb50 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2b  .SELECT col1 + +
1eb60 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63   ( + col1 ) AS c
1eb70 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
1eb80 2d 2d 2d 0d 0a 32 30 0d 0a 32 36 0d 0a 35 32 0d  ---..20..26..52.
1eb90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1eba0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
1ebb0 31 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20  1 + tab0.col1 * 
1ebc0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
1ebd0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1ebe0 2d 32 31 35 30 0d 0a 2d 33 34 39 32 0d 0a 2d 38  -2150..-3492..-8
1ebf0 31 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  190....query I r
1ec00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1ec10 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30  ISTINCT - - cor0
1ec20 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 41  .col2 + + col0 A
1ec30 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1ec40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
1ec50 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 73 6b 69  ..117..34....ski
1ec60 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1ec70 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1ec80 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1ec90 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1eca0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
1ecb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1ecc0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
1ecd0 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  + col0 col1 FROM
1ece0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1ecf0 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38 34 0d  ---..-49..-6084.
1ed00 0a 2d 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20  .-6241....query 
1ed10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ed20 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  T - + col1 * col
1ed30 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 * + col1 FROM 
1ed40 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1ed50 0a 2d 31 36 32 32 34 0d 0a 2d 33 36 35 30 34 0d  .-16224..-36504.
1ed60 0a 2d 35 37 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-5700....onlyif
1ed70 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1ed80 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1ed90 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1eda0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1edb0 6c 61 62 65 6c 2d 38 35 37 0d 0a 53 45 4c 45 43  label-857..SELEC
1edc0 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 44 49  T col0 + col1 DI
1edd0 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  V - col1 FROM ta
1ede0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1edf0 0d 0a 32 0d 0a 36 33 0d 0a 37 39 0d 0a 0d 0a 73  ..2..63..79....s
1ee00 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1ee10 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1ee20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1ee30 62 65 6c 2d 38 35 37 0d 0a 53 45 4c 45 43 54 20  bel-857..SELECT 
1ee40 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2f 20 2d 20  col0 + col1 / - 
1ee50 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
1ee60 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d  S cor0..----..2.
1ee70 0a 36 33 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79  .63..79....query
1ee80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ee90 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1eea0 6c 31 20 2a 20 2d 20 36 39 20 2a 20 63 6f 6c 31  l1 * - 69 * col1
1eeb0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1eec0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
1eed0 35 31 30 33 32 34 0d 0a 2d 35 37 31 33 38 39 0d  510324..-571389.
1eee0 0a 2d 36 34 39 32 32 31 0d 0a 0d 0a 6f 6e 6c 79  .-649221....only
1eef0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1ef00 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1ef10 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1ef20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ef30 74 20 6c 61 62 65 6c 2d 38 35 39 0d 0a 53 45 4c  t label-859..SEL
1ef40 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28  ECT DISTINCT + (
1ef50 20 2b 20 34 34 20 29 20 44 49 56 20 63 6f 72 30   + 44 ) DIV cor0
1ef60 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20  .col1 FROM tab1 
1ef70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1ef80 0d 0a 33 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..3..4....skipif
1ef90 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1efa0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1efb0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1efc0 35 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  59..SELECT DISTI
1efd0 4e 43 54 20 2b 20 28 20 2b 20 34 34 20 29 20 2f  NCT + ( + 44 ) /
1efe0 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
1eff0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1f000 2d 2d 0d 0a 31 0d 0a 33 0d 0a 34 0d 0a 0d 0a 71  --..1..3..4....q
1f010 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f020 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2d 20  SELECT - col2 - 
1f030 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  + cor0.col2 AS c
1f040 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
1f050 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a  r0..----..-108..
1f060 2d 31 31 34 0d 0a 2d 31 39 32 0d 0a 0d 0a 71 75  -114..-192....qu
1f070 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f080 45 4c 45 43 54 20 41 4c 4c 20 38 32 20 2b 20 2d  ELECT ALL 82 + -
1f090 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
1f0a0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1f0b0 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d 34 0d 0a  .----..-15..-4..
1f0c0 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -9....query I ro
1f0d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
1f0e0 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 29 20  - col0 + col2 ) 
1f0f0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1f100 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71  .-7..16..51....q
1f110 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f120 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
1f130 30 2e 63 6f 6c 31 20 2b 20 2d 20 28 20 63 6f 6c  0.col1 + - ( col
1f140 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  2 ) AS col2 FROM
1f150 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1f160 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d  ---..-28..-47..-
1f170 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
1f180 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1f190 53 54 49 4e 43 54 20 2b 20 28 20 2d 20 31 32 20  STINCT + ( - 12 
1f1a0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
1f1b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a  or0..----..-12..
1f1c0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1f1d0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1f1e0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1f1f0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1f200 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1f210 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 35 0d 0a  sort label-865..
1f220 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28  SELECT ALL CAST(
1f230 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
1f240 29 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ) / + cor0.col0 
1f250 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + - cor0.col2 * 
1f260 63 6f 6c 32 20 2a 20 37 32 20 41 53 20 63 6f 6c  col2 * 72 AS col
1f270 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
1f280 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
1f290 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
1f2a0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1f2b0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1f2c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1f2d0 62 65 6c 2d 38 36 35 0d 0a 53 45 4c 45 43 54 20  bel-865..SELECT 
1f2e0 41 4c 4c 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  ALL CAST ( NULL 
1f2f0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2b  AS INTEGER ) / +
1f300 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
1f310 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  or0.col2 * col2 
1f320 2a 20 37 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  * 72 AS col1 FRO
1f330 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1f340 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
1f350 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
1f360 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1f370 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1f380 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1f390 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1f3a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1f3b0 65 6c 2d 38 36 36 0d 0a 53 45 4c 45 43 54 20 41  el-866..SELECT A
1f3c0 4c 4c 20 2d 20 43 41 53 54 28 20 2b 20 63 6f 6c  LL - CAST( + col
1f3d0 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  2 AS SIGNED ) * 
1f3e0 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63  col0 * col0 AS c
1f3f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
1f400 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
1f410 32 35 0d 0a 2d 31 39 30 30 38 0d 0a 2d 36 34 39  25..-19008..-649
1f420 35 32 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  522....skipif my
1f430 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1f440 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1f450 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 36 0d  wsort label-866.
1f460 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41  .SELECT ALL - CA
1f470 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 49  ST ( + col2 AS I
1f480 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30 20  NTEGER ) * col0 
1f490 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
1f4a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1f4b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d  ..----..-1225..-
1f4c0 31 39 30 30 38 0d 0a 2d 36 34 39 35 32 32 0d 0a  19008..-649522..
1f4d0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1f4e0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1f4f0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1f500 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1f510 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1f520 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f530 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
1f540 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 38 32 20 63  r0.col1 * + 82 c
1f550 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1f560 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30   cor0..----..-70
1f570 35 32 0d 0a 2d 37 34 36 32 0d 0a 2d 37 39 35 34  52..-7462..-7954
1f580 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f590 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1f5a0 49 4e 43 54 20 34 38 20 46 52 4f 4d 20 74 61 62  INCT 48 FROM tab
1f5b0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 38  1 cor0..----..48
1f5c0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1f5d0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1f5e0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1f5f0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1f600 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1f610 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 39  owsort label-869
1f620 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1f630 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T + CAST( NULL A
1f640 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 37  S SIGNED ) * + 7
1f650 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + + col0 FROM t
1f660 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
1f670 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
1f680 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1f690 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1f6a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 39  owsort label-869
1f6b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1f6c0 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  T + CAST ( NULL 
1f6d0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b  AS INTEGER ) * +
1f6e0 20 37 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   7 + + col0 FROM
1f6f0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1f700 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
1f710 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1f720 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1f730 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1f740 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1f750 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1f760 65 6c 2d 38 37 30 0d 0a 53 45 4c 45 43 54 20 41  el-870..SELECT A
1f770 4c 4c 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53  LL CAST( NULL AS
1f780 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 32   SIGNED ) * col2
1f790 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   * col2 AS col1 
1f7a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1f7b0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
1f7c0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
1f7d0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1f7e0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1f7f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1f800 6c 2d 38 37 30 0d 0a 53 45 4c 45 43 54 20 41 4c  l-870..SELECT AL
1f810 4c 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  L CAST ( NULL AS
1f820 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c   INTEGER ) * col
1f830 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  2 * col2 AS col1
1f840 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1f850 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1f860 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
1f870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f880 45 4c 45 43 54 20 32 34 20 2a 20 2d 20 34 37 20  ELECT 24 * - 47 
1f890 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1f8a0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 38 0d 0a  0..----..-1128..
1f8b0 2d 31 31 32 38 0d 0a 2d 31 31 32 38 0d 0a 0d 0a  -1128..-1128....
1f8c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f8d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1f8e0 20 28 20 31 35 20 29 20 41 53 20 63 6f 6c 32 20   ( 15 ) AS col2 
1f8f0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1f900 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 0d 0a 71  0..----..15....q
1f910 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f920 53 45 4c 45 43 54 20 2d 20 2b 20 32 39 20 2d 20  SELECT - + 29 - 
1f930 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  + col2 * - col2 
1f940 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
1f950 2d 2d 2d 2d 0d 0a 32 38 38 37 0d 0a 33 32 32 30  ----..2887..3220
1f960 0d 0a 39 31 38 37 0d 0a 0d 0a 71 75 65 72 79 20  ..9187....query 
1f970 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f980 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b  T DISTINCT - ( +
1f990 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20 2b   col0 ) * col1 +
1f9a0 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
1f9b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1f9c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37 38 0d 0a  0..----..-1978..
1f9d0 2d 33 32 39 38 0d 0a 2d 38 30 30 38 0d 0a 0d 0a  -3298..-8008....
1f9e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f9f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
1fa00 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20  ( cor0.col2 ) * 
1fa10 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
1fa20 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1fa30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33  ..----..-162..-3
1fa40 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75  648..-7680....qu
1fa50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1fa60 45 4c 45 43 54 20 28 20 2d 20 32 35 20 29 20 2b  ELECT ( - 25 ) +
1fa70 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   - cor0.col0 FRO
1fa80 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1fa90 2d 2d 2d 2d 0d 0a 2d 31 30 35 0d 0a 2d 32 38 0d  ----..-105..-28.
1faa0 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-89....query I 
1fab0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1fac0 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d  - cor1.col1 FROM
1fad0 20 74 61 62 31 2c 20 74 61 62 30 20 63 6f 72 30   tab1, tab0 cor0
1fae0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
1faf0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
1fb00 68 61 73 68 69 6e 67 20 74 6f 20 63 37 38 39 30  hashing to c7890
1fb10 34 36 39 65 61 62 62 32 63 36 66 63 38 31 34 35  469eabb2c6fc8145
1fb20 34 62 33 35 64 32 33 33 33 62 36 0d 0a 0d 0a 71  4b35d2333b6....q
1fb30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1fb40 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1fb50 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
1fb60 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a  ab1, tab2 cor0..
1fb70 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  ----..0....query
1fb80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1fb90 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 74 61 62  CT ALL - ( - tab
1fba0 30 2e 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32  0.col0 ) AS col2
1fbb0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1fbc0 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a  ..24..35..89....
1fbd0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
1fbe0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
1fbf0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
1fc00 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
1fc10 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
1fc20 72 74 20 6c 61 62 65 6c 2d 38 38 30 0d 0a 53 45  rt label-880..SE
1fc30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41  LECT DISTINCT CA
1fc40 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
1fc50 45 44 20 29 20 2a 20 74 61 62 31 2e 63 6f 6c 31  ED ) * tab1.col1
1fc60 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1fc70 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
1fc80 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1fc90 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1fca0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1fcb0 38 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  80..SELECT DISTI
1fcc0 4e 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  NCT CAST ( NULL 
1fcd0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 74  AS INTEGER ) * t
1fce0 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ab1.col1 FROM ta
1fcf0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b1..----..NULL..
1fd00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1fd10 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1fd20 43 54 20 2b 20 34 34 20 2b 20 2d 20 63 6f 6c 32  CT + 44 + - col2
1fd30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1fd40 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1fd50 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 35 32 0d  ..-10..-13..-52.
1fd60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1fd70 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1fd80 4e 43 54 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c  NCT col0 + ( col
1fd90 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  2 ) AS col0 FROM
1fda0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1fdb0 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35  ---..121..176..5
1fdc0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1fdd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39  sort..SELECT - 9
1fde0 35 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  5 + + cor0.col2 
1fdf0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
1fe00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
1fe10 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1fe20 74 6f 20 39 31 30 33 37 31 64 66 61 38 33 34 66  to 910371dfa834f
1fe30 39 65 30 65 39 62 62 34 64 36 31 33 36 63 66 65  9e0e9bb4d6136cfe
1fe40 30 66 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  0f8....query I r
1fe50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1fe60 20 35 34 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f   54 + - col1 FRO
1fe70 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1fe80 2d 0d 0a 2d 33 32 0d 0a 2d 33 37 0d 0a 2d 34 33  -..-32..-37..-43
1fe90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1fea0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
1feb0 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  l0 * col2 + col0
1fec0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
1fed0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
1fee0 33 33 0d 0a 2d 33 35 37 34 0d 0a 2d 37 35 38 37  33..-3574..-7587
1fef0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ff00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
1ff10 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 28 20  col2 * col1 * ( 
1ff20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46  col0 ) AS col1 F
1ff30 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1ff40 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d  ..----..-3395..-
1ff50 36 36 34 31 31 38 0d 0a 2d 36 38 31 31 32 0d 0a  664118..-68112..
1ff60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ff70 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 20 2d 20  t..SELECT + 3 - 
1ff80 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1ff90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
1ffa0 31 0d 0a 2d 33 32 0d 0a 2d 38 36 0d 0a 0d 0a 71  1..-32..-86....q
1ffb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ffc0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 63 6f  SELECT col0 - co
1ffd0 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  l0 * + col1 * - 
1ffe0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
1fff0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
20000 2d 2d 2d 2d 0d 0a 31 37 37 35 32 38 0d 0a 33 32  ----..177528..32
20010 39 33 35 30 0d 0a 37 33 37 30 39 38 0d 0a 0d 0a  9350..737098....
20020 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
20030 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
20040 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
20050 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
20060 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38 39 0d  wsort label-889.
20070 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 44  .SELECT - col0 D
20080 49 56 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63  IV col0 - cor0.c
20090 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
200a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 39   cor0..----..-79
200b0 0d 0a 2d 38 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69  ..-8..-80....ski
200c0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
200d0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
200e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
200f0 6c 2d 38 38 39 0d 0a 53 45 4c 45 43 54 20 2d 20  l-889..SELECT - 
20100 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2d 20 63 6f  col0 / col0 - co
20110 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
20120 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20130 0a 2d 37 39 0d 0a 2d 38 0d 0a 2d 38 30 0d 0a 0d  .-79..-8..-80...
20140 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20150 0d 0a 53 45 4c 45 43 54 20 35 38 20 2b 20 63 6f  ..SELECT 58 + co
20160 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 * col2 FROM t
20170 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 37 0d  ab0..----..1147.
20180 0a 35 39 0d 0a 36 37 38 32 0d 0a 0d 0a 71 75 65  .59..6782....que
20190 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
201a0 4c 45 43 54 20 2d 20 30 20 41 53 20 63 6f 6c 30  LECT - 0 AS col0
201b0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
201c0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c  ..0..0..0....onl
201d0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
201e0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
201f0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
20200 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
20210 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
20220 6c 61 62 65 6c 2d 38 39 32 0d 0a 53 45 4c 45 43  label-892..SELEC
20230 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  T CAST( NULL AS 
20240 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 74 61 62  SIGNED ) * + tab
20250 32 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52  2.col0 * col2 FR
20260 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab2..----..N
20270 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
20280 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
20290 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
202a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
202b0 74 20 6c 61 62 65 6c 2d 38 39 32 0d 0a 53 45 4c  t label-892..SEL
202c0 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  ECT CAST ( NULL 
202d0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b  AS INTEGER ) * +
202e0 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 63 6f 6c   tab2.col0 * col
202f0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
20300 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
20310 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
20320 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
20330 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  LL + col0 + col2
20340 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   - - col2 AS col
20350 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
20360 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a 31 35 35  ..----..130..155
20370 0d 0a 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..61....onlyif m
20380 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
20390 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
203a0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
203b0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
203c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
203d0 2d 38 39 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -894..SELECT ALL
203e0 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54   - col1 + + CAST
203f0 28 20 38 36 20 41 53 20 53 49 47 4e 45 44 20 29  ( 86 AS SIGNED )
20400 20 2b 20 63 6f 6c 30 20 2a 20 36 37 20 2a 20 63   + col0 * 67 * c
20410 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
20420 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39   cor0..----..109
20430 31 34 0d 0a 32 34 34 34 39 32 0d 0a 35 31 34 36  14..244492..5146
20440 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  33....skipif mys
20450 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
20460 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
20470 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 34 0d 0a  sort label-894..
20480 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
20490 31 20 2b 20 2b 20 43 41 53 54 20 28 20 38 36 20  1 + + CAST ( 86 
204a0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63  AS INTEGER ) + c
204b0 6f 6c 30 20 2a 20 36 37 20 2a 20 63 6f 6c 32 20  ol0 * 67 * col2 
204c0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
204d0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 31 34 0d 0a  0..----..10914..
204e0 32 34 34 34 39 32 0d 0a 35 31 34 36 33 33 0d 0a  244492..514633..
204f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
20500 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
20510 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
20520 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
20530 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39  rowsort label-89
20540 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  5..SELECT ALL co
20550 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 44 49 56 20  l1 - - col2 DIV 
20560 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
20570 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
20580 31 39 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 73 6b  19..31..59....sk
20590 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
205a0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
205b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
205c0 65 6c 2d 38 39 35 0d 0a 53 45 4c 45 43 54 20 41  el-895..SELECT A
205d0 4c 4c 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32  LL col1 - - col2
205e0 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   / cor0.col1 FRO
205f0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
20600 2d 0d 0a 31 39 0d 0a 33 31 0d 0a 35 39 0d 0a 0d  -..19..31..59...
20610 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20620 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
20630 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 28 20 63  T - - col1 * ( c
20640 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 31 20 2a  ol2 ) + + col1 *
20650 20 2b 20 36 34 20 2b 20 63 6f 6c 32 20 41 53 20   + 64 + col2 AS 
20660 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
20670 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
20680 37 32 0d 0a 32 38 34 38 0d 0a 35 33 33 36 0d 0a  72..2848..5336..
20690 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
206a0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
206b0 20 28 20 2d 20 39 20 29 20 2b 20 2d 20 63 6f 6c   ( - 9 ) + - col
206c0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
206d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
206e0 2d 0d 0a 2d 38 30 37 0d 0a 2d 38 37 34 0d 0a 2d  -..-807..-874..-
206f0 39 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  901....query I r
20700 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
20710 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 31 20 29   col0 * ( col1 )
20720 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
20730 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39  .----..2064..339
20740 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79  5..8099....query
20750 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20760 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  CT - col1 + - co
20770 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32  r0.col0 * + col2
20780 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
20790 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
207a0 0d 0a 2d 32 30 38 37 0d 0a 2d 32 32 30 0d 0a 2d  ..-2087..-220..-
207b0 33 30 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3019....query I 
207c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
207d0 2d 20 2b 20 37 30 20 2a 20 36 39 20 46 52 4f 4d  - + 70 * 69 FROM
207e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
207f0 2d 2d 2d 0d 0a 2d 34 38 33 30 0d 0a 2d 34 38 33  ---..-4830..-483
20800 30 0d 0a 2d 34 38 33 30 0d 0a 0d 0a 71 75 65 72  0..-4830....quer
20810 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20820 45 43 54 20 39 37 20 41 53 20 63 6f 6c 30 20 46  ECT 97 AS col0 F
20830 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
20840 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32   CROSS JOIN tab2
20850 2c 20 74 61 62 30 20 63 6f 72 31 2c 20 74 61 62  , tab0 cor1, tab
20860 30 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31  0 cor2..----..81
20870 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
20880 74 6f 20 66 31 64 33 33 31 39 62 39 34 39 31 66  to f1d3319b9491f
20890 36 34 36 32 31 66 32 64 62 62 30 38 30 38 34 35  64621f2dbb080845
208a0 38 63 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  8ca....query I r
208b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
208c0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a  ISTINCT + col2 *
208d0 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 32 32 20 2a   + col2 + - 22 *
208e0 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63   + tab1.col0 + c
208f0 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 * col0 FROM 
20900 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 33  tab1..----..1513
20910 36 0d 0a 33 30 31 32 0d 0a 35 34 38 39 0d 0a 0d  6..3012..5489...
20920 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20930 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20  ..SELECT col0 - 
20940 28 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  ( + col2 ) AS co
20950 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
20960 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d  --..-16..-51..7.
20970 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20980 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62  rt..SELECT - tab
20990 32 2e 63 6f 6c 30 20 2b 20 35 32 20 2d 20 63 6f  2.col0 + 52 - co
209a0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
209b0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34  tab2..----..-104
209c0 0d 0a 2d 31 30 36 0d 0a 33 38 0d 0a 0d 0a 6f 6e  ..-106..38....on
209d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
209e0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
209f0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
20a00 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
20a10 6f 72 74 20 6c 61 62 65 6c 2d 39 30 35 0d 0a 53  ort label-905..S
20a20 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
20a30 72 30 2e 63 6f 6c 31 20 44 49 56 20 2b 20 38 20  r0.col1 DIV + 8 
20a40 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72  + - col0 * - cor
20a50 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  0.col0 AS col0 F
20a60 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
20a70 2d 2d 2d 0d 0a 31 32 0d 0a 34 30 39 37 0d 0a 36  ---..12..4097..6
20a80 34 30 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  401....skipif my
20a90 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
20aa0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
20ab0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 35 0d  wsort label-905.
20ac0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
20ad0 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 2b 20 38 20  cor0.col1 / + 8 
20ae0 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72  + - col0 * - cor
20af0 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  0.col0 AS col0 F
20b00 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
20b10 2d 2d 2d 0d 0a 31 32 0d 0a 34 30 39 37 0d 0a 36  ---..12..4097..6
20b20 34 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  401....query I r
20b30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
20b40 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  LL - - col0 * - 
20b50 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63  col2 + col1 AS c
20b60 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
20b70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30   cor0..----..-70
20b80 36 0d 0a 2d 37 32 30 37 0d 0a 36 32 0d 0a 0d 0a  6..-7207..62....
20b90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20ba0 0a 53 45 4c 45 43 54 20 37 37 20 2a 20 2d 20 33  .SELECT 77 * - 3
20bb0 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  0 + col0 AS col1
20bc0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
20bd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 32 31 0d  r0..----..-2221.
20be0 0a 2d 32 32 37 35 0d 0a 2d 32 32 38 36 0d 0a 0d  .-2275..-2286...
20bf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20c00 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
20c10 54 20 2b 20 32 36 20 2a 20 63 6f 6c 32 20 46 52  T + 26 * col2 FR
20c20 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
20c30 0a 2d 2d 2d 2d 0d 0a 31 34 30 34 0d 0a 31 34 38  .----..1404..148
20c40 32 0d 0a 32 34 39 36 0d 0a 0d 0a 73 6b 69 70 69  2..2496....skipi
20c50 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
20c60 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
20c70 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
20c80 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
20c90 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
20ca0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
20cb0 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 37 33  INCT - col1 + 73
20cc0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
20cd0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
20ce0 34 0d 0a 34 32 0d 0a 35 36 0d 0a 0d 0a 73 6b 69  4..42..56....ski
20cf0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
20d00 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
20d10 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
20d20 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
20d30 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
20d40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
20d50 4c 20 2d 20 2d 20 32 38 20 2a 20 39 38 20 63 6f  L - - 28 * 98 co
20d60 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
20d70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 34 34  cor0..----..2744
20d80 0d 0a 32 37 34 34 0d 0a 32 37 34 34 0d 0a 0d 0a  ..2744..2744....
20d90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20da0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d  .SELECT col2 + -
20db0 20 28 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 30   ( col0 ) * col0
20dc0 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
20dd0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
20de0 0a 2d 31 32 32 34 0d 0a 2d 31 38 39 37 35 0d 0a  .-1224..-18975..
20df0 2d 36 34 39 34 34 30 0d 0a 0d 0a 71 75 65 72 79  -649440....query
20e00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20e10 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20  CT ALL + col2 + 
20e20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 39  + ( + col0 ) * 9
20e30 38 20 2a 20 31 35 20 46 52 4f 4d 20 74 61 62 31  8 * 15 FROM tab1
20e40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20e50 31 31 37 36 39 36 0d 0a 34 34 36 34 0d 0a 39 34  117696..4464..94
20e60 31 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  137....query I r
20e70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
20e80 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 72 30   ( col2 ) * cor0
20e90 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
20ea0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
20eb0 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30  .----..1248..140
20ec0 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20  4..570....query 
20ed0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
20ee0 54 20 2b 20 37 34 20 2b 20 2b 20 63 6f 6c 31 20  T + 74 + + col1 
20ef0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
20f00 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20f10 0a 31 30 30 0d 0a 38 34 0d 0a 38 37 0d 0a 0d 0a  .100..84..87....
20f20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20f30 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 34  .SELECT col0 * 4
20f40 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  4 AS col2 FROM t
20f50 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 30 38 0d 0a  ab2..----..308..
20f60 33 34 33 32 0d 0a 33 34 37 36 0d 0a 0d 0a 71 75  3432..3476....qu
20f70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20f80 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 34 37  ELECT ALL - - 47
20f90 20 2a 20 2d 20 37 36 20 2b 20 63 6f 6c 30 20 2a   * - 76 + col0 *
20fa0 20 2b 20 37 39 20 41 53 20 63 6f 6c 30 20 46 52   + 79 AS col0 FR
20fb0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
20fc0 0a 2d 2d 2d 2d 0d 0a 2d 31 36 37 36 0d 0a 2d 38  .----..-1676..-8
20fd0 30 37 0d 0a 33 34 35 39 0d 0a 0d 0a 71 75 65 72  07..3459....quer
20fe0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20ff0 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 33 32 20  ECT col2 + - 32 
21000 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
21010 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
21020 0a 32 32 0d 0a 32 35 0d 0a 36 34 0d 0a 0d 0a 71  .22..25..64....q
21030 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21040 53 45 4c 45 43 54 20 2b 20 2d 20 33 36 20 2d 20  SELECT + - 36 - 
21050 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
21060 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
21070 2d 0d 0a 2d 31 32 35 0d 0a 2d 36 30 0d 0a 2d 37  -..-125..-60..-7
21080 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
21090 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
210a0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
210b0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
210c0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
210d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
210e0 45 4c 45 43 54 20 37 37 20 2b 20 63 6f 6c 32 20  ELECT 77 + col2 
210f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
21100 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
21110 30 0d 0a 31 35 39 0d 0a 37 38 0d 0a 0d 0a 71 75  0..159..78....qu
21120 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21130 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20 63  ELECT + col2 - c
21140 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
21150 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
21160 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a  ..-53..-9..-96..
21170 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21180 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
21190 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  CT - col0 * col2
211a0 20 2b 20 31 35 20 2b 20 2d 20 39 20 46 52 4f 4d   + 15 + - 9 FROM
211b0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
211c0 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37 32 39 32 0d  ---..-29..-7292.
211d0 0a 2d 37 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .-786....query I
211e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
211f0 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   ALL + cor0.col0
21200 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
21210 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
21220 0a 2d 32 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a  .-23..54..67....
21230 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21240 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
21250 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a  r0.col1 + col0 *
21260 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
21270 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
21280 0a 31 33 32 36 0d 0a 31 38 36 0d 0a 34 35 34 33  .1326..186..4543
21290 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
212a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
212b0 49 4e 43 54 20 39 20 46 52 4f 4d 20 74 61 62 31  INCT 9 FROM tab1
212c0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
212d0 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
212e0 2d 2d 2d 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20  ---..9....query 
212f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21300 54 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  T cor0.col0 FROM
21310 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
21320 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53  OSS JOIN tab2 AS
21330 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
21340 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
21350 20 64 64 31 38 62 39 33 32 36 33 61 36 63 64 34   dd18b93263a6cd4
21360 32 35 66 63 37 63 63 38 34 64 39 31 33 37 38 37  25fc7cc84d913787
21370 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
21380 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
21390 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2d 20 2d  TINCT - col1 - -
213a0 20 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   8 AS col0 FROM 
213b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
213c0 2d 2d 0d 0a 2d 31 38 0d 0a 2d 32 0d 0a 2d 35 0d  --..-18..-2..-5.
213d0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
213e0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
213f0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
21400 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
21410 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
21420 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 32 37 0d  wsort label-927.
21430 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
21440 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  l0 + cor0.col0 +
21450 20 2b 20 28 20 63 6f 6c 31 20 2b 20 2d 20 43 41   + ( col1 + - CA
21460 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
21470 45 44 20 29 20 29 20 41 53 20 63 6f 6c 32 20 46  ED ) ) AS col2 F
21480 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
21490 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
214a0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
214b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
214c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
214d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
214e0 2d 39 32 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -927..SELECT ALL
214f0 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63   - col0 + cor0.c
21500 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 6c 31 20 2b  ol0 + + ( col1 +
21510 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
21520 53 20 49 4e 54 45 47 45 52 20 29 20 29 20 41 53  S INTEGER ) ) AS
21530 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
21540 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
21550 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
21560 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21570 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
21580 20 36 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   63 AS col2 FROM
21590 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
215a0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53  OSS JOIN tab2 AS
215b0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
215c0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
215d0 20 63 33 65 65 61 39 32 63 34 36 66 32 63 34 39   c3eea92c46f2c49
215e0 37 31 36 66 33 38 36 61 35 38 62 35 37 35 30 32  716f386a58b57502
215f0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
21600 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
21610 32 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 28 20 2d  2 - - col2 * ( -
21620 20 34 34 20 29 20 41 53 20 63 6f 6c 32 20 46 52   44 ) AS col2 FR
21630 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
21640 31 34 31 39 0d 0a 2d 33 35 32 36 0d 0a 2d 34 33  1419..-3526..-43
21650 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21660 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
21670 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20 63 6f 6c  col0 * - ( + col
21680 32 20 29 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 63  2 ) - - col1 * c
21690 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
216a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37   cor0..----..127
216b0 32 0d 0a 33 33 36 30 0d 0a 38 30 31 0d 0a 0d 0a  2..3360..801....
216c0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
216d0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
216e0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
216f0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
21700 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
21710 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21720 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20 35 34   ALL col1 * - 54
21730 20 2b 20 31 34 20 63 6f 6c 32 20 46 52 4f 4d 20   + 14 col2 FROM 
21740 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
21750 2d 2d 0d 0a 2d 31 36 36 30 0d 0a 2d 33 31 37 32  --..-1660..-3172
21760 0d 0a 2d 39 30 34 0d 0a 0d 0a 71 75 65 72 79 20  ..-904....query 
21770 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21780 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
21790 6f 6c 31 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 - col1 AS co
217a0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
217b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  cor0..----..0...
217c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
217d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
217e0 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  T + col2 + + col
217f0 31 20 2d 20 28 20 63 6f 6c 31 20 29 20 46 52 4f  1 - ( col1 ) FRO
21800 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
21810 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36  ----..54..57..96
21820 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21830 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
21840 20 2b 20 2b 20 33 34 20 41 53 20 63 6f 6c 31 20   + + 34 AS col1 
21850 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
21860 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 0d 0a 31 31  0..----..112..11
21870 33 0d 0a 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  3..41....query I
21880 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21890 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 37 20 2d 20   - col1 + + 7 - 
218a0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f  + cor0.col1 * co
218b0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
218c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
218d0 2d 2d 0d 0a 2d 31 38 37 0d 0a 2d 32 39 31 37 0d  --..-187..-2917.
218e0 0a 2d 37 35 34 36 0d 0a 0d 0a 71 75 65 72 79 20  .-7546....query 
218f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21900 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 28 20 63  T ALL col1 * ( c
21910 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol0 ) FROM tab2 
21920 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
21930 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a  343..217..4602..
21940 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
21950 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
21960 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
21970 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
21980 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33  rowsort label-93
21990 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
219a0 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  CT - - cor0.col0
219b0 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63   DIV - col1 AS c
219c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
219d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
219e0 0a 2d 34 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-4..0....skipif
219f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
21a00 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
21a10 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
21a20 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  37..SELECT DISTI
21a30 4e 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  NCT - - cor0.col
21a40 30 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  0 / - col1 AS co
21a50 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
21a60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
21a70 2d 34 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -4..0....onlyif 
21a80 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
21a90 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
21aa0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
21ab0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
21ac0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
21ad0 6c 2d 39 33 38 0d 0a 53 45 4c 45 43 54 20 41 4c  l-938..SELECT AL
21ae0 4c 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53  L - col1 * - CAS
21af0 54 28 20 28 20 63 6f 6c 31 20 29 20 41 53 20 53  T( ( col1 ) AS S
21b00 49 47 4e 45 44 20 29 20 2d 20 63 6f 6c 30 20 41  IGNED ) - col0 A
21b10 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
21b20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21b30 37 33 37 32 0d 0a 38 31 39 32 0d 0a 39 33 37 34  7372..8192..9374
21b40 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
21b50 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
21b60 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
21b70 72 74 20 6c 61 62 65 6c 2d 39 33 38 0d 0a 53 45  rt label-938..SE
21b80 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
21b90 2a 20 2d 20 43 41 53 54 20 28 20 28 20 63 6f 6c  * - CAST ( ( col
21ba0 31 20 29 20 41 53 20 49 4e 54 45 47 45 52 20 29  1 ) AS INTEGER )
21bb0 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   - col0 AS col2 
21bc0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
21bd0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 37 32 0d 0a 38  0..----..7372..8
21be0 31 39 32 0d 0a 39 33 37 34 0d 0a 0d 0a 71 75 65  192..9374....que
21bf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21c00 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
21c10 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  * - col2 + + col
21c20 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
21c30 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
21c40 2d 0d 0a 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35  -..36..7380..825
21c50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21c60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
21c70 63 6f 6c 31 20 2a 20 32 32 20 46 52 4f 4d 20 74  col1 * 22 FROM t
21c80 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
21c90 2d 0d 0a 2d 31 32 39 38 0d 0a 2d 33 37 34 0d 0a  -..-1298..-374..
21ca0 2d 36 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -682....skipif p
21cb0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
21cc0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
21cd0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
21ce0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
21cf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21d00 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74  ..SELECT ALL - t
21d10 61 62 30 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52  ab0.col1 col2 FR
21d20 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74  OM tab0, tab2, t
21d30 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
21d40 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
21d50 67 20 74 6f 20 64 34 63 36 37 33 62 37 34 34 34  g to d4c673b7444
21d60 65 62 39 39 32 37 65 63 36 33 31 37 35 62 34 33  eb9927ec63175b43
21d70 63 36 62 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  c6b84....query I
21d80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21d90 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 74 61   ALL - col1 * ta
21da0 62 32 2e 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 46  b2.col0 - col1 F
21db0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
21dc0 2d 31 33 36 30 0d 0a 2d 32 34 38 0d 0a 2d 34 36  -1360..-248..-46
21dd0 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
21de0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
21df0 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f  L cor0.col2 + co
21e00 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  l1 * + col2 AS c
21e10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
21e20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37   cor0..----..287
21e30 31 0d 0a 37 35 34 34 0d 0a 39 38 0d 0a 0d 0a 71  1..7544..98....q
21e40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21e50 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
21e60 63 6f 6c 32 20 2a 20 28 20 28 20 63 6f 6c 32 20  col2 * ( ( col2 
21e70 29 20 29 20 2a 20 2b 20 37 33 20 41 53 20 63 6f  ) ) * + 73 AS co
21e80 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
21e90 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 32 38 36 38 0d  0..----..212868.
21ea0 0a 32 33 37 31 37 37 0d 0a 36 37 32 37 36 38 0d  .237177..672768.
21eb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21ec0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
21ed0 4e 43 54 20 63 6f 6c 30 20 2a 20 39 32 20 41 53  NCT col0 * 92 AS
21ee0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
21ef0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
21f00 32 30 38 0d 0a 33 32 32 30 0d 0a 38 31 38 38 0d  208..3220..8188.
21f10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21f20 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
21f30 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52  - col0 * col0 FR
21f40 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
21f50 2d 2d 0d 0a 2d 31 38 0d 0a 2d 36 30 32 35 0d 0a  --..-18..-6025..
21f60 2d 36 32 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -6224....query I
21f70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21f80 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a   col0 + - col2 *
21f90 20 28 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2d 20   ( col0 + + ( - 
21fa0 63 6f 72 30 2e 63 6f 6c 31 20 29 20 29 20 41 53  cor0.col1 ) ) AS
21fb0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
21fc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
21fd0 30 37 30 0d 0a 32 35 33 0d 0a 39 37 0d 0a 0d 0a  070..253..97....
21fe0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21ff0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 31 2e 63  .SELECT - cor1.c
22000 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
22010 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
22020 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53  OSS JOIN tab0 AS
22030 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
22040 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
22050 20 30 39 64 38 61 39 31 32 64 65 31 62 38 61 62   09d8a912de1b8ab
22060 37 36 32 65 35 66 66 62 65 30 32 38 63 65 39 39  762e5ffbe028ce99
22070 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  e....query I row
22080 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
22090 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46  ol1 ) * - col2 F
220a0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
220b0 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36  ---..-1534..-646
220c0 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20  ..-837....query 
220d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
220e0 54 20 63 6f 6c 32 20 2a 20 37 39 20 2b 20 63 6f  T col2 * 79 + co
220f0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
22100 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
22110 2d 2d 0d 0a 34 32 36 39 0d 0a 34 35 36 37 0d 0a  --..4269..4567..
22120 37 36 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7664....query I 
22130 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22140 2b 20 63 6f 6c 31 20 2d 20 35 30 20 46 52 4f 4d  + col1 - 50 FROM
22150 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39   tab2..----..-19
22160 0d 0a 2d 33 33 0d 0a 39 0d 0a 0d 0a 71 75 65 72  ..-33..9....quer
22170 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22180 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT + - cor0.col
22190 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 33  0 + - col1 * - 3
221a0 36 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  6 FROM tab0 cor0
221b0 0d 0a 2d 2d 2d 2d 0d 0a 33 30 37 32 0d 0a 33 31  ..----..3072..31
221c0 38 37 0d 0a 33 34 35 37 0d 0a 0d 0a 71 75 65 72  87..3457....quer
221d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
221e0 45 43 54 20 2d 20 2d 20 38 20 2a 20 2d 20 63 6f  ECT - - 8 * - co
221f0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
22200 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
22210 2d 2d 0d 0a 2d 32 30 38 0d 0a 2d 32 31 36 0d 0a  --..-208..-216..
22220 2d 33 30 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -304....skipif p
22230 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
22240 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
22250 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
22260 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
22270 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22280 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
22290 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T + col2 * + col
222a0 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  1 col0 FROM tab2
222b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33   cor0..----..153
222c0 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71  4..646..837....q
222d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
222e0 53 45 4c 45 43 54 20 31 39 20 2b 20 2d 20 74 61  SELECT 19 + - ta
222f0 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  b1.col2 AS col2 
22300 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
22310 0a 2d 33 35 0d 0a 2d 33 38 0d 0a 2d 37 37 0d 0a  .-35..-38..-77..
22320 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22330 74 0d 0a 53 45 4c 45 43 54 20 32 33 20 2a 20 63  t..SELECT 23 * c
22340 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  or0.col0 * - col
22350 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
22360 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 32  or0..----..-1472
22370 30 0d 0a 2d 31 37 39 34 0d 0a 2d 32 33 39 32 30  0..-1794..-23920
22380 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
22390 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
223a0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
223b0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
223c0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
223d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
223e0 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
223f0 30 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52  0 + col0 col0 FR
22400 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
22410 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a  .----..14..156..
22420 31 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  158....query I r
22430 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
22440 49 53 54 49 4e 43 54 20 2b 20 37 35 20 2a 20 63  ISTINCT + 75 * c
22450 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
22460 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
22470 0d 0a 31 39 35 30 0d 0a 37 35 30 0d 0a 39 37 35  ..1950..750..975
22480 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22490 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
224a0 49 4e 43 54 20 38 34 20 2b 20 63 6f 6c 30 20 46  INCT 84 + col0 F
224b0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
224c0 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 0d 0a 31 36 34  ..----..148..164
224d0 0d 0a 38 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..87....onlyif m
224e0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
224f0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
22500 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
22510 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22520 62 65 6c 2d 39 36 30 0d 0a 53 45 4c 45 43 54 20  bel-960..SELECT 
22530 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
22540 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  DIV - col1 + col
22550 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
22560 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 35 39  ab1..----..1..59
22570 0d 0a 37 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..73....skipif m
22580 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
22590 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
225a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36 30  owsort label-960
225b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
225c0 54 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c  T + col2 / - col
225d0 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  1 + col0 AS col2
225e0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
225f0 0d 0a 31 0d 0a 35 39 0d 0a 37 33 0d 0a 0d 0a 71  ..1..59..73....q
22600 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22610 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20  SELECT - col1 - 
22620 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 57  col2 FROM tab2 W
22630 48 45 52 45 20 4e 4f 54 20 63 6f 6c 30 20 3c 3e  HERE NOT col0 <>
22640 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   NULL..----....q
22650 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22660 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
22670 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53  + col1 * col0 AS
22680 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
22690 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d 0a 33 33 39  .----..2097..339
226a0 36 0d 0a 38 31 38 31 0d 0a 0d 0a 71 75 65 72 79  6..8181....query
226b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
226c0 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 74 61  CT - col0 + - ta
226d0 62 30 2e 63 6f 6c 32 20 2a 20 74 61 62 30 2e 63  b0.col2 * tab0.c
226e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
226f0 2d 2d 2d 0d 0a 2d 31 31 31 33 0d 0a 2d 33 36 0d  ---..-1113..-36.
22700 0a 2d 36 38 31 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-6813....onlyif
22710 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
22720 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
22730 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
22740 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
22750 6c 61 62 65 6c 2d 39 36 34 0d 0a 53 45 4c 45 43  label-964..SELEC
22760 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
22770 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20 2b  2 DIV - col0 + +
22780 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
22790 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 34 0d 0a 35  .----..17..34..5
227a0 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
227b0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
227c0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
227d0 6f 72 74 20 6c 61 62 65 6c 2d 39 36 34 0d 0a 53  ort label-964..S
227e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
227f0 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 2b   col2 / - col0 +
22800 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
22810 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 34 0d  2..----..17..34.
22820 0a 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .59....skipif po
22830 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
22840 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
22850 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
22860 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
22870 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22880 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
22890 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  l2 * col0 + col2
228a0 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62 32   * col0 * + tab2
228b0 2e 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20  .col1 col1 FROM 
228c0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 36  tab2..----..1216
228d0 38 30 0d 0a 35 34 30 33 36 0d 0a 36 30 34 38 0d  80..54036..6048.
228e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
228f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
22900 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2f   col1 + - col0 /
22910 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f   + tab1.col0 FRO
22920 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54  M tab1 WHERE NOT
22930 20 4e 55 4c 4c 20 49 4e 20 28 20 63 6f 6c 31 20   NULL IN ( col1 
22940 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
22950 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
22960 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20  LECT DISTINCT * 
22970 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
22980 2b 20 63 6f 6c 30 20 4e 4f 54 20 42 45 54 57 45  + col0 NOT BETWE
22990 45 4e 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b  EN col0 * col1 +
229a0 20 2b 20 63 6f 6c 30 20 41 4e 44 20 28 20 4e 55   + col0 AND ( NU
229b0 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  LL )..----..9 va
229c0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
229d0 33 38 61 31 36 37 33 65 32 65 30 39 64 36 39 34  38a1673e2e09d694
229e0 63 38 63 65 63 34 35 63 37 39 37 30 33 34 61 37  c8cec45c797034a7
229f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
22a00 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
22a10 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
22a20 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
22a30 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
22a40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22a50 4c 45 43 54 20 63 6f 6c 31 20 63 6f 6c 30 20 46  LECT col1 col0 F
22a60 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e  ROM tab1 WHERE N
22a70 4f 54 20 63 6f 6c 30 20 42 45 54 57 45 45 4e 20  OT col0 BETWEEN 
22a80 63 6f 6c 31 20 41 4e 44 20 63 6f 6c 32 0d 0a 2d  col1 AND col2..-
22a90 2d 2d 2d 0d 0a 31 30 0d 0a 32 36 0d 0a 0d 0a 71  ---..10..26....q
22aa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22ab0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61 62  SELECT ALL - tab
22ac0 32 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53  2.col0 + col2 AS
22ad0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
22ae0 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d  .----..-41..-52.
22af0 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .20....query I r
22b00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
22b10 20 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c   col2 + tab0.col
22b20 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
22b30 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab0..----..0..0.
22b40 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
22b50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
22b60 33 37 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 33 33  37 + col0 * - 33
22b70 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   + + col2 * - co
22b80 6c 32 20 2a 20 33 34 20 46 52 4f 4d 20 74 61 62  l2 * 34 FROM tab
22b90 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  0 cor0..----..-1
22ba0 32 32 36 0d 0a 2d 32 33 31 35 39 30 0d 0a 2d 33  226..-231590..-3
22bb0 37 38 35 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7855....onlyif m
22bc0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
22bd0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
22be0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
22bf0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
22c00 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
22c10 2d 39 37 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -972..SELECT - -
22c20 20 37 30 20 2a 20 63 6f 6c 32 20 2b 20 28 20 2d   70 * col2 + ( -
22c30 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 29   col1 * - col0 )
22c40 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   + + CAST( NULL 
22c50 41 53 20 53 49 47 4e 45 44 20 29 20 2f 20 28 20  AS SIGNED ) / ( 
22c60 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46  col0 ) AS col1 F
22c70 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
22c80 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
22c90 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
22ca0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
22cb0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
22cc0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
22cd0 2d 39 37 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -972..SELECT - -
22ce0 20 37 30 20 2a 20 63 6f 6c 32 20 2b 20 28 20 2d   70 * col2 + ( -
22cf0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 29   col1 * - col0 )
22d00 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c   + + CAST ( NULL
22d10 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20   AS INTEGER ) / 
22d20 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31  ( col0 ) AS col1
22d30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
22d40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
22d50 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
22d60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22d70 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
22d80 20 63 6f 6c 31 20 2a 20 74 61 62 31 2e 63 6f 6c   col1 * tab1.col
22d90 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 * col2 FROM ta
22da0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 38 30  b1..----..-11980
22db0 38 0d 0a 2d 33 32 34 39 30 0d 0a 2d 37 35 38 31  8..-32490..-7581
22dc0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
22dd0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
22de0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
22df0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
22e00 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
22e10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22e20 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d  ELECT - col0 * -
22e30 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 63 6f 6c   col2 * col2 col
22e40 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
22e50 2d 0d 0a 32 36 31 33 36 0d 0a 33 35 0d 0a 35 39  -..26136..35..59
22e60 38 34 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  8436....skipif p
22e70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
22e80 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
22e90 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
22ea0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
22eb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22ec0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
22ed0 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  T + col1 * col2 
22ee0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 57  col2 FROM tab2 W
22ef0 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20 63  HERE NULL IN ( c
22f00 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 29 0d 0a  ol1 * + col0 )..
22f10 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
22f20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22f30 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col0 + col0 * - 
22f40 35 20 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20 46  5 + - ( col2 ) F
22f50 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
22f60 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 33 0d 0a 2d 34  ..----..-313..-4
22f70 31 36 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65 72 79  16..-66....query
22f80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22f90 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  CT - col1 * - co
22fa0 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l0 * + col0 FROM
22fb0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34   tab1..----..234
22fc0 0d 0a 34 30 39 36 30 0d 0a 38 33 32 30 30 0d 0a  ..40960..83200..
22fd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22fe0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
22ff0 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   * + col0 * + co
23000 6c 31 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  l1 - col0 * + co
23010 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
23020 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 39  tab0..----..1769
23030 32 38 0d 0a 33 32 38 30 39 30 0d 0a 37 32 39 30  28..328090..7290
23040 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  88....query III 
23050 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23060 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20  DISTINCT * FROM 
23070 74 61 62 32 20 57 48 45 52 45 20 2b 20 63 6f 6c  tab2 WHERE + col
23080 30 20 2b 20 63 6f 6c 31 20 3c 3d 20 4e 55 4c 4c  0 + col1 <= NULL
23090 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
230a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
230b0 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  T + col0 + - col
230c0 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  2 * + col1 + col
230d0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
230e0 2d 0d 0a 2d 31 30 38 38 0d 0a 2d 31 33 39 38 0d  -..-1088..-1398.
230f0 0a 2d 34 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-442....skipif 
23100 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
23110 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
23120 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
23130 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
23140 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23150 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
23160 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 63   - col0 * col1 c
23170 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
23180 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d 36 36 34  ---..-3395..-664
23190 31 31 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d 0a 71  118..-68112....q
231a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
231b0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62  SELECT ALL + tab
231c0 31 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  1.col1 * + col1 
231d0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
231e0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36  1..----..100..16
231f0 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20  9..676....query 
23200 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23210 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 32 20  T ALL tab0.col2 
23220 2b 20 63 6f 6c 30 20 2b 20 74 61 62 30 2e 63 6f  + col0 + tab0.co
23230 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
23240 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 30 0d  tab0..----..260.
23250 0a 37 31 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79  .71..81....query
23260 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23270 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  CT - cor0.col1 *
23280 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
23290 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
232a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34  cor0..----..-124
232b0 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a  8..-1404..-570..
232c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
232d0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
232e0 43 54 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  CT + col0 AS col
232f0 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
23300 20 57 48 45 52 45 20 4e 4f 54 20 28 20 63 6f 6c   WHERE NOT ( col
23310 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  0 * col0 + col2 
23320 29 20 49 4e 20 28 20 2b 20 63 6f 72 30 2e 63 6f  ) IN ( + cor0.co
23330 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30  l1 + col0 + col0
23340 20 2a 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d   * col1 )..----.
23350 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71  .24..35..89....q
23360 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23370 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
23380 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2b 20  col2 * col0 * + 
23390 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
233a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
233b0 31 33 36 0d 0a 33 35 0d 0a 35 39 38 34 33 36 0d  136..35..598436.
233c0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
233d0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
233e0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
233f0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
23400 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
23410 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23420 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  ECT col1 + - col
23430 31 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20  1 * + tab2.col0 
23440 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
23450 2d 2d 2d 2d 0d 0a 2d 31 33 32 36 0d 0a 2d 31 38  ----..-1326..-18
23460 36 0d 0a 2d 34 35 34 33 0d 0a 0d 0a 71 75 65 72  6..-4543....quer
23470 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23480 45 43 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c  ECT ALL tab0.col
23490 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  0 + col0 * col2 
234a0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
234b0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 33 38  0..----..70..738
234c0 37 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20  7..816....query 
234d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
234e0 54 20 41 4c 4c 20 63 6f 6c 32 20 2d 20 63 6f 6c  T ALL col2 - col
234f0 31 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52  1 FROM tab1 WHER
23500 45 20 4e 4f 54 20 63 6f 6c 32 20 3d 20 2d 20 63  E NOT col2 = - c
23510 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34  ol1..----..28..4
23520 37 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49  7..83....query I
23530 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23540 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62 32   DISTINCT + tab2
23550 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b  .col2 * + col1 +
23560 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 74 61 62   tab2.col1 * tab
23570 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  2.col1 FROM tab2
23580 0d 0a 2d 2d 2d 2d 0d 0a 31 37 39 38 0d 0a 35 30  ..----..1798..50
23590 31 35 0d 0a 39 33 35 0d 0a 0d 0a 71 75 65 72 79  15..935....query
235a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
235b0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
235c0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45  l1 FROM tab2 WHE
235d0 52 45 20 28 20 2d 20 63 6f 6c 30 20 29 20 42 45  RE ( - col0 ) BE
235e0 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 28  TWEEN NULL AND (
235f0 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   NULL )..----...
23600 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
23610 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
23620 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
23630 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
23640 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 32  owsort label-992
23650 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
23660 54 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20  T col1 DIV col0 
23670 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52  + col2 * col2 FR
23680 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
23690 39 32 34 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d  924..3249..9216.
236a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
236b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
236c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
236d0 74 20 6c 61 62 65 6c 2d 39 39 32 0d 0a 53 45 4c  t label-992..SEL
236e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
236f0 31 20 2f 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  1 / col0 + col2 
23700 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  * col2 FROM tab1
23710 0d 0a 2d 2d 2d 2d 0d 0a 32 39 32 34 0d 0a 33 32  ..----..2924..32
23720 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a 71 75 65 72  49..9216....quer
23730 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23740 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
23750 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol0 * + col1 FRO
23760 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 55 4c  M tab2 WHERE NUL
23770 4c 20 4e 4f 54 20 49 4e 20 28 20 63 6f 6c 30 20  L NOT IN ( col0 
23780 2f 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 74 61 62  / + col2 + + tab
23790 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 29 0d  2.col1 * col1 ).
237a0 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
237b0 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
237c0 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57  CT * FROM tab0 W
237d0 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 49 4e  HERE NOT NULL IN
237e0 20 28 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2d   ( tab0.col1 * -
237f0 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   col1 )..----...
23800 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23810 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
23820 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T + col2 * + col
23830 30 20 2d 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  0 - - col0 FROM 
23840 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a  tab0..----..70..
23850 37 33 38 37 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65  7387..816....que
23860 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
23870 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
23880 62 30 20 57 48 45 52 45 20 28 20 2d 20 63 6f 6c  b0 WHERE ( - col
23890 30 20 29 20 49 4e 20 28 20 63 6f 6c 31 20 2a 20  0 ) IN ( col1 * 
238a0 2d 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a  - col2 )..----..
238b0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
238c0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
238d0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
238e0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
238f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39  rowsort label-99
23900 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  7..SELECT + col1
23910 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 44   + + tab1.col0 D
23920 49 56 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 41  IV - tab1.col0 A
23930 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
23940 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 32 35 0d 0a  ..----..12..25..
23950 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
23960 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
23970 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
23980 6f 72 74 20 6c 61 62 65 6c 2d 39 39 37 0d 0a 53  ort label-997..S
23990 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b  ELECT + col1 + +
239a0 20 74 61 62 31 2e 63 6f 6c 30 20 2f 20 2d 20 74   tab1.col0 / - t
239b0 61 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  ab1.col0 AS col2
239c0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
239d0 0d 0a 31 32 0d 0a 32 35 0d 0a 39 0d 0a 0d 0a 73  ..12..25..9....s
239e0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
239f0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
23a00 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
23a10 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
23a20 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
23a30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23a40 2d 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 63  - - ( + col1 ) c
23a50 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
23a60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d   cor0..----..86.
23a70 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79  .91..97....query
23a80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23a90 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
23aa0 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
23ab0 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
23ac0 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63   cor0, tab0 AS c
23ad0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  or1..----..54..5
23ae0 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  7..96....query I
23af0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23b00 20 41 4c 4c 20 2b 20 34 35 20 2b 20 2b 20 63 6f   ALL + 45 + + co
23b10 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
23b20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
23b30 2d 2d 0d 0a 31 30 32 0d 0a 31 34 31 0d 0a 39 39  --..102..141..99
23b40 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
23b50 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
23b60 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
23b70 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
23b80 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
23b90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30  owsort label-100
23ba0 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  1..SELECT - col2
23bb0 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 43 41 53 54   * - col0 + CAST
23bc0 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  ( col1 AS SIGNED
23bd0 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) * col2 FROM t
23be0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
23bf0 2d 0d 0a 31 33 32 0d 0a 31 34 37 36 30 0d 0a 33  -..132..14760..3
23c00 36 33 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  630....skipif my
23c10 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
23c20 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
23c30 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 31  wsort label-1001
23c40 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
23c50 2a 20 2d 20 63 6f 6c 30 20 2b 20 43 41 53 54 20  * - col0 + CAST 
23c60 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  ( col1 AS INTEGE
23c70 52 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  R ) * col2 FROM 
23c80 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
23c90 2d 2d 0d 0a 31 33 32 0d 0a 31 34 37 36 30 0d 0a  --..132..14760..
23ca0 33 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3630....query I 
23cb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23cc0 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ALL - cor0.col2 
23cd0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
23ce0 32 2c 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  2, tab0, tab1 AS
23cf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
23d00 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
23d10 6f 20 34 34 66 64 63 64 37 63 64 36 30 33 33 35  o 44fdcd7cd60335
23d20 32 64 34 64 31 32 37 38 31 31 64 31 36 34 63 63  2d4d127811d164cc
23d30 31 65 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  1e....onlyif mys
23d40 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
23d50 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
23d60 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
23d70 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
23d80 6c 2d 31 30 30 33 0d 0a 53 45 4c 45 43 54 20 2d  l-1003..SELECT -
23d90 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 33 33 20 44   - col0 + + 33 D
23da0 49 56 20 2b 20 33 37 20 46 52 4f 4d 20 74 61 62  IV + 37 FROM tab
23db0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
23dc0 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73 6b  .7..78..79....sk
23dd0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
23de0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
23df0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
23e00 65 6c 2d 31 30 30 33 0d 0a 53 45 4c 45 43 54 20  el-1003..SELECT 
23e10 2d 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 33 33 20  - - col0 + + 33 
23e20 2f 20 2b 20 33 37 20 46 52 4f 4d 20 74 61 62 32  / + 37 FROM tab2
23e30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23e40 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65  7..78..79....que
23e50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23e60 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  LECT - col0 + - 
23e70 39 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  9 * - col1 FROM 
23e80 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
23e90 2d 2d 0d 0a 32 33 31 0d 0a 32 36 0d 0a 33 37 0d  --..231..26..37.
23ea0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23eb0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
23ec0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b   col1 * + col1 +
23ed0 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
23ee0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
23ef0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 0d 0a 2d  0..----..-156..-
23f00 36 35 30 0d 0a 2d 39 30 0d 0a 0d 0a 6f 6e 6c 79  650..-90....only
23f10 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
23f20 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
23f30 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
23f40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23f50 74 20 6c 61 62 65 6c 2d 31 30 30 36 0d 0a 53 45  t label-1006..SE
23f60 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20  LECT - col2 DIV 
23f70 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72 30  cor0.col1 + cor0
23f80 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 44  .col2 + - col1 D
23f90 49 56 20 28 20 2b 20 33 38 20 29 20 46 52 4f 4d  IV ( + 38 ) FROM
23fa0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
23fb0 0d 0a 32 35 0d 0a 32 37 0d 0a 33 36 0d 0a 0d 0a  ..25..27..36....
23fc0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
23fd0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
23fe0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
23ff0 61 62 65 6c 2d 31 30 30 36 0d 0a 53 45 4c 45 43  abel-1006..SELEC
24000 54 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 72 30 2e  T - col2 / cor0.
24010 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  col1 + cor0.col2
24020 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 28 20 2b 20   + - col1 / ( + 
24030 33 38 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63  38 ) FROM tab2 c
24040 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 32  or0..----..25..2
24050 37 0d 0a 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  7..36....query I
24060 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24070 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30   DISTINCT + cor0
24080 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
24090 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74  OM tab0, tab1, t
240a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
240b0 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d  -..86..91..97...
240c0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
240d0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
240e0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
240f0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
24100 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
24110 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24120 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  T - col1 * col2 
24130 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  + col1 + - col2 
24140 2a 20 2d 20 34 31 20 2a 20 63 6f 6c 32 20 63 6f  * - 41 * col2 co
24150 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
24160 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 32 34 31 0d 0a  0..----..26241..
24170 32 39 30 38 33 0d 0a 35 38 35 37 35 0d 0a 0d 0a  29083..58575....
24180 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24190 0a 53 45 4c 45 43 54 20 35 30 20 46 52 4f 4d 20  .SELECT 50 FROM 
241a0 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
241b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
241c0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 65  es hashing to de
241d0 61 32 64 31 62 37 34 65 30 63 64 66 36 37 38 30  a2d1b74e0cdf6780
241e0 36 61 66 38 63 34 31 37 33 32 34 66 35 32 0d 0a  6af8c417324f52..
241f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24200 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
24210 43 54 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20  CT col0 * - ( + 
24220 63 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 31 20  col0 * - ( col1 
24230 29 20 29 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20  ) ) - tab2.col2 
24240 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 41 53  * - tab2.col0 AS
24250 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
24260 0a 2d 2d 2d 2d 0d 0a 31 30 39 30 39 39 0d 0a 31  .----..109099..1
24270 37 30 38 0d 0a 33 36 30 39 38 34 0d 0a 0d 0a 71  708..360984....q
24280 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24290 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
242a0 2b 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30 20  + col0 - + col0 
242b0 2a 20 2b 20 31 35 20 41 53 20 63 6f 6c 30 20 46  * + 15 AS col0 F
242c0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
242d0 2d 31 31 35 35 0d 0a 2d 32 35 30 0d 0a 2d 33 39  -1155..-250..-39
242e0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
242f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
24300 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2d   + tab0.col0 * -
24310 20 36 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   60 FROM tab0..-
24320 2d 2d 2d 0d 0a 2d 31 34 34 30 0d 0a 2d 32 31 30  ---..-1440..-210
24330 30 0d 0a 2d 35 33 34 30 0d 0a 0d 0a 6f 6e 6c 79  0..-5340....only
24340 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
24350 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
24360 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
24370 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
24380 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
24390 61 62 65 6c 2d 31 30 31 33 0d 0a 53 45 4c 45 43  abel-1013..SELEC
243a0 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28  T DISTINCT CAST(
243b0 20 2d 20 33 35 20 41 53 20 53 49 47 4e 45 44 20   - 35 AS SIGNED 
243c0 29 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  ) - - col2 FROM 
243d0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a  tab1..----..19..
243e0 32 32 0d 0a 36 31 0d 0a 0d 0a 73 6b 69 70 69 66  22..61....skipif
243f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
24400 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
24410 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
24420 30 31 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  013..SELECT DIST
24430 49 4e 43 54 20 43 41 53 54 20 28 20 2d 20 33 35  INCT CAST ( - 35
24440 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20   AS INTEGER ) - 
24450 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
24460 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a 32 32 0d 0a  ..----..19..22..
24470 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
24480 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
24490 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col1 * - col0 + 
244a0 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53  - col2 + col2 AS
244b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
244c0 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33  .----..-2064..-3
244d0 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75  395..-8099....qu
244e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
244f0 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
24500 30 20 2a 20 36 30 20 41 53 20 63 6f 6c 31 20 46  0 * 60 AS col1 F
24510 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41  ROM tab1, tab2 A
24520 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
24530 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
24540 6f 20 65 38 39 36 31 65 36 32 62 62 38 62 30 62  o e8961e62bb8b0b
24550 65 36 37 33 65 34 30 33 35 38 30 37 31 62 38 66  e673e40358071b8f
24560 66 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  f6....query I ro
24570 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
24580 2d 20 34 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  - 4 * col2 AS co
24590 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
245a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 36  cor0..----..-216
245b0 0d 0a 2d 32 32 38 0d 0a 2d 33 38 34 0d 0a 0d 0a  ..-228..-384....
245c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
245d0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a  .SELECT - col1 *
245e0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b   col1 * - col1 +
245f0 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b   + col1 * col1 +
24600 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30   - col1 * - cor0
24610 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20  .col1 FROM tab1 
24620 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
24630 32 30 30 0d 0a 31 38 39 32 38 0d 0a 32 35 33 35  200..18928..2535
24640 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
24650 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
24660 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
24670 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
24680 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
24690 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31  owsort label-101
246a0 38 0d 0a 53 45 4c 45 43 54 20 30 20 2a 20 63 6f  8..SELECT 0 * co
246b0 6c 32 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  l2 + CAST( NULL 
246c0 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
246d0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
246e0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
246f0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
24700 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
24710 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
24720 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
24730 31 38 0d 0a 53 45 4c 45 43 54 20 30 20 2a 20 63  18..SELECT 0 * c
24740 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ol2 + CAST ( NUL
24750 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
24760 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
24770 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
24780 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
24790 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
247a0 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT - cor0.col0 
247b0 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  * - col1 + col1 
247c0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + + cor0.col2 * 
247d0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
247e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
247f0 32 36 36 0d 0a 34 32 39 38 0d 0a 38 37 33 33 0d  266..4298..8733.
24800 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24810 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
24820 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b  NCT - - col2 * +
24830 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
24840 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
24850 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30  .162..3648..7680
24860 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
24870 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
24880 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
24890 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
248a0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
248b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32  owsort label-102
248c0 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  1..SELECT ALL - 
248d0 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 43 41 53  ( - col1 ) * CAS
248e0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
248f0 44 20 29 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63  D ) * col0 + - c
24900 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
24910 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
24920 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
24930 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
24940 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
24950 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
24960 6c 61 62 65 6c 2d 31 30 32 31 0d 0a 53 45 4c 45  label-1021..SELE
24970 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 63 6f 6c  CT ALL - ( - col
24980 31 20 29 20 2a 20 43 41 53 54 20 28 20 4e 55 4c  1 ) * CAST ( NUL
24990 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
249a0 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 46   col0 + - col1 F
249b0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
249c0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
249d0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
249e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
249f0 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  ECT - col1 + + c
24a00 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
24a10 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
24a20 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
24a30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24a40 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
24a50 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63  CT cor0.col0 * c
24a60 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
24a70 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
24a80 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38  ..162..3648..768
24a90 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
24aa0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
24ab0 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 28  ol0 * col0 - - (
24ac0 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
24ad0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
24ae0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 36 0d 0a 36  0..----..1226..6
24af0 30 39 0d 0a 38 30 30 33 0d 0a 0d 0a 71 75 65 72  09..8003....quer
24b00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24b10 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
24b20 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   cor0.col2 * + c
24b30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
24b40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31   cor0..----..111
24b50 33 0d 0a 33 36 0d 0a 36 38 31 33 0d 0a 0d 0a 71  3..36..6813....q
24b60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24b70 53 45 4c 45 43 54 20 2b 20 31 20 2a 20 63 6f 6c  SELECT + 1 * col
24b80 31 20 2a 20 36 33 20 2b 20 28 20 63 6f 6c 30 20  1 * 63 + ( col0 
24b90 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
24ba0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
24bb0 35 34 34 32 0d 0a 35 38 32 32 0d 0a 36 31 34 36  5442..5822..6146
24bc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24bd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
24be0 2d 20 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  - 1 AS col1 FROM
24bf0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
24c00 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d  ---..-1..-1..-1.
24c10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24c20 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
24c30 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  1 + + col1 * - c
24c40 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
24c50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 31 30 0d  r0..----..-7310.
24c60 0a 2d 38 31 39 30 0d 0a 2d 39 33 31 32 0d 0a 0d  .-8190..-9312...
24c70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24c80 0d 0a 53 45 4c 45 43 54 20 2d 20 31 35 20 41 53  ..SELECT - 15 AS
24c90 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
24ca0 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
24cb0 49 4e 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f  IN tab1, tab2 co
24cc0 72 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 32  r1, tab2 AS cor2
24cd0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 33 0d 0a  , tab2 AS cor3..
24ce0 2d 2d 2d 2d 0d 0a 32 34 33 20 76 61 6c 75 65 73  ----..243 values
24cf0 20 68 61 73 68 69 6e 67 20 74 6f 20 34 39 33 64   hashing to 493d
24d00 30 36 31 34 61 36 30 65 39 38 31 39 62 35 35 34  0614a60e9819b554
24d10 37 65 61 65 32 65 66 62 30 37 34 63 0d 0a 0d 0a  7eae2efb074c....
24d20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24d30 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b  .SELECT col0 + +
24d40 20 37 32 20 2a 20 2b 20 38 36 20 41 53 20 63 6f   72 * + 86 AS co
24d50 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
24d60 2d 2d 0d 0a 36 32 31 36 0d 0a 36 32 32 37 0d 0a  --..6216..6227..
24d70 36 32 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6281....query I 
24d80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24d90 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20  + cor0.col2 * - 
24da0 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32  ( col1 ) AS col2
24db0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
24dc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d  r0..----..-2838.
24dd0 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71  .-7462..-97....q
24de0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24df0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
24e00 34 37 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  47 FROM tab0 AS 
24e10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d  cor0..----..-42.
24e20 0a 31 32 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79  .12..23....query
24e30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24e40 43 54 20 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f  CT col2 * + ( co
24e50 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l1 ) AS col1 FRO
24e60 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
24e70 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34  ----..1248..1404
24e80 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..570....query I
24e90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24ea0 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29   + ( cor0.col1 )
24eb0 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
24ec0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
24ed0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a  or0..----..-21..
24ee0 33 33 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  33..4....skipif 
24ef0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
24f00 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
24f10 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
24f20 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
24f30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24f40 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 35 20 63  t..SELECT + 45 c
24f50 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
24f60 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
24f70 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
24f80 69 6e 67 20 74 6f 20 36 30 62 39 66 39 33 35 65  ing to 60b9f935e
24f90 65 38 65 34 30 34 64 31 35 35 61 32 66 35 65 39  e8e404d155a2f5e9
24fa0 35 31 35 63 30 35 30 0d 0a 0d 0a 71 75 65 72 79  515c050....query
24fb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24fc0 43 54 20 41 4c 4c 20 2d 20 33 30 20 2a 20 2b 20  CT ALL - 30 * + 
24fd0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63  col2 + col2 AS c
24fe0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
24ff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   cor0..----..-23
25000 37 38 0d 0a 2d 32 39 0d 0a 2d 39 35 37 0d 0a 0d  78..-29..-957...
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 2d 20 2d 20 28 20 35 38 20 29 20 2b 20 2d  T - - ( 58 ) + -
25040 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
25050 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
25060 30 0d 0a 33 31 0d 0a 33 32 0d 0a 0d 0a 71 75 65  0..31..32....que
25070 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
25080 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20 38 33 20  LECT ALL ( - 83 
25090 29 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ) - + col2 AS co
250a0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
250b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 0d 0a 2d  0..----..-109..-
250c0 31 31 30 0d 0a 2d 31 32 31 0d 0a 0d 0a 73 6b 69  110..-121....ski
250d0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
250e0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
250f0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
25100 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
25110 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
25120 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
25130 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 63 6f  ( cor0.col2 ) co
25140 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
25150 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d  0..----..54..57.
25160 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .96....query I r
25170 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
25180 20 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63   1 * - col1 AS c
25190 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
251a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
251b0 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 6f 6e  ..-31..-59....on
251c0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
251d0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
251e0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
251f0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
25200 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25210 20 6c 61 62 65 6c 2d 31 30 34 31 0d 0a 53 45 4c   label-1041..SEL
25220 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53  ECT DISTINCT CAS
25230 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45  T( col0 AS SIGNE
25240 44 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 28  D ) * col1 + - (
25250 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20   col0 ) AS col1 
25260 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
25270 2d 2d 2d 2d 0d 0a 32 30 34 30 0d 0a 33 33 36 30  ----..2040..3360
25280 0d 0a 38 30 31 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..8010....skipif
25290 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
252a0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
252b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
252c0 30 34 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  041..SELECT DIST
252d0 49 4e 43 54 20 43 41 53 54 20 28 20 63 6f 6c 30  INCT CAST ( col0
252e0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
252f0 63 6f 6c 31 20 2b 20 2d 20 28 20 63 6f 6c 30 20  col1 + - ( col0 
25300 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
25310 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
25320 32 30 34 30 0d 0a 33 33 36 30 0d 0a 38 30 31 30  2040..3360..8010
25330 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25340 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
25350 2b 20 39 33 20 2b 20 2d 20 63 6f 6c 30 20 46 52  + 93 + - col0 FR
25360 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
25370 2d 2d 0d 0a 31 34 0d 0a 31 35 0d 0a 38 36 0d 0a  --..14..15..86..
25380 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25390 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
253a0 43 54 20 2d 20 31 32 20 2b 20 63 6f 6c 32 20 41  CT - 12 + col2 A
253b0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
253c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
253d0 31 34 0d 0a 31 35 0d 0a 32 36 0d 0a 0d 0a 71 75  14..15..26....qu
253e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
253f0 45 4c 45 43 54 20 2b 20 31 38 20 41 53 20 63 6f  ELECT + 18 AS co
25400 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l2 FROM tab2, ta
25410 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
25420 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
25430 6e 67 20 74 6f 20 62 39 35 62 61 66 61 37 33 33  ng to b95bafa733
25440 36 36 36 64 66 33 39 63 35 64 33 66 39 34 37 36  666df39c5d3f9476
25450 30 64 30 31 30 66 0d 0a 0d 0a 73 6b 69 70 69 66  0d010f....skipif
25460 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
25470 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
25480 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
25490 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
254a0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
254b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
254c0 20 63 6f 6c 31 20 2d 20 2d 20 38 20 63 6f 6c 32   col1 - - 8 col2
254d0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
254e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d  r0..----..-23..-
254f0 35 31 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20  51..-9....query 
25500 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25510 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
25520 6f 6c 30 20 2d 20 2b 20 36 32 20 2a 20 2d 20 63  ol0 - + 62 * - c
25530 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  ol2 * - col0 FRO
25540 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
25550 2d 2d 2d 2d 0d 0a 2d 32 31 33 35 0d 0a 2d 34 35  ----..-2135..-45
25560 32 33 38 37 0d 0a 2d 34 39 30 38 30 0d 0a 0d 0a  2387..-49080....
25570 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25580 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
25590 63 6f 6c 32 20 2b 20 2b 20 37 33 20 46 52 4f 4d  col2 + + 73 FROM
255a0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
255b0 2d 2d 2d 0d 0a 31 30 36 0d 0a 31 35 35 0d 0a 37  ---..106..155..7
255c0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
255d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 32 20  sort..SELECT 42 
255e0 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  * + col2 AS col1
255f0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
25600 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 36 0d 0a  r0..----..1386..
25610 33 34 34 34 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72  3444..42....quer
25620 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25630 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  ECT - col2 + + c
25640 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol2 * + col1 FRO
25650 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
25660 2d 0d 0a 32 38 30 35 0d 0a 37 33 38 30 0d 0a 39  -..2805..7380..9
25670 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
25680 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
25690 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 74 61 62  or0.col1 + + tab
256a0 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  1.col2 AS col2 F
256b0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
256c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
256d0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
256e0 6f 20 33 35 64 65 30 62 35 35 33 65 31 34 66 38  o 35de0b553e14f8
256f0 39 65 61 34 34 62 37 36 35 32 65 31 66 66 36 34  9ea44b7652e1ff64
25700 32 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  2c....query I ro
25710 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
25720 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l2 * col0 * - co
25730 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l0 + + col2 FROM
25740 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
25750 2d 2d 2d 0d 0a 2d 31 32 39 36 0d 0a 2d 31 35 38  ---..-1296..-158
25760 31 35 38 0d 0a 2d 32 33 37 31 32 30 0d 0a 0d 0a  158..-237120....
25770 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
25780 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
25790 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
257a0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
257b0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
257c0 72 74 20 6c 61 62 65 6c 2d 31 30 35 32 0d 0a 53  rt label-1052..S
257d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
257e0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 43 41 53   cor0.col2 + CAS
257f0 54 28 20 2d 20 31 31 20 2a 20 2d 20 63 6f 6c 30  T( - 11 * - col0
25800 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
25810 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
25820 2d 0d 0a 32 33 31 0d 0a 33 38 34 0d 0a 38 39 37  -..231..384..897
25830 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
25840 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
25850 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
25860 72 74 20 6c 61 62 65 6c 2d 31 30 35 32 0d 0a 53  rt label-1052..S
25870 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
25880 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 43 41 53   cor0.col2 + CAS
25890 54 20 28 20 2d 20 31 31 20 2a 20 2d 20 63 6f 6c  T ( - 11 * - col
258a0 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  0 AS INTEGER ) F
258b0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
258c0 2d 2d 2d 0d 0a 32 33 31 0d 0a 33 38 34 0d 0a 38  ---..231..384..8
258d0 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  97....onlyif mys
258e0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
258f0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
25900 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
25910 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
25920 6c 2d 31 30 35 33 0d 0a 53 45 4c 45 43 54 20 44  l-1053..SELECT D
25930 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 44  ISTINCT - col2 D
25940 49 56 20 2d 20 43 41 53 54 28 20 63 6f 6c 30 20  IV - CAST( col0 
25950 2a 20 2d 20 63 6f 6c 31 20 41 53 20 53 49 47 4e  * - col1 AS SIGN
25960 45 44 20 29 20 2d 20 31 37 20 46 52 4f 4d 20 74  ED ) - 17 FROM t
25970 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
25980 2d 31 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -17....skipif my
25990 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
259a0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
259b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 33  wsort label-1053
259c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
259d0 54 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 43 41 53  T - col2 / - CAS
259e0 54 20 28 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  T ( col0 * - col
259f0 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d  1 AS INTEGER ) -
25a00 20 31 37 20 46 52 4f 4d 20 74 61 62 32 20 63 6f   17 FROM tab2 co
25a10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 0d  r0..----..-17...
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 2b 20 2d 20 63 6f 6c  ..SELECT + - col
25a40 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  2 * cor0.col0 + 
25a50 2d 20 33 39 20 2a 20 63 6f 6c 32 20 41 53 20 63  - 39 * col2 AS c
25a60 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
25a70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
25a80 34 32 34 0d 0a 2d 32 32 36 38 0d 0a 2d 35 38 37  424..-2268..-587
25a90 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
25aa0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
25ab0 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  2 * - col1 + col
25ac0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
25ad0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
25ae0 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 36 30 38 0d 0a  -..-1508..-608..
25af0 2d 38 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -810....query I 
25b00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25b10 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20  ALL tab2.col2 * 
25b20 2d 20 33 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 31 AS col0 FRO
25b30 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
25b40 31 37 38 0d 0a 2d 38 30 36 0d 0a 2d 38 33 37 0d  178..-806..-837.
25b50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25b60 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
25b70 32 20 2d 20 28 20 2b 20 63 6f 6c 32 20 2b 20 2d  2 - ( + col2 + -
25b80 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
25b90 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 0d 0a 32 30  0..----..-73..20
25ba0 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..95....query I 
25bb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25bc0 2b 20 35 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  + 50 * cor0.col1
25bd0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30   FROM tab0, tab0
25be0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
25bf0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
25c00 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
25c10 74 6f 20 64 32 66 66 33 32 35 36 33 66 61 65 32  to d2ff32563fae2
25c20 37 65 63 36 35 62 64 37 66 64 39 63 38 66 31 62  7ec65bd7fd9c8f1b
25c30 34 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  456....query I r
25c40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
25c50 6f 6c 30 20 2b 20 37 20 2a 20 2b 20 63 6f 6c 31  ol0 + 7 * + col1
25c60 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
25c70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 0d 0a 31  r0..----..134..1
25c80 37 31 0d 0a 31 38 35 0d 0a 0d 0a 71 75 65 72 79  71..185....query
25c90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25ca0 43 54 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2d 20  CT col2 * - ( - 
25cb0 36 37 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  67 ) AS col1 FRO
25cc0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36  M tab1..----..36
25cd0 31 38 0d 0a 33 38 31 39 0d 0a 36 34 33 32 0d 0a  18..3819..6432..
25ce0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
25cf0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
25d00 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
25d10 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
25d20 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
25d30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25d40 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  CT + - col1 + - 
25d50 28 20 2d 20 32 39 20 29 20 63 6f 6c 30 20 46 52  ( - 29 ) col0 FR
25d60 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
25d70 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 31 39 0d 0a 33  .----..16..19..3
25d80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25d90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
25da0 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 32 34 20 41   * col0 + + 24 A
25db0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
25dc0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 39 0d 0a 36 30  ..----..1249..60
25dd0 30 0d 0a 37 39 34 35 0d 0a 0d 0a 71 75 65 72 79  0..7945....query
25de0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25df0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
25e00 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  l0 + - col0 * + 
25e10 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
25e20 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
25e30 2d 0d 0a 2d 34 32 0d 0a 2d 36 30 30 36 0d 0a 2d  -..-42..-6006..-
25e40 36 31 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6162....query I 
25e50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25e60 44 49 53 54 49 4e 43 54 20 2b 20 34 38 20 2a 20  DISTINCT + 48 * 
25e70 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
25e80 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
25e90 2d 0d 0a 34 31 32 38 0d 0a 34 33 36 38 0d 0a 34  -..4128..4368..4
25ea0 36 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  656....query I r
25eb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
25ec0 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20   - ( - col2 ) * 
25ed0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col2 + col2 FROM
25ee0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
25ef0 2d 2d 2d 0d 0a 31 34 38 32 0d 0a 37 30 32 0d 0a  ---..1482..702..
25f00 37 35 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  756....onlyif my
25f10 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
25f20 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
25f30 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
25f40 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
25f50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25f60 31 30 36 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1066..SELECT ALL
25f70 20 2b 20 31 33 20 2a 20 2b 20 63 6f 6c 30 20 2d   + 13 * + col0 -
25f80 20 43 41 53 54 28 20 63 6f 6c 32 20 2b 20 2b 20   CAST( col2 + + 
25f90 63 6f 6c 32 20 2a 20 31 33 20 41 53 20 53 49 47  col2 * 13 AS SIG
25fa0 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20  NED ) FROM tab0 
25fb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
25fc0 31 35 30 0d 0a 34 34 31 0d 0a 39 0d 0a 0d 0a 73  150..441..9....s
25fd0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
25fe0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
25ff0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
26000 62 65 6c 2d 31 30 36 36 0d 0a 53 45 4c 45 43 54  bel-1066..SELECT
26010 20 41 4c 4c 20 2b 20 31 33 20 2a 20 2b 20 63 6f   ALL + 13 * + co
26020 6c 30 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 32  l0 - CAST ( col2
26030 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 31 33 20 41   + + col2 * 13 A
26040 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
26050 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
26060 2d 2d 2d 0d 0a 2d 31 35 30 0d 0a 34 34 31 0d 0a  ---..-150..441..
26070 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
26080 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
26090 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
260a0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
260b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
260c0 2d 31 30 36 37 0d 0a 53 45 4c 45 43 54 20 41 4c  -1067..SELECT AL
260d0 4c 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 63  L + col1 DIV + c
260e0 6f 6c 31 20 2b 20 2b 20 33 34 20 2b 20 2b 20 63  ol1 + + 34 + + c
260f0 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
26100 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
26110 0d 0a 31 33 31 0d 0a 38 39 0d 0a 39 32 0d 0a 0d  ..131..89..92...
26120 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
26130 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
26140 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
26150 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
26160 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
26170 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
26180 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
26190 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
261a0 30 36 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  067..SELECT ALL 
261b0 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20  + col1 / + col1 
261c0 2b 20 2b 20 33 34 20 2b 20 2b 20 63 6f 6c 32 20  + + 34 + + col2 
261d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
261e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
261f0 31 0d 0a 38 39 0d 0a 39 32 0d 0a 0d 0a 71 75 65  1..89..92....que
26200 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26210 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  LECT + col1 * co
26220 6c 31 20 2b 20 2b 20 35 39 20 46 52 4f 4d 20 74  l1 + + 59 FROM t
26230 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
26240 2d 0d 0a 31 30 32 30 0d 0a 33 34 38 0d 0a 33 35  -..1020..348..35
26250 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  40....skipif pos
26260 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
26270 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
26280 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
26290 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
262a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
262b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
262c0 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  - ( + cor0.col2 
262d0 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  ) col0 FROM tab0
262e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
262f0 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a  -1..-33..-82....
26300 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
26310 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
26320 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
26330 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
26340 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 30  wsort label-1070
26350 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
26360 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 * cor0.col2 
26370 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c  + col1 DIV + col
26380 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
26390 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
263a0 2d 32 39 31 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39  -2916..-3249..-9
263b0 32 31 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  216....skipif my
263c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
263d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
263e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 30  wsort label-1070
263f0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
26400 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 * cor0.col2 
26410 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 32 20  + col1 / + col2 
26420 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
26430 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  1 cor0..----..-2
26440 39 31 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39 32 31  916..-3249..-921
26450 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
26460 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
26470 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
26480 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
26490 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
264a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
264b0 45 4c 45 43 54 20 36 39 20 63 6f 6c 32 20 46 52  ELECT 69 col2 FR
264c0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
264d0 2d 2d 0d 0a 36 39 0d 0a 36 39 0d 0a 36 39 0d 0a  --..69..69..69..
264e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
264f0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
26500 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32  CT col1 * - col2
26510 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a   + col1 + col2 *
26520 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   - cor0.col0 FRO
26530 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
26540 2d 2d 2d 2d 0d 0a 2d 33 35 30 33 0d 0a 2d 33 36  ----..-3503..-36
26550 33 31 0d 0a 2d 39 39 35 0d 0a 0d 0a 73 6b 69 70  31..-995....skip
26560 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
26570 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
26580 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
26590 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
265a0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
265b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
265c0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 36 39 20   cor0.col0 * 69 
265d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
265e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
265f0 30 37 0d 0a 2d 34 34 31 36 0d 0a 2d 35 35 32 30  07..-4416..-5520
26600 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26610 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
26620 49 4e 43 54 20 33 31 20 41 53 20 63 6f 6c 31 20  INCT 31 AS col1 
26630 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
26640 63 6f 72 30 2c 20 74 61 62 30 20 63 6f 72 31 0d  cor0, tab0 cor1.
26650 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a 0d 0a 73 6b 69  .----..31....ski
26660 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
26670 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
26680 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
26690 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
266a0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
266b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
266c0 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32 20 46  cor0.col0 col2 F
266d0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
266e0 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a  ---..7..78..79..
266f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
26700 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
26710 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
26720 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
26730 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
26740 37 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  76..SELECT DISTI
26750 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 37  NCT - col2 + + 7
26760 32 20 2b 20 33 37 20 2a 20 63 6f 6c 30 20 44 49  2 + 37 * col0 DI
26770 56 20 31 33 20 41 53 20 63 6f 6c 30 20 46 52 4f  V 13 AS col0 FRO
26780 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
26790 2d 2d 2d 2d 0d 0a 31 39 37 0d 0a 32 30 33 0d 0a  ----..197..203..
267a0 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  26....skipif mys
267b0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
267c0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
267d0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 36 0d  sort label-1076.
267e0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
267f0 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 37 32 20 2b   - col2 + + 72 +
26800 20 33 37 20 2a 20 63 6f 6c 30 20 2f 20 31 33 20   37 * col0 / 13 
26810 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
26820 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
26830 0a 31 39 37 0d 0a 32 30 33 0d 0a 32 36 0d 0a 0d  .197..203..26...
26840 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26850 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 35  ..SELECT ALL + 5
26860 33 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  3 FROM tab0, tab
26870 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  1 cor0..----..9 
26880 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
26890 6f 20 66 65 64 65 36 30 33 33 64 65 65 33 34 36  o fede6033dee346
268a0 64 62 64 32 37 32 30 38 35 63 30 35 37 32 34 66  dbd272085c05724f
268b0 64 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  da....query I ro
268c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
268d0 4c 20 28 20 2d 20 38 38 20 29 20 2b 20 2b 20 63  L ( - 88 ) + + c
268e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
268f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
26900 0a 33 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .3..9....query I
26910 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26920 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
26930 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41   * col1 + col0 A
26940 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
26950 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   cor0..----..-21
26960 30 0d 0a 2d 33 34 30 33 0d 0a 2d 39 35 34 0d 0a  0..-3403..-954..
26970 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26980 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
26990 2d 20 33 20 2b 20 37 36 20 2a 20 2b 20 63 6f 6c  - 3 + 76 * + col
269a0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
269b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 30 35 0d  or0..----..2505.
269c0 0a 36 32 32 39 0d 0a 37 33 0d 0a 0d 0a 71 75 65  .6229..73....que
269d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
269e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
269f0 2b 20 63 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 6c  + col0 + + ( col
26a00 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  2 ) AS col1 FROM
26a10 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
26a20 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37  ---..171..36..57
26a30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
26a40 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
26a50 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
26a60 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
26a70 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
26a80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26a90 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  LECT + - col0 + 
26aa0 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
26ab0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
26ac0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
26ad0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26ae0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
26af0 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b 20 31   tab1.col0 * + 1
26b00 36 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  6 FROM tab1..---
26b10 2d 0d 0a 31 30 32 34 0d 0a 31 32 38 30 0d 0a 34  -..1024..1280..4
26b20 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
26b30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
26b40 20 34 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20   42 * col1 FROM 
26b50 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
26b60 2d 2d 0d 0a 2d 31 33 30 32 0d 0a 2d 32 34 37 38  --..-1302..-2478
26b70 0d 0a 2d 37 31 34 0d 0a 0d 0a 71 75 65 72 79 20  ..-714....query 
26b80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26b90 54 20 41 4c 4c 20 2d 20 39 34 20 2a 20 33 20 46  T ALL - 94 * 3 F
26ba0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26bb0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 32 0d 0a 2d 32  ..----..-282..-2
26bc0 38 32 0d 0a 2d 32 38 32 0d 0a 0d 0a 71 75 65 72  82..-282....quer
26bd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26be0 45 43 54 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b  ECT ( + col0 ) +
26bf0 20 2b 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f   + col2 * ( - co
26c00 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63  l2 ) FROM tab0 c
26c10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 35  or0..----..-1065
26c20 0d 0a 2d 36 36 33 35 0d 0a 33 34 0d 0a 0d 0a 6f  ..-6635..34....o
26c30 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
26c40 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
26c50 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
26c60 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
26c70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26c80 74 20 6c 61 62 65 6c 2d 31 30 38 37 0d 0a 53 45  t label-1087..SE
26c90 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 32 20  LECT + ( + col2 
26ca0 29 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 43  ) * + col1 + + C
26cb0 41 53 54 28 20 34 35 20 41 53 20 53 49 47 4e 45  AST( 45 AS SIGNE
26cc0 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  D ) FROM tab0 AS
26cd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32   cor0..----..142
26ce0 0d 0a 32 38 38 33 0d 0a 37 35 30 37 0d 0a 0d 0a  ..2883..7507....
26cf0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
26d00 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
26d10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26d20 61 62 65 6c 2d 31 30 38 37 0d 0a 53 45 4c 45 43  abel-1087..SELEC
26d30 54 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a  T + ( + col2 ) *
26d40 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54   + col1 + + CAST
26d50 20 28 20 34 35 20 41 53 20 49 4e 54 45 47 45 52   ( 45 AS INTEGER
26d60 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
26d70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 0d  cor0..----..142.
26d80 0a 32 38 38 33 0d 0a 37 35 30 37 0d 0a 0d 0a 71  .2883..7507....q
26d90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26da0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26db0 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f  cor0.col1 * - co
26dc0 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l0 + - cor0.col1
26dd0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
26de0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
26df0 0d 0a 2d 32 31 35 30 0d 0a 2d 33 34 39 32 0d 0a  ..-2150..-3492..
26e00 2d 38 31 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -8190....query I
26e10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26e20 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2b 20 35 39   ALL col2 + + 59
26e30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
26e40 0d 0a 31 34 31 0d 0a 36 30 0d 0a 39 32 0d 0a 0d  ..141..60..92...
26e50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26e60 0d 0a 53 45 4c 45 43 54 20 33 20 2d 20 63 6f 6c  ..SELECT 3 - col
26e70 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
26e80 2d 0d 0a 2d 31 30 0d 0a 2d 32 33 0d 0a 2d 37 0d  -..-10..-23..-7.
26e90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26ea0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
26eb0 4e 43 54 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c  NCT - col2 - col
26ec0 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 * col2 FROM ta
26ed0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
26ee0 0d 0a 2d 32 38 37 31 0d 0a 2d 37 35 34 34 0d 0a  ..-2871..-7544..
26ef0 2d 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -98....skipif po
26f00 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
26f10 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
26f20 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
26f30 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
26f40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26f50 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
26f60 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20   - ( - col2 ) * 
26f70 2d 20 32 39 20 63 6f 6c 31 20 46 52 4f 4d 20 74  - 29 col1 FROM t
26f80 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
26f90 2d 0d 0a 2d 32 33 37 38 0d 0a 2d 32 39 0d 0a 2d  -..-2378..-29..-
26fa0 39 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  957....query I r
26fb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
26fc0 4c 4c 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63  LL col1 + cor0.c
26fd0 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 * col1 AS co
26fe0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
26ff0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30  cor0..----..1360
27000 0d 0a 32 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 71  ..248..4661....q
27010 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27020 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 33 35 20  SELECT + ( + 35 
27030 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
27040 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62 31 20  ab2, tab1, tab1 
27050 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
27060 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
27070 20 74 6f 20 30 64 31 33 64 66 64 34 63 34 61 39   to 0d13dfd4c4a9
27080 64 35 31 61 63 65 33 35 38 32 63 33 31 63 61 64  d51ace3582c31cad
27090 63 64 62 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20  cdbc....query I 
270a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
270b0 44 49 53 54 49 4e 43 54 20 2b 20 39 20 2b 20 63  DISTINCT + 9 + c
270c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
270d0 2d 2d 2d 0d 0a 33 35 0d 0a 33 36 0d 0a 34 37 0d  ---..35..36..47.
270e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
270f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
27100 6f 6c 30 20 2b 20 2d 20 33 30 20 46 52 4f 4d 20  ol0 + - 30 FROM 
27110 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a  tab0..----..-6..
27120 35 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..59....query I
27130 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27140 20 39 33 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c   93 * - tab0.col
27150 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
27160 2d 0d 0a 2d 33 30 36 39 0d 0a 2d 37 36 32 36 0d  -..-3069..-7626.
27170 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-93....query I 
27180 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27190 44 49 53 54 49 4e 43 54 20 2b 20 32 30 20 41 53  DISTINCT + 20 AS
271a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c   col1 FROM tab2,
271b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
271c0 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
271d0 2d 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -..20....query I
271e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
271f0 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30   + col1 * - cor0
27200 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
27210 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
27220 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d  --..-1534..-646.
27230 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .-837....query I
27240 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27250 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30   - + col2 * cor0
27260 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 46  .col0 + + col0 F
27270 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
27280 2d 2d 2d 0d 0a 2d 37 32 30 39 0d 0a 2d 37 36 38  ---..-7209..-768
27290 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..0....skipif po
272a0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
272b0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
272c0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
272d0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
272e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
272f0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b  .SELECT col1 * +
27300 20 63 6f 6c 30 20 2a 20 34 31 20 63 6f 6c 30 20   col0 * 41 col0 
27310 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
27320 0a 31 38 38 36 38 32 0d 0a 35 35 30 36 33 0d 0a  .188682..55063..
27330 38 38 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8897....query I 
27340 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27350 63 6f 6c 32 20 2a 20 2d 20 38 37 20 46 52 4f 4d  col2 * - 87 FROM
27360 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36   tab1..----..-46
27370 39 38 0d 0a 2d 34 39 35 39 0d 0a 2d 38 33 35 32  98..-4959..-8352
27380 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27390 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
273a0 6c 30 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 30  l0 + - tab2.col0
273b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
273c0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b2..----..0..0..
273d0 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
273e0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
273f0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
27400 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
27410 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
27420 2d 31 31 30 34 0d 0a 53 45 4c 45 43 54 20 44 49  -1104..SELECT DI
27430 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
27440 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 44 49 56 20  col2 + col2 DIV 
27450 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
27460 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 33 37 0d  ..----..172..37.
27470 0a 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .58....skipif my
27480 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
27490 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
274a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 34  wsort label-1104
274b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
274c0 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  T + col0 + col2 
274d0 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20  + col2 / + col2 
274e0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
274f0 0a 31 37 32 0d 0a 33 37 0d 0a 35 38 0d 0a 0d 0a  .172..37..58....
27500 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
27510 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
27520 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
27530 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
27540 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 35  wsort label-1105
27550 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
27560 30 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20  0 DIV - col0 AS 
27570 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
27580 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
27590 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70  ..-1..-1....skip
275a0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
275b0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
275c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
275d0 2d 31 31 30 35 0d 0a 53 45 4c 45 43 54 20 2b 20  -1105..SELECT + 
275e0 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20  + col0 / - col0 
275f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
27600 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
27610 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71  .-1..-1..-1....q
27620 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27630 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 2d 20  SELECT col2 - - 
27640 31 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  15 AS col1 FROM 
27650 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
27660 0a 31 31 31 0d 0a 36 39 0d 0a 37 32 0d 0a 0d 0a  .111..69..72....
27670 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27680 0a 53 45 4c 45 43 54 20 2d 20 2b 20 38 30 20 2a  .SELECT - + 80 *
27690 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63   - col1 + cor0.c
276a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
276b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33   cor0..----..113
276c0 36 0d 0a 32 31 33 34 0d 0a 38 35 37 0d 0a 0d 0a  6..2134..857....
276d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
276e0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
276f0 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
27700 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31  ab1..----..-7..1
27710 36 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  6..51....query I
27720 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27730 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 37 38 20 41   ALL col1 * 78 A
27740 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
27750 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 34 0d 0a 32 30  ..----..1014..20
27760 32 38 0d 0a 37 38 30 0d 0a 0d 0a 71 75 65 72 79  28..780....query
27770 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27780 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a  CT col0 * col2 *
27790 20 2d 20 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d   - 0 + col2 FROM
277a0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
277b0 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20  33..82....query 
277c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
277d0 54 20 2d 20 63 6f 6c 30 20 2b 20 28 20 28 20 63  T - col0 + ( ( c
277e0 6f 6c 30 20 29 20 29 20 2b 20 2b 20 63 6f 6c 30  ol0 ) ) + + col0
277f0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
27800 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d  b2..----..7..78.
27810 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .79....query I r
27820 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
27830 20 63 6f 6c 30 20 2a 20 28 20 2b 20 74 61 62 31   col0 * ( + tab1
27840 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20  .col2 ) AS col1 
27850 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
27860 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37  .-162..-3648..-7
27870 36 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  680....onlyif my
27880 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
27890 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
278a0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
278b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
278c0 65 6c 2d 31 31 31 33 0d 0a 53 45 4c 45 43 54 20  el-1113..SELECT 
278d0 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 31 36 20  ALL + col0 + 16 
278e0 2b 20 37 31 20 44 49 56 20 2b 20 74 61 62 30 2e  + 71 DIV + tab0.
278f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
27900 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 32 32 0d 0a  ----..105..122..
27910 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  42....skipif mys
27920 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
27930 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
27940 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31 33 0d  sort label-1113.
27950 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
27960 6c 30 20 2b 20 31 36 20 2b 20 37 31 20 2f 20 2b  l0 + 16 + 71 / +
27970 20 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab0.col2 FROM 
27980 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d  tab0..----..105.
27990 0a 31 32 32 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72  .122..42....quer
279a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
279b0 45 43 54 20 41 4c 4c 20 2d 20 31 38 20 46 52 4f  ECT ALL - 18 FRO
279c0 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  M tab0, tab1 AS 
279d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
279e0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
279f0 30 39 61 66 61 66 65 63 36 35 37 61 35 65 39 66  09afafec657a5e9f
27a00 30 38 32 62 65 62 36 61 31 36 65 63 38 35 64 65  082beb6a16ec85de
27a10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27a20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
27a30 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 2b 20  col2 * col1 * + 
27a40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
27a50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
27a60 31 39 36 35 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d  19652..-51034..-
27a70 35 38 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5859....query I 
27a80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27a90 2d 20 63 6f 6c 31 20 2a 20 33 32 20 2b 20 2d 20  - col1 * 32 + - 
27aa0 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63  col1 * col2 AS c
27ab0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
27ac0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
27ad0 33 37 34 0d 0a 2d 33 32 30 31 0d 0a 2d 35 35 39  374..-3201..-559
27ae0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
27af0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
27b00 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 38 39   - - col1 + + 89
27b10 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * - cor0.col1 F
27b20 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
27b30 2d 2d 2d 0d 0a 2d 31 34 39 36 0d 0a 2d 32 37 32  ---..-1496..-272
27b40 38 0d 0a 2d 35 31 39 32 0d 0a 0d 0a 71 75 65 72  8..-5192....quer
27b50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27b60 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
27b70 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41   - cor0.col2 ) A
27b80 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
27b90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27ba0 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 71 75  26..27..38....qu
27bb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27bc0 45 4c 45 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c  ELECT - cor1.col
27bd0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
27be0 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab1 AS cor0 CROS
27bf0 53 20 4a 4f 49 4e 20 74 61 62 32 20 63 6f 72 31  S JOIN tab2 cor1
27c00 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
27c10 20 68 61 73 68 69 6e 67 20 74 6f 20 37 62 35 39   hashing to 7b59
27c20 33 38 31 32 34 32 35 33 37 39 38 34 32 36 66 62  38124253798426fb
27c30 66 30 39 63 31 38 65 31 66 64 37 35 0d 0a 0d 0a  f09c18e1fd75....
27c40 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
27c50 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
27c60 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
27c70 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
27c80 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 30  wsort label-1120
27c90 0d 0a 53 45 4c 45 43 54 20 2d 20 32 36 20 2a 20  ..SELECT - 26 * 
27ca0 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 46 52  col2 DIV col0 FR
27cb0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
27cc0 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 32 0d 0a 2d  --..-100..-12..-
27cd0 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
27ce0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
27cf0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
27d00 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 30 0d 0a  ort label-1120..
27d10 53 45 4c 45 43 54 20 2d 20 32 36 20 2a 20 63 6f  SELECT - 26 * co
27d20 6c 32 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l2 / col0 FROM t
27d30 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
27d40 2d 31 30 30 0d 0a 2d 31 32 0d 0a 2d 38 0d 0a 0d  -100..-12..-8...
27d50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27d60 0d 0a 53 45 4c 45 43 54 20 2d 20 32 30 20 2b 20  ..SELECT - 20 + 
27d70 36 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  63 AS col2 FROM 
27d80 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
27d90 2d 2d 0d 0a 34 33 0d 0a 34 33 0d 0a 34 33 0d 0a  --..43..43..43..
27da0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27db0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 30 20 2b  t..SELECT + 70 +
27dc0 20 33 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c   30 * + cor0.col
27dd0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
27de0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 30 0d  or0..----..1690.
27df0 0a 31 37 38 30 0d 0a 32 39 35 30 0d 0a 0d 0a 6f  .1780..2950....o
27e00 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
27e10 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
27e20 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
27e30 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
27e40 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 33 0d  sort label-1123.
27e50 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
27e60 34 33 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56 20  43 + - col1 DIV 
27e70 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
27e80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27e90 34 34 0d 0a 34 34 0d 0a 34 34 0d 0a 0d 0a 73 6b  44..44..44....sk
27ea0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
27eb0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
27ec0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
27ed0 65 6c 2d 31 31 32 33 0d 0a 53 45 4c 45 43 54 20  el-1123..SELECT 
27ee0 41 4c 4c 20 2b 20 2b 20 34 33 20 2b 20 2d 20 63  ALL + + 43 + - c
27ef0 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f  ol1 / - col1 FRO
27f00 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
27f10 2d 2d 2d 2d 0d 0a 34 34 0d 0a 34 34 0d 0a 34 34  ----..44..44..44
27f20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27f30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
27f40 63 6f 6c 30 20 2b 20 31 39 20 2a 20 2b 20 63 6f  col0 + 19 * + co
27f50 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
27f60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 34 0d  cor0..----..254.
27f70 0a 33 32 37 0d 0a 34 39 37 0d 0a 0d 0a 71 75 65  .327..497....que
27f80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27f90 4c 45 43 54 20 2d 20 2d 20 33 31 20 2d 20 2d 20  LECT - - 31 - - 
27fa0 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31  cor0.col2 * col1
27fb0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
27fc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 32  r0..----..128..2
27fd0 38 36 39 0d 0a 37 34 39 33 0d 0a 0d 0a 71 75 65  869..7493....que
27fe0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27ff0 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c  LECT ALL + - col
28000 32 20 2b 20 2b 20 32 34 20 46 52 4f 4d 20 74 61  2 + + 24 FROM ta
28010 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
28020 35 38 0d 0a 2d 39 0d 0a 32 33 0d 0a 0d 0a 71 75  58..-9..23....qu
28030 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28040 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
28050 20 63 6f 6c 31 20 2a 20 2d 20 33 32 20 41 53 20   col1 * - 32 AS 
28060 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
28070 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
28080 32 30 0d 0a 2d 34 31 36 0d 0a 2d 38 33 32 0d 0a  20..-416..-832..
28090 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
280a0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
280b0 20 2a 20 2b 20 39 31 20 41 53 20 63 6f 6c 30 20   * + 91 AS col0 
280c0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
280d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 30 33 0d 0a  0..----..-3003..
280e0 2d 37 34 36 32 0d 0a 2d 39 31 0d 0a 0d 0a 71 75  -7462..-91....qu
280f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28100 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
28110 20 2a 20 2d 20 31 39 20 41 53 20 63 6f 6c 30 20   * - 19 AS col0 
28120 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
28130 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 36 0d 0a  0..----..-1216..
28140 2d 31 35 32 30 0d 0a 2d 35 37 0d 0a 0d 0a 71 75  -1520..-57....qu
28150 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28160 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 34 20 2a  ELECT ALL + 94 *
28170 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
28180 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
28190 0a 32 32 35 36 0d 0a 33 32 39 30 0d 0a 38 33 36  .2256..3290..836
281a0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
281b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
281c0 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 30 20  TINCT tab1.col0 
281d0 2a 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30 20  * col0 - + col0 
281e0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
281f0 0a 34 30 33 32 0d 0a 36 0d 0a 36 33 32 30 0d 0a  .4032..6..6320..
28200 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28210 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
28220 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41  CT + cor0.col2 A
28230 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
28240 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20  , tab2 AS cor0, 
28250 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
28260 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a  --..26..27..38..
28270 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
28280 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
28290 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
282a0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
282b0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
282c0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33 33 0d  sort label-1133.
282d0 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 32 2e 63  .SELECT + tab2.c
282e0 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 28  ol1 * col1 + + (
282f0 20 63 6f 6c 32 20 2a 20 43 41 53 54 28 20 4e 55   col2 * CAST( NU
28300 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 29  LL AS SIGNED ) )
28310 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 74 61 62 32   + - col2 * tab2
28320 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
28330 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab2..----..N
28340 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
28350 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
28360 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
28370 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28380 74 20 6c 61 62 65 6c 2d 31 31 33 33 0d 0a 53 45  t label-1133..SE
28390 4c 45 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 31  LECT + tab2.col1
283a0 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f   * col1 + + ( co
283b0 6c 32 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c  l2 * CAST ( NULL
283c0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 29 20   AS INTEGER ) ) 
283d0 2b 20 2d 20 63 6f 6c 32 20 2a 20 74 61 62 32 2e  + - col2 * tab2.
283e0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
283f0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab2..----..NU
28400 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
28410 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
28420 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
28430 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
28440 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
28450 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
28460 33 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  34..SELECT - col
28470 30 20 2b 20 2d 20 32 39 20 2a 20 63 6f 6c 32 20  0 + - 29 * col2 
28480 44 49 56 20 74 61 62 31 2e 63 6f 6c 31 20 41 53  DIV tab1.col1 AS
28490 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
284a0 0a 2d 2d 2d 2d 0d 0a 2d 32 32 39 0d 0a 2d 32 39  .----..-229..-29
284b0 34 0d 0a 2d 36 33 0d 0a 0d 0a 73 6b 69 70 69 66  4..-63....skipif
284c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
284d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
284e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
284f0 31 33 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  134..SELECT - co
28500 6c 30 20 2b 20 2d 20 32 39 20 2a 20 63 6f 6c 32  l0 + - 29 * col2
28510 20 2f 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20   / tab1.col1 AS 
28520 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
28530 2d 2d 2d 2d 0d 0a 2d 32 32 39 0d 0a 2d 32 39 34  ----..-229..-294
28540 0d 0a 2d 36 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-63....onlyif 
28550 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
28560 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
28570 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
28580 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28590 61 62 65 6c 2d 31 31 33 35 0d 0a 53 45 4c 45 43  abel-1135..SELEC
285a0 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  T + col0 * col2 
285b0 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c  + col1 DIV - col
285c0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
285d0 2d 0d 0a 2d 36 32 0d 0a 37 32 39 37 0d 0a 37 39  -..-62..7297..79
285e0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
285f0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
28600 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
28610 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33 35 0d 0a  ort label-1135..
28620 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
28630 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20 2d 20  col2 + col1 / - 
28640 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
28650 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a 37 32 39 37 0d  ----..-62..7297.
28660 0a 37 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .790....query I 
28670 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28680 63 6f 6c 32 20 2a 20 38 20 2b 20 74 61 62 31 2e  col2 * 8 + tab1.
28690 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
286a0 2d 2d 2d 2d 0d 0a 34 38 36 0d 0a 35 31 33 0d 0a  ----..486..513..
286b0 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  864....query I r
286c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
286d0 4c 4c 20 28 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  LL ( col2 + col1
286e0 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c   ) * col0 AS col
286f0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
28700 2d 0d 0a 32 34 30 0d 0a 34 32 38 38 0d 0a 38 37  -..240..4288..87
28710 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  20....onlyif mys
28720 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
28730 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
28740 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
28750 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28760 6c 2d 31 31 33 38 0d 0a 53 45 4c 45 43 54 20 41  l-1138..SELECT A
28770 4c 4c 20 43 41 53 54 28 20 63 6f 6c 30 20 2b 20  LL CAST( col0 + 
28780 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44  + col0 AS SIGNED
28790 20 29 20 44 49 56 20 2d 20 74 61 62 32 2e 63 6f   ) DIV - tab2.co
287a0 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
287b0 2d 2d 0d 0a 2d 32 0d 0a 2d 39 0d 0a 30 0d 0a 0d  --..-2..-9..0...
287c0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
287d0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
287e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
287f0 6c 61 62 65 6c 2d 31 31 33 38 0d 0a 53 45 4c 45  label-1138..SELE
28800 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 63 6f  CT ALL CAST ( co
28810 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 49  l0 + + col0 AS I
28820 4e 54 45 47 45 52 20 29 20 2f 20 2d 20 74 61 62  NTEGER ) / - tab
28830 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  2.col1 FROM tab2
28840 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 39 0d 0a  ..----..-2..-9..
28850 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
28860 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
28870 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 74 61 62  TINCT col2 * tab
28880 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53  0.col0 + col1 AS
28890 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
288a0 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 37 33 38 39  .----..132..7389
288b0 0d 0a 38 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..878....query I
288c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
288d0 20 2b 20 2b 20 31 30 20 41 53 20 63 6f 6c 31 20   + + 10 AS col1 
288e0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
288f0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 30 0d  0..----..10..10.
28900 0a 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .10....onlyif my
28910 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
28920 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
28930 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
28940 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
28950 65 6c 2d 31 31 34 31 0d 0a 53 45 4c 45 43 54 20  el-1141..SELECT 
28960 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 44 49  col0 + + col0 DI
28970 56 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  V + col2 FROM ta
28980 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 37 30  b0..----..24..70
28990 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..90....skipif m
289a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
289b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
289c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34  owsort label-114
289d0 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  1..SELECT col0 +
289e0 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 32   + col0 / + col2
289f0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
28a00 0d 0a 32 34 0d 0a 37 30 0d 0a 39 30 0d 0a 0d 0a  ..24..70..90....
28a10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28a20 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
28a30 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  col0 + col1 * co
28a40 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
28a50 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
28a60 0a 32 38 31 34 0d 0a 36 32 0d 0a 37 33 37 33 0d  .2814..62..7373.
28a70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28a80 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
28a90 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  NCT - col0 * - c
28aa0 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  or0.col0 * cor0.
28ab0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
28ac0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
28ad0 2d 2d 2d 2d 0d 0a 31 33 38 32 34 0d 0a 34 32 38  ----..13824..428
28ae0 37 35 0d 0a 37 30 34 39 36 39 0d 0a 0d 0a 73 6b  75..704969....sk
28af0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
28b00 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
28b10 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
28b20 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
28b30 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
28b40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
28b50 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  or0.col1 * - col
28b60 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  2 col1 FROM tab0
28b70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28b80 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39  -2838..-7462..-9
28b90 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
28ba0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
28bb0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
28bc0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
28bd0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
28be0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
28bf0 34 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  45..SELECT DISTI
28c00 4e 43 54 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e  NCT col2 + cor0.
28c10 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 4e 55 4c  col1 * CAST( NUL
28c20 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
28c30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
28c40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
28c50 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
28c60 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
28c70 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
28c80 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 35  wsort label-1145
28c90 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
28ca0 54 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f  T col2 + cor0.co
28cb0 6c 31 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c  l1 * CAST ( NULL
28cc0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
28cd0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
28ce0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
28cf0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
28d00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
28d10 20 63 6f 6c 32 20 29 20 2b 20 28 20 31 38 20 29   col2 ) + ( 18 )
28d20 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20   * tab2.col1 AS 
28d30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
28d40 2d 2d 2d 2d 0d 0a 31 30 38 38 0d 0a 33 34 34 0d  ----..1088..344.
28d50 0a 35 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .585....query I 
28d60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28d70 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b  ALL - - col0 * +
28d80 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c   cor0.col2 + col
28d90 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  0 * - col0 FROM 
28da0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
28db0 2d 2d 0d 0a 2d 31 31 39 30 0d 0a 2d 36 32 33 0d  --..-1190..-623.
28dc0 0a 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .216....query I 
28dd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28de0 63 6f 6c 32 20 2a 20 28 20 2d 20 28 20 2b 20 63  col2 * ( - ( + c
28df0 6f 6c 31 20 29 20 29 20 41 53 20 63 6f 6c 32 20  ol1 ) ) AS col2 
28e00 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
28e10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a  0..----..-1248..
28e20 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 73  -1404..-570....s
28e30 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
28e40 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
28e50 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
28e60 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
28e70 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
28e80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28e90 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 31  ALL + col1 * - 1
28ea0 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0 col0 FROM tab2
28eb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28ec0 2d 31 37 30 0d 0a 2d 33 31 30 0d 0a 2d 35 39 30  -170..-310..-590
28ed0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28ee0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
28ef0 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  INCT + col1 * co
28f00 72 30 2e 63 6f 6c 31 20 2b 20 28 20 63 6f 72 30  r0.col1 + ( cor0
28f10 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20  .col2 ) AS col0 
28f20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
28f30 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 37 0d 0a 33 35  0..----..327..35
28f40 30 37 0d 0a 39 38 38 0d 0a 0d 0a 71 75 65 72 79  07..988....query
28f50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28f60 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  CT - cor0.col0 *
28f70 20 2d 20 39 37 20 46 52 4f 4d 20 74 61 62 32 20   - 97 FROM tab2 
28f80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  AS cor0..----..6
28f90 37 39 0d 0a 37 35 36 36 0d 0a 37 36 36 33 0d 0a  79..7566..7663..
28fa0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28fb0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
28fc0 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  + col1 * - col0 
28fd0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
28fe0 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34  ----..-1040..-64
28ff0 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20  0..-78....query 
29000 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29010 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
29020 2b 20 2b 20 39 31 20 2a 20 2d 20 33 31 20 46 52  + + 91 * - 31 FR
29030 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
29040 0a 2d 2d 2d 2d 0d 0a 2d 32 37 34 31 0d 0a 2d 32  .----..-2741..-2
29050 37 35 37 0d 0a 2d 32 38 31 38 0d 0a 0d 0a 71 75  757..-2818....qu
29060 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29070 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b  ELECT - col0 + +
29080 20 33 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   33 AS col1 FROM
29090 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
290a0 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35 36 0d 0a 39 0d  ---..-2..-56..9.
290b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
290c0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
290d0 20 2d 20 63 6f 6c 31 20 2b 20 28 20 2b 20 28 20   - col1 + ( + ( 
290e0 63 6f 6c 31 20 29 20 2a 20 2b 20 34 38 20 29 20  col1 ) * + 48 ) 
290f0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
29100 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
29110 0a 31 32 37 34 0d 0a 34 39 30 0d 0a 36 33 37 0d  .1274..490..637.
29120 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29130 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
29140 2a 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c  * + col0 - + col
29150 30 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29  0 * - ( - col0 )
29160 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
29170 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
29180 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29190 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
291a0 63 6f 6c 32 20 2b 20 37 20 46 52 4f 4d 20 74 61  col2 + 7 FROM ta
291b0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
291c0 0d 0a 2d 31 39 0d 0a 2d 32 30 0d 0a 2d 33 31 0d  ..-19..-20..-31.
291d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
291e0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
291f0 31 20 2a 20 33 38 20 2a 20 63 6f 6c 32 20 46 52  1 * 38 * col2 FR
29200 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
29210 0a 2d 2d 2d 2d 0d 0a 31 30 37 38 34 34 0d 0a 32  .----..107844..2
29220 38 33 35 35 36 0d 0a 33 36 38 36 0d 0a 0d 0a 6f  83556..3686....o
29230 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
29240 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
29250 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
29260 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
29270 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29280 74 20 6c 61 62 65 6c 2d 31 31 35 39 0d 0a 53 45  t label-1159..SE
29290 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  LECT + - col0 + 
292a0 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
292b0 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 32 20  SIGNED ) * col2 
292c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
292d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
292e0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
292f0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
29300 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
29310 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
29320 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 39 0d 0a  ort label-1159..
29330 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20  SELECT + - col0 
29340 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + + CAST ( NULL 
29350 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63  AS INTEGER ) * c
29360 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
29370 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
29380 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
29390 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
293a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
293b0 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a   - col2 * col1 *
293c0 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a   + col2 + col2 *
293d0 20 38 35 20 46 52 4f 4d 20 74 61 62 32 20 63 6f   85 FROM tab2 co
293e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 33 30 34  r0..----..-20304
293f0 0d 0a 2d 32 31 33 31 38 0d 0a 2d 33 37 36 37 34  ..-21318..-37674
29400 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29410 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
29420 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  INCT cor0.col1 +
29430 20 39 37 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f   97 * col0 AS co
29440 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
29450 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 37 0d  cor0..----..317.
29460 0a 36 32 31 38 0d 0a 37 37 37 33 0d 0a 0d 0a 6f  .6218..7773....o
29470 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
29480 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
29490 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
294a0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
294b0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 32 0d  sort label-1162.
294c0 0a 53 45 4c 45 43 54 20 2b 20 39 32 20 2b 20 63  .SELECT + 92 + c
294d0 6f 6c 31 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 - + cor0.col
294e0 32 20 44 49 56 20 35 30 20 46 52 4f 4d 20 74 61  2 DIV 50 FROM ta
294f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
29500 0d 0a 31 30 39 0d 0a 31 32 33 0d 0a 31 35 31 0d  ..109..123..151.
29510 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
29520 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
29530 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29540 74 20 6c 61 62 65 6c 2d 31 31 36 32 0d 0a 53 45  t label-1162..SE
29550 4c 45 43 54 20 2b 20 39 32 20 2b 20 63 6f 6c 31  LECT + 92 + col1
29560 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2f   - + cor0.col2 /
29570 20 35 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53   50 FROM tab2 AS
29580 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39   cor0..----..109
29590 0d 0a 31 32 33 0d 0a 31 35 31 0d 0a 0d 0a 71 75  ..123..151....qu
295a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
295b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
295c0 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 31 20 29   col0 * ( col1 )
295d0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
295e0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
295f0 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d  1040..-640..-78.
29600 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29610 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
29620 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30   + col0 * + col0
29630 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
29640 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
29650 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 36  or0..----..22..6
29660 30 35 38 0d 0a 36 32 30 33 0d 0a 0d 0a 71 75 65  058..6203....que
29670 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29680 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
29690 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 34 37 20 46  cor0.col1 + 47 F
296a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
296b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 0d 0a 2d 34 34  ..----..-39..-44
296c0 0d 0a 2d 35 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-50....onlyif 
296d0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
296e0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
296f0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
29700 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
29710 61 62 65 6c 2d 31 31 36 36 0d 0a 53 45 4c 45 43  abel-1166..SELEC
29720 54 20 63 6f 6c 32 20 44 49 56 20 38 38 20 2b 20  T col2 DIV 88 + 
29730 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
29740 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
29750 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 37 0d 0a 0d  -..54..57..97...
29760 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
29770 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
29780 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
29790 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
297a0 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
297b0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
297c0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
297d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
297e0 31 36 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  166..SELECT col2
297f0 20 2f 20 38 38 20 2b 20 63 6f 6c 32 20 63 6f 6c   / 88 + col2 col
29800 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
29810 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  or0..----..54..5
29820 37 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  7..97....query I
29830 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29840 20 41 4c 4c 20 2b 20 28 20 36 37 20 29 20 2a 20   ALL + ( 67 ) * 
29850 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
29860 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29870 2d 33 36 31 38 0d 0a 2d 33 38 31 39 0d 0a 2d 36  -3618..-3819..-6
29880 34 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  432....query I r
29890 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
298a0 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  ol0 + col2 + - c
298b0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
298c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
298d0 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a  ---..3..64..80..
298e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
298f0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 30  t..SELECT ALL 70
29900 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b   * col1 + col0 +
29910 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
29920 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  AS cor0..----..6
29930 30 36 38 0d 0a 36 35 34 38 0d 0a 36 38 36 30 0d  068..6548..6860.
29940 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29950 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
29960 4e 43 54 20 2b 20 33 20 2a 20 2b 20 63 6f 6c 31  NCT + 3 * + col1
29970 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
29980 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 37 0d 0a 35  r0..----..177..5
29990 31 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49  1..93....query I
299a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
299b0 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 2b 20   ALL - col0 * + 
299c0 34 37 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  47 FROM tab0 AS 
299d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32  cor0..----..-112
299e0 38 0d 0a 2d 31 36 34 35 0d 0a 2d 34 31 38 33 0d  8..-1645..-4183.
299f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29a00 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
29a10 20 63 6f 6c 31 20 2b 20 2b 20 35 36 20 2a 20 63   col1 + + 56 * c
29a20 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
29a30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 35   cor0..----..305
29a40 30 0d 0a 33 32 30 32 0d 0a 35 33 38 39 0d 0a 0d  0..3202..5389...
29a50 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
29a60 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
29a70 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
29a80 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
29a90 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
29aa0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29ab0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
29ac0 6f 6c 30 20 2b 20 28 20 63 6f 6c 31 20 29 20 63  ol0 + ( col1 ) c
29ad0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
29ae0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34  r0..----..29..74
29af0 0d 0a 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..93....onlyif m
29b00 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
29b10 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
29b20 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
29b30 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
29b40 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
29b50 2d 31 31 37 34 0d 0a 53 45 4c 45 43 54 20 44 49  -1174..SELECT DI
29b60 53 54 49 4e 43 54 20 2b 20 43 41 53 54 28 20 4e  STINCT + CAST( N
29b70 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
29b80 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
29b90 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
29ba0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
29bb0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
29bc0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
29bd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
29be0 61 62 65 6c 2d 31 31 37 34 0d 0a 53 45 4c 45 43  abel-1174..SELEC
29bf0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53  T DISTINCT + CAS
29c00 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
29c10 47 45 52 20 29 20 2d 20 63 6f 6c 32 20 41 53 20  GER ) - col2 AS 
29c20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
29c30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
29c40 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
29c50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
29c60 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  L + col1 * col0 
29c70 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e  + col0 + + cor0.
29c80 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
29c90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
29ca0 31 36 0d 0a 31 33 35 0d 0a 37 36 31 0d 0a 0d 0a  16..135..761....
29cb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29cc0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
29cd0 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 31   + ( - cor0.col1
29ce0 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   ) * cor0.col2 +
29cf0 20 33 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53   32 FROM tab0 AS
29d00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
29d10 30 36 0d 0a 2d 36 35 0d 0a 2d 37 34 33 30 0d 0a  06..-65..-7430..
29d20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29d30 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 33 20 2a  t..SELECT - 23 *
29d40 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b   - col0 * col0 +
29d50 20 2d 20 37 37 20 46 52 4f 4d 20 74 61 62 31 20   - 77 FROM tab1 
29d60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
29d70 33 30 0d 0a 31 34 37 31 32 33 0d 0a 39 34 31 33  30..147123..9413
29d80 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
29d90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
29da0 54 49 4e 43 54 20 2d 20 39 37 20 2b 20 63 6f 6c  TINCT - 97 + col
29db0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
29dc0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
29dd0 2d 0d 0a 2d 31 38 0d 0a 2d 31 39 0d 0a 2d 39 30  -..-18..-19..-90
29de0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
29df0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
29e00 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
29e10 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
29e20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29e30 31 31 37 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1179..SELECT ALL
29e40 20 2d 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20   - - col2 DIV + 
29e50 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32  cor0.col1 + col2
29e60 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
29e70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d  cor0..----..103.
29e80 0a 35 36 0d 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69  .56..62....skipi
29e90 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
29ea0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
29eb0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
29ec0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
29ed0 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
29ee0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
29ef0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
29f00 72 74 20 6c 61 62 65 6c 2d 31 31 37 39 0d 0a 53  rt label-1179..S
29f10 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
29f20 6c 32 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l2 / + cor0.col1
29f30 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f   + col2 col0 FRO
29f40 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
29f50 2d 0d 0a 31 30 33 0d 0a 35 36 0d 0a 36 32 0d 0a  -..103..56..62..
29f60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29f70 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
29f80 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   - - col2 FROM t
29f90 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
29fa0 31 36 34 0d 0a 32 0d 0a 36 36 0d 0a 0d 0a 71 75  164..2..66....qu
29fb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29fc0 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 28  ELECT + col1 + (
29fd0 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
29fe0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
29ff0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37  0..----..119..17
2a000 33 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  3..98....query I
2a010 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a020 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a   + col2 + col0 *
2a030 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
2a040 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2a050 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 35  0..----..-24..-5
2a060 38 33 0d 0a 2d 39 34 34 0d 0a 0d 0a 71 75 65 72  83..-944....quer
2a070 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a080 45 43 54 20 2b 20 34 31 20 2a 20 63 6f 6c 30 20  ECT + 41 * col0 
2a090 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  + col1 * + col1 
2a0a0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2a0b0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  2 cor0..----..12
2a0c0 34 38 0d 0a 33 35 32 38 0d 0a 36 36 37 39 0d 0a  48..3528..6679..
2a0d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2a0e0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
2a0f0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
2a100 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
2a110 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
2a120 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 34 0d  sort label-1184.
2a130 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2a140 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b 20   + ( - col0 ) + 
2a150 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c 32 20 2b  + CAST( - col2 +
2a160 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20   col2 AS SIGNED 
2a170 29 20 2a 20 2d 20 36 34 20 46 52 4f 4d 20 74 61  ) * - 64 FROM ta
2a180 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2a190 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a  ..-7..-78..-79..
2a1a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2a1b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2a1c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a1d0 20 6c 61 62 65 6c 2d 31 31 38 34 0d 0a 53 45 4c   label-1184..SEL
2a1e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28  ECT DISTINCT + (
2a1f0 20 2d 20 63 6f 6c 30 20 29 20 2b 20 2b 20 43 41   - col0 ) + + CA
2a200 53 54 20 28 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  ST ( - col2 + co
2a210 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l2 AS INTEGER ) 
2a220 2a 20 2d 20 36 34 20 46 52 4f 4d 20 74 61 62 32  * - 64 FROM tab2
2a230 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a240 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a  -7..-78..-79....
2a250 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2a260 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32  .SELECT + + col2
2a270 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 28 20   * + col2 + + ( 
2a280 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 31 20  col2 ) * - col1 
2a290 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2a2a0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 32 0d 0a 32  0..----..1512..2
2a2b0 36 37 39 0d 0a 37 39 36 38 0d 0a 0d 0a 71 75 65  679..7968....que
2a2c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a2d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2a2e0 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f  cor0.col2 * + co
2a2f0 6c 32 20 2b 20 31 33 20 41 53 20 63 6f 6c 30 20  l2 + 13 AS col0 
2a300 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
2a310 2d 2d 2d 2d 0d 0a 32 39 32 39 0d 0a 33 32 36 32  ----..2929..3262
2a320 0d 0a 39 32 32 39 0d 0a 0d 0a 73 6b 69 70 69 66  ..9229....skipif
2a330 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2a340 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2a350 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2a360 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2a370 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
2a380 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
2a390 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col2 + - cor0.co
2a3a0 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
2a3b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2a3c0 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d  .-53..-9..-96...
2a3d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a3e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2a3f0 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  T + col0 * col1 
2a400 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
2a410 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2a420 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 32 0d 0a 32 32  ..----..1422..22
2a430 34 0d 0a 34 36 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  4..4680....onlyi
2a440 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
2a450 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
2a460 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
2a470 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
2a480 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2a490 62 65 6c 2d 31 31 38 39 0d 0a 53 45 4c 45 43 54  bel-1189..SELECT
2a4a0 20 41 4c 4c 20 63 6f 6c 32 20 2f 20 63 6f 6c 31   ALL col2 / col1
2a4b0 20 2b 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20   + - CAST( NULL 
2a4c0 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2d 20 2b  AS DECIMAL ) - +
2a4d0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
2a4e0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2a4f0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2a500 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2a510 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2a520 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2a530 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38  owsort label-118
2a540 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  9..SELECT ALL co
2a550 6c 32 20 2f 20 63 6f 6c 31 20 2b 20 2d 20 43 41  l2 / col1 + - CA
2a560 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
2a570 4c 20 29 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20  L ) - + col2 AS 
2a580 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
2a590 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2a5a0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
2a5b0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2a5c0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2a5d0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2a5e0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2a5f0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2a600 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a610 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20  - col0 * col1 + 
2a620 63 6f 6c 32 20 2a 20 28 20 2b 20 63 6f 6c 31 20  col2 * ( + col1 
2a630 2b 20 2b 20 63 6f 6c 31 20 29 20 63 6f 6c 32 20  + + col1 ) col2 
2a640 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2a650 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 36 0d 0a 32  0..----..1456..2
2a660 37 33 30 0d 0a 35 30 30 0d 0a 0d 0a 73 6b 69 70  730..500....skip
2a670 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2a680 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2a690 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2a6a0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2a6b0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2a6c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
2a6d0 20 31 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   10 col2 FROM ta
2a6e0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2a6f0 0d 0a 31 30 0d 0a 31 30 0d 0a 31 30 0d 0a 0d 0a  ..10..10..10....
2a700 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2a710 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2a720 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2a730 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2a740 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 32  wsort label-1192
2a750 0d 0a 53 45 4c 45 43 54 20 2b 20 33 31 20 2b 20  ..SELECT + 31 + 
2a760 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 44 49 56 20  col0 + col0 DIV 
2a770 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
2a780 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2a790 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 31 34 0d 0a  ----..110..114..
2a7a0 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  38....skipif mys
2a7b0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2a7c0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2a7d0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 32 0d  sort label-1192.
2a7e0 0a 53 45 4c 45 43 54 20 2b 20 33 31 20 2b 20 63  .SELECT + 31 + c
2a7f0 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c  ol0 + col0 / col
2a800 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
2a810 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2a820 2d 0d 0a 31 31 30 0d 0a 31 31 34 0d 0a 33 38 0d  -..110..114..38.
2a830 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a840 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
2a850 6f 6c 31 20 2b 20 35 20 2a 20 63 6f 6c 32 20 41  ol1 + 5 * col2 A
2a860 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
2a870 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 34   cor0..----..244
2a880 0d 0a 32 37 35 0d 0a 34 36 37 0d 0a 0d 0a 71 75  ..275..467....qu
2a890 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a8a0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a  ELECT ALL col1 *
2a8b0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   + col0 * - col0
2a8c0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2a8d0 0d 0a 2d 32 33 34 0d 0a 2d 34 30 39 36 30 0d 0a  ..-234..-40960..
2a8e0 2d 38 33 32 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  -83200....onlyif
2a8f0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2a900 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2a910 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2a920 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2a930 6c 61 62 65 6c 2d 31 31 39 35 0d 0a 53 45 4c 45  label-1195..SELE
2a940 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
2a950 38 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  81 * cor0.col0 +
2a960 20 63 6f 6c 32 20 44 49 56 20 34 31 20 2d 20 63   col2 DIV 41 - c
2a970 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2a980 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 30   cor0..----..540
2a990 0d 0a 36 32 39 32 0d 0a 36 33 36 31 0d 0a 0d 0a  ..6292..6361....
2a9a0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2a9b0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2a9c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2a9d0 61 62 65 6c 2d 31 31 39 35 0d 0a 53 45 4c 45 43  abel-1195..SELEC
2a9e0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 38  T DISTINCT + + 8
2a9f0 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  1 * cor0.col0 + 
2aa00 63 6f 6c 32 20 2f 20 34 31 20 2d 20 63 6f 6c 32  col2 / 41 - col2
2aa10 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2aa20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 30 0d 0a 36  r0..----..540..6
2aa30 32 39 32 0d 0a 36 33 36 31 0d 0a 0d 0a 71 75 65  292..6361....que
2aa40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2aa50 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20 2d  LECT ALL + - ( -
2aa60 20 39 32 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f   92 ) + col2 FRO
2aa70 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2aa80 2d 2d 2d 2d 0d 0a 31 34 36 0d 0a 31 34 39 0d 0a  ----..146..149..
2aa90 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  188....query I r
2aaa0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2aab0 20 2d 20 31 39 20 41 53 20 63 6f 6c 32 20 46 52   - 19 AS col2 FR
2aac0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2aad0 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a 31 39 0d 0a 31  .----..19..19..1
2aae0 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
2aaf0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2ab00 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2ab10 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2ab20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2ab30 2d 31 31 39 38 0d 0a 53 45 4c 45 43 54 20 2b 20  -1198..SELECT + 
2ab40 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c  + col1 DIV - col
2ab50 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  1 + - col0 * - c
2ab60 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
2ab70 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
2ab80 30 33 39 0d 0a 36 33 39 0d 0a 37 37 0d 0a 0d 0a  039..639..77....
2ab90 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2aba0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2abb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2abc0 61 62 65 6c 2d 31 31 39 38 0d 0a 53 45 4c 45 43  abel-1198..SELEC
2abd0 54 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 63  T + + col1 / - c
2abe0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d  ol1 + - col0 * -
2abf0 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
2ac00 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2ac10 0a 31 30 33 39 0d 0a 36 33 39 0d 0a 37 37 0d 0a  .1039..639..77..
2ac20 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2ac30 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
2ac40 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
2ac50 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
2ac60 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
2ac70 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 39 0d  sort label-1199.
2ac80 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2ac90 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
2aca0 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63 6f   SIGNED ) * + co
2acb0 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41  r0.col2 + col0 A
2acc0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2acd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2ace0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2acf0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2ad00 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2ad10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39  owsort label-119
2ad20 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
2ad30 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT + CAST ( NULL
2ad40 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
2ad50 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f  + cor0.col2 + co
2ad60 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
2ad70 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2ad80 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  --..NULL....quer
2ad90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ada0 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b  ECT ALL col2 * +
2adb0 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 41   col2 + - col1 A
2adc0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
2add0 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 37 0d 0a 36 31  ..----..1427..61
2ade0 37 0d 0a 36 39 38 0d 0a 0d 0a 71 75 65 72 79 20  7..698....query 
2adf0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ae00 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 63  T ALL + col1 + c
2ae10 6f 6c 32 20 2b 20 2b 20 36 32 20 41 53 20 63 6f  ol2 + + 62 AS co
2ae20 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
2ae30 2d 2d 0d 0a 31 36 30 0d 0a 31 38 31 0d 0a 32 33  --..160..181..23
2ae40 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
2ae50 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2ae60 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2ae70 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2ae80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2ae90 2d 31 32 30 32 0d 0a 53 45 4c 45 43 54 20 41 4c  -1202..SELECT AL
2aea0 4c 20 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c  L ( col2 ) + col
2aeb0 31 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20 63  1 DIV + col0 + c
2aec0 6f 6c 30 20 2a 20 63 6f 6c 32 20 63 6f 6c 30 20  ol0 * col2 col0 
2aed0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2aee0 0a 32 30 35 34 0d 0a 32 32 30 0d 0a 33 30 34 30  .2054..220..3040
2aef0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2af00 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2af10 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2af20 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2af30 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
2af40 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2af50 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2af60 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2af70 6c 2d 31 32 30 32 0d 0a 53 45 4c 45 43 54 20 41  l-1202..SELECT A
2af80 4c 4c 20 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f  LL ( col2 ) + co
2af90 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  l1 / + col0 + co
2afa0 6c 30 20 2a 20 63 6f 6c 32 20 63 6f 6c 30 20 46  l0 * col2 col0 F
2afb0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
2afc0 32 30 35 34 0d 0a 32 32 30 0d 0a 33 30 34 30 0d  2054..220..3040.
2afd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2afe0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b  rt..SELECT + ( +
2aff0 20 63 6f 6c 32 20 29 20 2a 20 33 31 20 2b 20 2b   col2 ) * 31 + +
2b000 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c   col2 * cor0.col
2b010 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
2b020 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2b030 2d 0d 0a 31 30 36 35 36 0d 0a 31 38 33 36 0d 0a  -..10656..1836..
2b040 35 34 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5415....query I 
2b050 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b060 41 4c 4c 20 2b 20 31 36 20 41 53 20 63 6f 6c 30  ALL + 16 AS col0
2b070 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2b080 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 31 36  r0..----..16..16
2b090 0d 0a 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..16....query I 
2b0a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b0b0 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + - col2 * - col
2b0c0 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  2 + - cor0.col1 
2b0d0 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  * + col0 + col0 
2b0e0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2b0f0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 38 34 38 0d 0a  0..----..-3848..
2b100 31 38 30 0d 0a 35 31 39 0d 0a 0d 0a 71 75 65 72  180..519....quer
2b110 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b120 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT - cor0.col0 
2b130 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  + - cor0.col1 * 
2b140 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
2b150 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2b160 2d 0d 0a 2d 33 35 35 39 0d 0a 2d 33 36 38 0d 0a  -..-3559..-368..
2b170 2d 39 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -968....query I 
2b180 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b190 44 49 53 54 49 4e 43 54 20 2d 20 36 20 46 52 4f  DISTINCT - 6 FRO
2b1a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2b1b0 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 0d 0a 71 75 65 72  ----..-6....quer
2b1c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b1d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
2b1e0 20 63 6f 6c 32 20 2b 20 28 20 2b 20 63 6f 6c 30   col2 + ( + col0
2b1f0 20 29 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20   ) * + col1 + + 
2b200 28 20 35 39 20 29 20 41 53 20 63 6f 6c 32 20 46  ( 59 ) AS col2 F
2b210 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2b220 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 30 0d 0a 33 30  ..----..1440..30
2b230 33 0d 0a 34 36 38 37 0d 0a 0d 0a 71 75 65 72 79  3..4687....query
2b240 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b250 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  CT - + cor0.col1
2b260 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41   + + cor0.col1 A
2b270 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
2b280 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b290 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
2b2a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b2b0 43 54 20 63 6f 6c 31 20 2a 20 2d 20 38 31 20 46  CT col1 * - 81 F
2b2c0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2b2d0 2d 36 39 36 36 0d 0a 2d 37 33 37 31 0d 0a 2d 37  -6966..-7371..-7
2b2e0 38 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  857....query I r
2b2f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2b300 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30  LL + col2 * col0
2b310 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 46   * + tab0.col0 F
2b320 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2b330 31 32 32 35 0d 0a 31 39 30 30 38 0d 0a 36 34 39  1225..19008..649
2b340 35 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  522....query I r
2b350 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2b360 20 63 6f 6c 30 20 2a 20 38 35 20 41 53 20 63 6f   col0 * 85 AS co
2b370 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
2b380 2d 2d 0d 0a 2d 32 30 34 30 0d 0a 2d 32 39 37 35  --..-2040..-2975
2b390 0d 0a 2d 37 35 36 35 0d 0a 0d 0a 71 75 65 72 79  ..-7565....query
2b3a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b3b0 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  CT + col1 * - co
2b3c0 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  l2 * + col2 + co
2b3d0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
2b3e0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2b3f0 0a 2d 31 31 39 37 39 35 0d 0a 2d 33 32 34 38 30  .-119795..-32480
2b400 0d 0a 2d 37 35 37 39 30 0d 0a 0d 0a 71 75 65 72  ..-75790....quer
2b410 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b420 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74  ECT DISTINCT - t
2b430 61 62 30 2e 63 6f 6c 31 20 2d 20 2d 20 34 35 20  ab0.col1 - - 45 
2b440 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
2b450 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2b460 33 37 38 34 0d 0a 34 30 30 34 0d 0a 34 32 36 38  3784..4004..4268
2b470 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b480 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
2b490 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2a  .col2 * + col2 *
2b4a0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63   cor0.col1 + - c
2b4b0 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 + col0 FROM 
2b4c0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2b4d0 2d 2d 0d 0a 31 31 39 38 30 38 0d 0a 33 32 34 39  --..119808..3249
2b4e0 30 0d 0a 37 35 38 31 36 0d 0a 0d 0a 71 75 65 72  0..75816....quer
2b4f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b500 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 28 20 63  ECT + col1 * ( c
2b510 6f 72 30 2e 63 6f 6c 32 20 29 20 2d 20 63 6f 6c  or0.col2 ) - col
2b520 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2b530 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 31 34 0d  or0..----..2814.
2b540 0a 36 32 0d 0a 37 33 37 33 0d 0a 0d 0a 71 75 65  .62..7373....que
2b550 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2b560 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20  LECT - + col2 * 
2b570 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  - cor0.col2 * + 
2b580 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 63  col1 + col0 AS c
2b590 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2b5a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
2b5b0 38 38 38 0d 0a 33 32 35 35 34 0d 0a 37 35 38 31  888..32554..7581
2b5c0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2b5d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2b5e0 6f 6c 30 20 2a 20 2b 20 37 20 41 53 20 63 6f 6c  ol0 * + 7 AS col
2b5f0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2b600 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 0d 0a  or0..----..168..
2b610 32 34 35 0d 0a 36 32 33 0d 0a 0d 0a 71 75 65 72  245..623....quer
2b620 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b630 45 43 54 20 63 6f 6c 32 20 2a 20 33 37 20 2a 20  ECT col2 * 37 * 
2b640 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 41 53  col0 - - col2 AS
2b650 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2b660 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2b670 32 39 36 0d 0a 32 37 30 31 30 38 0d 0a 32 39 33  296..270108..293
2b680 33 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  37....skipif pos
2b690 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2b6a0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2b6b0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2b6c0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2b6d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b6e0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72  SELECT ALL - cor
2b6f0 30 2e 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d  0.col2 col0 FROM
2b700 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
2b710 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
2b720 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30  ues hashing to 0
2b730 64 63 39 62 62 65 33 39 32 64 35 32 64 66 39 33  dc9bbe392d52df93
2b740 64 32 61 31 31 35 64 37 66 36 32 32 64 62 61 0d  d2a115d7f622dba.
2b750 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2b760 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2b770 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2b780 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2b790 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2b7a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b7b0 45 43 54 20 2b 20 34 35 20 63 6f 6c 31 20 46 52  ECT + 45 col1 FR
2b7c0 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
2b7d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
2b7e0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2b7f0 20 36 30 62 39 66 39 33 35 65 65 38 65 34 30 34   60b9f935ee8e404
2b800 64 31 35 35 61 32 66 35 65 39 35 31 35 63 30 35  d155a2f5e9515c05
2b810 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2b820 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
2b830 20 31 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20   11 * col0 FROM 
2b840 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
2b850 0a 37 37 0d 0a 38 35 38 0d 0a 38 36 39 0d 0a 0d  .77..858..869...
2b860 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b870 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2b880 54 20 2d 20 2b 20 39 30 20 46 52 4f 4d 20 74 61  T - + 90 FROM ta
2b890 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b0 AS cor0 CROSS
2b8a0 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f   JOIN tab2 AS co
2b8b0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 30 0d 0a 0d  r1..----..-90...
2b8c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2b8d0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2b8e0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2b8f0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2b900 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32  owsort label-122
2b910 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  4..SELECT + col2
2b920 20 44 49 56 20 2d 20 74 61 62 32 2e 63 6f 6c 31   DIV - tab2.col1
2b930 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2b940 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d  b2..----..-2..0.
2b950 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
2b960 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2b970 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2b980 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 34 0d  sort label-1224.
2b990 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2f  .SELECT + col2 /
2b9a0 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20   - tab2.col1 AS 
2b9b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
2b9c0 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d 0a 30 0d 0a  ----..-2..0..0..
2b9d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b9e0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2b9f0 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
2ba00 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
2ba10 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
2ba20 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
2ba30 20 68 61 73 68 69 6e 67 20 74 6f 20 34 30 66 64   hashing to 40fd
2ba40 38 63 63 30 64 65 39 32 65 61 36 38 64 37 33 36  8cc0de92ea68d736
2ba50 33 34 63 32 64 38 66 37 35 62 66 35 0d 0a 0d 0a  34c2d8f75bf5....
2ba60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ba70 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 30  .SELECT ( + col0
2ba80 20 29 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   ) * col1 + col1
2ba90 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2baa0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
2bab0 33 36 30 0d 0a 32 34 38 0d 0a 34 36 36 31 0d 0a  360..248..4661..
2bac0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2bad0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2bae0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col2 * - col1 + 
2baf0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2bb00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2bb10 31 35 32 0d 0a 2d 31 33 35 30 0d 0a 2d 35 31 33  152..-1350..-513
2bb20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2bb30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
2bb40 35 35 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  55 FROM tab0 cor
2bb50 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 35 0d  0..----..55..55.
2bb60 0a 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .55....query I r
2bb70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2bb80 20 32 30 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20   20 + + col1 AS 
2bb90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
2bba0 2d 2d 2d 2d 0d 0a 33 30 0d 0a 33 33 0d 0a 34 36  ----..30..33..46
2bbb0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2bbc0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2bbd0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2bbe0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2bbf0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2bc00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33  owsort label-123
2bc10 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
2bc20 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 43  CT tab1.col2 * C
2bc30 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
2bc40 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52  NED ) AS col2 FR
2bc50 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  OM tab1, tab2 AS
2bc60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
2bc70 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
2bc80 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2bc90 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2bca0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 30 0d 0a  ort label-1230..
2bcb0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2bcc0 74 61 62 31 2e 63 6f 6c 32 20 2a 20 43 41 53 54  tab1.col2 * CAST
2bcd0 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
2bce0 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ER ) AS col2 FRO
2bcf0 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
2bd00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
2bd10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2bd20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2bd30 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab2.col1 FROM t
2bd40 61 62 32 2c 20 74 61 62 30 2c 20 74 61 62 31 20  ab2, tab0, tab1 
2bd50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
2bd60 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2bd70 20 37 35 39 39 62 34 38 30 31 32 35 64 65 35 32   7599b480125de52
2bd80 31 65 66 65 64 37 31 62 35 62 32 34 31 33 63 37  1efed71b5b2413c7
2bd90 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  d....query I row
2bda0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2bdb0 20 34 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   41 FROM tab1, t
2bdc0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
2bdd0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
2bde0 20 74 6f 20 35 62 31 38 39 38 36 62 62 32 39 34   to 5b18986bb294
2bdf0 34 31 32 62 33 64 39 66 30 37 62 37 65 36 66 63  412b3d9f07b7e6fc
2be00 38 32 31 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20  821e....query I 
2be10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2be20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20  + col1 * col2 + 
2be30 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
2be40 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2be50 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36  ..----..132..286
2be60 32 0d 0a 37 35 35 31 0d 0a 0d 0a 73 6b 69 70 69  2..7551....skipi
2be70 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2be80 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2be90 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2bea0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2beb0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2bec0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2bed0 38 38 20 2a 20 63 6f 6c 32 20 63 6f 6c 32 20 46  88 * col2 col2 F
2bee0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2bef0 0d 0a 2d 2d 2d 2d 0d 0a 32 39 30 34 0d 0a 37 32  ..----..2904..72
2bf00 31 36 0d 0a 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  16..88....onlyif
2bf10 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2bf20 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2bf30 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2bf40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2bf50 6c 61 62 65 6c 2d 31 32 33 35 0d 0a 53 45 4c 45  label-1235..SELE
2bf60 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 32 20  CT ALL - ( col2 
2bf70 29 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  ) + - col2 + col
2bf80 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f  2 DIV + col1 FRO
2bf90 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2bfa0 2d 2d 2d 2d 0d 0a 2d 31 30 36 0d 0a 2d 31 30 39  ----..-106..-109
2bfb0 0d 0a 2d 31 38 35 0d 0a 0d 0a 73 6b 69 70 69 66  ..-185....skipif
2bfc0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2bfd0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2bfe0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2bff0 32 33 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  235..SELECT ALL 
2c000 2d 20 28 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63  - ( col2 ) + - c
2c010 6f 6c 32 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63  ol2 + col2 / + c
2c020 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2c030 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
2c040 36 0d 0a 2d 31 30 39 0d 0a 2d 31 38 35 0d 0a 0d  6..-109..-185...
2c050 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c060 0d 0a 53 45 4c 45 43 54 20 28 20 39 31 20 29 20  ..SELECT ( 91 ) 
2c070 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2c080 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2c090 0a 39 31 0d 0a 39 31 0d 0a 39 31 0d 0a 0d 0a 71  .91..91..91....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 2d 20 37 32 20 2a 20 2b 20 34 33 20 2a 20 63 6f  - 72 * + 43 * co
2c0d0 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  l2 + - col0 * co
2c0e0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2c0f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32  cor0..----..-102
2c100 39 36 30 0d 0a 2d 32 36 31 31 37 30 0d 0a 2d 33  960..-261170..-3
2c110 31 33 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  131....onlyif my
2c120 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2c130 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2c140 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2c150 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2c160 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2c170 31 32 33 38 0d 0a 53 45 4c 45 43 54 20 2d 20 43  1238..SELECT - C
2c180 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
2c190 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 32 20 63  NED ) + - col2 c
2c1a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2c1b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
2c1c0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
2c1d0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2c1e0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2c1f0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2c200 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2c210 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
2c220 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2c230 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2c240 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2c250 32 33 38 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41  238..SELECT - CA
2c260 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
2c270 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c 32 20  EGER ) + - col2 
2c280 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
2c290 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
2c2a0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
2c2b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c2c0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2c2d0 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col2 * - cor0.co
2c2e0 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l0 + + cor0.col0
2c2f0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2c300 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 33  r0..----..70..73
2c310 38 37 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79  87..816....query
2c320 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c330 43 54 20 2b 20 2b 20 37 39 20 2a 20 63 6f 6c 31  CT + + 79 * col1
2c340 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + - col0 FROM t
2c350 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
2c360 32 30 35 31 0d 0a 37 32 36 0d 0a 39 34 37 0d 0a  2051..726..947..
2c370 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2c380 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2c390 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2c3a0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2c3b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2c3c0 34 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  41..SELECT ALL -
2c3d0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2b   + cor0.col0 - +
2c3e0 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 46   col1 DIV col1 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 2d 37 39 0d 0a 2d 38 0d  ..----..-79..-8.
2c410 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-80....skipif m
2c420 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2c430 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2c440 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34  owsort label-124
2c450 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  1..SELECT ALL - 
2c460 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2b 20  + cor0.col0 - + 
2c470 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  col1 / col1 FROM
2c480 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2c490 2d 2d 2d 0d 0a 2d 37 39 0d 0a 2d 38 0d 0a 2d 38  ---..-79..-8..-8
2c4a0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2c4b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
2c4c0 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 30   ( col2 ) * col0
2c4d0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
2c4e0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2c4f0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d  0..----..-159..-
2c500 33 35 38 34 0d 0a 2d 37 36 30 30 0d 0a 0d 0a 73  3584..-7600....s
2c510 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2c520 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2c530 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2c540 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2c550 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2c560 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c570 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20  DISTINCT col2 + 
2c580 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 63 6f 6c 30  col1 * col1 col0
2c590 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
2c5a0 0a 2d 2d 2d 2d 0d 0a 31 35 37 0d 0a 32 36 35 0d  .----..157..265.
2c5b0 0a 37 33 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .730....skipif p
2c5c0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2c5d0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2c5e0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2c5f0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2c600 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c610 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 34  ..SELECT ALL - 4
2c620 33 20 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c 32 20  3 + - col1 col2 
2c630 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2c640 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 35  0..----..-53..-5
2c650 36 0d 0a 2d 36 39 0d 0a 0d 0a 71 75 65 72 79 20  6..-69....query 
2c660 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c670 54 20 34 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  T 4 + col1 AS co
2c680 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
2c690 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 0d  cor0..----..101.
2c6a0 0a 39 30 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79  .90..95....query
2c6b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c6c0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 39 35  CT DISTINCT - 95
2c6d0 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30   + + col0 * cor0
2c6e0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
2c6f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2c700 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 35 34 35 0d  .----..-17..545.
2c710 0a 39 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .945....skipif p
2c720 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2c730 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2c740 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2c750 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2c760 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c770 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 20 2d  ..SELECT ALL 2 -
2c780 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 63   col1 * - col0 c
2c790 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2c7a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
2c7b0 32 0d 0a 36 34 32 0d 0a 38 30 0d 0a 0d 0a 71 75  2..642..80....qu
2c7c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c7d0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
2c7e0 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l1 * col1 + + co
2c7f0 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l2 * + col2 FROM
2c800 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2c810 2d 2d 2d 0d 0a 32 32 34 30 0d 0a 33 31 34 39 0d  ---..2240..3149.
2c820 0a 39 30 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .9047....query I
2c830 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c840 20 2d 20 2b 20 38 36 20 2a 20 63 6f 6c 32 20 2a   - + 86 * col2 *
2c850 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
2c860 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2c870 0a 2d 2d 2d 2d 0d 0a 2d 35 37 38 32 36 34 0d 0a  .----..-578264..
2c880 2d 38 36 0d 0a 2d 39 33 36 35 34 0d 0a 0d 0a 6f  -86..-93654....o
2c890 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2c8a0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2c8b0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2c8c0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2c8d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c8e0 74 20 6c 61 62 65 6c 2d 31 32 35 30 0d 0a 53 45  t label-1250..SE
2c8f0 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 43 41  LECT + col2 + CA
2c900 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
2c910 4d 41 4c 20 29 20 41 53 20 63 6f 6c 32 20 46 52  MAL ) AS col2 FR
2c920 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2c930 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
2c940 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
2c950 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2c960 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2c970 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2c980 31 32 35 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63  1250..SELECT + c
2c990 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ol2 + CAST ( NUL
2c9a0 4c 20 41 53 20 52 45 41 4c 20 29 20 41 53 20 63  L AS REAL ) AS c
2c9b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2c9c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
2c9d0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
2c9e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2c9f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2ca00 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2ca10 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2ca20 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2ca30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ca40 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
2ca50 6f 6c 32 20 2a 20 2d 20 36 37 20 2a 20 2b 20 63  ol2 * - 67 * + c
2ca60 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 30 20 46 52  or0.col1 col0 FR
2ca70 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2ca80 0a 2d 2d 2d 2d 0d 0a 2d 31 39 30 31 34 36 0d 0a  .----..-190146..
2ca90 2d 34 39 39 39 35 34 0d 0a 2d 36 34 39 39 0d 0a  -499954..-6499..
2caa0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2cab0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2cac0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2cad0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2cae0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2caf0 35 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  52..SELECT ALL +
2cb00 20 63 6f 6c 32 20 2d 20 38 33 20 44 49 56 20 63   col2 - 83 DIV c
2cb10 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2cb20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 32   cor0..----..-82
2cb30 0d 0a 33 31 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70  ..31..81....skip
2cb40 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2cb50 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2cb60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2cb70 2d 31 32 35 32 0d 0a 53 45 4c 45 43 54 20 41 4c  -1252..SELECT AL
2cb80 4c 20 2b 20 63 6f 6c 32 20 2d 20 38 33 20 2f 20  L + col2 - 83 / 
2cb90 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
2cba0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
2cbb0 32 0d 0a 33 31 0d 0a 38 31 0d 0a 0d 0a 71 75 65  2..31..81....que
2cbc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2cbd0 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  LECT - col1 * - 
2cbe0 39 33 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  93 + + col2 FROM
2cbf0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2cc00 2d 2d 2d 0d 0a 31 33 30 35 0d 0a 32 34 37 32 0d  ---..1305..2472.
2cc10 0a 39 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .987....query I 
2cc20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2cc30 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  - + cor0.col0 * 
2cc40 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20  + col1 + + col0 
2cc50 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2cc60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 34 0d 0a  0..----..-1264..
2cc70 2d 32 31 30 0d 0a 2d 34 35 32 34 0d 0a 0d 0a 71  -210..-4524....q
2cc80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2cc90 53 45 4c 45 43 54 20 28 20 74 61 62 32 2e 63 6f  SELECT ( tab2.co
2cca0 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 29 20 41 53  l2 + + col2 ) AS
2ccb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
2ccc0 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35 34 0d 0a 37  .----..52..54..7
2ccd0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2cce0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2ccf0 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20   - ( - col0 ) * 
2cd00 2d 20 33 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  - 30 FROM tab2..
2cd10 2d 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a 2d 32 33 34  ----..-210..-234
2cd20 30 0d 0a 2d 32 33 37 30 0d 0a 0d 0a 71 75 65 72  0..-2370....quer
2cd30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2cd40 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  ECT + col0 * + c
2cd50 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20  ol2 + + col1 AS 
2cd60 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
2cd70 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 37 33 38 39 0d  ----..132..7389.
2cd80 0a 38 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .878....onlyif m
2cd90 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2cda0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2cdb0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2cdc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2cdd0 62 65 6c 2d 31 32 35 38 0d 0a 53 45 4c 45 43 54  bel-1258..SELECT
2cde0 20 38 30 20 44 49 56 20 74 61 62 30 2e 63 6f 6c   80 DIV tab0.col
2cdf0 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  2 col1 FROM tab0
2ce00 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
2ce10 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
2ce20 61 73 68 69 6e 67 20 74 6f 20 64 39 61 38 35 35  ashing to d9a855
2ce30 66 33 63 62 30 33 33 36 63 35 39 66 63 63 31 65  f3cb0336c59fcc1e
2ce40 31 63 64 38 65 34 63 36 36 66 0d 0a 0d 0a 73 6b  1cd8e4c66f....sk
2ce50 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2ce60 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2ce70 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2ce80 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2ce90 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
2cea0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2ceb0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2cec0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 38  wsort label-1258
2ced0 0d 0a 53 45 4c 45 43 54 20 38 30 20 2f 20 74 61  ..SELECT 80 / ta
2cee0 62 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f  b0.col2 col1 FRO
2cef0 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
2cf00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
2cf10 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2cf20 64 39 61 38 35 35 66 33 63 62 30 33 33 36 63 35  d9a855f3cb0336c5
2cf30 39 66 63 63 31 65 31 63 64 38 65 34 63 36 36 66  9fcc1e1cd8e4c66f
2cf40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2cf50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 37  ort..SELECT + 47
2cf60 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2cf70 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
2cf80 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
2cf90 20 68 61 73 68 69 6e 67 20 74 6f 20 34 66 65 31   hashing to 4fe1
2cfa0 39 32 66 32 39 36 37 39 31 65 31 65 34 30 65 61  92f296791e1e40ea
2cfb0 30 30 61 36 38 61 61 38 64 61 62 37 0d 0a 0d 0a  00a68aa8dab7....
2cfc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2cfd0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31  .SELECT - - col1
2cfe0 20 2a 20 2d 20 33 36 20 46 52 4f 4d 20 74 61 62   * - 36 FROM tab
2cff0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2d000 0a 2d 33 30 39 36 0d 0a 2d 33 32 37 36 0d 0a 2d  .-3096..-3276..-
2d010 33 34 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3492....query I 
2d020 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d030 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  - cor0.col0 * co
2d040 6c 31 20 2b 20 2b 20 38 38 20 2b 20 2b 20 63 6f  l1 + + 88 + + co
2d050 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
2d060 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2d070 2d 2d 0d 0a 2d 31 39 34 33 0d 0a 2d 33 33 30 36  --..-1943..-3306
2d080 0d 0a 2d 37 39 32 39 0d 0a 0d 0a 6f 6e 6c 79 69  ..-7929....onlyi
2d090 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2d0a0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2d0b0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2d0c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d0d0 20 6c 61 62 65 6c 2d 31 32 36 32 0d 0a 53 45 4c   label-1262..SEL
2d0e0 45 43 54 20 63 6f 6c 30 20 44 49 56 20 2d 20 35  ECT col0 DIV - 5
2d0f0 34 20 2b 20 2d 20 39 32 20 41 53 20 63 6f 6c 31  4 + - 92 AS col1
2d100 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2d110 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 32 0d 0a 2d  r0..----..-92..-
2d120 39 32 0d 0a 2d 39 33 0d 0a 0d 0a 73 6b 69 70 69  92..-93....skipi
2d130 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2d140 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2d150 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2d160 31 32 36 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1262..SELECT col
2d170 30 20 2f 20 2d 20 35 34 20 2b 20 2d 20 39 32 20  0 / - 54 + - 92 
2d180 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2d190 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2d1a0 0a 2d 39 32 0d 0a 2d 39 32 0d 0a 2d 39 33 0d 0a  .-92..-92..-93..
2d1b0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2d1c0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2d1d0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2d1e0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2d1f0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2d200 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d210 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 32 30  CT - col1 * + 20
2d220 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 32 20 2b 20   + - ( + col2 + 
2d230 2d 20 63 6f 6c 31 20 29 20 63 6f 6c 30 20 46 52  - col1 ) col0 FR
2d240 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
2d250 2d 2d 0d 0a 2d 31 36 36 37 0d 0a 2d 31 38 31 31  --..-1667..-1811
2d260 0d 0a 2d 31 38 34 34 0d 0a 0d 0a 6f 6e 6c 79 69  ..-1844....onlyi
2d270 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
2d280 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
2d290 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
2d2a0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
2d2b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2d2c0 62 65 6c 2d 31 32 36 34 0d 0a 53 45 4c 45 43 54  bel-1264..SELECT
2d2d0 20 2d 20 63 6f 6c 31 20 2a 20 43 41 53 54 28 20   - col1 * CAST( 
2d2e0 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 53  col1 + col2 AS S
2d2f0 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
2d300 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2d310 0a 2d 31 37 39 38 0d 0a 2d 35 30 31 35 0d 0a 2d  .-1798..-5015..-
2d320 39 33 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  935....skipif my
2d330 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2d340 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2d350 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 36 34  wsort label-1264
2d360 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
2d370 2a 20 43 41 53 54 20 28 20 63 6f 6c 31 20 2b 20  * CAST ( col1 + 
2d380 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
2d390 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
2d3a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 39 38  or0..----..-1798
2d3b0 0d 0a 2d 35 30 31 35 0d 0a 2d 39 33 35 0d 0a 0d  ..-5015..-935...
2d3c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d3d0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
2d3e0 2a 20 74 61 62 30 2e 63 6f 6c 30 20 2d 20 2d 20  * tab0.col0 - - 
2d3f0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
2d400 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab0..----..13
2d410 32 0d 0a 37 33 38 39 0d 0a 38 37 38 0d 0a 0d 0a  2..7389..878....
2d420 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2d430 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2d440 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2d450 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2d460 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 36 36  wsort label-1266
2d470 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f  ..SELECT tab1.co
2d480 6c 30 20 44 49 56 20 2d 20 63 6f 6c 30 20 2d 20  l0 DIV - col0 - 
2d490 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
2d4a0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2d4b0 2d 34 0d 0a 2d 36 35 0d 0a 2d 38 31 0d 0a 0d 0a  -4..-65..-81....
2d4c0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2d4d0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2d4e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2d4f0 61 62 65 6c 2d 31 32 36 36 0d 0a 53 45 4c 45 43  abel-1266..SELEC
2d500 54 20 74 61 62 31 2e 63 6f 6c 30 20 2f 20 2d 20  T tab1.col0 / - 
2d510 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30 20 41 53  col0 - + col0 AS
2d520 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
2d530 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 36 35 0d 0a  .----..-4..-65..
2d540 2d 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -81....query I r
2d550 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2d560 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
2d570 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46   - col0 * col0 F
2d580 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2d590 2d 31 32 32 36 0d 0a 2d 36 30 39 0d 0a 2d 38 30  -1226..-609..-80
2d5a0 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  03....query I ro
2d5b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2d5c0 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2d 20  STINCT col2 + - 
2d5d0 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2d 20  col1 * col1 * - 
2d5e0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
2d5f0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab1..----..13
2d600 36 31 36 0d 0a 32 30 38 32 0d 0a 36 34 35 37 0d  616..2082..6457.
2d610 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2d620 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2d630 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2d640 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2d650 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2d660 32 36 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  269..SELECT - co
2d670 6c 30 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f  l0 + col2 DIV co
2d680 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2d690 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a  cor0..----..-7..
2d6a0 2d 37 37 0d 0a 2d 37 38 0d 0a 0d 0a 73 6b 69 70  -77..-78....skip
2d6b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2d6c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2d6d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d6e0 2d 31 32 36 39 0d 0a 53 45 4c 45 43 54 20 2d 20  -1269..SELECT - 
2d6f0 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2f 20 63 6f  col0 + col2 / co
2d700 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2d710 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a  cor0..----..-7..
2d720 2d 37 37 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72  -77..-78....quer
2d730 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d740 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2d750 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  ol1 + col0 * + c
2d760 6f 6c 31 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20  ol1 + tab0.col1 
2d770 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2d780 0a 32 32 33 36 0d 0a 33 35 38 39 0d 0a 38 32 38  .2236..3589..828
2d790 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2d7a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
2d7b0 32 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20  2 + tab0.col0 + 
2d7c0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52  + col2 * col0 FR
2d7d0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab0..----..7
2d7e0 31 0d 0a 37 34 36 39 0d 0a 38 34 39 0d 0a 0d 0a  1..7469..849....
2d7f0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2d800 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2d810 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2d820 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2d830 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 32  wsort label-1272
2d840 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
2d850 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 74  DIV - col0 + + t
2d860 61 62 32 2e 63 6f 6c 32 20 44 49 56 20 2d 20 63  ab2.col2 DIV - c
2d870 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
2d880 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 34 0d  ---..-1..-1..-4.
2d890 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2d8a0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2d8b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d8c0 74 20 6c 61 62 65 6c 2d 31 32 37 32 0d 0a 53 45  t label-1272..SE
2d8d0 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2d 20  LECT + col0 / - 
2d8e0 63 6f 6c 30 20 2b 20 2b 20 74 61 62 32 2e 63 6f  col0 + + tab2.co
2d8f0 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l2 / - col0 FROM
2d900 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   tab2..----..-1.
2d910 0a 2d 31 0d 0a 2d 34 0d 0a 0d 0a 6f 6e 6c 79 69  .-1..-4....onlyi
2d920 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2d930 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2d940 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2d950 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d960 20 6c 61 62 65 6c 2d 31 32 37 33 0d 0a 53 45 4c   label-1273..SEL
2d970 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
2d980 31 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20  1 + - tab0.col0 
2d990 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  + + col2 DIV - c
2d9a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
2d9b0 2d 2d 2d 0d 0a 32 0d 0a 36 31 0d 0a 36 32 0d 0a  ---..2..61..62..
2d9c0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2d9d0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2d9e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d9f0 20 6c 61 62 65 6c 2d 31 32 37 33 0d 0a 53 45 4c   label-1273..SEL
2da00 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
2da10 31 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20  1 + - tab0.col0 
2da20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c  + + col2 / - col
2da30 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2da40 2d 0d 0a 32 0d 0a 36 31 0d 0a 36 32 0d 0a 0d 0a  -..2..61..62....
2da50 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2da60 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2da70 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2da80 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2da90 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 34  wsort label-1274
2daa0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2dab0 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  T + col0 + + col
2dac0 30 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20  0 DIV - col0 AS 
2dad0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2dae0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33  S cor0..----..23
2daf0 0d 0a 33 34 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70  ..34..88....skip
2db00 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2db10 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2db20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2db30 2d 31 32 37 34 0d 0a 53 45 4c 45 43 54 20 44 49  -1274..SELECT DI
2db40 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
2db50 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20  + col0 / - col0 
2db60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2db70 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2db80 0a 32 33 0d 0a 33 34 0d 0a 38 38 0d 0a 0d 0a 71  .23..34..88....q
2db90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2dba0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
2dbb0 6f 6c 30 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 - + cor0.col
2dbc0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
2dbd0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2dbe0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
2dbf0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2dc00 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
2dc10 2e 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31 20 41  .col2 - - col1 A
2dc20 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2dc30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2dc40 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75  55..58..85....qu
2dc50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2dc60 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63  ELECT col2 + + c
2dc70 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol0 * col0 AS co
2dc80 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
2dc90 2d 2d 0d 0a 36 31 31 30 0d 0a 36 32 37 39 0d 0a  --..6110..6279..
2dca0 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
2dcb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2dcc0 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  L + + cor0.col0 
2dcd0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2dce0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  0 cor0..----..24
2dcf0 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 6f 6e 6c 79  ..35..89....only
2dd00 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2dd10 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2dd20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2dd30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2dd40 74 20 6c 61 62 65 6c 2d 31 32 37 39 0d 0a 53 45  t label-1279..SE
2dd50 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  LECT + cor0.col0
2dd60 20 2b 20 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f   + + col1 DIV co
2dd70 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 30  l0 + + col0 col0
2dd80 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2dd90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a 31  r0..----..156..1
2dda0 35 38 0d 0a 31 38 0d 0a 0d 0a 73 6b 69 70 69 66  58..18....skipif
2ddb0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2ddc0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2ddd0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2dde0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2ddf0 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
2de00 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2de10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2de20 74 20 6c 61 62 65 6c 2d 31 32 37 39 0d 0a 53 45  t label-1279..SE
2de30 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  LECT + cor0.col0
2de40 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 30   + + col1 / col0
2de50 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46   + + col0 col0 F
2de60 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2de70 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a 31 35 38  ..----..156..158
2de80 0d 0a 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..18....query I 
2de90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2dea0 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL - cor0.col0 
2deb0 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  * cor0.col0 AS c
2dec0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
2ded0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d  r0..----..-4096.
2dee0 0a 2d 36 34 30 30 0d 0a 2d 39 0d 0a 0d 0a 73 6b  .-6400..-9....sk
2def0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2df00 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2df10 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2df20 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2df30 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2df40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2df50 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30  ISTINCT + + cor0
2df60 2e 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20  .col1 col0 FROM 
2df70 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2df80 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a  --..86..91..97..
2df90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2dfa0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
2dfb0 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b  r0.col0 + col0 +
2dfc0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41   col1 * + col1 A
2dfd0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2dfe0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2dff0 37 34 34 34 0d 0a 38 34 35 39 0d 0a 39 34 37 39  7444..8459..9479
2e000 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2e010 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2e020 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2e030 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2e040 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2e050 31 32 38 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  1283..SELECT DIS
2e060 54 49 4e 43 54 20 2d 20 35 30 20 44 49 56 20 74  TINCT - 50 DIV t
2e070 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  ab1.col1 AS col1
2e080 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2e090 0d 0a 2d 31 0d 0a 2d 33 0d 0a 2d 35 0d 0a 0d 0a  ..-1..-3..-5....
2e0a0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2e0b0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2e0c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2e0d0 61 62 65 6c 2d 31 32 38 33 0d 0a 53 45 4c 45 43  abel-1283..SELEC
2e0e0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 35 30 20  T DISTINCT - 50 
2e0f0 2f 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63  / tab1.col1 AS c
2e100 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
2e110 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 0d 0a 2d 35 0d  ---..-1..-3..-5.
2e120 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2e130 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2e140 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2e150 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2e160 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2e170 32 38 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  284..SELECT + + 
2e180 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20  col0 DIV - col1 
2e190 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2e1a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
2e1b0 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ..-6..0....skipi
2e1c0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2e1d0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2e1e0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2e1f0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2e200 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
2e210 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2e220 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2e230 72 74 20 6c 61 62 65 6c 2d 31 32 38 34 0d 0a 53  rt label-1284..S
2e240 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2f  ELECT + + col0 /
2e250 20 2d 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f   - col1 col2 FRO
2e260 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2e270 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d  ----..-6..-6..0.
2e280 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e290 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 31 20  rt..SELECT - 11 
2e2a0 2a 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c  * + col0 - + col
2e2b0 30 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 41 53  0 * tab1.col1 AS
2e2c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
2e2d0 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 0d 0a 2d 31 33  .----..-111..-13
2e2e0 34 34 0d 0a 2d 31 39 32 30 0d 0a 0d 0a 6f 6e 6c  44..-1920....onl
2e2f0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2e300 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2e310 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2e320 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2e330 72 74 20 6c 61 62 65 6c 2d 31 32 38 36 0d 0a 53  rt label-1286..S
2e340 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2e350 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 44 49 56   col0 + col1 DIV
2e360 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20   col0 col2 FROM 
2e370 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2e380 2d 2d 0d 0a 31 31 0d 0a 36 34 0d 0a 38 30 0d 0a  --..11..64..80..
2e390 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2e3a0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2e3b0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2e3c0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2e3d0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
2e3e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2e3f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2e400 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2e410 31 32 38 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  1286..SELECT DIS
2e420 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63  TINCT + col0 + c
2e430 6f 6c 31 20 2f 20 63 6f 6c 30 20 63 6f 6c 32 20  ol1 / col0 col2 
2e440 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2e450 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 36 34 0d  0..----..11..64.
2e460 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
2e470 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2e480 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63   cor0.col1 + - c
2e490 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
2e4a0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  b0 cor0..----..5
2e4b0 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70  3..9..96....skip
2e4c0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2e4d0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2e4e0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2e4f0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2e500 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2e510 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2e520 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   - + col0 + + co
2e530 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
2e540 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2e550 0a 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 6f  .-34..-7..9....o
2e560 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2e570 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2e580 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2e590 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2e5a0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 39 0d  sort label-1289.
2e5b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2e5c0 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 44   - col2 + col0 D
2e5d0 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c  IV - col1 AS col
2e5e0 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
2e5f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 0d 0a 2d 35  ..----..-102..-5
2e600 34 0d 0a 2d 36 33 0d 0a 0d 0a 73 6b 69 70 69 66  4..-63....skipif
2e610 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2e620 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2e630 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2e640 32 38 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  289..SELECT DIST
2e650 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  INCT - col2 + co
2e660 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63  l0 / - col1 AS c
2e670 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
2e680 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 0d 0a  r0..----..-102..
2e690 2d 35 34 0d 0a 2d 36 33 0d 0a 0d 0a 71 75 65 72  -54..-63....quer
2e6a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e6b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
2e6c0 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  2 * - col1 + - c
2e6d0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol1 * + col0 FRO
2e6e0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2e6f0 2d 2d 2d 2d 0d 0a 2d 31 32 31 30 0d 0a 2d 31 34  ----..-1210..-14
2e700 38 32 0d 0a 2d 32 32 38 38 0d 0a 0d 0a 73 6b 69  82..-2288....ski
2e710 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2e720 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2e730 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2e740 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2e750 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2e760 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2e770 4c 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  L + col0 + col0 
2e780 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f  - + cor0.col0 co
2e790 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2e7a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36  cor0..----..3..6
2e7b0 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  4..80....query I
2e7c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e7d0 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   + - col2 + col1
2e7e0 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30   + + col0 * cor0
2e7f0 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
2e800 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2e810 31 39 0d 0a 34 30 34 39 0d 0a 36 33 31 37 0d 0a  19..4049..6317..
2e820 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e830 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2e840 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  - col1 * + col0 
2e850 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  * + col2 AS col0
2e860 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2e870 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 38 30  r0..----..-36480
2e880 0d 0a 2d 34 32 31 32 0d 0a 2d 39 39 38 34 30 0d  ..-4212..-99840.
2e890 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e8a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
2e8b0 6f 6c 30 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 - + cor0.col
2e8c0 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  1 * - cor0.col0 
2e8d0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2e8e0 2d 2d 2d 2d 0d 0a 32 30 38 38 0d 0a 33 34 33 30  ----..2088..3430
2e8f0 0d 0a 38 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20  ..8188....query 
2e900 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e910 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  T + + col0 * col
2e920 30 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  0 + + col0 FROM 
2e930 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2e940 2d 2d 0d 0a 35 36 0d 0a 36 31 36 32 0d 0a 36 33  --..56..6162..63
2e950 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
2e960 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2e970 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l0 * + cor0.col1
2e980 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t
2e990 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
2e9a0 32 30 33 31 0d 0a 33 33 39 34 0d 0a 38 30 31 37  2031..3394..8017
2e9b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2e9c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2e9d0 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l1 + - cor0.col2
2e9e0 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46   * col1 * col2 F
2e9f0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
2ea00 2d 2d 2d 0d 0a 2d 31 39 34 0d 0a 2d 36 31 31 39  ---..-194..-6119
2ea10 37 35 0d 0a 2d 39 33 37 34 30 0d 0a 0d 0a 71 75  75..-93740....qu
2ea20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ea30 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
2ea40 6f 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 63  ol2 * col0 - - c
2ea50 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
2ea60 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2ea70 0d 0a 32 31 36 0d 0a 33 37 30 35 0d 0a 37 37 37  ..216..3705..777
2ea80 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2ea90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2eaa0 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  TINCT + - cor0.c
2eab0 6f 6c 32 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 - col1 FROM 
2eac0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2ead0 2d 2d 0d 0a 2d 31 30 39 0d 0a 2d 36 37 0d 0a 2d  --..-109..-67..-
2eae0 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
2eaf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2eb00 4c 20 2b 20 2b 20 37 30 20 46 52 4f 4d 20 74 61  L + + 70 FROM ta
2eb10 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2eb20 0d 0a 37 30 0d 0a 37 30 0d 0a 37 30 0d 0a 0d 0a  ..70..70..70....
2eb30 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2eb40 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2eb50 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2eb60 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2eb70 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2eb80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2eb90 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d   + cor0.col0 + -
2eba0 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 30 20   cor0.col0 col0 
2ebb0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2ebc0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
2ebd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ebe0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2ebf0 49 4e 43 54 20 2d 20 35 30 20 41 53 20 63 6f 6c  INCT - 50 AS col
2ec00 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2ec10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 30 0d 0a  or0..----..-50..
2ec20 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2ec30 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
2ec40 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
2ec50 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
2ec60 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
2ec70 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30 33 0d  sort label-1303.
2ec80 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
2ec90 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f  cor0.col1 * - co
2eca0 6c 31 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  l1 + CAST( NULL 
2ecb0 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 28 20  AS SIGNED ) * ( 
2ecc0 2b 20 63 6f 6c 32 20 29 20 2f 20 28 20 2b 20 63  + col2 ) / ( + c
2ecd0 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol2 ) FROM tab0 
2ece0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
2ecf0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
2ed00 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2ed10 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2ed20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ed30 74 20 6c 61 62 65 6c 2d 31 33 30 33 0d 0a 53 45  t label-1303..SE
2ed40 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72  LECT ALL - + cor
2ed50 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  0.col1 * - col1 
2ed60 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
2ed70 20 49 4e 54 45 47 45 52 20 29 20 2a 20 28 20 2b   INTEGER ) * ( +
2ed80 20 63 6f 6c 32 20 29 20 2f 20 28 20 2b 20 63 6f   col2 ) / ( + co
2ed90 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l2 ) FROM tab0 A
2eda0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
2edb0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
2edc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2edd0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 33 20 41  t..SELECT + 63 A
2ede0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2edf0 2c 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72  , tab1, tab2 cor
2ee00 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  0..----..27 valu
2ee10 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 38  es hashing to 38
2ee20 37 36 34 61 36 65 36 39 36 64 31 61 36 62 35 30  764a6e696d1a6b50
2ee30 39 35 65 32 39 65 66 38 34 39 35 39 63 30 0d 0a  95e29ef84959c0..
2ee40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ee50 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2ee60 43 54 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20  CT - ( + col1 ) 
2ee70 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20  + tab1.col1 * - 
2ee80 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63  col1 * col0 AS c
2ee90 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
2eea0 2d 2d 2d 0d 0a 2d 31 33 35 33 33 0d 0a 2d 32 30  ---..-13533..-20
2eeb0 35 34 0d 0a 2d 36 34 31 30 0d 0a 0d 0a 71 75 65  54..-6410....que
2eec0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2eed0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
2eee0 6c 32 20 2b 20 2d 20 37 32 20 41 53 20 63 6f 6c  l2 + - 72 AS col
2eef0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
2ef00 2d 0d 0a 2d 33 34 0d 0a 2d 34 35 0d 0a 2d 34 36  -..-34..-45..-46
2ef10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ef20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
2ef30 33 35 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  35 * + col2 AS c
2ef40 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
2ef50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35   cor0..----..115
2ef60 35 0d 0a 32 38 37 30 0d 0a 33 35 0d 0a 0d 0a 6f  5..2870..35....o
2ef70 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2ef80 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2ef90 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2efa0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2efb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2efc0 74 20 6c 61 62 65 6c 2d 31 33 30 38 0d 0a 53 45  t label-1308..SE
2efd0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41  LECT DISTINCT CA
2efe0 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
2eff0 4d 41 4c 20 29 20 2b 20 2b 20 63 6f 6c 31 20 41  MAL ) + + col1 A
2f000 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
2f010 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
2f020 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2f030 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2f040 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2f050 61 62 65 6c 2d 31 33 30 38 0d 0a 53 45 4c 45 43  abel-1308..SELEC
2f060 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 20  T DISTINCT CAST 
2f070 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29  ( NULL AS REAL )
2f080 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
2f090 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
2f0a0 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  -..NULL....query
2f0b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f0c0 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  CT - - cor0.col0
2f0d0 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + + col1 FROM t
2f0e0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2f0f0 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30  -..110..132..180
2f100 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2f110 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
2f120 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 28 20 2d 20  l1 * col1 + ( - 
2f130 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 29 20 2a 20  col2 + col2 ) * 
2f140 2d 20 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  - 4 AS col2 FROM
2f150 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2f160 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a 36  ---..100..169..6
2f170 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  76....onlyif mys
2f180 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
2f190 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
2f1a0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
2f1b0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
2f1c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2f1d0 33 31 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  311..SELECT ALL 
2f1e0 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 2b 20  col1 / + col0 + 
2f1f0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
2f200 47 4e 45 44 20 29 20 63 6f 6c 30 20 46 52 4f 4d  GNED ) col0 FROM
2f210 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2f220 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
2f230 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
2f240 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2f250 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2f260 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2f270 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2f280 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2f290 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2f2a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f2b0 20 6c 61 62 65 6c 2d 31 33 31 31 0d 0a 53 45 4c   label-1311..SEL
2f2c0 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2f 20 2b  ECT ALL col1 / +
2f2d0 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 4e   col0 + CAST ( N
2f2e0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
2f2f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2f300 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
2f310 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
2f320 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f330 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 33  rt..SELECT - - 3
2f340 38 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  8 * + col0 FROM 
2f350 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2f360 2d 2d 0d 0a 31 33 33 30 0d 0a 33 33 38 32 0d 0a  --..1330..3382..
2f370 39 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  912....query I r
2f380 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2f390 20 34 38 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20   48 * + col1 AS 
2f3a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
2f3b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
2f3c0 31 32 38 0d 0a 2d 34 33 36 38 0d 0a 2d 34 36 35  128..-4368..-465
2f3d0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2f3e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2f3f0 54 49 4e 43 54 20 2d 20 39 37 20 46 52 4f 4d 20  TINCT - 97 FROM 
2f400 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
2f410 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61  SS JOIN tab1, ta
2f420 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32  b1 AS cor1, tab2
2f430 20 41 53 20 63 6f 72 32 2c 20 74 61 62 32 20 41   AS cor2, tab2 A
2f440 53 20 63 6f 72 33 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  S cor3..----..-9
2f450 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2f460 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
2f470 30 20 2b 20 2b 20 31 35 20 2a 20 63 6f 6c 30 20  0 + + 15 * col0 
2f480 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2f490 0a 31 30 32 34 0d 0a 31 32 38 30 0d 0a 34 38 0d  .1024..1280..48.
2f4a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f4b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
2f4c0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
2f4d0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
2f4e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
2f4f0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2f500 20 63 36 31 64 32 37 61 30 30 32 32 65 36 64 30   c61d27a0022e6d0
2f510 32 32 33 37 31 64 63 35 38 38 31 39 61 62 32 37  22371dc58819ab27
2f520 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2f530 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2f540 6f 72 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or1.col0 AS col1
2f550 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2f560 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
2f570 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
2f580 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2f590 6e 67 20 74 6f 20 64 64 31 38 62 39 33 32 36 33  ng to dd18b93263
2f5a0 61 36 63 64 34 32 35 66 63 37 63 63 38 34 64 39  a6cd425fc7cc84d9
2f5b0 31 33 37 38 37 30 0d 0a 0d 0a 71 75 65 72 79 20  137870....query 
2f5c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f5d0 54 20 41 4c 4c 20 37 37 20 46 52 4f 4d 20 74 61  T ALL 77 FROM ta
2f5e0 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b2, tab1 AS cor0
2f5f0 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d  , tab2 cor1..---
2f600 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
2f610 68 69 6e 67 20 74 6f 20 64 37 62 30 32 37 62 63  hing to d7b027bc
2f620 61 35 64 33 37 63 36 37 65 32 39 30 31 33 39 30  a5d37c67e2901390
2f630 34 64 65 66 38 31 32 35 0d 0a 0d 0a 71 75 65 72  4def8125....quer
2f640 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2f650 45 43 54 20 41 4c 4c 20 37 34 20 2b 20 63 6f 6c  ECT ALL 74 + col
2f660 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
2f670 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32 0d 0a  ab2..----..152..
2f680 31 35 33 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79  153..81....query
2f690 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f6a0 43 54 20 44 49 53 54 49 4e 43 54 20 31 33 20 2a  CT DISTINCT 13 *
2f6b0 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f   tab0.col1 AS co
2f6c0 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
2f6d0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2f6e0 0d 0a 31 31 31 38 0d 0a 31 31 38 33 0d 0a 31 32  ..1118..1183..12
2f6f0 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  61....onlyif mys
2f700 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2f710 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2f720 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2f730 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2f740 6c 2d 31 33 32 31 0d 0a 53 45 4c 45 43 54 20 41  l-1321..SELECT A
2f750 4c 4c 20 2d 20 39 37 20 44 49 56 20 2d 20 39 20  LL - 97 DIV - 9 
2f760 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2f770 30 2c 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  0, tab1, tab2 AS
2f780 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
2f790 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2f7a0 6f 20 30 66 65 33 65 34 35 61 39 65 63 64 34 39  o 0fe3e45a9ecd49
2f7b0 35 38 34 63 32 61 62 34 34 32 31 30 30 64 35 31  584c2ab442100d51
2f7c0 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  76....skipif mys
2f7d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2f7e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2f7f0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 31 0d  sort label-1321.
2f800 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 39 37  .SELECT ALL - 97
2f810 20 2f 20 2d 20 39 20 41 53 20 63 6f 6c 30 20 46   / - 9 AS col0 F
2f820 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20  ROM tab0, tab1, 
2f830 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2f840 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
2f850 73 68 69 6e 67 20 74 6f 20 30 66 65 33 65 34 35  shing to 0fe3e45
2f860 61 39 65 63 64 34 39 35 38 34 63 32 61 62 34 34  a9ecd49584c2ab44
2f870 32 31 30 30 64 35 31 37 36 0d 0a 0d 0a 71 75 65  2100d5176....que
2f880 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f890 4c 45 43 54 20 28 20 63 6f 6c 32 20 2b 20 63 6f  LECT ( col2 + co
2f8a0 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41 53  l1 ) * - col1 AS
2f8b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
2f8c0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 33 34 0d 0a 2d  .----..-10234..-
2f8d0 31 35 37 34 33 0d 0a 2d 39 35 30 36 0d 0a 0d 0a  15743..-9506....
2f8e0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2f8f0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2f900 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2f910 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2f920 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 33  wsort label-1323
2f930 0d 0a 53 45 4c 45 43 54 20 2b 20 34 30 20 44 49  ..SELECT + 40 DI
2f940 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  V col1 FROM tab1
2f950 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 0d 0a 34 0d  ..----..1..3..4.
2f960 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2f970 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2f980 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f990 74 20 6c 61 62 65 6c 2d 31 33 32 33 0d 0a 53 45  t label-1323..SE
2f9a0 4c 45 43 54 20 2b 20 34 30 20 2f 20 63 6f 6c 31  LECT + 40 / col1
2f9b0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2f9c0 0d 0a 31 0d 0a 33 0d 0a 34 0d 0a 0d 0a 71 75 65  ..1..3..4....que
2f9d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f9e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2f9f0 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f 6c 31 20  col2 * ( - col1 
2fa00 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
2fa10 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2fa20 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a  -..-1534..-646..
2fa30 2d 38 33 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -837....skipif p
2fa40 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2fa50 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2fa60 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2fa70 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2fa80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fa90 0d 0a 53 45 4c 45 43 54 20 28 20 28 20 63 6f 6c  ..SELECT ( ( col
2faa0 30 20 29 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20  0 ) ) col0 FROM 
2fab0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2fac0 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a  --..24..35..89..
2fad0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fae0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2faf0 32 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  20 FROM tab1, ta
2fb00 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2fb10 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2fb20 6e 67 20 74 6f 20 32 66 64 64 39 34 32 66 65 30  ng to 2fdd942fe0
2fb30 33 30 37 61 36 66 66 36 36 62 36 33 30 30 34 65  307a6ff66b63004e
2fb40 66 31 30 32 63 34 0d 0a 0d 0a 73 6b 69 70 69 66  f102c4....skipif
2fb50 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2fb60 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2fb70 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2fb80 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2fb90 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
2fba0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
2fbb0 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52  or0.col2 col1 FR
2fbc0 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
2fbd0 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
2fbe0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
2fbf0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2fc00 37 37 38 36 37 31 38 62 64 38 30 34 32 30 32 32  7786718bd8042022
2fc10 35 33 37 33 37 38 64 34 30 65 63 38 37 34 37 35  537378d40ec87475
2fc20 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2fc30 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2fc40 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2fc50 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2fc60 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2fc70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2fc80 4c 45 43 54 20 41 4c 4c 20 2d 20 36 39 20 2a 20  LECT ALL - 69 * 
2fc90 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col1 col1 FROM t
2fca0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2fcb0 2d 0d 0a 2d 31 31 37 33 0d 0a 2d 32 31 33 39 0d  -..-1173..-2139.
2fcc0 0a 2d 34 30 37 31 0d 0a 0d 0a 71 75 65 72 79 20  .-4071....query 
2fcd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2fce0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 28  T DISTINCT - - (
2fcf0 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( + cor0.col0 )
2fd00 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
2fd10 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2fd20 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73  .24..35..89....s
2fd30 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2fd40 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2fd50 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2fd60 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2fd70 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2fd80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2fd90 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 63 6f  + col0 * col1 co
2fda0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
2fdb0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32  0..----..1343..2
2fdc0 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72  17..4602....quer
2fdd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2fde0 45 43 54 20 28 20 2d 20 63 6f 6c 31 20 2a 20 2d  ECT ( - col1 * -
2fdf0 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62   col0 ) FROM tab
2fe00 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32  2..----..1343..2
2fe10 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 6f 6e 6c 79  17..4602....only
2fe20 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2fe30 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2fe40 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2fe50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fe60 74 20 6c 61 62 65 6c 2d 31 33 33 32 0d 0a 53 45  t label-1332..SE
2fe70 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f  LECT ALL tab1.co
2fe80 6c 31 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53  l1 DIV - col0 AS
2fe90 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
2fea0 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 30 0d 0a 30 0d  .----..-8..0..0.
2feb0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2fec0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2fed0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fee0 74 20 6c 61 62 65 6c 2d 31 33 33 32 0d 0a 53 45  t label-1332..SE
2fef0 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f  LECT ALL tab1.co
2ff00 6c 31 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63  l1 / - col0 AS c
2ff10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
2ff20 2d 2d 2d 0d 0a 2d 38 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-8..0..0...
2ff30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ff40 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2ff50 54 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 74 61 62  T - col0 - + tab
2ff60 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  0.col1 * col2 FR
2ff70 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
2ff80 31 33 32 0d 0a 2d 32 38 36 32 0d 0a 2d 37 35 35  132..-2862..-755
2ff90 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2ffa0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2ffb0 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 72  ol0 * col1 + cor
2ffc0 30 2e 63 6f 6c 32 20 2a 20 32 37 20 2a 20 2b 20  0.col2 * 27 * + 
2ffd0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
2ffe0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2fff0 2d 2d 2d 2d 0d 0a 2d 32 34 35 30 0d 0a 31 38 38  ----..-2450..188
30000 39 34 37 0d 0a 31 39 33 32 30 0d 0a 0d 0a 73 6b  947..19320....sk
30010 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
30020 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
30030 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
30040 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
30050 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
30060 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
30070 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  LL + cor0.col0 *
30080 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
30090 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  2 col0 FROM tab1
300a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor0..----..364
300b0 38 30 0d 0a 34 32 31 32 0d 0a 39 39 38 34 30 0d  80..4212..99840.
300c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
300d0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
300e0 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 36 32 20  NCT - col2 + 62 
300f0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
30100 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
30110 0a 2d 33 34 0d 0a 35 0d 0a 38 0d 0a 0d 0a 6f 6e  .-34..5..8....on
30120 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
30130 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
30140 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
30150 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
30160 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 37 0d 0a  ort label-1337..
30170 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20  SELECT + - col1 
30180 2b 20 63 6f 6c 31 20 44 49 56 20 31 34 20 46 52  + col1 DIV 14 FR
30190 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
301a0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d  .----..-10..-13.
301b0 0a 2d 32 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-25....skipif m
301c0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
301d0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
301e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33  owsort label-133
301f0 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  7..SELECT + - co
30200 6c 31 20 2b 20 63 6f 6c 31 20 2f 20 31 34 20 46  l1 + col1 / 14 F
30210 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
30220 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33  ..----..-10..-13
30230 0d 0a 2d 32 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-25....onlyif 
30240 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
30250 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
30260 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
30270 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
30280 61 62 65 6c 2d 31 33 33 38 0d 0a 53 45 4c 45 43  abel-1338..SELEC
30290 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 44  T ALL - + col0 D
302a0 49 56 20 2d 20 28 20 63 6f 6c 30 20 29 20 41 53  IV - ( col0 ) AS
302b0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
302c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
302d0 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..1..1....skipif
302e0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
302f0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
30300 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
30310 33 33 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  338..SELECT ALL 
30320 2d 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 28 20 63  - + col0 / - ( c
30330 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol0 ) AS col1 FR
30340 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
30350 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a  .----..1..1..1..
30360 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30370 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
30380 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l2 * - cor0.col0
30390 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
303a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a  r0..----..-189..
303b0 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a  -2028..-3002....
303c0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
303d0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
303e0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
303f0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
30400 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34 30  wsort label-1340
30410 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
30420 2a 20 63 6f 6c 30 20 44 49 56 20 63 6f 72 30 2e  * col0 DIV cor0.
30430 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
30440 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34  S cor0..----..54
30450 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70  ..57..96....skip
30460 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
30470 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
30480 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30490 2d 31 33 34 30 0d 0a 53 45 4c 45 43 54 20 2b 20  -1340..SELECT + 
304a0 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2f 20 63 6f  col2 * col0 / co
304b0 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
304c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
304d0 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71  .54..57..96....q
304e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
304f0 53 45 4c 45 43 54 20 2d 20 33 39 20 2b 20 34 32  SELECT - 39 + 42
30500 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
30510 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
30520 0d 0a 33 0d 0a 33 0d 0a 33 0d 0a 0d 0a 71 75 65  ..3..3..3....que
30530 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30540 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
30550 37 37 20 2a 20 2b 20 36 20 41 53 20 63 6f 6c 30  77 * + 6 AS col0
30560 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
30570 0d 0a 32 34 39 34 38 0d 0a 32 36 33 33 34 0d 0a  ..24948..26334..
30580 34 34 33 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  44352....query I
30590 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
305a0 20 2b 20 2b 20 30 20 41 53 20 63 6f 6c 31 20 46   + + 0 AS col1 F
305b0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
305c0 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32   CROSS JOIN tab2
305d0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
305e0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
305f0 20 74 6f 20 38 62 37 35 31 33 36 62 32 62 35 31   to 8b75136b2b51
30600 63 37 37 33 34 35 63 30 33 38 30 34 65 63 31 63  c77345c03804ec1c
30610 64 61 35 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20  da5c....query I 
30620 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30630 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  + col0 * + col1 
30640 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  + col0 * - col1 
30650 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  + + col0 * col2 
30660 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
30670 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
30680 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a  .35..7298..792..
30690 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
306a0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
306b0 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   + - cor0.col2 +
306c0 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
306d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
306e0 0a 2d 31 33 30 0d 0a 2d 31 35 35 0d 0a 2d 36 31  .-130..-155..-61
306f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30700 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
30710 2e 63 6f 6c 30 20 2b 20 32 30 20 2a 20 2d 20 36  .col0 + 20 * - 6
30720 34 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  4 FROM tab2 cor0
30730 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 30 31 0d 0a 2d  ..----..-1201..-
30740 31 32 30 32 0d 0a 2d 31 32 37 33 0d 0a 0d 0a 71  1202..-1273....q
30750 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30760 53 45 4c 45 43 54 20 2b 20 74 61 62 32 2e 63 6f  SELECT + tab2.co
30770 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  l0 + col1 * - co
30780 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
30790 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36  tab2..----..-126
307a0 34 0d 0a 2d 32 31 30 0d 0a 2d 34 35 32 34 0d 0a  4..-210..-4524..
307b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
307c0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
307d0 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 30   * - col1 - col0
307e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
307f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 0d 0a 33  r0..----..210..3
30800 34 30 33 0d 0a 39 35 34 0d 0a 0d 0a 71 75 65 72  403..954....quer
30810 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30820 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63  ECT ALL col2 * c
30830 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ol0 + cor0.col1 
30840 2d 20 2b 20 63 6f 6c 30 20 2a 20 38 37 20 46 52  - + col0 * 87 FR
30850 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
30860 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 30 0d 0a 2d 32  .----..-1210..-2
30870 39 31 33 0d 0a 2d 33 35 34 0d 0a 0d 0a 71 75 65  913..-354....que
30880 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30890 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
308a0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col0 * - col1 + 
308b0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
308c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
308d0 2d 2d 2d 2d 0d 0a 32 31 35 30 0d 0a 33 34 39 32  ----..2150..3492
308e0 0d 0a 38 31 39 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..8190....skipif
308f0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
30900 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
30910 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
30920 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
30930 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
30940 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 37  rt..SELECT - - 7
30950 35 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  5 col0 FROM tab0
30960 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30970 37 35 0d 0a 37 35 0d 0a 37 35 0d 0a 0d 0a 71 75  75..75..75....qu
30980 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30990 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2d  ELECT ALL col1 -
309a0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d   + cor0.col0 * -
309b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
309c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
309d0 38 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d 0a  88..3658..7693..
309e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
309f0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 35 20 2b  t..SELECT + 85 +
30a00 20 39 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20   90 + col2 FROM 
30a10 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
30a20 2d 2d 0d 0a 32 30 31 0d 0a 32 30 32 0d 0a 32 31  --..201..202..21
30a30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
30a40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
30a50 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a  TINCT - + col0 *
30a60 20 37 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53   77 FROM tab2 AS
30a70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33   cor0..----..-53
30a80 39 0d 0a 2d 36 30 30 36 0d 0a 2d 36 30 38 33 0d  9..-6006..-6083.
30a90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
30aa0 72 74 0d 0a 53 45 4c 45 43 54 20 32 30 20 41 53  rt..SELECT 20 AS
30ab0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c   col2 FROM tab1,
30ac0 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61 62 30   tab0 cor0, tab0
30ad0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
30ae0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
30af0 67 20 74 6f 20 30 61 33 35 66 65 39 38 66 33 65  g to 0a35fe98f3e
30b00 37 64 35 66 63 38 66 66 32 61 65 38 31 35 62 64  7d5fc8ff2ae815bd
30b10 32 30 65 66 34 0d 0a 0d 0a 71 75 65 72 79 20 49  20ef4....query I
30b20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30b30 20 41 4c 4c 20 2b 20 2b 20 36 32 20 2a 20 2b 20   ALL + + 62 * + 
30b40 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
30b50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 33 32 0d  or0..----..5332.
30b60 0a 35 36 34 32 0d 0a 36 30 31 34 0d 0a 0d 0a 6f  .5642..6014....o
30b70 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
30b80 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
30b90 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
30ba0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
30bb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30bc0 74 20 6c 61 62 65 6c 2d 31 33 35 37 0d 0a 53 45  t label-1357..SE
30bd0 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20 31  LECT ALL CAST( 1
30be0 37 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  7 AS SIGNED ) * 
30bf0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
30c00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30c10 31 37 30 0d 0a 32 32 31 0d 0a 34 34 32 0d 0a 0d  170..221..442...
30c20 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
30c30 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
30c40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
30c50 6c 61 62 65 6c 2d 31 33 35 37 0d 0a 53 45 4c 45  label-1357..SELE
30c60 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 31 37  CT ALL CAST ( 17
30c70 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
30c80 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
30c90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30ca0 31 37 30 0d 0a 32 32 31 0d 0a 34 34 32 0d 0a 0d  170..221..442...
30cb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30cc0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
30cd0 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  * + col0 + col2 
30ce0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
30cf0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 0d 0a 2d 33  ..----..-105..-3
30d00 35 32 37 0d 0a 2d 37 35 30 34 0d 0a 0d 0a 71 75  527..-7504....qu
30d10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30d20 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
30d30 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 41   col2 - + col2 A
30d40 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
30d50 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 0d 0a 2d 35 34  ..----..-52..-54
30d60 0d 0a 2d 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-76....query I
30d70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30d80 20 2d 20 34 32 20 41 53 20 63 6f 6c 31 20 46 52   - 42 AS col1 FR
30d90 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
30da0 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a 2d 34 32 0d  .----..-42..-42.
30db0 0a 2d 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-42....query I 
30dc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30dd0 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 38 31 20  DISTINCT + - 81 
30de0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
30df0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  2 cor0..----..-8
30e00 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
30e10 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
30e20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
30e30 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
30e40 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
30e50 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
30e60 36 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  62..SELECT DISTI
30e70 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  NCT - cor0.col2 
30e80 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53  + + col1 * + CAS
30e90 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
30ea0 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  D ) FROM tab1 AS
30eb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
30ec0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
30ed0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
30ee0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
30ef0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36 32 0d 0a  ort label-1362..
30f00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
30f10 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  - cor0.col2 + + 
30f20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20 28 20  col1 * + CAST ( 
30f30 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
30f40 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
30f50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
30f60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
30f70 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
30f80 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20  0.col1 * + col2 
30f90 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
30fa0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30fb0 2d 33 36 34 38 30 0d 0a 2d 34 32 31 32 0d 0a 2d  -36480..-4212..-
30fc0 39 39 38 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  99840....query I
30fd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30fe0 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20   ALL + col2 + + 
30ff0 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
31000 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
31010 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75  55..58..85....qu
31020 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31030 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63  ELECT - col2 * c
31040 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  ol2 * - col0 FRO
31050 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
31060 2d 0d 0a 31 31 34 30 37 36 0d 0a 35 31 30 33 0d  -..114076..5103.
31070 0a 35 32 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20  .52728....query 
31080 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31090 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2a 20 36  T - ( col0 ) * 6
310a0 38 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  8 * - col1 AS co
310b0 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
310c0 2d 2d 0d 0a 31 34 37 35 36 0d 0a 33 31 32 39 33  --..14756..31293
310d0 36 0d 0a 39 31 33 32 34 0d 0a 0d 0a 71 75 65 72  6..91324....quer
310e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
310f0 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d  ECT ALL col2 + -
31100 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
31110 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
31120 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
31130 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31140 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20  SELECT - - col0 
31150 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53 20  * ( - col2 ) AS 
31160 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
31170 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
31180 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32  89..-2028..-3002
31190 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
311a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
311b0 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  INCT + - col0 + 
311c0 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  + col1 * - col1 
311d0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
311e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d  0..----..-164..-
311f0 32 34 39 0d 0a 2d 36 37 39 0d 0a 0d 0a 71 75 65  249..-679....que
31200 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31210 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c  LECT ALL + - col
31220 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  1 * - col1 + col
31230 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  2 * col1 AS col1
31240 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
31250 0a 2d 2d 2d 2d 0d 0a 31 37 39 38 0d 0a 35 30 31  .----..1798..501
31260 35 0d 0a 39 33 35 0d 0a 0d 0a 6f 6e 6c 79 69 66  5..935....onlyif
31270 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
31280 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
31290 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
312a0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
312b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
312c0 65 6c 2d 31 33 37 31 0d 0a 53 45 4c 45 43 54 20  el-1371..SELECT 
312d0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
312e0 2b 20 2d 20 43 41 53 54 28 20 63 6f 6c 32 20 2a  + - CAST( col2 *
312f0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   - cor0.col0 AS 
31300 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
31310 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
31320 0d 0a 31 33 32 0d 0a 37 33 38 39 0d 0a 38 37 38  ..132..7389..878
31330 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
31340 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
31350 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
31360 72 74 20 6c 61 62 65 6c 2d 31 33 37 31 0d 0a 53  rt label-1371..S
31370 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
31380 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 20 28   col1 + - CAST (
31390 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63   col2 * - cor0.c
313a0 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
313b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
313c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 37  r0..----..132..7
313d0 33 38 39 0d 0a 38 37 38 0d 0a 0d 0a 71 75 65 72  389..878....quer
313e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
313f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 35 30 20  ECT DISTINCT 50 
31400 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  * + cor0.col0 AS
31410 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c   col1 FROM tab0,
31420 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63   tab2, tab2 AS c
31430 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 30 0d 0a  or0..----..350..
31440 33 39 30 30 0d 0a 33 39 35 30 0d 0a 0d 0a 6f 6e  3900..3950....on
31450 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
31460 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
31470 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
31480 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
31490 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
314a0 20 6c 61 62 65 6c 2d 31 33 37 33 0d 0a 53 45 4c   label-1373..SEL
314b0 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  ECT col0 * col2 
314c0 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  + + CAST( NULL A
314d0 53 20 53 49 47 4e 45 44 20 29 20 2d 20 63 6f 6c  S SIGNED ) - col
314e0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
314f0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab2..----..NULL.
31500 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
31510 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
31520 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
31530 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
31540 62 65 6c 2d 31 33 37 33 0d 0a 53 45 4c 45 43 54  bel-1373..SELECT
31550 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2b   col0 * col2 + +
31560 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
31570 49 4e 54 45 47 45 52 20 29 20 2d 20 63 6f 6c 30  INTEGER ) - col0
31580 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
31590 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b2..----..NULL..
315a0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
315b0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
315c0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
315d0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
315e0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
315f0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
31600 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74  owsort..SELECT t
31610 61 62 31 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  ab1.col2 + + col
31620 31 20 2a 20 2b 20 32 20 2d 20 2d 20 63 6f 6c 30  1 * + 2 - - col0
31630 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46   * + col0 col2 F
31640 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
31650 31 31 35 0d 0a 34 31 37 33 0d 0a 36 35 32 32 0d  115..4173..6522.
31660 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31670 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
31680 20 35 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c   52 * col1 * col
31690 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
316a0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 33 35 39 32  ab2..----..33592
316b0 0d 0a 34 33 35 32 34 0d 0a 37 39 37 36 38 0d 0a  ..43524..79768..
316c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
316d0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
316e0 6c 32 20 2a 20 38 33 20 2b 20 63 6f 6c 30 20 46  l2 * 83 + col0 F
316f0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
31700 2d 2d 2d 0d 0a 2d 32 30 38 30 0d 0a 2d 32 32 33  ---..-2080..-223
31710 34 0d 0a 2d 33 30 37 35 0d 0a 0d 0a 73 6b 69 70  4..-3075....skip
31720 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
31730 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
31740 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
31750 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
31760 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
31770 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
31780 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63  TINCT - - cor0.c
31790 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
317a0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  b1 cor0..----..3
317b0 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79  ..64..80....only
317c0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
317d0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
317e0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
317f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31800 74 20 6c 61 62 65 6c 2d 31 33 37 38 0d 0a 53 45  t label-1378..SE
31810 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72  LECT ALL - - cor
31820 30 2e 63 6f 6c 32 20 44 49 56 20 2b 20 34 39 20  0.col2 DIV + 49 
31830 2d 20 28 20 2b 20 63 6f 6c 32 20 2b 20 35 33 20  - ( + col2 + 53 
31840 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  ) FROM tab2 cor0
31850 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 39 0d 0a 2d 38 30  ..----..-79..-80
31860 0d 0a 2d 39 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-91....skipif 
31870 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
31880 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
31890 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
318a0 37 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  78..SELECT ALL -
318b0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2b   - cor0.col2 / +
318c0 20 34 39 20 2d 20 28 20 2b 20 63 6f 6c 32 20 2b   49 - ( + col2 +
318d0 20 35 33 20 29 20 46 52 4f 4d 20 74 61 62 32 20   53 ) FROM tab2 
318e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 39 0d  cor0..----..-79.
318f0 0a 2d 38 30 0d 0a 2d 39 31 0d 0a 0d 0a 71 75 65  .-80..-91....que
31900 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31910 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 39 39  LECT - col1 + 99
31920 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46   * - cor0.col0 F
31930 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
31940 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 34 0d 0a 2d 37  ..----..-724..-7
31950 37 38 31 0d 0a 2d 37 38 33 38 0d 0a 0d 0a 73 6b  781..-7838....sk
31960 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
31970 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
31980 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
31990 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
319a0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
319b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
319c0 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
319d0 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol0 col2 FROM ta
319e0 62 31 2c 20 74 61 62 32 20 63 6f 72 30 2c 20 74  b1, tab2 cor0, t
319f0 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
31a00 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d  -..-7..-78..-79.
31a10 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
31a20 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
31a30 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
31a40 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
31a50 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
31a60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31a70 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
31a80 31 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20  1 * + col0 col1 
31a90 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
31aa0 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d  ----..1040..640.
31ab0 0a 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .78....onlyif my
31ac0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
31ad0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
31ae0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
31af0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
31b00 65 6c 2d 31 33 38 32 0d 0a 53 45 4c 45 43 54 20  el-1382..SELECT 
31b10 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53  ALL + col2 * CAS
31b20 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45  T( col1 AS SIGNE
31b30 44 20 29 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  D ) + col1 * col
31b40 30 20 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c  0 DIV + cor0.col
31b50 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  2 + + col0 FROM 
31b60 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
31b70 2d 2d 0d 0a 31 33 33 38 0d 0a 31 34 30 38 0d 0a  --..1338..1408..
31b80 36 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  645....skipif my
31b90 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
31ba0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
31bb0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 38 32  wsort label-1382
31bc0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
31bd0 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 63 6f 6c  ol2 * CAST ( col
31be0 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  1 AS INTEGER ) +
31bf0 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2f 20 2b   col1 * col0 / +
31c00 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63   cor0.col2 + + c
31c10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
31c20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33   cor0..----..133
31c30 38 0d 0a 31 34 30 38 0d 0a 36 34 35 0d 0a 0d 0a  8..1408..645....
31c40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31c50 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31c60 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2d   - tab1.col1 + -
31c70 20 32 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   26 AS col0 FROM
31c80 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36   tab1..----..-36
31c90 0d 0a 2d 33 39 0d 0a 2d 35 32 0d 0a 0d 0a 71 75  ..-39..-52....qu
31ca0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31cb0 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63  ELECT col2 * + c
31cc0 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 + + cor0.col
31cd0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
31ce0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
31cf0 2d 0d 0a 31 39 36 0d 0a 32 31 30 36 0d 0a 33 30  -..196..2106..30
31d00 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
31d10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
31d20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 2b 20 37 35  tab1.col0 + + 75
31d30 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31   * col1 + - col1
31d40 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
31d50 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 32 0d 0a  b1..----..1042..
31d60 31 39 32 37 0d 0a 38 30 34 0d 0a 0d 0a 71 75 65  1927..804....que
31d70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31d80 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  LECT + + col2 * 
31d90 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a 20  + col0 - col1 * 
31da0 63 6f 6c 30 20 2a 20 33 20 41 53 20 63 6f 6c 32  col0 * 3 AS col2
31db0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
31dc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 37 0d  r0..----..-1027.
31dd0 0a 2d 31 31 37 37 38 0d 0a 2d 34 36 32 0d 0a 0d  .-11778..-462...
31de0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31df0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
31e00 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  T - - col0 * col
31e10 31 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  1 - col1 AS col0
31e20 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
31e30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 37 0d 0a  r0..----..1027..
31e40 35 32 0d 0a 36 33 30 0d 0a 0d 0a 71 75 65 72 79  52..630....query
31e50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31e60 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2b  CT + tab2.col2 +
31e70 20 28 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f 4d   ( - col2 ) FROM
31e80 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
31e90 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
31ea0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31eb0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
31ec0 2a 20 35 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  * 5 + col0 AS co
31ed0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
31ee0 2d 2d 0d 0a 31 34 34 0d 0a 32 31 30 0d 0a 35 33  --..144..210..53
31ef0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
31f00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
31f10 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63   col0 + col2 * c
31f20 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
31f30 2d 2d 2d 0d 0a 31 31 31 33 0d 0a 33 36 0d 0a 36  ---..1113..36..6
31f40 38 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  813....query I r
31f50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
31f60 4c 4c 20 63 6f 6c 32 20 2b 20 2b 20 34 39 20 41  LL col2 + + 49 A
31f70 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
31f80 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 31 30 36  ..----..103..106
31f90 0d 0a 31 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..145....query I
31fa0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31fb0 20 2d 20 38 34 20 41 53 20 63 6f 6c 32 20 46 52   - 84 AS col2 FR
31fc0 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  OM tab1, tab2 AS
31fd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
31fe0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
31ff0 20 39 37 35 65 32 65 66 32 61 33 62 66 31 65 65   975e2ef2a3bf1ee
32000 32 36 32 32 33 36 32 66 34 65 34 33 35 37 35 32  2622362f4e435752
32010 66 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  f....onlyif mysq
32020 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
32030 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
32040 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
32050 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
32060 2d 31 33 39 33 0d 0a 53 45 4c 45 43 54 20 44 49  -1393..SELECT DI
32070 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f  STINCT + cor0.co
32080 6c 30 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63  l0 DIV col1 AS c
32090 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
320a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
320b0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
320c0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
320d0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
320e0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39 33 0d 0a  ort label-1393..
320f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
32100 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 63 6f  + cor0.col0 / co
32110 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
32120 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
32130 2d 2d 0d 0a 30 0d 0a 36 0d 0a 0d 0a 71 75 65 72  --..0..6....quer
32140 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32150 45 43 54 20 28 20 2d 20 63 6f 6c 32 20 29 20 41  ECT ( - col2 ) A
32160 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
32170 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   cor0..----..-54
32180 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b  ..-57..-96....sk
32190 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
321a0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
321b0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
321c0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
321d0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
321e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
321f0 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32   - col1 * - col2
32200 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
32210 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
32220 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37  2838..-7462..-97
32230 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
32240 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
32250 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
32260 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
32270 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
32280 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32290 4c 45 43 54 20 41 4c 4c 20 2d 20 31 20 63 6f 6c  LECT ALL - 1 col
322a0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
322b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
322c0 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49  1..-1....query I
322d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
322e0 20 2d 20 34 20 2a 20 63 6f 72 30 2e 63 6f 6c 30   - 4 * cor0.col0
322f0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
32300 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
32310 0d 0a 2d 31 32 0d 0a 2d 32 35 36 0d 0a 2d 33 32  ..-12..-256..-32
32320 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
32330 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
32340 20 2d 20 34 20 41 53 20 63 6f 6c 31 20 46 52 4f   - 4 AS col1 FRO
32350 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43  M tab0 AS cor0 C
32360 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41  ROSS JOIN tab2 A
32370 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor1..----..9 
32380 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
32390 6f 20 35 37 38 34 35 34 30 61 35 61 66 36 63 61  o 5784540a5af6ca
323a0 32 62 65 38 34 33 39 39 64 33 31 34 61 63 64 32  2be84399d314acd2
323b0 66 64 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  fd....onlyif mys
323c0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
323d0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
323e0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
323f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
32400 6c 2d 31 33 39 39 0d 0a 53 45 4c 45 43 54 20 44  l-1399..SELECT D
32410 49 53 54 49 4e 43 54 20 2b 20 37 30 20 44 49 56  ISTINCT + 70 DIV
32420 20 63 6f 6c 31 20 2b 20 35 20 46 52 4f 4d 20 74   col1 + 5 FROM t
32430 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
32440 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
32450 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
32460 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
32470 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39 39 0d 0a  ort label-1399..
32480 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
32490 2b 20 37 30 20 2f 20 63 6f 6c 31 20 2b 20 35 20  + 70 / col1 + 5 
324a0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
324b0 2d 2d 2d 2d 0d 0a 35 0d 0a 0d 0a 71 75 65 72 79  ----..5....query
324c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
324d0 43 54 20 2d 20 39 38 20 41 53 20 63 6f 6c 32 20  CT - 98 AS col2 
324e0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
324f0 2d 2d 2d 2d 0d 0a 2d 39 38 0d 0a 2d 39 38 0d 0a  ----..-98..-98..
32500 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -98....query I r
32510 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
32520 4c 4c 20 2d 20 2b 20 35 39 20 2b 20 63 6f 6c 32  LL - + 59 + col2
32530 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
32540 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d  r0..----..-21..-
32550 33 32 0d 0a 2d 33 33 0d 0a 0d 0a 71 75 65 72 79  32..-33....query
32560 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32570 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  CT - col2 + - co
32580 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
32590 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
325a0 0a 2d 31 30 38 0d 0a 2d 31 31 34 0d 0a 2d 31 39  .-108..-114..-19
325b0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
325c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
325d0 54 49 4e 43 54 20 2d 20 2b 20 34 36 20 2a 20 63  TINCT - + 46 * c
325e0 6f 6c 32 20 2d 20 2b 20 32 20 46 52 4f 4d 20 74  ol2 - + 2 FROM t
325f0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
32600 2d 0d 0a 2d 32 34 38 36 0d 0a 2d 32 36 32 34 0d  -..-2486..-2624.
32610 0a 2d 34 34 31 38 0d 0a 0d 0a 71 75 65 72 79 20  .-4418....query 
32620 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32630 54 20 28 20 31 34 20 29 20 46 52 4f 4d 20 74 61  T ( 14 ) FROM ta
32640 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 34  b0..----..14..14
32650 0d 0a 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..14....query I 
32660 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32670 2d 20 2b 20 39 38 20 41 53 20 63 6f 6c 32 20 46  - + 98 AS col2 F
32680 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 2c 20  ROM tab2, tab0, 
32690 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
326a0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  b1..----..81 val
326b0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62  ues hashing to b
326c0 36 61 33 63 39 65 65 61 32 36 63 33 37 35 39 65  6a3c9eea26c3759e
326d0 36 34 31 37 64 37 35 66 33 38 32 35 38 64 31 0d  6417d75f38258d1.
326e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
326f0 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 74  rt..SELECT ( + t
32700 61 62 31 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  ab1.col0 * col1 
32710 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
32720 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38  -..1040..640..78
32730 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32740 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 31  ort..SELECT tab1
32750 2e 63 6f 6c 31 20 2a 20 33 34 20 41 53 20 63 6f  .col1 * 34 AS co
32760 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
32770 2d 2d 0d 0a 33 34 30 0d 0a 34 34 32 0d 0a 38 38  --..340..442..88
32780 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
32790 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
327a0 54 49 4e 43 54 20 2d 20 28 20 63 6f 72 30 2e 63  TINCT - ( cor0.c
327b0 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63  ol1 ) * + cor0.c
327c0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
327d0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
327e0 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37  ---..-1343..-217
327f0 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79  ..-4602....query
32800 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32810 43 54 20 2d 20 38 37 20 2a 20 2b 20 63 6f 6c 30  CT - 87 * + col0
32820 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
32830 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
32840 0d 0a 2d 32 36 31 0d 0a 2d 35 35 36 38 0d 0a 2d  ..-261..-5568..-
32850 36 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6960....query I 
32860 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32870 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72  + + col0 * - cor
32880 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  0.col2 + col2 * 
32890 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  - col1 AS col1 F
328a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
328b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 31  ..----..-132..-1
328c0 34 37 36 30 0d 0a 2d 33 36 33 30 0d 0a 0d 0a 71  4760..-3630....q
328d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
328e0 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e  SELECT - - cor0.
328f0 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 41 53  col2 - + col0 AS
32900 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
32910 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
32920 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71 75 65  7..16..51....que
32930 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32940 4c 45 43 54 20 35 35 20 2d 20 63 6f 6c 30 20 41  LECT 55 - col0 A
32950 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
32960 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32970 2d 32 35 0d 0a 2d 39 0d 0a 35 32 0d 0a 0d 0a 71  -25..-9..52....q
32980 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32990 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 33 35 20  SELECT + ( + 35 
329a0 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) * col0 FROM ta
329b0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a  b0..----..1225..
329c0 33 31 31 35 0d 0a 38 34 30 0d 0a 0d 0a 71 75 65  3115..840....que
329d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
329e0 4c 45 43 54 20 37 20 2b 20 2b 20 74 61 62 30 2e  LECT 7 + + tab0.
329f0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
32a00 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31  M tab0..----..31
32a10 0d 0a 34 32 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  ..42..96....quer
32a20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32a30 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d  ECT DISTINCT ( -
32a40 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20 2a   col2 ) + col1 *
32a50 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20   - ( + col1 ) * 
32a60 2d 20 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d  - tab2.col1 FROM
32a70 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35   tab2..----..205
32a80 33 35 33 0d 0a 32 39 37 36 34 0d 0a 34 38 37 35  353..29764..4875
32a90 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
32aa0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
32ab0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
32ac0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
32ad0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
32ae0 31 34 31 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  1416..SELECT DIS
32af0 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 32 39  TINCT - CAST( 29
32b00 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
32b10 6f 6c 32 20 44 49 56 20 2b 20 28 20 28 20 2d 20  ol2 DIV + ( ( - 
32b20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30 20 29 20  col1 ) * col0 ) 
32b30 2b 20 2b 20 63 6f 6c 30 20 2b 20 74 61 62 30 2e  + + col0 + tab0.
32b40 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
32b50 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a  ----..110..132..
32b60 31 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  180....skipif my
32b70 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
32b80 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
32b90 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 36  wsort label-1416
32ba0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
32bb0 54 20 2d 20 43 41 53 54 20 28 20 32 39 20 41 53  T - CAST ( 29 AS
32bc0 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c   INTEGER ) * col
32bd0 32 20 2f 20 2b 20 28 20 28 20 2d 20 63 6f 6c 31  2 / + ( ( - col1
32be0 20 29 20 2a 20 63 6f 6c 30 20 29 20 2b 20 2b 20   ) * col0 ) + + 
32bf0 63 6f 6c 30 20 2b 20 74 61 62 30 2e 63 6f 6c 31  col0 + tab0.col1
32c00 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
32c10 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d  ..110..132..180.
32c20 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
32c30 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
32c40 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
32c50 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
32c60 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
32c70 34 31 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  417..SELECT ALL 
32c80 2d 20 28 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20  - ( + tab0.col0 
32c90 29 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  ) + + col0 + col
32ca0 31 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f  1 DIV col0 AS co
32cb0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
32cc0 2d 2d 0d 0a 31 0d 0a 32 0d 0a 33 0d 0a 0d 0a 73  --..1..2..3....s
32cd0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
32ce0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
32cf0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
32d00 62 65 6c 2d 31 34 31 37 0d 0a 53 45 4c 45 43 54  bel-1417..SELECT
32d10 20 41 4c 4c 20 2d 20 28 20 2b 20 74 61 62 30 2e   ALL - ( + tab0.
32d20 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c 30 20  col0 ) + + col0 
32d30 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 41 53  + col1 / col0 AS
32d40 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
32d50 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 33 0d 0a  .----..1..2..3..
32d60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32d70 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
32d80 43 54 20 35 33 20 2b 20 2b 20 63 6f 6c 32 20 2a  CT 53 + + col2 *
32d90 20 2d 20 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63   - col0 + tab1.c
32da0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
32db0 2d 2d 2d 0d 0a 2d 33 35 38 35 0d 0a 2d 37 36 31  ---..-3585..-761
32dc0 34 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20  4..-83....query 
32dd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32de0 54 20 32 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20  T 22 * col0 * - 
32df0 63 6f 6c 32 20 2d 20 37 35 20 2a 20 2b 20 63 6f  col2 - 75 * + co
32e00 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
32e10 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
32e20 0a 2d 34 36 35 36 36 0d 0a 2d 36 31 38 33 0d 0a  .-46566..-6183..
32e30 2d 36 38 38 39 34 0d 0a 0d 0a 71 75 65 72 79 20  -68894....query 
32e40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32e50 54 20 2b 20 2b 20 36 33 20 2a 20 63 6f 6c 30 20  T + + 63 * col0 
32e60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
32e70 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  1 cor0..----..18
32e80 39 0d 0a 34 30 33 32 0d 0a 35 30 34 30 0d 0a 0d  9..4032..5040...
32e90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32ea0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
32eb0 54 20 2b 20 63 6f 6c 30 20 2b 20 36 31 20 2b 20  T + col0 + 61 + 
32ec0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
32ed0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32ee0 31 33 35 0d 0a 31 35 34 0d 0a 39 30 0d 0a 0d 0a  135..154..90....
32ef0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32f00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
32f10 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 28 20 35 37   + col2 * + ( 57
32f20 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
32f30 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
32f40 2d 2d 0d 0a 31 38 38 31 0d 0a 34 36 37 34 0d 0a  --..1881..4674..
32f50 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  57....onlyif mys
32f60 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
32f70 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
32f80 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
32f90 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
32fa0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
32fb0 34 32 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  423..SELECT + - 
32fc0 63 6f 6c 32 20 2b 20 43 41 53 54 28 20 37 30 20  col2 + CAST( 70 
32fd0 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
32fe0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
32ff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   cor0..----..-26
33000 0d 0a 31 33 0d 0a 31 36 0d 0a 0d 0a 73 6b 69 70  ..13..16....skip
33010 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
33020 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
33030 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
33040 2d 31 34 32 33 0d 0a 53 45 4c 45 43 54 20 2b 20  -1423..SELECT + 
33050 2d 20 63 6f 6c 32 20 2b 20 43 41 53 54 20 28 20  - col2 + CAST ( 
33060 37 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  70 AS INTEGER ) 
33070 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
33080 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
33090 0a 2d 32 36 0d 0a 31 33 0d 0a 31 36 0d 0a 0d 0a  .-26..13..16....
330a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
330b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
330c0 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 35 39 20 46   - col0 * - 59 F
330d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
330e0 0d 0a 2d 2d 2d 2d 0d 0a 34 31 33 0d 0a 34 36 30  ..----..413..460
330f0 32 0d 0a 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79  2..4661....query
33100 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33110 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
33120 20 2a 20 2d 20 28 20 63 6f 6c 31 20 29 20 2b 20   * - ( col1 ) + 
33130 2b 20 63 6f 6c 32 20 2b 20 2b 20 32 36 20 41 53  + col2 + + 26 AS
33140 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
33150 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
33160 32 37 37 39 0d 0a 2d 37 30 0d 0a 2d 37 33 35 34  2779..-70..-7354
33170 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33180 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
33190 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  - col2 * + col2 
331a0 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  + col1 * - col0 
331b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
331c0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  2 cor0..----..-2
331d0 37 38 37 0d 0a 2d 35 32 37 38 0d 0a 2d 39 34 36  787..-5278..-946
331e0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
331f0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
33200 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
33210 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
33220 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
33230 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32  owsort label-142
33240 37 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 32  7..SELECT ( col2
33250 20 29 20 2d 20 2b 20 43 41 53 54 28 20 2d 20 63   ) - + CAST( - c
33260 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol0 AS SIGNED ) 
33270 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
33280 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d  .121..176..57...
33290 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
332a0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
332b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
332c0 6c 61 62 65 6c 2d 31 34 32 37 0d 0a 53 45 4c 45  label-1427..SELE
332d0 43 54 20 28 20 63 6f 6c 32 20 29 20 2d 20 2b 20  CT ( col2 ) - + 
332e0 43 41 53 54 20 28 20 2d 20 63 6f 6c 30 20 41 53  CAST ( - col0 AS
332f0 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
33300 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d  tab1..----..121.
33310 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70  .176..57....skip
33320 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
33330 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
33340 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
33350 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
33360 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
33370 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
33380 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c  TINCT col1 + col
33390 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0 col2 FROM tab0
333a0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32  ..----..110..132
333b0 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..180....query I
333c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
333d0 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   - - col2 * col1
333e0 20 2b 20 32 35 20 41 53 20 63 6f 6c 30 20 46 52   + 25 AS col0 FR
333f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
33400 0a 2d 2d 2d 2d 0d 0a 31 35 35 39 0d 0a 36 37 31  .----..1559..671
33410 0d 0a 38 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..862....query I
33420 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33430 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 33 20 41 53   + col2 * - 3 AS
33440 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
33450 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
33460 31 36 32 0d 0a 2d 31 37 31 0d 0a 2d 32 38 38 0d  162..-171..-288.
33470 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33480 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
33490 31 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  1 + col2 * col0 
334a0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
334b0 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 37 0d 0a 32  2..----..2087..2
334c0 32 30 0d 0a 33 30 31 39 0d 0a 0d 0a 71 75 65 72  20..3019....quer
334d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
334e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
334f0 6f 6c 30 20 2a 20 2b 20 33 30 20 46 52 4f 4d 20  ol0 * + 30 FROM 
33500 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 30  tab1..----..1920
33510 0d 0a 32 34 30 30 0d 0a 39 30 0d 0a 0d 0a 6f 6e  ..2400..90....on
33520 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
33530 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
33540 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
33550 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
33560 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 33 0d 0a  ort label-1433..
33570 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
33580 28 20 28 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ( ( + tab1.col0 
33590 29 20 29 20 2b 20 39 34 20 2b 20 2b 20 34 35 20  ) ) + 94 + + 45 
335a0 44 49 56 20 74 61 62 31 2e 63 6f 6c 32 20 46 52  DIV tab1.col2 FR
335b0 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
335c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38   cor0..----..158
335d0 0d 0a 31 37 34 0d 0a 39 37 0d 0a 0d 0a 73 6b 69  ..174..97....ski
335e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
335f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
33600 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
33610 6c 2d 31 34 33 33 0d 0a 53 45 4c 45 43 54 20 44  l-1433..SELECT D
33620 49 53 54 49 4e 43 54 20 28 20 28 20 2b 20 74 61  ISTINCT ( ( + ta
33630 62 31 2e 63 6f 6c 30 20 29 20 29 20 2b 20 39 34  b1.col0 ) ) + 94
33640 20 2b 20 2b 20 34 35 20 2f 20 74 61 62 31 2e 63   + + 45 / tab1.c
33650 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
33660 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
33670 2d 0d 0a 31 35 38 0d 0a 31 37 34 0d 0a 39 37 0d  -..158..174..97.
33680 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33690 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 34  rt..SELECT + - 4
336a0 37 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  7 * - col2 FROM 
336b0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
336c0 2d 2d 0d 0a 31 32 32 32 0d 0a 31 32 36 39 0d 0a  --..1222..1269..
336d0 31 37 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1786....query I 
336e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
336f0 2b 20 63 6f 6c 32 20 2a 20 2d 20 39 39 20 41 53  + col2 * - 99 AS
33700 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
33710 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 36  cor0..----..-326
33720 37 0d 0a 2d 38 31 31 38 0d 0a 2d 39 39 0d 0a 0d  7..-8118..-99...
33730 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
33740 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
33750 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
33760 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
33770 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
33780 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 36 0d 0a  ort label-1436..
33790 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
337a0 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  - col1 * - col0 
337b0 2a 20 2b 20 63 6f 6c 30 20 2b 20 43 41 53 54 28  * + col0 + CAST(
337c0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
337d0 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
337e0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
337f0 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
33800 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
33810 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
33820 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
33830 31 34 33 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  1436..SELECT DIS
33840 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d  TINCT - col1 * -
33850 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b   col0 * + col0 +
33860 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
33870 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
33880 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
33890 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
338a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
338b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
338c0 4e 43 54 20 2d 20 2d 20 38 33 20 2b 20 35 35 20  NCT - - 83 + 55 
338d0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
338e0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 0d 0a 0d 0a  0..----..138....
338f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33900 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
33910 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20  ( cor0.col2 ) + 
33920 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
33930 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33940 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71  -33..-4..21....q
33950 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33960 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31  SELECT cor0.col1
33970 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
33980 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
33990 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a  ----..110..132..
339a0 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  180....query I r
339b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
339c0 20 63 6f 6c 32 20 2a 20 35 20 41 53 20 63 6f 6c   col2 * 5 AS col
339d0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
339e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 30 0d  or0..----..-270.
339f0 0a 2d 32 38 35 0d 0a 2d 34 38 30 0d 0a 0d 0a 71  .-285..-480....q
33a00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33a10 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
33a20 2b 20 28 20 2d 20 38 34 20 29 20 2a 20 63 6f 6c  + ( - 84 ) * col
33a30 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
33a40 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 33 37 36 30  ab1..----..53760
33a50 0d 0a 36 35 35 32 0d 0a 38 37 33 36 30 0d 0a 0d  ..6552..87360...
33a60 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
33a70 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
33a80 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
33a90 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
33aa0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
33ab0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34 32 0d 0a  ort label-1442..
33ac0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
33ad0 2d 20 2b 20 28 20 2b 20 36 31 20 29 20 2b 20 63  - + ( + 61 ) + c
33ae0 6f 6c 31 20 2f 20 43 41 53 54 28 20 4e 55 4c 4c  ol1 / CAST( NULL
33af0 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
33b00 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
33b10 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
33b20 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
33b30 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
33b40 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
33b50 65 6c 2d 31 34 34 32 0d 0a 53 45 4c 45 43 54 20  el-1442..SELECT 
33b60 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 28 20 2b  DISTINCT - + ( +
33b70 20 36 31 20 29 20 2b 20 63 6f 6c 31 20 2f 20 43   61 ) + col1 / C
33b80 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
33b90 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
33ba0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
33bb0 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
33bc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33bd0 20 2d 20 31 30 20 41 53 20 63 6f 6c 30 20 46 52   - 10 AS col0 FR
33be0 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
33bf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
33c00 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
33c10 20 66 36 38 66 33 33 30 33 32 38 34 36 65 32 31   f68f33032846e21
33c20 65 65 36 62 32 63 36 36 38 66 63 31 30 33 35 35  ee6b2c668fc10355
33c30 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  e....query I row
33c40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37  sort..SELECT + 7
33c50 33 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  3 * cor0.col2 FR
33c60 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 63 6f  OM tab2, tab2 co
33c70 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  r0, tab2 AS cor1
33c80 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
33c90 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 64 35  s hashing to fd5
33ca0 61 63 34 30 64 34 37 36 32 39 65 33 37 61 62 31  ac40d47629e37ab1
33cb0 61 64 62 64 37 64 66 33 63 37 32 39 31 0d 0a 0d  adbd7df3c7291...
33cc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33cd0 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 72 30 2e  ..SELECT ( cor0.
33ce0 63 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 72 31 2e  col0 ) * - cor1.
33cf0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
33d00 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
33d10 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  N tab2 AS cor1..
33d20 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
33d30 61 73 68 69 6e 67 20 74 6f 20 30 36 66 31 61 61  ashing to 06f1aa
33d40 36 35 38 33 39 63 31 62 66 63 38 35 38 31 35 38  65839c1bfc858158
33d50 30 62 61 63 64 62 36 37 38 37 0d 0a 0d 0a 6f 6e  0bacdb6787....on
33d60 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
33d70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
33d80 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
33d90 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
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 34 34 36 0d 0a 53 45 4c   label-1446..SEL
33dc0 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  ECT CAST( NULL A
33dd0 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
33de0 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
33df0 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b1 AS cor0, tab2
33e00 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
33e10 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
33e20 67 20 74 6f 20 31 36 62 65 38 38 36 38 61 31 65  g to 16be8868a1e
33e30 36 66 34 65 38 38 35 30 35 30 39 66 39 33 32 37  6f4e8850509f9327
33e40 61 66 65 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  afe90....skipif 
33e50 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
33e60 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
33e70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
33e80 34 36 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20  46..SELECT CAST 
33e90 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
33ea0 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  R ) AS col1 FROM
33eb0 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
33ec0 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
33ed0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
33ee0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 36  es hashing to 16
33ef0 62 65 38 38 36 38 61 31 65 36 66 34 65 38 38 35  be8868a1e6f4e885
33f00 30 35 30 39 66 39 33 32 37 61 66 65 39 30 0d 0a  0509f9327afe90..
33f10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33f20 74 0d 0a 53 45 4c 45 43 54 20 37 35 20 2a 20 63  t..SELECT 75 * c
33f30 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
33f40 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
33f50 2d 2d 2d 0d 0a 31 38 30 30 0d 0a 32 36 32 35 0d  ---..1800..2625.
33f60 0a 36 36 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .6675....query I
33f70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33f80 20 44 49 53 54 49 4e 43 54 20 2b 20 31 35 20 46   DISTINCT + 15 F
33f90 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20  ROM tab1, tab2, 
33fa0 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61  tab1 AS cor0, ta
33fb0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 0d 0a  b0..----..15....
33fc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33fd0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
33fe0 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   - col1 + - col0
33ff0 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   * cor0.col2 AS 
34000 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
34010 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
34020 33 32 0d 0a 2d 31 34 37 36 30 0d 0a 2d 33 36 33  32..-14760..-363
34030 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
34040 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
34050 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
34060 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
34070 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
34080 2d 31 34 35 30 0d 0a 53 45 4c 45 43 54 20 63 6f  -1450..SELECT co
34090 6c 30 20 44 49 56 20 63 6f 6c 30 20 63 6f 6c 31  l0 DIV col0 col1
340a0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
340b0 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..1..1..1....ski
340c0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
340d0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
340e0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
340f0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
34100 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
34110 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
34120 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
34130 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 30 0d  sort label-1450.
34140 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20 63  .SELECT col0 / c
34150 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
34160 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a  b2..----..1..1..
34170 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
34180 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
34190 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
341a0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
341b0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
341c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
341d0 35 31 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28  51..SELECT CAST(
341e0 20 2b 20 31 35 20 41 53 20 53 49 47 4e 45 44 20   + 15 AS SIGNED 
341f0 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
34200 2d 0d 0a 31 35 0d 0a 31 35 0d 0a 31 35 0d 0a 0d  -..15..15..15...
34210 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
34220 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
34230 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
34240 6c 61 62 65 6c 2d 31 34 35 31 0d 0a 53 45 4c 45  label-1451..SELE
34250 43 54 20 43 41 53 54 20 28 20 2b 20 31 35 20 41  CT CAST ( + 15 A
34260 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
34270 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d   tab0..----..15.
34280 0a 31 35 0d 0a 31 35 0d 0a 0d 0a 71 75 65 72 79  .15..15....query
34290 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
342a0 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20  CT DISTINCT ( + 
342b0 35 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 2b  5 ) * + col0 - +
342c0 20 28 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d   ( + col0 ) FROM
342d0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d   tab1..----..12.
342e0 0a 32 35 36 0d 0a 33 32 30 0d 0a 0d 0a 6f 6e 6c  .256..320....onl
342f0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
34300 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
34310 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
34320 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
34330 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
34340 6c 61 62 65 6c 2d 31 34 35 33 0d 0a 53 45 4c 45  label-1453..SELE
34350 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53  CT CAST( NULL AS
34360 20 53 49 47 4e 45 44 20 29 20 2f 20 2b 20 63 6f   SIGNED ) / + co
34370 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
34380 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab0..----..NULL
34390 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
343a0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
343b0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
343c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
343d0 61 62 65 6c 2d 31 34 35 33 0d 0a 53 45 4c 45 43  abel-1453..SELEC
343e0 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  T CAST ( NULL AS
343f0 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2b 20 63   INTEGER ) / + c
34400 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
34410 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab0..----..NUL
34420 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
34430 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34440 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e  ..SELECT + tab0.
34450 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20  col2 * col0 + + 
34460 74 61 62 30 2e 63 6f 6c 30 20 2d 20 2b 20 38 32  tab0.col0 - + 82
34470 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
34480 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 37  b0..----..-12..7
34490 33 30 35 0d 0a 37 33 34 0d 0a 0d 0a 71 75 65 72  305..734....quer
344a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
344b0 45 43 54 20 41 4c 4c 20 32 39 20 2a 20 63 6f 6c  ECT ALL 29 * col
344c0 32 20 2b 20 30 20 41 53 20 63 6f 6c 30 20 46 52  2 + 0 AS col0 FR
344d0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
344e0 33 37 38 0d 0a 32 39 0d 0a 39 35 37 0d 0a 0d 0a  378..29..957....
344f0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
34500 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
34510 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
34520 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
34530 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 36  wsort label-1456
34540 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
34550 30 20 44 49 56 20 63 6f 6c 30 20 2b 20 32 32 20  0 DIV col0 + 22 
34560 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  + - col1 * col0 
34570 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
34580 0a 2d 32 30 34 31 0d 0a 2d 33 33 37 32 0d 0a 2d  .-2041..-3372..-
34590 38 30 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  8076....skipif m
345a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
345b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
345c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35  owsort label-145
345d0 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  6..SELECT ALL co
345e0 6c 30 20 2f 20 63 6f 6c 30 20 2b 20 32 32 20 2b  l0 / col0 + 22 +
345f0 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46   - col1 * col0 F
34600 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
34610 2d 32 30 34 31 0d 0a 2d 33 33 37 32 0d 0a 2d 38  -2041..-3372..-8
34620 30 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  076....query I r
34630 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
34640 49 53 54 49 4e 43 54 20 2b 20 74 61 62 30 2e 63  ISTINCT + tab0.c
34650 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  ol1 + + col0 * c
34660 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
34670 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32   tab0..----..132
34680 32 0d 0a 36 36 32 0d 0a 38 30 31 32 0d 0a 0d 0a  2..662..8012....
34690 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
346a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31 38 20 2b  .SELECT ALL 18 +
346b0 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   - col0 AS col2 
346c0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
346d0 0a 2d 34 36 0d 0a 2d 36 32 0d 0a 31 35 0d 0a 0d  .-46..-62..15...
346e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
346f0 0d 0a 53 45 4c 45 43 54 20 2d 20 35 32 20 2a 20  ..SELECT - 52 * 
34700 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
34710 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
34720 2d 2d 2d 2d 0d 0a 2d 31 33 35 32 0d 0a 2d 35 32  ----..-1352..-52
34730 30 0d 0a 2d 36 37 36 0d 0a 0d 0a 71 75 65 72 79  0..-676....query
34740 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34750 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
34760 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l1 + + cor0.col1
34770 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
34780 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
34790 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
347a0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
347b0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
347c0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
347d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
347e0 65 6c 2d 31 34 36 31 0d 0a 53 45 4c 45 43 54 20  el-1461..SELECT 
347f0 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 44 49  DISTINCT col1 DI
34800 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  V + cor0.col2 + 
34810 2b 20 32 36 20 46 52 4f 4d 20 74 61 62 30 20 63  + 26 FROM tab0 c
34820 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 0d 0a  or0..----..123..
34830 32 37 0d 0a 32 38 0d 0a 0d 0a 73 6b 69 70 69 66  27..28....skipif
34840 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
34850 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
34860 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
34870 34 36 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  461..SELECT DIST
34880 49 4e 43 54 20 63 6f 6c 31 20 2f 20 2b 20 63 6f  INCT col1 / + co
34890 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 32 36 20 46  r0.col2 + + 26 F
348a0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
348b0 2d 2d 2d 0d 0a 31 32 33 0d 0a 32 37 0d 0a 32 38  ---..123..27..28
348c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
348d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
348e0 2b 20 2b 20 33 37 20 2a 20 2d 20 63 6f 6c 31 20  + + 37 * - col1 
348f0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
34900 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 30 0d 0a 2d  0..----..-370..-
34910 34 38 31 0d 0a 2d 39 36 32 0d 0a 0d 0a 71 75 65  481..-962....que
34920 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34930 4c 45 43 54 20 63 6f 6c 30 20 2b 20 37 31 20 46  LECT col0 + 71 F
34940 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
34950 31 34 39 0d 0a 31 35 30 0d 0a 37 38 0d 0a 0d 0a  149..150..78....
34960 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34970 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d  .SELECT col2 * -
34980 20 35 35 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 30   55 + + ( + col0
34990 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
349a0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35  tab2..----..-135
349b0 32 0d 0a 2d 31 34 37 38 0d 0a 2d 32 30 31 31 0d  2..-1478..-2011.
349c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
349d0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
349e0 6f 6c 30 20 2a 20 36 39 20 46 52 4f 4d 20 74 61  ol0 * 69 FROM ta
349f0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
34a00 0d 0a 2d 31 36 35 36 0d 0a 2d 32 34 31 35 0d 0a  ..-1656..-2415..
34a10 2d 36 31 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -6141....query I
34a20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34a30 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
34a40 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l2 FROM tab2, ta
34a50 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b0 AS cor0, tab2
34a60 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
34a70 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
34a80 6f 20 39 66 63 31 64 63 64 37 36 66 65 61 66 34  o 9fc1dcd76feaf4
34a90 33 65 35 63 35 64 63 30 36 30 61 30 32 30 31 34  3e5c5dc060a02014
34aa0 63 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  cd....query I ro
34ab0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
34ac0 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c  + ( col2 ) + col
34ad0 30 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  0 * + col1 * col
34ae0 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
34af0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 32 36 0d 0a  ..----..118826..
34b00 34 39 35 36 39 0d 0a 37 32 30 38 39 33 0d 0a 0d  49569..720893...
34b10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34b20 0d 0a 53 45 4c 45 43 54 20 2d 20 35 31 20 41 53  ..SELECT - 51 AS
34b30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
34b40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d  cor0..----..-51.
34b50 0a 2d 35 31 0d 0a 2d 35 31 0d 0a 0d 0a 71 75 65  .-51..-51....que
34b60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34b70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
34b80 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  + cor0.col0 * + 
34b90 28 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  ( + col0 * + col
34ba0 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  0 ) FROM tab0 AS
34bb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
34bc0 38 32 34 0d 0a 2d 34 32 38 37 35 0d 0a 2d 37 30  824..-42875..-70
34bd0 34 39 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4969....query I 
34be0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34bf0 44 49 53 54 49 4e 43 54 20 33 30 20 41 53 20 63  DISTINCT 30 AS c
34c00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
34c10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 0d   cor0..----..30.
34c20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34c30 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 32 20  rt..SELECT + 22 
34c40 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  * cor0.col2 AS c
34c50 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
34c60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 30   cor0..----..180
34c70 34 0d 0a 32 32 0d 0a 37 32 36 0d 0a 0d 0a 71 75  4..22..726....qu
34c80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34c90 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b  ELECT + col2 * +
34ca0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63   col0 * - cor0.c
34cb0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
34cc0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
34cd0 2d 2d 2d 0d 0a 2d 32 33 33 34 37 32 0d 0a 2d 34  ---..-233472..-4
34ce0 38 36 0d 0a 2d 36 31 34 34 30 30 0d 0a 0d 0a 73  86..-614400....s
34cf0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
34d00 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
34d10 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
34d20 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
34d30 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
34d40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34d50 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ALL - - cor0.col
34d60 32 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29  2 * + ( - col0 )
34d70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
34d80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
34d90 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38  162..-3648..-768
34da0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
34db0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
34dc0 20 2d 20 31 39 20 29 20 41 53 20 63 6f 6c 32 20   - 19 ) AS col2 
34dd0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
34de0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a 31 39 0d  0..----..19..19.
34df0 0a 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .19....query I r
34e00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
34e10 49 53 54 49 4e 43 54 20 2b 20 37 33 20 41 53 20  ISTINCT + 73 AS 
34e20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
34e30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  S cor0..----..73
34e40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34e50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
34e60 2b 20 2d 20 63 6f 6c 32 20 2a 20 36 37 20 46 52  + - col2 * 67 FR
34e70 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
34e80 0a 2d 2d 2d 2d 0d 0a 2d 32 32 31 31 0d 0a 2d 35  .----..-2211..-5
34e90 34 39 34 0d 0a 2d 36 37 0d 0a 0d 0a 71 75 65 72  494..-67....quer
34ea0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34eb0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33  ECT DISTINCT + 3
34ec0 33 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  3 + + col1 AS co
34ed0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
34ee0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 32  0..----..119..12
34ef0 34 0d 0a 31 33 30 0d 0a 0d 0a 73 6b 69 70 69 66  4..130....skipif
34f00 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
34f10 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
34f20 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
34f30 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
34f40 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
34f50 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
34f60 20 2d 20 28 20 63 6f 6c 32 20 29 20 63 6f 6c 31   - ( col2 ) col1
34f70 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
34f80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33  r0..----..-1..-3
34f90 33 0d 0a 2d 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  3..-82....onlyif
34fa0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
34fb0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
34fc0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
34fd0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
34fe0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
34ff0 65 6c 2d 31 34 37 39 0d 0a 53 45 4c 45 43 54 20  el-1479..SELECT 
35000 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28  DISTINCT - CAST(
35010 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
35020 29 20 2b 20 35 30 20 2a 20 2b 20 63 6f 6c 30 20  ) + 50 * + col0 
35030 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
35040 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
35050 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
35060 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
35070 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
35080 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
35090 37 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  79..SELECT DISTI
350a0 4e 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  NCT - CAST ( NUL
350b0 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  L AS INTEGER ) +
350c0 20 35 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20   50 * + col0 AS 
350d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
350e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
350f0 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  LL....onlyif mys
35100 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
35110 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
35120 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
35130 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
35140 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
35150 34 38 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  480..SELECT ALL 
35160 2d 20 43 41 53 54 28 20 2d 20 36 37 20 41 53 20  - CAST( - 67 AS 
35170 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 32 20  SIGNED ) * col2 
35180 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
35190 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
351a0 0a 31 37 34 32 0d 0a 31 38 30 39 0d 0a 32 35 34  .1742..1809..254
351b0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
351c0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
351d0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
351e0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 30 0d 0a  ort label-1480..
351f0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53  SELECT ALL - CAS
35200 54 20 28 20 2d 20 36 37 20 41 53 20 49 4e 54 45  T ( - 67 AS INTE
35210 47 45 52 20 29 20 2a 20 63 6f 6c 32 20 41 53 20  GER ) * col2 AS 
35220 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
35230 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
35240 34 32 0d 0a 31 38 30 39 0d 0a 32 35 34 36 0d 0a  42..1809..2546..
35250 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
35260 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
35270 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
35280 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
35290 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
352a0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 31 0d  sort label-1481.
352b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
352c0 20 2b 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53   + CAST( col2 AS
352d0 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30   SIGNED ) + col0
352e0 20 2a 20 2d 20 38 38 20 2b 20 63 6f 72 30 2e 63   * - 88 + cor0.c
352f0 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol0 * cor0.col1 
35300 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
35310 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d  0..----..-132..-
35320 34 39 33 35 0d 0a 2d 35 39 30 34 0d 0a 0d 0a 73  4935..-5904....s
35330 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
35340 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
35350 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
35360 62 65 6c 2d 31 34 38 31 0d 0a 53 45 4c 45 43 54  bel-1481..SELECT
35370 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53 54   DISTINCT + CAST
35380 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   ( col2 AS INTEG
35390 45 52 20 29 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  ER ) + col0 * - 
353a0 38 38 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  88 + cor0.col0 *
353b0 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
353c0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
353d0 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 34 39 33 35 0d  --..-132..-4935.
353e0 0a 2d 35 39 30 34 0d 0a 0d 0a 71 75 65 72 79 20  .-5904....query 
353f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35400 54 20 2b 20 2b 20 37 32 20 41 53 20 63 6f 6c 32  T + + 72 AS col2
35410 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
35420 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 32 0d 0a 37 32  r0..----..72..72
35430 0d 0a 37 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..72....skipif m
35440 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
35450 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
35460 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
35470 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 63  ISTINCT CAST ( c
35480 6f 6c 32 20 41 53 20 52 45 41 4c 20 29 20 2b 20  ol2 AS REAL ) + 
35490 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  - cor0.col0 FROM
354a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
354b0 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d 0a 32  ---..-41..-52..2
354c0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
354d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
354e0 20 2b 20 32 20 2a 20 63 6f 6c 32 20 41 53 20 63   + 2 * col2 AS c
354f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
35500 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38   cor0..----..108
35510 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d 0a 73 6b  ..114..192....sk
35520 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
35530 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
35540 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
35550 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
35560 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
35570 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
35580 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  LL + cor0.col1 *
35590 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   + col0 * - col2
355a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
355b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
355c0 31 31 39 36 35 32 0d 0a 2d 35 31 30 33 34 0d 0a  119652..-51034..
355d0 2d 35 38 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -5859....onlyif 
355e0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
355f0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
35600 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
35610 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
35620 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
35630 6c 2d 31 34 38 36 0d 0a 53 45 4c 45 43 54 20 2d  l-1486..SELECT -
35640 20 32 39 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 43   29 * + col0 * C
35650 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
35660 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52  NED ) AS col2 FR
35670 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
35680 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
35690 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
356a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
356b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
356c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
356d0 31 34 38 36 0d 0a 53 45 4c 45 43 54 20 2d 20 32  1486..SELECT - 2
356e0 39 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 43 41 53  9 * + col0 * CAS
356f0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
35700 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52  GER ) AS col2 FR
35710 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
35720 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
35730 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  L..NULL....onlyi
35740 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
35750 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
35760 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
35770 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35780 20 6c 61 62 65 6c 2d 31 34 38 37 0d 0a 53 45 4c   label-1487..SEL
35790 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ECT + + cor0.col
357a0 30 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63 6f  0 DIV col2 AS co
357b0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
357c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
357d0 0d 0a 33 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..35....skipif m
357e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
357f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
35800 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38  owsort label-148
35810 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  7..SELECT + + co
35820 72 30 2e 63 6f 6c 30 20 2f 20 63 6f 6c 32 20 41  r0.col0 / col2 A
35830 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
35840 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35850 30 0d 0a 31 0d 0a 33 35 0d 0a 0d 0a 73 6b 69 70  0..1..35....skip
35860 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
35870 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
35880 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
35890 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
358a0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
358b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38  sort..SELECT + 8
358c0 39 20 2b 20 2d 20 63 6f 6c 32 20 63 6f 6c 31 20  9 + - col2 col1 
358d0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
358e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 33 32 0d  0..----..-7..32.
358f0 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .35....query I r
35900 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
35910 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63 6f  ISTINCT - ( + co
35920 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41 53  l0 ) * - col1 AS
35930 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
35940 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
35950 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
35960 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
35970 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
35980 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
35990 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
359a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
359b0 34 39 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  490..SELECT ALL 
359c0 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  + col1 * + col0 
359d0 2b 20 2d 20 63 6f 6c 31 20 44 49 56 20 2b 20 63  + - col1 DIV + c
359e0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
359f0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
35a00 0d 0a 31 33 34 32 0d 0a 32 31 36 0d 0a 34 36 30  ..1342..216..460
35a10 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
35a20 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
35a30 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
35a40 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 30 0d 0a  ort label-1490..
35a50 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
35a60 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  1 * + col0 + - c
35a70 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20  ol1 / + col1 AS 
35a80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
35a90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 32 0d  or0..----..1342.
35aa0 0a 32 31 36 0d 0a 34 36 30 31 0d 0a 0d 0a 6f 6e  .216..4601....on
35ab0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
35ac0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
35ad0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
35ae0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
35af0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 31 0d 0a  ort label-1491..
35b00 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
35b10 30 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  0 + col1 * - col
35b20 32 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 28  2 + col1 DIV + (
35b30 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
35b40 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
35b50 0a 2d 32 38 31 33 0d 0a 2d 36 31 0d 0a 2d 37 33  .-2813..-61..-73
35b60 37 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  72....skipif mys
35b70 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
35b80 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
35b90 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 31 0d  sort label-1491.
35ba0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
35bb0 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  l0 + col1 * - co
35bc0 6c 32 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 28 20  l2 + col1 / + ( 
35bd0 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30  col1 ) FROM tab0
35be0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35bf0 2d 32 38 31 33 0d 0a 2d 36 31 0d 0a 2d 37 33 37  -2813..-61..-737
35c00 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
35c10 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
35c20 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
35c30 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
35c40 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
35c50 2d 31 34 39 32 0d 0a 53 45 4c 45 43 54 20 41 4c  -1492..SELECT AL
35c60 4c 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d  L - + col2 DIV -
35c70 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 46   col0 + + col0 F
35c80 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
35c90 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 37 38 0d 0a  ..----..10..78..
35ca0 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  79....skipif mys
35cb0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
35cc0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
35cd0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 32 0d  sort label-1492.
35ce0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
35cf0 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 2b 20  col2 / - col0 + 
35d00 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
35d10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35d20 31 30 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73 6b  10..78..79....sk
35d30 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
35d40 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
35d50 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
35d60 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
35d70 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
35d80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
35d90 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32  ISTINCT + + col2
35da0 20 2a 20 38 33 20 2d 20 63 6f 6c 30 20 63 6f 6c   * 83 - col0 col
35db0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
35dc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34 37 39 0d  or0..----..4479.
35dd0 0a 34 36 36 37 0d 0a 37 38 38 38 0d 0a 0d 0a 71  .4667..7888....q
35de0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35df0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
35e00 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  - - cor0.col1 + 
35e10 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20  ( + cor0.col0 ) 
35e20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
35e30 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
35e40 0a 31 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a  .137..38..96....
35e50 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
35e60 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
35e70 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
35e80 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
35e90 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
35ea0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35eb0 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a   + col2 + col0 *
35ec0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c   + cor0.col2 col
35ed0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
35ee0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a  or0..----..216..
35ef0 33 37 30 35 0d 0a 37 37 37 36 0d 0a 0d 0a 71 75  3705..7776....qu
35f00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35f10 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b  ELECT + + col0 +
35f20 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 38 38 20 41   - col1 * + 88 A
35f30 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
35f40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
35f50 36 34 0d 0a 2d 32 32 38 35 0d 0a 2d 38 31 36 0d  64..-2285..-816.
35f60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35f70 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
35f80 6f 6c 31 20 2a 20 28 20 2b 20 63 6f 6c 32 20 29  ol1 * ( + col2 )
35f90 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b   + col1 * col0 +
35fa0 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
35fb0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
35fc0 0a 2d 37 39 38 0d 0a 33 32 36 33 0d 0a 35 34 38  .-798..3263..548
35fd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35fe0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
35ff0 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e  + col2 * + cor0.
36000 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
36010 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
36020 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33 32 34 39  ----..2916..3249
36030 0d 0a 39 32 31 36 0d 0a 0d 0a 73 6b 69 70 69 66  ..9216....skipif
36040 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
36050 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
36060 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
36070 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
36080 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
36090 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
360a0 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 28  NCT - col2 * - (
360b0 20 32 39 20 29 20 2a 20 2b 20 63 6f 6c 30 20 63   29 ) * + col0 c
360c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
360d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35   cor0..----..105
360e0 37 39 32 0d 0a 32 32 32 37 32 30 0d 0a 34 36 39  792..222720..469
360f0 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
36100 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
36110 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
36120 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
36130 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
36140 2d 31 35 30 30 0d 0a 53 45 4c 45 43 54 20 41 4c  -1500..SELECT AL
36150 4c 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  L + - col0 * col
36160 31 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f  1 DIV col0 AS co
36170 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
36180 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  cor0..----..-17.
36190 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 73 6b 69  .-31..-59....ski
361a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
361b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
361c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
361d0 6c 2d 31 35 30 30 0d 0a 53 45 4c 45 43 54 20 41  l-1500..SELECT A
361e0 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LL + - col0 * co
361f0 6c 31 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l1 / col0 AS col
36200 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
36210 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a  or0..----..-17..
36220 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 73 6b 69 70  -31..-59....skip
36230 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
36240 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
36250 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
36260 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
36270 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
36280 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
36290 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63  TINCT + col1 + c
362a0 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol1 col2 FROM ta
362b0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33  b2..----..118..3
362c0 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  4..62....query I
362d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
362e0 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2d 20 2b   - tab0.col0 - +
362f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
36300 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a 2d 33 36  .----..-171..-36
36310 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-57....query I
36320 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36330 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 63   col0 + col0 * c
36340 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
36350 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d   tab1..----..12.
36360 0a 34 31 36 30 0d 0a 36 34 38 30 0d 0a 0d 0a 71  .4160..6480....q
36370 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36380 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
36390 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  - + cor0.col1 * 
363a0 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63  ( + col1 ) + + c
363b0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
363c0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
363d0 2d 2d 2d 0d 0a 2d 37 33 37 32 0d 0a 2d 38 31 39  ---..-7372..-819
363e0 32 0d 0a 2d 39 33 37 34 0d 0a 0d 0a 71 75 65 72  2..-9374....quer
363f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36400 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30  ECT ALL - - col0
36410 20 2b 20 37 31 20 46 52 4f 4d 20 74 61 62 30 20   + 71 FROM tab0 
36420 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
36430 30 36 0d 0a 31 36 30 0d 0a 39 35 0d 0a 0d 0a 71  06..160..95....q
36440 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36450 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20  SELECT + col1 + 
36460 32 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  24 FROM tab0 AS 
36470 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d  cor0..----..110.
36480 0a 31 31 35 0d 0a 31 32 31 0d 0a 0d 0a 71 75 65  .115..121....que
36490 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
364a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
364b0 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32  cor0.col2 * col2
364c0 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30   + col0 + - col0
364d0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
364e0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
364f0 0d 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32  ..2916..3249..92
36500 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
36510 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
36520 53 54 49 4e 43 54 20 2d 20 31 35 20 41 53 20 63  STINCT - 15 AS c
36530 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
36540 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
36550 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 0d 0a  0..----..-15....
36560 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
36570 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
36580 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
36590 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
365a0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
365b0 72 74 20 6c 61 62 65 6c 2d 31 35 30 39 0d 0a 53  rt label-1509..S
365c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
365d0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44   CAST( NULL AS D
365e0 45 43 49 4d 41 4c 20 29 20 2a 20 63 6f 6c 31 20  ECIMAL ) * col1 
365f0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
36600 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
36610 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
36620 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
36630 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
36640 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
36650 30 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  09..SELECT DISTI
36660 4e 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  NCT - CAST ( NUL
36670 4c 20 41 53 20 52 45 41 4c 20 29 20 2a 20 63 6f  L AS REAL ) * co
36680 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
36690 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
366a0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  --..NULL....quer
366b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
366c0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
366d0 6f 6c 31 20 2b 20 32 38 20 2b 20 2d 20 36 20 41  ol1 + 28 + - 6 A
366e0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
366f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36700 2d 33 37 0d 0a 2d 39 0d 0a 35 0d 0a 0d 0a 71 75  -37..-9..5....qu
36710 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36720 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
36730 20 2a 20 2b 20 28 20 63 6f 6c 30 20 29 20 2d 20   * + ( col0 ) - 
36740 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
36750 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
36760 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 33 35 39 31 0d  ----..108..3591.
36770 0a 37 35 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .7584....query I
36780 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36790 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2b 20   ALL - col1 * + 
367a0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  col2 + col2 + co
367b0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
367c0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
367d0 2d 2d 0d 0a 2d 31 31 33 39 0d 0a 2d 31 33 32 34  --..-1139..-1324
367e0 0d 0a 2d 35 30 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-503....onlyif
367f0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
36800 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
36810 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
36820 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
36830 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
36840 65 6c 2d 31 35 31 33 0d 0a 53 45 4c 45 43 54 20  el-1513..SELECT 
36850 41 4c 4c 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  ALL CAST( NULL A
36860 53 20 53 49 47 4e 45 44 20 29 20 2a 20 28 20 2d  S SIGNED ) * ( -
36870 20 74 61 62 32 2e 63 6f 6c 30 20 29 20 46 52 4f   tab2.col0 ) FRO
36880 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
36890 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
368a0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
368b0 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31 35  cd7a7901e47c1515
368c0 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30 62  5404aff0d216fe0b
368d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
368e0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
368f0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
36900 72 74 20 6c 61 62 65 6c 2d 31 35 31 33 0d 0a 53  rt label-1513..S
36910 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28  ELECT ALL CAST (
36920 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
36930 20 29 20 2a 20 28 20 2d 20 74 61 62 32 2e 63 6f   ) * ( - tab2.co
36940 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20  l0 ) FROM tab2, 
36950 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
36960 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
36970 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31  hing to cd7a7901
36980 65 34 37 63 31 35 31 35 35 34 30 34 61 66 66 30  e47c15155404aff0
36990 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73 6b 69 70  d216fe0b....skip
369a0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
369b0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
369c0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
369d0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
369e0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
369f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
36a00 20 2d 20 63 6f 6c 30 20 29 20 63 6f 6c 32 20 46   - col0 ) col2 F
36a10 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
36a20 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65  7..78..79....que
36a30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36a40 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  LECT + cor0.col2
36a50 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
36a60 62 32 2c 20 74 61 62 31 2c 20 74 61 62 31 20 41  b2, tab1, tab1 A
36a70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
36a80 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
36a90 74 6f 20 37 66 34 61 39 62 66 32 34 64 36 34 38  to 7f4a9bf24d648
36aa0 33 33 37 30 36 64 66 62 64 64 30 62 61 66 34 39  33706dfbdd0baf49
36ab0 64 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  d79....query I r
36ac0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
36ad0 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  LL + col2 * + co
36ae0 6c 31 20 2b 20 2d 20 34 32 20 46 52 4f 4d 20 74  l1 + - 42 FROM t
36af0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
36b00 2d 0d 0a 31 34 39 32 0d 0a 36 30 34 0d 0a 37 39  -..1492..604..79
36b10 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
36b20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
36b30 20 63 6f 6c 31 20 2a 20 2d 20 37 35 20 41 53 20   col1 * - 75 AS 
36b40 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
36b50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
36b60 34 35 30 0d 0a 2d 36 38 32 35 0d 0a 2d 37 32 37  450..-6825..-727
36b70 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
36b80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
36b90 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  TINCT + cor0.col
36ba0 32 20 2b 20 36 35 20 2b 20 63 6f 6c 30 20 2a 20  2 + 65 + col0 * 
36bb0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
36bc0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
36bd0 34 36 0d 0a 33 30 39 0d 0a 34 36 39 33 0d 0a 0d  46..309..4693...
36be0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36bf0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
36c00 54 20 2d 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 63  T - + col1 - - c
36c10 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
36c20 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
36c30 2d 2d 2d 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d  ---..28..47..83.
36c40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
36c50 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
36c60 2a 20 2d 20 35 32 20 41 53 20 63 6f 6c 30 20 46  * - 52 AS col0 F
36c70 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
36c80 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 38 0d 0a 2d  ..----..-2808..-
36c90 32 39 36 34 0d 0a 2d 34 39 39 32 0d 0a 0d 0a 73  2964..-4992....s
36ca0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
36cb0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
36cc0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
36cd0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
36ce0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
36cf0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36d00 2d 20 2b 20 34 38 20 63 6f 6c 31 20 46 52 4f 4d  - + 48 col1 FROM
36d10 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
36d20 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53  OSS JOIN tab0 AS
36d30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
36d40 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
36d50 20 33 31 63 39 34 39 34 33 63 30 37 33 39 35 34   31c94943c073954
36d60 65 34 63 61 32 30 62 31 37 30 61 62 36 31 66 38  e4ca20b170ab61f8
36d70 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  c....skipif post
36d80 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
36d90 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
36da0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
36db0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
36dc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36dd0 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20  ELECT cor0.col0 
36de0 2a 20 2b 20 34 30 20 63 6f 6c 31 20 46 52 4f 4d  * + 40 col1 FROM
36df0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
36e00 0d 0a 31 32 30 0d 0a 32 35 36 30 0d 0a 33 32 30  ..120..2560..320
36e10 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
36e20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
36e30 6f 6c 31 20 2a 20 2b 20 32 38 20 41 53 20 63 6f  ol1 * + 28 AS co
36e40 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
36e50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 30 38  cor0..----..2408
36e60 0d 0a 32 35 34 38 0d 0a 32 37 31 36 0d 0a 0d 0a  ..2548..2716....
36e70 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
36e80 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
36e90 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
36ea0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
36eb0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
36ec0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36ed0 20 2b 20 33 33 20 63 6f 6c 31 20 46 52 4f 4d 20   + 33 col1 FROM 
36ee0 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
36ef0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
36f00 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36 32  es hashing to 62
36f10 30 64 33 38 34 32 38 36 65 38 32 64 31 63 36 63  0d384286e82d1c6c
36f20 38 62 31 62 32 62 31 30 39 61 37 64 61 35 0d 0a  8b1b2b109a7da5..
36f30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36f40 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
36f50 43 54 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 31 20  CT + - ( + col1 
36f60 29 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  ) * - col0 AS co
36f70 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
36f80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33  cor0..----..1343
36f90 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 6f  ..217..4602....o
36fa0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
36fb0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
36fc0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
36fd0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
36fe0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36ff0 74 20 6c 61 62 65 6c 2d 31 35 32 36 0d 0a 53 45  t label-1526..SE
37000 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28  LECT ALL - CAST(
37010 20 2d 20 34 20 41 53 20 53 49 47 4e 45 44 20 29   - 4 AS SIGNED )
37020 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   * col1 AS col2 
37030 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
37040 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 34 0d 0a 33 36  0..----..344..36
37050 34 0d 0a 33 38 38 0d 0a 0d 0a 73 6b 69 70 69 66  4..388....skipif
37060 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
37070 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
37080 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
37090 35 32 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  526..SELECT ALL 
370a0 2d 20 43 41 53 54 20 28 20 2d 20 34 20 41 53 20  - CAST ( - 4 AS 
370b0 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 31  INTEGER ) * col1
370c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
370d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
370e0 0d 0a 33 34 34 0d 0a 33 36 34 0d 0a 33 38 38 0d  ..344..364..388.
370f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37100 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
37110 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63  ol1 * + col0 + c
37120 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
37130 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38   cor0..----..208
37140 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d  8..3430..8188...
37150 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37160 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c  ..SELECT - ( col
37170 31 20 29 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f  1 ) + + col2 FRO
37180 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
37190 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33  ----..28..47..83
371a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
371b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
371c0 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l0 * - cor0.col0
371d0 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32   * col2 + + col2
371e0 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
371f0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
37200 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 30 0d 0a 31  0..----..1260..1
37210 39 38 30 30 0d 0a 36 35 36 38 32 30 0d 0a 0d 0a  9800..656820....
37220 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37230 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
37240 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   * col2 + - col2
37250 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
37260 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
37270 0a 2d 31 30 38 0d 0a 2d 38 35 38 0d 0a 37 39 38  .-108..-858..798
37280 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
37290 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
372a0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
372b0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
372c0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
372d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33  owsort label-153
372e0 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  1..SELECT ALL - 
372f0 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
37300 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 72  SIGNED ) * - cor
37310 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e  0.col0 + - cor0.
37320 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 41 53  col2 + + col0 AS
37330 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
37340 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
37350 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
37360 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
37370 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
37380 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37390 74 20 6c 61 62 65 6c 2d 31 35 33 31 0d 0a 53 45  t label-1531..SE
373a0 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 43 41 53  LECT ALL - - CAS
373b0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
373c0 47 45 52 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63  GER ) * - cor0.c
373d0 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 + - cor0.col
373e0 32 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  2 + + col0 AS co
373f0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
37400 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
37410 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
37420 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37430 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
37440 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 41   ( cor0.col1 ) A
37450 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
37460 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37470 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 6f 6e  17..31..59....on
37480 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
37490 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
374a0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
374b0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
374c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
374d0 20 6c 61 62 65 6c 2d 31 35 33 33 0d 0a 53 45 4c   label-1533..SEL
374e0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
374f0 20 2d 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20   - col1 + CAST( 
37500 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
37510 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
37520 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
37530 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
37540 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
37550 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
37560 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
37570 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 33 0d 0a  ort label-1533..
37580 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
37590 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 43 41 53  0 * - col1 + CAS
375a0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
375b0 47 45 52 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f  GER ) * col0 FRO
375c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
375d0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
375e0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
375f0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
37600 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
37610 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
37620 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
37630 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
37640 65 6c 2d 31 35 33 34 0d 0a 53 45 4c 45 43 54 20  el-1534..SELECT 
37650 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 43  - ( + col0 ) + C
37660 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
37670 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c 31 20 46  IMAL ) AS col1 F
37680 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
37690 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
376a0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
376b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
376c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
376d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
376e0 2d 31 35 33 34 0d 0a 53 45 4c 45 43 54 20 2d 20  -1534..SELECT - 
376f0 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 43 41 53  ( + col0 ) + CAS
37700 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c  T ( NULL AS REAL
37710 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
37720 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
37730 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
37740 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  NULL....onlyif m
37750 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
37760 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
37770 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
37780 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37790 62 65 6c 2d 31 35 33 35 0d 0a 53 45 4c 45 43 54  bel-1535..SELECT
377a0 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 44 49 56   col1 * col2 DIV
377b0 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31   - col0 + + col1
377c0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
377d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 34  r0..----..-2..-4
377e0 34 32 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  42..2....skipif 
377f0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
37800 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
37810 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
37820 33 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  35..SELECT col1 
37830 2a 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20  * col2 / - col0 
37840 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
37850 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
37860 0d 0a 2d 32 0d 0a 2d 34 34 32 0d 0a 32 0d 0a 0d  ..-2..-442..2...
37870 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37880 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
37890 54 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20  T + tab0.col1 + 
378a0 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f  tab0.col1 * - co
378b0 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l2 * + col0 FROM
378c0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32   tab0..----..-32
378d0 39 38 0d 0a 2d 36 36 34 30 32 37 0d 0a 2d 36 38  98..-664027..-68
378e0 30 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  026....query I r
378f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37  owsort..SELECT 7
37900 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 28  0 * + col0 + + (
37910 20 2b 20 33 37 20 2a 20 2b 20 63 6f 6c 32 20 29   + 37 * + col2 )
37920 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
37930 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 39 0d 0a  r0..----..1489..
37940 36 34 32 32 0d 0a 36 39 33 36 0d 0a 0d 0a 71 75  6422..6936....qu
37950 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37960 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
37970 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63   - cor0.col0 + c
37980 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
37990 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
379a0 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ---..0....query 
379b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
379c0 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  T - col2 * - col
379d0 32 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  2 + - col0 AS co
379e0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
379f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 33  cor0..----..2913
37a00 0d 0a 33 31 38 35 0d 0a 39 31 33 36 0d 0a 0d 0a  ..3185..9136....
37a10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37a20 0a 53 45 4c 45 43 54 20 2b 20 35 35 20 2a 20 2b  .SELECT + 55 * +
37a30 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 46   col1 + - col1 F
37a40 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
37a50 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 34 0d 0a 35 34  ..----..1404..54
37a60 30 0d 0a 37 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  0..702....onlyif
37a70 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
37a80 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
37a90 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
37aa0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
37ab0 6c 61 62 65 6c 2d 31 35 34 31 0d 0a 53 45 4c 45  label-1541..SELE
37ac0 43 54 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30  CT col2 DIV col0
37ad0 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
37ae0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
37af0 2d 0d 0a 2d 31 37 0d 0a 2d 32 38 0d 0a 2d 35 39  -..-17..-28..-59
37b00 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
37b10 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
37b20 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
37b30 72 74 20 6c 61 62 65 6c 2d 31 35 34 31 0d 0a 53  rt label-1541..S
37b40 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 63 6f 6c  ELECT col2 / col
37b50 30 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  0 + - col1 FROM 
37b60 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
37b70 2d 2d 0d 0a 2d 31 37 0d 0a 2d 32 38 0d 0a 2d 35  --..-17..-28..-5
37b80 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
37b90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
37ba0 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 28 20 2d  TINCT col0 + ( -
37bb0 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 32   col1 ) * - col2
37bc0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
37bd0 0a 2d 2d 2d 2d 0d 0a 31 36 31 32 0d 0a 37 32 35  .----..1612..725
37be0 0d 0a 38 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..844....query I
37bf0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37c00 20 41 4c 4c 20 36 30 20 41 53 20 63 6f 6c 30 20   ALL 60 AS col0 
37c10 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20  FROM tab2, tab0 
37c20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  AS cor0, tab2 AS
37c30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
37c40 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
37c50 6f 20 31 64 32 61 62 33 30 32 61 65 36 30 66 39  o 1d2ab302ae60f9
37c60 35 62 31 35 65 36 38 63 66 38 39 30 38 33 62 31  5b15e68cf89083b1
37c70 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
37c80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
37c90 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 38 20  l1 * col1 + - 8 
37ca0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
37cb0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
37cc0 0a 32 38 31 0d 0a 33 34 37 33 0d 0a 39 35 33 0d  .281..3473..953.
37cd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37ce0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d  rt..SELECT + ( -
37cf0 20 34 38 20 29 20 46 52 4f 4d 20 74 61 62 32 2c   48 ) FROM tab2,
37d00 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
37d10 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
37d20 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
37d30 68 69 6e 67 20 74 6f 20 32 35 35 38 37 33 35 65  hing to 2558735e
37d40 61 61 32 35 38 61 30 38 35 39 32 61 65 66 39 64  aa258a08592aef9d
37d50 33 33 30 32 30 63 31 38 0d 0a 0d 0a 71 75 65 72  33020c18....quer
37d60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37d70 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT - cor0.col0 
37d80 2b 20 2d 20 31 33 20 41 53 20 63 6f 6c 30 20 46  + - 13 AS col0 F
37d90 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
37da0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 37 37  ..----..-16..-77
37db0 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-93....query I
37dc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37dd0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d   - cor0.col2 + -
37de0 20 37 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   76 AS col0 FROM
37df0 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
37e00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
37e10 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
37e20 34 65 61 64 30 32 63 65 38 38 32 61 33 37 35 36  4ead02ce882a3756
37e30 66 64 39 64 65 66 31 63 33 36 36 63 65 31 65 0d  fd9def1c366ce1e.
37e40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37e50 72 74 0d 0a 53 45 4c 45 43 54 20 31 39 20 2b 20  rt..SELECT 19 + 
37e60 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 46 52  col1 * - col2 FR
37e70 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
37e80 0a 2d 2d 2d 2d 0d 0a 2d 31 35 31 35 0d 0a 2d 36  .----..-1515..-6
37e90 32 37 0d 0a 2d 38 31 38 0d 0a 0d 0a 71 75 65 72  27..-818....quer
37ea0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37eb0 45 43 54 20 31 31 20 2b 20 63 6f 6c 31 20 46 52  ECT 11 + col1 FR
37ec0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
37ed0 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31 30 38 0d  .----..102..108.
37ee0 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .97....query I r
37ef0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
37f00 20 2b 20 28 20 63 6f 72 31 2e 63 6f 6c 30 20 29   + ( cor1.col0 )
37f10 20 2a 20 38 31 20 46 52 4f 4d 20 74 61 62 31 20   * 81 FROM tab1 
37f20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
37f30 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  IN tab0 AS cor1.
37f40 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
37f50 68 61 73 68 69 6e 67 20 74 6f 20 64 64 64 65 37  hashing to ddde7
37f60 64 35 31 65 32 38 34 38 35 36 65 30 63 65 63 63  d51e284856e0cecc
37f70 35 39 36 62 37 37 35 37 32 30 62 0d 0a 0d 0a 6f  596b775720b....o
37f80 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
37f90 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
37fa0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
37fb0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
37fc0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 31 0d  sort label-1551.
37fd0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
37fe0 20 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 32   DIV col1 + col2
37ff0 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
38000 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 30 0d 0a 32  0..----..1090..2
38010 0d 0a 36 37 32 35 0d 0a 0d 0a 73 6b 69 70 69 66  ..6725....skipif
38020 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
38030 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
38040 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
38050 35 35 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  551..SELECT ALL 
38060 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 2b 20 63 6f  col1 / col1 + co
38070 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 * col2 FROM t
38080 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 30 0d  ab0..----..1090.
38090 0a 32 0d 0a 36 37 32 35 0d 0a 0d 0a 71 75 65 72  .2..6725....quer
380a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
380b0 45 43 54 20 41 4c 4c 20 2b 20 38 32 20 46 52 4f  ECT ALL + 82 FRO
380c0 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
380d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
380e0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
380f0 66 33 31 38 66 64 39 64 61 63 32 64 65 37 61 66  f318fd9dac2de7af
38100 34 62 38 32 63 63 37 35 37 34 62 62 63 61 32 63  4b82cc7574bbca2c
38110 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
38120 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
38130 49 4e 43 54 20 2d 20 28 20 2b 20 74 61 62 30 2e  INCT - ( + tab0.
38140 63 6f 6c 30 20 2a 20 2b 20 74 61 62 30 2e 63 6f  col0 * + tab0.co
38150 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l2 ) AS col0 FRO
38160 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab0..----..-3
38170 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a  5..-7298..-792..
38180 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38190 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
381a0 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  l2 * col2 + - co
381b0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
381c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d  cor0..----..-34.
381d0 0a 31 30 36 35 0d 0a 36 36 33 35 0d 0a 0d 0a 73  .1065..6635....s
381e0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
381f0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
38200 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
38210 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
38220 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
38230 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
38240 2b 20 2b 20 28 20 63 6f 6c 32 20 29 20 63 6f 6c  + + ( col2 ) col
38250 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
38260 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  or0..----..54..5
38270 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  7..96....query I
38280 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38290 20 2b 20 35 34 20 2a 20 2b 20 38 31 20 41 53 20   + 54 * + 81 AS 
382a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
382b0 2d 2d 2d 2d 0d 0a 34 33 37 34 0d 0a 34 33 37 34  ----..4374..4374
382c0 0d 0a 34 33 37 34 0d 0a 0d 0a 71 75 65 72 79 20  ..4374....query 
382d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
382e0 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c  T ALL col1 * col
382f0 31 20 2a 20 2d 20 37 31 20 2b 20 2b 20 63 6f 6c  1 * - 71 + + col
38300 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
38310 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 35 30  or0..----..-5250
38320 38 33 0d 0a 2d 35 38 37 38 36 39 0d 0a 2d 36 36  83..-587869..-66
38330 38 30 33 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8038....onlyif m
38340 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
38350 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
38360 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
38370 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
38380 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
38390 2d 31 35 35 38 0d 0a 53 45 4c 45 43 54 20 44 49  -1558..SELECT DI
383a0 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 43 41  STINCT col0 + CA
383b0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
383c0 45 44 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63  ED ) * col2 AS c
383d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
383e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
383f0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
38400 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
38410 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
38420 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 38 0d 0a  ort label-1558..
38430 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
38440 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 4e 55  col0 + CAST ( NU
38450 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
38460 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
38470 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
38480 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
38490 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
384a0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
384b0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
384c0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
384d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 39  wsort label-1559
384e0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
384f0 32 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f  2 DIV col1 AS co
38500 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
38510 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
38520 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
38530 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
38540 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
38550 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 39  wsort label-1559
38560 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
38570 32 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  2 / col1 AS col0
38580 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
38590 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
385a0 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
385b0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
385c0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
385d0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
385e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
385f0 2d 31 35 36 30 0d 0a 53 45 4c 45 43 54 20 44 49  -1560..SELECT DI
38600 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31  STINCT cor0.col1
38610 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c   DIV col0 AS col
38620 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
38630 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d  or0..----..1..2.
38640 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .3....skipif mys
38650 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
38660 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
38670 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 36 30 0d  sort label-1560.
38680 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
38690 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c   cor0.col1 / col
386a0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
386b0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
386c0 2d 0d 0a 31 0d 0a 32 0d 0a 33 0d 0a 0d 0a 71 75  -..1..2..3....qu
386d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
386e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
386f0 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol0 * cor0.col1 
38700 2b 20 31 36 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  + 16 * col0 FROM
38710 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
38720 2d 2d 2d 0d 0a 32 36 30 37 0d 0a 33 32 39 0d 0a  ---..2607..329..
38730 35 38 35 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  5850....skipif p
38740 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
38750 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
38760 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
38770 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
38780 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38790 0d 0a 53 45 4c 45 43 54 20 2b 20 31 36 20 2d 20  ..SELECT + 16 - 
387a0 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2d 20  - tab2.col1 * - 
387b0 37 33 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  73 col2 FROM tab
387c0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a  2..----..-1225..
387d0 2d 32 32 34 37 0d 0a 2d 34 32 39 31 0d 0a 0d 0a  -2247..-4291....
387e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
387f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
38800 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a   - col2 + col2 *
38810 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31   - col2 + + col1
38820 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
38830 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
38840 2d 0d 0a 2d 31 34 32 36 38 0d 0a 2d 33 39 36 30  -..-14268..-3960
38850 0d 0a 2d 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-99....onlyif 
38860 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
38870 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
38880 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
38890 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
388a0 61 62 65 6c 2d 31 35 36 34 0d 0a 53 45 4c 45 43  abel-1564..SELEC
388b0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
388c0 30 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 44  0 + ( - col0 ) D
388d0 49 56 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  IV + col2 FROM t
388e0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
388f0 2d 0d 0a 33 0d 0a 36 33 0d 0a 38 30 0d 0a 0d 0a  -..3..63..80....
38900 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
38910 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
38920 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
38930 61 62 65 6c 2d 31 35 36 34 0d 0a 53 45 4c 45 43  abel-1564..SELEC
38940 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
38950 30 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2f  0 + ( - col0 ) /
38960 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
38970 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
38980 0a 33 0d 0a 36 33 0d 0a 38 30 0d 0a 0d 0a 71 75  .3..63..80....qu
38990 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
389a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
389b0 6f 6c 31 20 2a 20 2b 20 34 39 20 2b 20 2d 20 63  ol1 * + 49 + - c
389c0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
389d0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
389e0 0a 2d 2d 2d 2d 0d 0a 31 34 38 38 0d 0a 32 38 33  .----..1488..283
389f0 32 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20  2..816....query 
38a00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38a10 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
38a20 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63  2 * - col0 + + c
38a30 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol2 * + col2 FRO
38a40 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
38a50 2d 2d 2d 2d 0d 0a 31 34 30 32 32 0d 0a 31 38 38  ----..14022..188
38a60 31 0d 0a 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..36....skipif 
38a70 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
38a80 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
38a90 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
38aa0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
38ab0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38ac0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
38ad0 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   + + col2 + col0
38ae0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
38af0 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a 31 35 35 0d  .----..130..155.
38b00 0a 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .61....query I r
38b10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
38b20 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2d 20 2b  ISTINCT col2 - +
38b30 20 33 32 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63   32 * - col2 * c
38b40 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
38b50 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32   tab1..----..182
38b60 39 37 0d 0a 34 30 30 33 32 0d 0a 34 34 39 38 32  97..40032..44982
38b70 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
38b80 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
38b90 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
38ba0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
38bb0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
38bc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38bd0 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  LECT col1 * col2
38be0 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 63 6f   + - col0 - - co
38bf0 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 31  l1 * - col2 col1
38c00 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
38c10 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a  ..-3..-64..-80..
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 44 49 53 54 49 4e  t..SELECT DISTIN
38c40 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 28 20  CT + + col0 * ( 
38c50 2b 20 63 6f 6c 32 20 2a 20